Skip to content

Instantly share code, notes, and snippets.

@ChaituVR
Last active June 17, 2024 07:41
Show Gist options
  • Save ChaituVR/40e6517578a1ec86a420a9de52dc681f to your computer and use it in GitHub Desktop.
Save ChaituVR/40e6517578a1ec86a420a9de52dc681f to your computer and use it in GitHub Desktop.

Boost Creation

UI flow to create boost:

  1. Go to a space that has boost enabled (still in beta)
  2. Go to any open proposal and click on "Boost"
  3. Which will take us to a page like https://snapshot.org/#/thanku.eth/boost/0x25487e3e1ea520e40114a245cf59583a8e05389e5ae48a8746deab29b000af73
  4. We have different configurations as seen in this page

Steps to create a boost programmatically

1. Pinning to IPFS

We need to pin a JSON file to IPFS, Example:

{
  "name": "Boost",
  "description": "Snapshot.org proposal boost",
  "image": "https://snapshot.org/boost.png",
  "external_url": "https://snapshot.org/#/thanku.eth/proposal/0x25487e3e1ea520e40114a245cf59583a8e05389e5ae48a8746deab29b000af73",
  "strategyName": "proposal",
  "params": {
    "version": "0.0.1",
    "env": "snapshot",
    "proposal": "0x25487e3e1ea520e40114a245cf59583a8e05389e5ae48a8746deab29b000af73",
    "eligibility": {
      "type": "incentive"
    },
    "distribution": {
      "type": "weighted"
    }
  }
}

Change following parameters:

  • external_url: Proposal URL on snapshot
  • params.proposal: Proposal ID
  • params.eligibility.type: Type of eligibility
    • incentive (Any one who votes)
    • prediction (Any one who votes for the winning choice)
    • bribe (Any one who votes for a particular choice)
  • params.eligibility.choice: Choice to boost (Pass it only if type is bribe)
  • params.distribution.type:
    • weighted (Distributed based on voting power)
    • lottery (Randomly selected based on voting power)
  • params.distribution.limit (optional for all types):
    • (If type is weighted) Max reward (value based on decimal value of token)
    • (iIf type is lottery) Max % chance to win * 100 (for example if user has max chance of 50% then value will be 5000
  • params.distribution.numWinners: (If type is lottery) Number of winners that can be selected randomly

2. Deposit and mint:

In order to reward users, boost creater should deposit ERC20 tokens to snapshot's boost contract: 0x8e8913197114c911f13cfbfcbbd138c1dc74b964

Boost contract is deployed on following networks

  • Ethereum (mainnet)
  • Polygon PoS
  • Base
  • Sepolia testnet

After selecting the token:

  1. Approve spending cap for token => Use approve method
  2. Mint the boost => Use mint method with following parameters
Param Type Notes Example
_strategyURI string Pinned IPFS URL ipfs://QmUP7M525N6Bb145HvhKP8hSZBkNNij8oss7HyqiFDbWTv
_token address ERC20 token contract address 0xe485E2f1bab389C08721B291f6b59780feC83Fd7
_amount uint256 Amount of token 3000000000000000000000
_owner address Boost creator address 0xb97d9350F32C1366016e2C0a55E4A210D1158b22
_guard address Can be always 0x064417ab192edC00E791d5911ecDbb7c9a718383 0x064417ab192edC00E791d5911ecDbb7c9a718383
_start uint48 Claiming period start time = Proposal end date 1714906236
_end uint48 Claiming period end time = Two weeks from proposal end 1716115836
  1. Once transaction is successful, you should be able to see boost on the proposal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment