This page explains how to manage FlareDrop functionality in applications.
Working with the FlareDrop requires interacting with these contracts:
DistributionToDelegators(Dist). Manages all claims.
ClaimSetupManager(CSM). Needed to configure autoclaiming.
To find their addresses, read the Contract Addresses page.
Dist.claim method allows claiming the FlareDrop one account at a time.
function claim( address _rewardOwner, address _recipient, uint256 _month, bool _wrap ) external returns( uint256 _rewardAmount );
It transfers the FlareDrop rewards accrued by account
_rewardOwner during the specified
_month to the specified
_wrap controls whether the reward is transferred in native
$FLR tokens or wrapped in
You can use
Dist.getCurrentMonth() to find out the current month (starting at 0), or
Dist.getClaimableMonths() to get the interval of months which are currently available for claiming.
Dist.getClaimableAmountOf() to find out if a given address has pending rewards on any given month.
Dist.claim() returns the amount of claimed rewards.
Two modes of operation are supported: Self-claiming and claiming on behalf of another account.
_rewardOwner, the caller is claiming its own rewards. In this case
_recipientcan be any address.
Claiming on behalf of another account:
msg.senderdoes not match
_rewardOwner, the caller must be a claim executor, claiming on behalf of
_msg.senderis not in the authorized list of executors for
_rewardOwner, the call will revert. Authorized executors must be set beforehand by
_recipientmust either be
_rewardOwner, its PDA, or any of the authorized recipients previously set by
CSM.setAllowedClaimRecipients(). The call will revert otherwise.
Dist.autoClaim() method allows claiming the FlareDrop for an arbitrary amount of accounts in a single call, with convenient default values.
function autoClaim( address calldata _rewardOwners, uint256 _month ) external;
It claims the rewards accrued by all the accounts in the
_rewardOwners array during the specified
If an account does not have an enabled PDA, the rewards are sent to the same account.
However, if an account does have an enabled PDA, the rewards are sent to the PDA account. Any rewards accrued by the PDA account are also claimed and sent to the PDA.
Rewards claimed with this method are always wrapped.
If the executor is a registered executor with a nonzero fee, the fee is automatically deducted from each claimed reward and sent to the executor account (unwrapped). If rewards are claimed for both an address and its PDA, the fee is deducted only once.
The call reverts if:
msg.senderis not in the authorized list of executors for any of the
- The total claimed rewards for any of the
_rewardOwnersis not high enough to cover the executor's fee.