Skip to content

Commit

Permalink
Events upgrade (#200)
Browse files Browse the repository at this point in the history
* Added proposalId to Escrow & Review parmas

Archived V1 contracts

Signed-off-by: Quentin D.C <[email protected]>

* Added proposalId to Escrow & Review parmas

Archived V1 contracts

Signed-off-by: Quentin D.C <[email protected]>

* Updated payment events

Signed-off-by: Quentin D.C <[email protected]>

* Added review "Mint" event test

Signed-off-by: Quentin D.C <[email protected]>

* added arbitratorAdded and arbitratorRemoved events

* Fixed imports

Signed-off-by: Quentin D.C <[email protected]>

* Removes event in initializer

Signed-off-by: Quentin D.C <[email protected]>

* Added PlatformId archive

Signed-off-by: Quentin D.C <[email protected]>

* Renamed archive contract

Signed-off-by: Quentin D.C <[email protected]>

* Removed unused import

Signed-off-by: Quentin D.C <[email protected]>

* Updated RPC

Signed-off-by: Quentin D.C <[email protected]>

* Added event Payment emit in tests

Signed-off-by: Quentin D.C <[email protected]>

* Fixed test error

Signed-off-by: Quentin D.C <[email protected]>

---------

Signed-off-by: Quentin D.C <[email protected]>
Co-authored-by: Yash Goyal <[email protected]>
  • Loading branch information
quent043 and yashgo0018 authored Nov 25, 2023
1 parent e56f897 commit dd56c83
Show file tree
Hide file tree
Showing 11 changed files with 2,114 additions and 13 deletions.
13 changes: 11 additions & 2 deletions contracts/TalentLayerEscrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,15 @@ contract TalentLayerEscrow is
* @param _token The address of the token used for the payment.
* @param _amount The amount paid.
* @param _serviceId The id of the concerned service.
* @param _proposalId The id of the corresponding proposal.
*/
event Payment(
uint256 _transactionId,
PaymentType _paymentType,
address _token,
uint256 _amount,
uint256 _serviceId
uint256 _serviceId,
uint256 _proposalId
);

/**
Expand Down Expand Up @@ -980,7 +982,14 @@ contract TalentLayerEscrow is
*/
function _afterPayment(uint256 _transactionId, PaymentType _paymentType, uint256 _releaseAmount) private {
Transaction storage transaction = transactions[_transactionId];
emit Payment(transaction.id, _paymentType, transaction.token, _releaseAmount, transaction.serviceId);
emit Payment(
transaction.id,
_paymentType,
transaction.token,
_releaseAmount,
transaction.serviceId,
transaction.proposalId
);

if (transaction.amount == 0) {
talentLayerServiceContract.afterFullPayment(transaction.serviceId, transaction.releasedAmount);
Expand Down
15 changes: 15 additions & 0 deletions contracts/TalentLayerPlatformID.sol
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ contract TalentLayerPlatformID is ERC721Upgradeable, AccessControlUpgradeable, U
function addArbitrator(address _arbitrator, bool _isInternal) public onlyRole(DEFAULT_ADMIN_ROLE) {
validArbitrators[address(_arbitrator)] = true;
internalArbitrators[address(_arbitrator)] = _isInternal;
emit ArbitratorAdded(_arbitrator, _isInternal);
}

/**
Expand All @@ -429,6 +430,7 @@ contract TalentLayerPlatformID is ERC721Upgradeable, AccessControlUpgradeable, U
function removeArbitrator(address _arbitrator) public onlyRole(DEFAULT_ADMIN_ROLE) {
validArbitrators[address(_arbitrator)] = false;
internalArbitrators[address(_arbitrator)] = false;
emit ArbitratorRemoved(_arbitrator);
}

/**
Expand Down Expand Up @@ -638,6 +640,19 @@ contract TalentLayerPlatformID is ERC721Upgradeable, AccessControlUpgradeable, U
*/
event OriginValidatedProposalFeeRateUpdated(uint256 platformId, uint16 originValidatedProposalFeeRate);

/**
* @notice Emit after the arbitrator is added
* @param arbitrator The address of the new arbitrator
* @param isInternal Boolean denoting if the arbitrator is internal (is part of TalentLayer) or not
*/
event ArbitratorAdded(address arbitrator, bool isInternal);

/**
* @notice Emit after the arbitrator is removed
* @param arbitrator The address of the arbitrator
*/
event ArbitratorRemoved(address arbitrator);

/**
* @notice Emit after the arbitrator is updated for a platform
* @param platformId The Platform Id
Expand Down
8 changes: 6 additions & 2 deletions contracts/TalentLayerReview.sol
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ contract TalentLayerReview is ERC2771RecipientUpgradeable, ERC721Upgradeable, UU
uint256 reviewId = nextReviewId.current();
nextReviewId.increment();

ITalentLayerService.Service memory service = talentLayerService.getService(_serviceId);

reviews[reviewId] = Review({
id: reviewId,
ownerId: _to,
Expand All @@ -173,7 +175,7 @@ contract TalentLayerReview is ERC2771RecipientUpgradeable, ERC721Upgradeable, UU
rating: _rating
});

emit Mint(_serviceId, _to, reviewId, _rating, _reviewUri);
emit Mint(_serviceId, _to, reviewId, _rating, _reviewUri, service.acceptedProposalId);
return reviewId;
}

Expand Down Expand Up @@ -271,12 +273,14 @@ contract TalentLayerReview is ERC2771RecipientUpgradeable, ERC721Upgradeable, UU
* @param tokenId The ID of the review token
* @param rating The rating of the review
* @param reviewUri The IPFS URI of the review metadata
* @param proposalId The id of the corresponding proposal.
*/
event Mint(
uint256 indexed serviceId,
uint256 indexed toId,
uint256 indexed tokenId,
uint256 rating,
string reviewUri
string reviewUri,
uint256 proposalId
);
}
Loading

0 comments on commit dd56c83

Please sign in to comment.