Boost an NFT Mint on Zora
Learn how to reward users with ERC20 rewards when they mint an NFT on Zora.
In this example, you’ve created an NFT on Zora, and want to incentivize users to mint it by offering additional rewards.
Make sure you’ve completed the quick start guide before proceeding with this example.
See the code
Set up a Managed Budget
First you’ll need to either initialize a new budget, or use an existing one, and allow the budget to spend a certain amount of your selected ERC20.
Define The Action
Next you’ll need to define the action that qualifies a user to claim the reward.
For Zora, we want to reward users that mint a specific NFT on Zora. To do this, we’ll key off of the Purchased
event,
which has the event signature Purchased(address indexed,address indexed,uint256 indexed,uint256,uint256)
.
'Purchased' Event Structure. We reference the event arguments using zero-based indexing. The third argument represents the tokenId, which corresponds to index 2.
Here is how you can structure the EventActionPayload to target the Purchased
event.
The important parameters to target in the event data are the tokenId and the NFT contract address.
If you’re using a known event, you can use the selectors package to get the signature.
Here is an example of the Purchased event
Next, we need to define the action claimant and create the payload for the new event action.
The 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.
-
actionClaimant: This object defines the conditions under which a user is eligible to claim rewards. It includes:
signatureType
: Specifies that the signature type is an event.signature
: The event signature we are targeting, in this case, thePurchased
event.fieldIndex
: Indicates which field in the event data we are interested in; We can target any field that contains the claimants address.targetContract
: The address of the contract we are monitoring for the event.
-
actionSteps: This array can contain up to four action steps that outline the specific actions or conditions that must be met for the event action to be valid. In this example, we include the previously defined
eventActionStep
.
Next, we create an EventAction
, passing in the constructed eventActionPayload
.
Deploy the Boost
Once the event action is created, we can set up the incentives and deploy our boost.
Claiming Incentives
Once a claimant has successfully completed the action, you can claim the incentive for that claimant.
ERC20Incentive
is a fixed reward incentive. If you would like to have a variable reward based on on-chain logic, you can use the ERC20VariableCriteriaIncentive
type.
In order to successfully claim the reward for a claimant, you will need to generate the signature payload.
To generate the signature payload you will need to call the Boost /signatures
api endpoint with the following params:
boostId
: The id of the boost where the action was completed. The format ischainId:boostId
(e.g.8453:69
)txHash
: The hash of the transaction that completed the action.
The signatures api will return an array of signatures, one for each available incentive on the boost.
Claim Signature API
See additional documentation on how to build a claim signature
There can be multiple incentives to claim in a single boost. The example shown only has one incentive.
The boost will stay active until the maxParticipants
set for the boost is reached.