π³οΈDeploy your campaign from a DAO
Guide to deploy a Merkl Campaign from a DAO
From an Onchain Gauge System
Many protocols rely on gauge systems where users vote onchain to determine the allocation of governance token rewards.
Merkl offers a set of plugins to facilitate the integration of Merkl campaign creation within such systems. These are designed to offer the best of Merkl's flexibility and reporting features combined with the advantages of a fully automated onchain setup.
How it works
These plugins are smart contracts that expose the same interfaces as usual staking contracts when it comes to creating new campaigns (like notifyReward
). When called, these contracts take the reward tokens (transferFrom
the caller address) and create Merkl campaigns directly based on pre-set parameters for the campaign data.
For these to work, these contracts must first be initialized with data about the campaigns they will createβsuch as which pool to incentivize, duration, blacklist/whitelist settings, and other parameters.
Once set up, campaigns can then be created automatically every week by a bot, with no trust assumptions towards the bot (it can even be made permissionless).
Every week, based on what was voted by the DAO or on the voting contract, when called, the voting contract will take the predefined parameters and update the reward amount (based on the vote) and the start timestamps.
An example plug-in can be found here.
Other teams have also worked on different implementations. You may check some other examples here:
Step by Step Guide
Update the plug-in contract interface
The plugin example assumes that the voting contract calls the gauge with the notifyReward
function.
Your voting contract may call associated gauges with different parameters. You must ensure that the interface exposed by the plugin contract matches the one used by your other gauges.
Your onchain governance vote may only work with one reward token instead of multiple. You may need to update the plugin contract accordingly, as the Merkl template is designed to accommodate multiple reward tokens.
Technically (but this depends on the setup of your voting contract), you can deploy one contract for all of your gauges.
Define your campaign parameters
Once your contract is deployed, the way you can pre-format your campaign is through the setGaugeParameters
function here.
To retrieve the necessary campaign data and parameters for this function based on your use case, follow the guide here.
Automate weekly (or biweekly) execution
Once your plugin is set up and your campaigns are correctly pre-formatted (a one-time setup), you only need to configure a mechanism within your voting contract to trigger execution automatically each week.
If you already have an automation setup to push rewards to your other gauges, then there's nothing specific that you need to do!
From a One-Off Governance Proposal
Some protocols may also need to execute one-off governance votes through onchain systems to execute campaigns (can be airdrops typically).
To successfully deploy your campaign through an onchain governance, you will need to create a campaign payload, then use the Foundry Forge CLI to generate the calldata for a DAO proposal.
Follow these steps to build the payload and finalize your campaign creation:
The example below is for Arbitrum network. Be sure to select the correct address for the Creator contract on your network: https://app.merkl.xyz/status
Create the approval transaction
Approve the Creator contract to spend tokens. Don't forget the Merkl fee in your calculation.
Then use the output to craft the proposal action, for example:
Create the ToS transaction Sign the Merkl terms of service
Example result:
Copy and edit the payload Follow the instructions in π§βπ¬ Deploy your campaign from a multisig or Gnosis Safe to generate and copy the campaign payload. This step is required to properly generate the
campaignData
, which includes the campaign IPFS hash.
The campaign becomes available at `startTime + duration`. NOTE: `duration` is NOT the length of time in which users can claim. Here is the function selector for reference:
Then update the format to be compatible with the Foundry CLI:
Replace the square brackets
[
with parenthesis(
Remove quotations
"
Remove newlines
Add single quotes
'
For example:
Create the
createCampaign
transaction Run the cast command using the the properly formatted payload
The third and final transaction will look like this:
Last updated