Skip to content

Commit

Permalink
wip: cover finish root
Browse files Browse the repository at this point in the history
  • Loading branch information
MishaShWoof committed Nov 15, 2024
1 parent 271bb21 commit 3f8aff1
Show file tree
Hide file tree
Showing 3 changed files with 476 additions and 41 deletions.
29 changes: 26 additions & 3 deletions contracts/CometRewardsV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,13 @@ contract CometRewardsV2 {
/**
* @notice Set finish root for a campaign
* @param comet The protocol instance
* @param finishRoot The root of the Merkle tree for the finishAccrued
* @param campaignId The id of the campaign
* @param finishRoot The root of the Merkle tree for the finishAccrued
*/
function setCampaignFinishRoot(
address comet,
bytes32 finishRoot,
uint256 campaignId
uint256 campaignId,
bytes32 finishRoot
) public {
if(msg.sender != governor) revert NotPermitted(msg.sender);
if(finishRoot == bytes32(0)) revert BadData();
Expand Down Expand Up @@ -713,6 +713,29 @@ contract CometRewardsV2 {
}
}

/**
* @notice Returns true if the proof is valid
* @param root The root of the Merkle tree
* @param proofs The Merkle proofs
* @param account The account to check for
* @param index The index of the account
* @param accrued The accrued value for the account
* @return True if the proof is valid
*/
function verifyProof(
bytes32 root,
bytes32[] calldata proofs,
address account,
uint256 index,
uint256 accrued
) external pure returns(bool) {
return MerkleProof.verifyCalldata(
proofs,
root,
keccak256(bytes.concat(keccak256(abi.encode(account, index, accrued))))
);
}


/**
* @notice Returns the reward configuration for a specific token in a specific campaign
Expand Down
Loading

0 comments on commit 3f8aff1

Please sign in to comment.