ðŸ—ģïļDeploy your campaign from a DAO

Guide to deploy a Merkl Campaign from a DAO

To successfully deploy your campaign, you will need to create a campaign payload, then use the Foundry Forge CLI to generate the calldata for a DAO proposal.

Create the calldata

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

  1. Create the approval transaction

Approve the Creator contract to spend tokens. Don't forget the Merkl fee in your calculation.

cast calldata "approve(address,uint256) 0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd 35175873467336683417086

Then use the output to craft the proposal action, for example:

{
  "target": "0x000D636bD52BFc1B3a699165Ef5aa340BEA8939c",
  "calldata": "0x095ea7b30000000000000000000000008bb4c975ff3c250e0ceea271728547f3802b36fd000000000000000000000000000000000000000000000772e34ed4c71327edfe"
}
  1. Create the ToS transaction Sign the Merkl terms of service

cast calldata "acceptConditions()"

Example result:

{
  "target": "0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd",
  "calldata": "0x63b87bf0"
}
  1. 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:

createCampaign(
  tuple(
    bytes32, // campaignId
    address, // creator
    address, // rewardToken
    uint256, // amount
    uint32, // campaignType
    uint32, // startTimestamp
    uint32, // duration
    bytes, // campaignData
  ),
)
;[
  '0x0000000000000000000000000000000000000000000000000000000000000000',
  '0x0000000000000000000000000000000000000000',
  '0x000D636bD52BFc1B3a699165Ef5aa340BEA8939c',
  '35175873467336683417086',
  4,
  1734307200,
  3600,
  '0x000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000005568747470733a2f2f616e676c652d626c6f672e696e667572612d697066732e696f2f697066732f516d5558667658666274526576376d377750796a464d4c736a777568457a676e796a334653376172714b69446f33000000000000000000000000000000000000000000000000000000000000000000000000000000000000194f70656e20446f6c6c617220626f6c74732072657761726473000000000000000000000000000000000000000000000000000000000000000000000000000000',
]

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:

'(0x0000000000000000000000000000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,0x000D636bD52BFc1B3a699165Ef5aa340BEA8939c,35175873467336683417086,4,1734307200,3600,0x000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000005568747470733a2f2f616e676c652d626c6f672e696e667572612d697066732e696f2f697066732f516d5558667658666274526576376d377750796a464d4c736a777568457a676e796a334653376172714b69446f33000000000000000000000000000000000000000000000000000000000000000000000000000000000000194f70656e20446f6c6c617220626f6c74732072657761726473000000000000000000000000000000000000000000000000000000000000000000000000000000)'
  1. Create the createCampaign transaction Run the cast command using the the properly formatted payload

cast calldata "createCampaign(tuple(bytes32,address,address,uint256,uint32,uint32,uint32,bytes))" '<YOUR_PAYLOAD>'

// Example
cast calldata "createCampaign(tuple(bytes32,address,address,uint256,uint32,uint32,uint32,bytes))" '(0x0000000000000000000000000000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,0x000D636bD52BFc1B3a699165Ef5aa340BEA8939c,35175873467336683417086,4,1734307200,3600,0x000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000005568747470733a2f2f616e676c652d626c6f672e696e667572612d697066732e696f2f697066732f516d5558667658666274526576376d377750796a464d4c736a777568457a676e796a334653376172714b69446f33000000000000000000000000000000000000000000000000000000000000000000000000000000000000194f70656e20446f6c6c617220626f6c74732072657761726473000000000000000000000000000000000000000000000000000000000000000000000000000000)'

The third and final transaction will look like this:

{
  "target": "0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd",
  "calldata": "0xa63f05ad000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d636bd52bfc1b3a699165ef5aa340bea8939c000000000000000000000000000000000000000000000772e34ed4c71327edfe000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000675f6d800000000000000000000000000000000000000000000000000000000000000e1000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000005568747470733a2f2f616e676c652d626c6f672e696e667572612d697066732e696f2f697066732f516d5558667658666274526576376d377750796a464d4c736a777568457a676e796a334653376172714b69446f33000000000000000000000000000000000000000000000000000000000000000000000000000000000000194f70656e20446f6c6c617220626f6c74732072657761726473000000000000000000000000000000000000000000000000000000000000000000000000000000"
}

Last updated