π€Claiming Onchain Rewards on Fuul
This article shows how to claim rewards from your FuulProject contract.
1. Getting claim checks
Claim checks are vouchers that allow users to claim their rewards.
To get the unclaimed claim checks for a specific user and Fuul project, use the claim check endpoint using the Fuul API.
2. Building claim function argument
The claim function argument is an array of claimCheckstruct elements. You will receive all the parameters from the endpoint.
// Solidity interface
struct ClaimCheck {
address projectAddress;
address to;
address currency;
IFuulProject.TokenType currencyType;
uint256 amount;
ClaimReason reason;
uint256 tokenId;
uint256 deadline;
bytes32 proof;
bytes[] signatures;
}
enum ClaimReason {
AFFILIATE_PAYOUT,
END_USER_PAYOUT
}
enum TokenType {
NATIVE,
ERC20,
ERC721,
ERC1155
}The claimChecks array can contain multiple elements, belonging to different projects and currencies.
3. Making the transaction
To perform a claim, the transaction must always be directed to the FuulManager contract.
So, the complete code, using ethers.js, would be the following:
Last updated