Hedgey Community Docs
  • โœŒ๏ธThis is Hedgey.
  • Products
    • ๐Ÿช™Vesting Plans
      • Getting Started
        • โœ…Note for Issuers
        • ๐Ÿ‘ฉโ€๐Ÿ’ผFor Issuers
        • ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆFor Token Vesting recipients
        • โœ”๏ธDelegating your tokens
    • ๐Ÿ’ฐToken Grants
      • Getting Started
      • ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆFor Grant Recipients
      • ๐Ÿ‘จโ€๐Ÿ’ผFor Grant Issuers
    • ๐Ÿ›๏ธInvestor Lockups
      • Getting Started
        • โœ…Note for Issuers
        • ๐Ÿคตโ€โ™€๏ธFor Issuers
        • ๐Ÿ‘ฏFor Investors who have received locked token allocations via Hedgey
      • Special Features
        • Segmenting Plans
        • โœ”๏ธDelegating your tokens
      • Creating Investor Lockups using Fireblocks (+troubleshooting)
    • ๐Ÿ”Treasury Lockups
      • Getting Started
      • Creating Treasury Lockups
    • ๐Ÿช‚Token Claims
      • ๐Ÿ‡Getting started
        • Using token claims on Farcaster
        • ๐ŸŽFor Claims Issuers
        • ๐Ÿ•ต๏ธโ€โ™‚๏ธCreating a test claim to verify wallet addresses
        • ๐ŸŽ‰For Claims Recipients (unlocked & locked claims)
    • ๐Ÿ•—Time Locks
      • ๐Ÿ‡Getting started
        • โฐCreating Time Locks
  • ๐ŸงฐSupport docs
    • ๐Ÿ”ตGrants (Arbitrum STIP)
      • Getting Started
      • For STIP Grant Recipients
      • For Arbitrum Grant Issuers
    • ๐Ÿ”ตGrants (Arbitrum LTIPP)
      • Getting Started
      • For LTIPP Grant Recipients
      • For Arbitrum Grant Issuers
    • ๐ŸŸฃGrants (Polygon Village)
      • Getting Started
      • For Grant Recipients
      • For Polygon Village Grant Issuers
    • ๐Ÿ”ตLocking your team tokens and LP tokens on Hedgey using Hedgey Treasury Locks (for ShimmerSea)
      • Getting Started
      • Creating a Treasury Lockup
    • ๐ŸŸ (Celo Specific) Connecting with Celo Terminal
    • โœ…(Celo Specific) using Hedgey through Valora
    • ๐ŸคฉGovernance
      • โšกHedgey <> Snapshot strategy
    • ๐Ÿ‘ฝOn-Chain Governance
    • ๐Ÿ”บUsing Hedgey app with Fireblocks
    • โš’๏ธTroubleshooting
    • ๐Ÿ’ปAdding Hedgey Apps as "custom" Safe apps
    • ๐ŸชฑFor Wormhole investors who have received lockups on Hedgey
    • โค๏ธโ€๐Ÿ”ฅCreating Investor Lockups using FireBlocks (+troubleshooting)
    • ๐ŸกViewing your Puffer lockup
  • FOR DEVELOPERS
    • โŒšTechnical Documentation
      • ๐Ÿ’พToken Vesting
        • Smart Contract Details
        • Integration & Direct Contract Interactions
      • ๐Ÿ“ผToken Lockups
        • Smart Contract Details
        • Integration & Direct Contract Interactions
      • โ˜Ž๏ธDelegation Architecture
        • Delegator Architecture
        • Voting Vaults & On-Chain Delegation
        • ERC721Delegate
      • ๐ŸฅณToken Claims
        • Smart Contract Information
      • ๐Ÿ“€V1 Contracts
        • Hedgeys NFT
          • Technical Details
        • DAO <> DAO Swap
        • Error Codes
    • ๐ŸAudits
    • ๐Ÿ“ŽBug Bounty
    • Deployments
      • Token Vesting Plans
      • Voting Token Vesting Plans
      • Vesting + Lockup Plans
      • Token Lockup Plans
      • Voting Token Lockup Plans
      • Bound Token Lockup Plans
      • Bound Voting Token Lockup Plans
      • Batch Planner Contract
      • Token Claims (ClaimCampaigns)
      • V1 Streaming Contracts
      • V1 Stream Vesting Contracts
      • Hedgeys
  • Contact HEDGEY
    • Social Media
    • Press and Media kit
  • LEGAL
    • Protocol Disclaimer
    • Terms of Use
    • Hedgey Pro Terms of Use
