IMerkleVault
Inherits: IAdministrable
Author: mortimr @ Kiln
Funds distribution vault using merkle proofs to authorize withdrawals
Functions
initialize
function initialize(address admin, bytes32 initialRoot, string calldata initialIpfsHash, uint256 initialFrameSize) external;
Parameters
| Name | Type | Description |
|---|---|---|
admin | address | The address able to update the merkle root |
initialRoot | bytes32 | The initial merkle root |
initialIpfsHash | string | The initial report ipfs hash |
initialFrameSize | uint256 | The initial frame size |
totalClaimedForAccount
Retrieve the total claimed amount for an account
function totalClaimedForAccount(address account) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The account to inspect |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The total claimed amount for the account |
totalClaimed
Retrieve the total claimed on the contract
function totalClaimed() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The total claimed amount |
root
Retrieve the current merkle root
function root() external view returns (bytes32);
Returns
| Name | Type | Description |
|---|---|---|
<none> | bytes32 | Current merkle root |
ipfsHash
Retrieve the ipfs hash holding the merkle tree + extra data
function ipfsHash() external view returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The ipfs hash |
setRootAndIpfsHash
Set the current merkle root
function setRootAndIpfsHash(bytes32 newRoot, string calldata newIpfsHash) external;
Parameters
| Name | Type | Description |
|---|---|---|
newRoot | bytes32 | The new merkle root value |
newIpfsHash | string |
claim
Claims funds based on total claimed and current amount
function claim(address account, uint256 amount, bytes32[] calldata proofs) external;
Parameters
| Name | Type | Description |
|---|---|---|
account | address | |
amount | uint256 | The total amount of rewards claimable for the caller |
proofs | bytes32[] | The array of proofs to verify before claim |
frameSize
Retreive the number of epochs between two reports
function frameSize() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The number of epochs |
setFrameSize
Update the number of epochs between two reports
function setFrameSize(uint256 newFrameSize) external;
Parameters
| Name | Type | Description |
|---|---|---|
newFrameSize | uint256 | The new frame size |
fallback
fallback() external payable;
receive
receive() external payable;
Events
Claimed
Emitted when claim action occured
event Claimed(address account, uint256 amount, uint256 totalClaimed);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The account that claimed the rewards |
amount | uint256 | The amount claimed during the claim action |
totalClaimed | uint256 | The total amount claimed |
SetFrameSize
Emitted a new frame size is set
event SetFrameSize(uint256 frameSize);
Parameters
| Name | Type | Description |
|---|---|---|
frameSize | uint256 | The new frame size |
SetRootAndIpfsHash
Emitted when root and ipfs hash are updated
event SetRootAndIpfsHash(bytes32 root, string ipfsHash);
Parameters
| Name | Type | Description |
|---|---|---|
root | bytes32 | The new merkle tree root |
ipfsHash | string | The new ipfs hash |
Errors
InvalidProofs
Thrown when the provided proofs are invalid
error InvalidProofs(address account, uint256 amount, bytes32[] proofs);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The account upon which claim is performed |
amount | uint256 | The amount that was claimed |
proofs | bytes32[] | The proofs that were provided |
NothingToClaim
Thrown when nothing to claim
error NothingToClaim(address account);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The account that has nothing to claim |