Skip to content

Commit

Permalink
Updated interfaces (#202)
Browse files Browse the repository at this point in the history
* Updated interfaces

* Lint & format
  • Loading branch information
quent043 authored Dec 18, 2023
1 parent dd56c83 commit 40df71a
Show file tree
Hide file tree
Showing 7 changed files with 298 additions and 78 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ Understand the protocol and how we tackle our main problems:
- [Mumbai](./.deployment/mumbai.json)
- [Polygon](./.deployment/polygon.json)

## Audits
## Audits

- Internal: https://talentlayer.notion.site/TLIP-0002-Security-Assessment-782ab9e80d774749811adfc61cbb7622
- Externals:
- Externals:
- Bios42: https://github.com/bios42eth/talenlayer-id-report
- Ahmet: https://github.com/ahmedovv123/audits/blob/main/audits/TalentLayer.md

Expand All @@ -36,7 +36,7 @@ Understand the protocol and how we tackle our main problems:
- Launch your local node: `npx hardhat node`
- Deploy contract: `npx hardhat deploy-full --use-test-erc20 --network localhost`

## Tests
## Tests

### Coverage

Expand Down
117 changes: 97 additions & 20 deletions contracts/interfaces/ITalentLayerEscrow.sol
Original file line number Diff line number Diff line change
@@ -1,38 +1,64 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "../Arbitrator.sol";

/**
* @title Platform ID Interface
* @author TalentLayer Team <[email protected]> | Website: https://talentlayer.org | Twitter: @talentlayer
*/
interface ITalentLayerEscrow {
// Enum declarations
enum PaymentType {
Release,
Reimburse
}
enum ArbitrationFeePaymentType {
Pay,
Reimburse
}
enum Party {
Sender,
Receiver
}
enum Status {
NoDispute, // no dispute has arisen about the transaction
WaitingSender, // receiver has paid arbitration fee, while sender still has to do it
WaitingReceiver, // sender has paid arbitration fee, while receiver still has to do it
DisputeCreated, // both parties have paid the arbitration fee and a dispute has been created
Resolved // the transaction is solved (either no dispute has ever arisen or the dispute has been resolved)
}

// Struct declarations
struct Transaction {
uint256 id;
address sender;
address receiver;
address token;
uint256 amount;
uint256 releasedAmount;
uint256 serviceId;
uint256 proposalId;
uint16 protocolEscrowFeeRate;
uint16 originServiceFeeRate;
uint16 originValidatedProposalFeeRate;
Arbitrator arbitrator;
Status status;
uint256 disputeId;
uint256 senderFee;
uint256 receiverFee;
uint256 lastInteraction;
Status status;
// Arbitrator arbitrator;
bytes arbitratorExtraData;
uint256 arbitrationFeeTimeout;
}

enum Status {
NoDispute, // no dispute has arisen about the transaction
WaitingSender, // receiver has paid arbitration fee, while sender still has to do it
WaitingReceiver, // sender has paid arbitration fee, while receiver still has to do it
DisputeCreated, // both parties have paid the arbitration fee and a dispute has been created
Resolved // the transaction is solved (either no dispute has ever arisen or the dispute has been resolved)
}
// Function declarations
function initialize(
address _talentLayerServiceAddress,
address _talentLayerIDAddress,
address _talentLayerPlatformIDAddress,
address _protocolWallet
) external;

function getClaimableFeeBalance(address _token) external view returns (uint256 balance);

Expand All @@ -42,32 +68,83 @@ interface ITalentLayerEscrow {

function updateProtocolWallet(address payable _protocolWallet) external;

function pause() external;

function unpause() external;

function createTransaction(
uint256 _serviceId,
uint256 _proposalId,
string memory _metaEvidence,
string memory originDataUri
string memory _originDataUri
) external payable returns (uint256);

function release(uint256 _transactionId, uint256 _amount) external;
function release(uint256 _profileId, uint256 _transactionId, uint256 _amount) external;

function reimburse(uint256 _transactionId, uint256 _amount) external;

function claim(uint256 _platformId, address _tokenAddress) external;

function claimAll(uint256 _platformId) external;
function reimburse(uint256 _profileId, uint256 _transactionId, uint256 _amount) external;

function payArbitrationFeeBySender(uint256 _transactionId) external payable;

function payArbitrationFeeByReceiver(uint256 _transactionId) external payable;

function timeOutBySender(uint256 _transactionId) external;

function timeOutByReceiver(uint256 _transactionId) external;
function arbitrationFeeTimeout(uint256 _transactionId) external;

function submitEvidence(uint256 _transactionId, string memory _evidence) external;
function submitEvidence(uint256 _profileId, uint256 _transactionId, string memory _evidence) external;

function appeal(uint256 _transactionId) external payable;

// Platform functions
function claim(uint256 _platformId, address _tokenAddress) external;

// Arbitrator functions
function rule(uint256 _disputeID, uint256 _ruling) external;

// Event declarations
event Payment(
uint256 _transactionId,
PaymentType _paymentType,
address _token,
uint256 _amount,
uint256 _serviceId,
uint256 _proposalId
);
event PaymentCompleted(uint256 _serviceId);
event ProtocolEscrowFeeRateUpdated(uint16 _protocolEscrowFeeRate);
event FeesClaimed(uint256 _platformId, address indexed _token, uint256 _amount);
event OriginServiceFeeRateReleased(
uint256 _platformId,
uint256 _serviceId,
address indexed _token,
uint256 _amount
);
event OriginValidatedProposalFeeRateReleased(
uint256 _platformId,
uint256 _serviceId,
address indexed _token,
uint256 _amount
);
event HasToPayFee(uint256 indexed _transactionId, Party _party);
event ArbitrationFeePayment(
uint256 indexed _transactionId,
ArbitrationFeePaymentType _paymentType,
Party _party,
uint256 _amount
);
event RulingExecuted(uint256 indexed _transactionId, uint256 _ruling);
event TransactionCreated(
uint256 _transactionId,
uint256 _senderId,
uint256 _receiverId,
address _token,
uint256 _amount,
uint256 _serviceId,
uint256 _proposalId,
uint16 _protocolEscrowFeeRate,
uint16 _originServiceFeeRate,
uint16 _originValidatedProposalFeeRate,
Arbitrator _arbitrator,
bytes _arbitratorExtraData,
uint256 _arbitrationFeeTimeout
);
event EvidenceSubmitted(uint256 indexed _transactionId, uint256 indexed _partyId, string _evidenceUri);
}
73 changes: 58 additions & 15 deletions contracts/interfaces/ITalentLayerID.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,48 @@ pragma solidity ^0.8.9;
* @author TalentLayer Team <[email protected]> | Website: https://talentlayer.org | Twitter: @talentlayer
*/
interface ITalentLayerID {
// Enum declarations
enum MintStatus {
ON_PAUSE,
ONLY_WHITELIST,
PUBLIC
}

// Struct declarations
struct Profile {
uint256 id;
string handle;
uint256 platformId;
string dataUri;
}

function balanceOf(address _user) external view returns (uint256);
// Function declarations
// View functions
function ownerOf(uint256 _tokenId) external view returns (address);

function totalSupply() external view returns (uint256);

function getOriginatorPlatformIdByAddress(address _address) external view returns (uint256);

function isValid(uint256 _profileId) external view;

function isDelegate(uint256 _profileId, address _address) external view returns (bool);

function isOwnerOrDelegate(uint256 _profileId, address _address) external view returns (bool);

function ownersOf(uint256 _tokenId1, uint256 _tokenId2) external view returns (address, address);

function isWhitelisted(
address _address,
string memory _handle,
bytes32[] memory _proof
) external view returns (bool);

function getHandlePrice(string calldata _handle) external view returns (uint256);

function tokenURI(uint256 tokenId) external view returns (string memory);

// User functions
function mint(uint256 _platformId, string calldata _handle) external payable returns (uint256);

function mintForAddress(
Expand All @@ -28,31 +56,46 @@ interface ITalentLayerID {
string calldata _handle
) external payable returns (uint256);

function updateProfileData(uint256 _tokenId, string memory _newCid) external;

function freeMint(uint256 _platformId, address _userAddress, string calldata _handle) external returns (uint256);

function isValid(uint256 _tokenId) external view;

function whitelistMint(
uint256 _platformId,
string calldata _handle,
bytes32[] calldata _proof
) external payable returns (uint256);

function ownerOf(uint256 _tokenId) external view returns (address);
function updateProfileData(uint256 _profileId, string memory _newCid) external;

function ownersOf(uint256 _tokenId1, uint256 _tokenId2) external view returns (address, address);
function addDelegate(uint256 _profileId, address _delegate) external;

function getOriginatorPlatformIdByAddress(address _address) external view returns (uint256);
function removeDelegate(uint256 _profileId, address _delegate) external;

function setHasActivity(uint256 _profileId) external;

// Owner functions
function updateMintFee(uint256 _mintFee) external;

function isDelegate(uint256 _tokenId, address _address) external view returns (bool);
function withdraw() external;

function isOwnerOrDelegate(uint256 _tokenId, address _address) external view returns (bool);
function freeMint(uint256 _platformId, address _userAddress, string calldata _handle) external returns (uint256);

function ids(address _user) external view returns (uint256);
function setWhitelistMerkleRoot(bytes32 root) external;

function setHasActivity(uint256 _profileId) external;
function updateMintStatus(MintStatus _mintStatus) external;

function updateShortHandlesMaxPrice(uint256 _shortHandlesMaxPrice) external;

function setIsServiceContract(address _address, bool _isServiceContract) external;

// Event declarations
event Mint(address indexed user, uint256 profileId, string handle, uint256 platformId, uint256 fee);
event CidUpdated(uint256 indexed profileId, string newCid);
event MintFeeUpdated(uint256 mintFee);
event DelegateAdded(uint256 profileId, address delegate);
event DelegateRemoved(uint256 profileId, address delegate);
event MintStatusUpdated(MintStatus mintStatus);
event ShortHandlesMaxPriceUpdated(uint256 price);

event Mint(address indexed _user, uint256 _tokenId, string _handle);
// Error declarations
error HandleLengthInvalid();
error HandleContainsInvalidCharacters();
error HandleFirstCharInvalid();
}
Loading

0 comments on commit 40df71a

Please sign in to comment.