IMerkleVault

Git Source

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

NameTypeDescription
adminaddressThe address able to update the merkle root
initialRootbytes32The initial merkle root
initialIpfsHashstringThe initial report ipfs hash
initialFrameSizeuint256The initial frame size

totalClaimedForAccount

Retrieve the total claimed amount for an account

function totalClaimedForAccount(address account) external view returns (uint256);

Parameters

NameTypeDescription
accountaddressThe account to inspect

Returns

NameTypeDescription
<none>uint256The total claimed amount for the account

totalClaimed

Retrieve the total claimed on the contract

function totalClaimed() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The total claimed amount

root

Retrieve the current merkle root

function root() external view returns (bytes32);

Returns

NameTypeDescription
<none>bytes32Current merkle root

ipfsHash

Retrieve the ipfs hash holding the merkle tree + extra data

function ipfsHash() external view returns (string memory);

Returns

NameTypeDescription
<none>stringThe ipfs hash

setRootAndIpfsHash

Set the current merkle root

function setRootAndIpfsHash(bytes32 newRoot, string calldata newIpfsHash) external;

Parameters

NameTypeDescription
newRootbytes32The new merkle root value
newIpfsHashstring

claim

Claims funds based on total claimed and current amount

function claim(address account, uint256 amount, bytes32[] calldata proofs) external;

Parameters

NameTypeDescription
accountaddress
amountuint256The total amount of rewards claimable for the caller
proofsbytes32[]The array of proofs to verify before claim

frameSize

Retreive the number of epochs between two reports

function frameSize() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The number of epochs

setFrameSize

Update the number of epochs between two reports

function setFrameSize(uint256 newFrameSize) external;

Parameters

NameTypeDescription
newFrameSizeuint256The 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

NameTypeDescription
accountaddressThe account that claimed the rewards
amountuint256The amount claimed during the claim action
totalClaimeduint256The total amount claimed

SetFrameSize

Emitted a new frame size is set

event SetFrameSize(uint256 frameSize);

Parameters

NameTypeDescription
frameSizeuint256The new frame size

SetRootAndIpfsHash

Emitted when root and ipfs hash are updated

event SetRootAndIpfsHash(bytes32 root, string ipfsHash);

Parameters

NameTypeDescription
rootbytes32The new merkle tree root
ipfsHashstringThe new ipfs hash

Errors

InvalidProofs

Thrown when the provided proofs are invalid

error InvalidProofs(address account, uint256 amount, bytes32[] proofs);

Parameters

NameTypeDescription
accountaddressThe account upon which claim is performed
amountuint256The amount that was claimed
proofsbytes32[]The proofs that were provided

NothingToClaim

Thrown when nothing to claim

error NothingToClaim(address account);

Parameters

NameTypeDescription
accountaddressThe account that has nothing to claim