Powered by GitBook
On this page
  • Creating Vesting Plans
  • dApp Integrations
  • Governance Contract (Governor Bravo) Interaction
  • Smart Contract Interaction via Contract Interface
  1. FOR DEVELOPERS
  2. Technical Documentation
  3. Token Vesting

Integration & Direct Contract Interactions

This section describes how best to integrate with the contracts directly, for governance & smart contract direct interactions.

There are three typical ways you may want to integrate or interact with the smart contracts;

  1. dApp integrations using Web3.js | Ethers.js | Viem (Wagmi) or other SDK & Library

  2. Governance Contract interactions

  3. Smart Contract interactions & Modules

Creating Vesting Plans

For creating vesting plans, there are two ways to interact with the smart contract directly - either using the createPlan function itself, or by using the BatchPlanner contract, which will mint many plans in a single transaction.

dApp Integrations

Governance Contract (Governor Bravo) Interaction

We assume that you will be leveraging a Governor Bravo style contract, with the following function:

function propose(
  address[] memory targets, 
  uint[] memory values, 
  string[] memory signatures, 
  bytes[] memory calldatas, 
  string memory description) returns (uint)
  • targets: The ordered list of target addresses for calls to be made during proposal execution. This array must be the same length as all other array parameters in this function.

  • calldatas: The ordered list of data to be passed to each individual function call during proposal execution. This array must be the same length as all other array parameters in this function.

target will be the BatchPlanner address: 0x3466EB008EDD8d5052446293D1a7D212cb65C646

calldatas To generate this, you can use web3 library (ethersjs or web3js), and create the array of plans and parameters, and ABI encode the plans, converting to bytes. Here's an example script you can run to convert multiple plans into encoded data.

const { ethers,  BigNumber } = require("ethers")

let planA = {
    recipient: '0x0CCFAb8d9DBE788808EeCCC3bf0295278E307777',
    amount: BigNumber.from(10).pow(18), // 10 tokens
    start: '1696161600', // Oct 1st
    cliff: '1698840000', // Nov 1st
    rate: '1000',
}

let planB = {
    recipient: '0xDD06fEee44433A0B9eEEEE0Ed777721F88885555',
    amount: BigNumber.from(10).pow(18).mul(2), // 10 tokens
    start: '1696161600', // Oct 1st
    cliff: '1698840000', // Nov 1st
    rate: '2000',
}


let locker = '0x1bb64AF7FE05fc69c740609267d2AbE3e119Ef82' // voting vesting address
let token = '0xE13FB676E9bdd7AFda91495eC4e027FC63212FC3' //input token address here
let period = '1' // use 1 for streaming version
let dao = '0xDA0B6bDA01eEd76667D7b4FDA0615657C6b9aDA0' // doa contract address, or address that will be responsible for revoking plans

async function encodeData(vestingAddress, tokenAddress, plans, period, daoAddress) {
    let totalAmount = BigNumber.from(0);
    for (let i = 0; i < plans.length; i++) {
        totalAmount.add(plans[i].amount);
    }
    const abiCoder = new ethers.utils.AbiCoder();
    const encodedData = abiCoder.encode(
        ['address', 'address', 'uint256', "tuple(address recipient, uint256 amount, uint256 start, uint256 cliff, uint256 rate)[]", 'uint256', 'address', 'bool', 'uint8'],
        [vestingAddress, tokenAddress, totalAmount, plans, period, daoAddress, true, '4']
    )
    
    const hexString = encodedData.slice(2);
    const bytes = Buffer.from(hexString, 'hex')
    console.log(bytes);
    return bytes;
}

encodeData(locker, token, [planA, planB], period, dao);

With this information, you can now create a proposal and input the other information required by the DAO in its governance system into the propose function.

Smart Contract Interaction via Contract Interface

This section will help you understand how to create a middleware solidity file that incorporates the BatchPlanner interface so that you can effectively create vesting plans from a smart contract directly. You will need to import the below file, and then your contract should call the function with its inputs directly.

pragma solidity 0.8.19;

interface IBatchPlanner {
  struct Plan {
    address recipient;
    uint256 amount;
    uint256 start;
    uint256 cliff;
    uint256 rate;
  }
  

  function batchVestingPlans(
    address locker,
    address token,
    uint256 totalAmount,
    Plan[] calldata plans,
    uint256 period,
    address vestingAdmin,
    bool adminTransferOBO,
    uint8 mintType
  ) external;
}
PreviousSmart Contract DetailsNextToken Lockups

Last updated 1 year ago

You can find more information here about the . There is no need to send a value in the propose function, but we will address the targets and the calldatas elements.

โŒš
๐Ÿ’พ
Governor Bravo Smart Contract