Skip to content

FluidMerkleDistributor ​

Git Source

Inherits:FluidMerkleDistributorCore, FluidMerkleDistributorAdmin, FluidMerkleDistributorApprover, FluidMerkleDistributorProposer, FluidMerkleDistributorRewards

Functions ​

constructor ​

solidity
constructor(ConstructorParams memory params_)
    validAddress(params_.owner)
    validAddress(params_.proposer)
    validAddress(params_.approver)
    validAddress(params_.rewardToken)
    Variables(params_.owner, params_.rewardToken);

hasPendingRoot ​

checks if there is a proposed root waiting to be approved

solidity
function hasPendingRoot() external view returns (bool);

currentMerkleCycle ​

merkle root data related to current cycle (proposed and approved).

solidity
function currentMerkleCycle() public view returns (MerkleCycle memory);

pendingMerkleCycle ​

merkle root data related to pending cycle (proposed but not yet approved).

solidity
function pendingMerkleCycle() public view returns (MerkleCycle memory);

encodeClaim ​

solidity
function encodeClaim(
    address recipient_,
    uint256 cumulativeAmount_,
    uint8 positionType_,
    bytes32 positionId_,
    uint256 cycle_,
    bytes memory metadata_
) public pure returns (bytes memory encoded_, bytes32 hash_);

claimOnBehalfOf ​

Claims rewards on behalf of an address for a given recipient. Only for backup claiming for integrating protocols without ability to claim on their side. Only callable by owner.

solidity
function claimOnBehalfOf(
    address onBehalfOf_,
    address recipient_,
    uint256 cumulativeAmount_,
    uint8 positionType_,
    bytes32 positionId_,
    uint256 cycle_,
    bytes32[] calldata merkleProof_,
    bytes memory metadata_
) public onlyOwner whenNotPaused;

Parameters

NameTypeDescription
onBehalfOf_address- user on behalf of which to claim the rewards. this users rewards get transferred to recipient_
recipient_address- address of the recipient
cumulativeAmount_uint256- cumulative amount of rewards to claim
positionType_uint8- type of position, 1 for lending, 2 for vaults, 3 for smart lending, etc
positionId_bytes32- id of the position, fToken address for lending and vaultId for vaults
cycle_uint256- cycle of the rewards
merkleProof_bytes32[]- merkle proof of the rewards
metadata_bytes

claim ​

Claims rewards for a given recipient

solidity
function claim(
    address recipient_,
    uint256 cumulativeAmount_,
    uint8 positionType_,
    bytes32 positionId_,
    uint256 cycle_,
    bytes32[] calldata merkleProof_,
    bytes memory metadata_
) public whenNotPaused;

Parameters

NameTypeDescription
recipient_address- address of the recipient
cumulativeAmount_uint256- cumulative amount of rewards to claim
positionType_uint8- type of position, 1 for lending, 2 for vaults, 3 for smart lending, etc
positionId_bytes32- id of the position, fToken address for lending and vaultId for vaults
cycle_uint256- cycle of the rewards
merkleProof_bytes32[]- merkle proof of the rewards
metadata_bytes

_claim ​

solidity
function _claim(
    address recipient_,
    uint256 cumulativeAmount_,
    uint8 positionType_,
    bytes32 positionId_,
    uint256 cycle_,
    bytes32[] calldata merkleProof_,
    bytes memory metadata_
) internal returns (uint256 claimable_);

bulkClaim ​

solidity
function bulkClaim(Claim[] calldata claims_) external;

Structs ​

Claim ​

solidity
struct Claim {
    address recipient;
    uint256 cumulativeAmount;
    uint8 positionType;
    bytes32 positionId;
    uint256 cycle;
    bytes32[] merkleProof;
    bytes metadata;
}