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;
dApp integrations using Web3.js | Ethers.js | Viem (Wagmi) or other SDK & Library
Governance Contract interactions
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:
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.
You can find more information here about the Governor Bravo Smart Contract. There is no need to send a value
in the propose function, but we will address the targets and the calldatas elements.
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.
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.
Last updated