Learn how to reward users with ERC20 rewards when they vote for/against a specific proposal
VoteCast
event,
which has the event signature VoteCast(address indexed,uint256,uint8,uint256,string)
.
VoteCastWithParams
event. The SDK can only validate one at a time (for now), so this tutorial will just check for the VoteCast
event.A workaround for this is to create one boost for VoteCast
and another boost for VoteCastWithParams
.'VoteCast' Event Structure. Take note of the proposalId and support fields which are at index 1 and 2.
VoteCast
event.
eventAction
payload consists of the actionClaimant
and the actionSteps
we defined previously.
The purpose of the eventAction
is to track and reward users based on their interactions with the specified event.
signatureType
: Specifies that the signature type is an event.signature
: The event signature we are targeting, in this case, the VoteCast
event.fieldIndex
: Indicates which field in the event data we are interested in; here, it targets the ‘voter’ address (the address that initiated the vote).targetContract
: The address of the contract we are monitoring for the event.eventActionStepOne
and eventActionStepTwo
.
core.EventAction
to set up the event action with our constructed eventActionPayload
.
core.OpenAllowList()
makes this boost available to all addresses. If you want to limit it to a specific address, you can use a SimpleAllowList
.ERC20VariableIncentive
uses off-chain logic to determine the reward amount. If you would like to base your reward on on-chain logic, you can use the ERC20VariableCriteriaIncentive
type./signatures
api endpoint with the following params:
boostId
: The id of the boost where the action was completed. The format is chainId:boostId
(e.g. 8453:0x378632819f39c74c4f56b1429e760739c5fb51b7:12
)txHash
: The hash of the transaction that completed the action.claimData
: This is only nessecary for variableIncentives. For this parameter you would pass in the rewardAmount
which is used to determine the amount of the incentive to claim.
If you have more than one variable incentive you can pass in a comma-separated list of claimData values.maxParticipants
set for the boost is reached, or the incentive budget is fully spent.