Claim Rewards from a Boost
Learn how to claim rewards from a Boost
In this example, you’ll learn how to claim a reward from a Boost.
To claim a reward from a Boost, you’ll need to follow these general steps:
- Retrieve the Boost you want to claim from
- Prepare the claim data payload
- Execute the claim transaction
This process will differ depending on if you have set up your own validator or are using the default validator.
If using the default validator, you will need to call the boost’s /signatures
endpoint to generate the signature payload,
otherwise you will need to build the payload yourself.
The default validator will be always be used by default unless you specify your own validator on boost creation.
In order to claim an incentive from a boost using the default validator, you will need to generate a valid signature payload.
You can do this by calling the boost api /signatures
endpoint and passing in the boostID and txHash.
This example assumes you have already instantiated a BoostCore
client and have a valid transaction hash for the action that the claimant completed.
Generate the Signature Payload
If using ERC20VariableIncentive
or ERC20VariableCriteriaIncentive
, you will need to pass in the rewardAmount
as claimData
to the /signatures
endpoint.
The /signatures
endpoint will return an array of signatures, one for each available incentive on the boost.
Each item in the array will contain the following fields:
signature
: The signature to be used in the claim transactionincentiveId
: The id of the incentive being claimedclaimant
: The address of the claimant
Claiming the incentives
Once you have a valid response from the /signatures
endpoint, you can loop through the response and claim the incentives.
claimIncentive
must be called by the claimant. This is useful if you have access to the claimants wallet, like in the case of a dapp.
If you are claiming on behalf of another user, you must use claimIncentiveFor
.
You can also claim on behalf of another user by using the claimIncentiveFor
method.