Lending Market Governance
Here is a high level overview of how the Canto Lending Market is governed:
The proposals are initiated on the Network side (Cosmos runtime) and voted on by network validators as specified in the SDK governance module. Lending protocol governance uses a custom Canto proposal type equivalent to Compound V2's governance proposal type.
When a proposal is approved, the GovShuttle module sends the proposal type to the EVM module where it can be retrieved by a smart contract call to a specific oracle address.
When the proposal is retrieved, it is stored in the queue and then executed in the same manner as traditional governance on Compound V2, outlined in Compound's Governor Bravo after a proposal is approved.
Technical Overview & Details
Here is a technical overview of Canto Lending Market governance:
User uses CLI to submit proposal.
cantod tx unigov submit-proposal “proposal text here” --address="address to map contract"
This submits a proposal using the governance keeper.
Users vote on the proposal.
If the proposal passes, the governance module handler sends the proposal to the GovShuttle proposal handler, which triggers the GovShuttle module to call the keeper function
AppendLendingMarketProposal
located in theproposals.go
file.AppendLendingMarketProposal
function takes in theLendingMarketProposal
function from earlier and returns the address at which the Map Contract is deployed.Lending Market can now use the
QueryProp
method on the map contract to return a proposal struct. Importantly, the lending market can only query proposals that have passed through GovShuttle governance.
Proposals are saved to the EVM as follows:
DeployMapContract
packs the arguments contained in the proposal usingProposalStoreContract.ABI.Pack
Then it creates a contract address using
CreateAddress(types.ModuleAddress, nonce)
It then creates a byte array with the packed data and passes that into a keeper call to the EVM with
CallEVMWithData(ctx, types.ModuleAddress, nil, data, true)
Finally it returns the address where the Map Contract (shown below) with the initial proposal is deployed.
5. If a GovShuttle proposal has passed before, add a proposal to the Map Contract by using:
Last updated