Skip to content

Commit

Permalink
Lint & format
Browse files Browse the repository at this point in the history
  • Loading branch information
quent043 committed Dec 18, 2023
1 parent 3d5721d commit 76c5ca9
Show file tree
Hide file tree
Showing 7 changed files with 178 additions and 57 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
81 changes: 58 additions & 23 deletions contracts/interfaces/ITalentLayerEscrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ interface ITalentLayerEscrow {
Resolved // the transaction is solved (either no dispute has ever arisen or the dispute has been resolved)
}


// Struct declarations
struct Transaction {
uint256 id;
Expand All @@ -53,44 +52,45 @@ interface ITalentLayerEscrow {
uint256 arbitrationFeeTimeout;
}


// Function declarations
function initialize(
address _talentLayerServiceAddress,
address _talentLayerIDAddress,
address _talentLayerPlatformIDAddress,
address _protocolWallet
) external;

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

function getTransactionDetails(uint256 _transactionId) external view returns (Transaction memory);

function updateProtocolEscrowFeeRate(uint16 _protocolEscrowFeeRate) external;

function updateProtocolWallet(address payable _protocolWallet) external;

function pause() external;

function unpause() external;

function createTransaction(
uint256 _serviceId,
uint256 _proposalId,
string memory _metaEvidence,
string memory _originDataUri
) external payable returns (uint256);
function release(
uint256 _profileId,
uint256 _transactionId,
uint256 _amount
) external;
function reimburse(
uint256 _profileId,
uint256 _transactionId,
uint256 _amount
) external;

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

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

function payArbitrationFeeBySender(uint256 _transactionId) external payable;

function payArbitrationFeeByReceiver(uint256 _transactionId) external payable;

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

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

function appeal(uint256 _transactionId) external payable;

// Platform functions
Expand All @@ -99,17 +99,52 @@ interface ITalentLayerEscrow {
// 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 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 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 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 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);
}
35 changes: 23 additions & 12 deletions contracts/interfaces/ITalentLayerID.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,57 +21,69 @@ interface ITalentLayerID {
string dataUri;
}


// 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 mint(uint256 _platformId, string calldata _handle) external payable returns (uint256);

function mintForAddress(
address _address,
uint256 _platformId,
string calldata _handle
) external payable returns (uint256);

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

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

function addDelegate(uint256 _profileId, address _delegate) external;

function removeDelegate(uint256 _profileId, address _delegate) external;

function setHasActivity(uint256 _profileId) external;

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

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

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

function setWhitelistMerkleRoot(bytes32 root) external;

function updateMintStatus(MintStatus _mintStatus) external;

function updateShortHandlesMaxPrice(uint256 _shortHandlesMaxPrice) external;
function setIsServiceContract(address _address, bool _isServiceContract) external;

function setIsServiceContract(address _address, bool _isServiceContract) external;

// Event declarations
event Mint(address indexed user, uint256 profileId, string handle, uint256 platformId, uint256 fee);
Expand All @@ -82,7 +94,6 @@ interface ITalentLayerID {
event MintStatusUpdated(MintStatus mintStatus);
event ShortHandlesMaxPriceUpdated(uint256 price);


// Error declarations
error HandleLengthInvalid();
error HandleContainsInvalidCharacters();
Expand Down
35 changes: 30 additions & 5 deletions contracts/interfaces/ITalentLayerPlatformID.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ interface ITalentLayerPlatformID is IERC721Upgradeable {
PUBLIC
}


// Struct declarations
struct Platform {
uint256 id;
Expand All @@ -32,49 +31,75 @@ interface ITalentLayerPlatformID is IERC721Upgradeable {
address signer;
}


// Function declarations
// View Functions
function ids(address _user) external view returns (uint256);

function isValid(uint256 _platformId) external view;

function getOriginServiceFeeRate(uint256 _platformId) external view returns (uint16);

function getOriginValidatedProposalFeeRate(uint256 _platformId) external view returns (uint16);

function getServicePostingFee(uint256 _platformId) external view returns (uint256);

function getProposalPostingFee(uint256 _platformId) external view returns (uint256);

function getSigner(uint256 _platformId) external view returns (address);

function getPlatform(uint256 _platformId) external view returns (Platform memory);

function totalSupply() external view returns (uint256);

// User Functions
function mint(string calldata _platformName) external payable returns (uint256);

function mintForAddress(string calldata _platformName, address _platformAddress) external payable returns (uint256);

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

function updateOriginServiceFeeRate(uint256 _platformId, uint16 _originServiceFeeRate) external;

function updateOriginValidatedProposalFeeRate(uint256 _platformId, uint16 _originValidatedProposalFeeRate) external;

function updateArbitrator(uint256 _platformId, Arbitrator _arbitrator, bytes memory _extraData) external;

function updateArbitrationFeeTimeout(uint256 _platformId, uint256 _arbitrationFeeTimeout) external;

function updateServicePostingFee(uint256 _platformId, uint256 _servicePostingFee) external;

function updateProposalPostingFee(uint256 _platformId, uint256 _proposalPostingFee) external;

function updateSigner(uint256 _platformId, address _signer) external;

// Owner Functions
function whitelistUser(address _user) external;

function updateMintStatus(MintStatus _mintStatus) external;

function updateMintFee(uint256 _mintFee) external;

function withdraw() external;

function addArbitrator(address _arbitrator, bool _isInternal) external;

function removeArbitrator(address _arbitrator) external;
function updateMinArbitrationFeeTimeout(uint256 _minArbitrationFeeTimeout) external;

function updateMinArbitrationFeeTimeout(uint256 _minArbitrationFeeTimeout) external;

// Error declarations
error HandleLengthInvalid();
error HandleContainsInvalidCharacters();
error HandleFirstCharInvalid();


// Event declarations
event Mint(address indexed platformOwnerAddress, uint256 platformId, string platformName, uint256 fee, uint256 arbitrationFeeTimeout);
event Mint(
address indexed platformOwnerAddress,
uint256 platformId,
string platformName,
uint256 fee,
uint256 arbitrationFeeTimeout
);
event CidUpdated(uint256 indexed platformId, string newCid);
event MintFeeUpdated(uint256 mintFee);
event OriginServiceFeeRateUpdated(uint256 platformId, uint16 originServiceFeeRate);
Expand Down
3 changes: 1 addition & 2 deletions contracts/interfaces/ITalentLayerReview.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ interface ITalentLayerReview {
uint256 rating;
}


// Function declarations
// View Functions
function getReview(uint256 _reviewId) external view returns (Review memory);

function totalSupply() external view returns (uint256);

// User Functions
Expand All @@ -29,7 +29,6 @@ interface ITalentLayerReview {
uint256 _rating
) external returns (uint256);


// Event declarations
event Mint(
uint256 indexed serviceId,
Expand Down
Loading

0 comments on commit 76c5ca9

Please sign in to comment.