Governance
This section is for developers and technical users. For a non-technical overview, see the Protocol Governance section of Aavenomics.
The LEND (and AAVE) token can be used in the protocol's decision-making process, ensuring that the protocol evolves and grows in a decentralised manner.
Overview
On a technical level, the main components of the Aave Genesis Governance are:
The
AaveProtoGovernance
contract, which handles most of the logic for voting.The
AssetVotingWeightProvider
contract, which whitelists and sets voting weight for assets.The
AavePropositionPower
contract, which controls permissions for protocol governance such as registering a new proposal.The
GovernanceParamsProvider
contract, which stores the global protocol governance parameters such as the threshold of proposition power needed to register a new proposal.
Genesis Governance proposals have distinct phases:
Creation: A proposal is created by a user with enough proposition power. In the early stages, this will be the Genesis team. The proposal includes code that will be executed on passing of the proposal.
Voting: The proposal enters the 'Voting' phase, with a duration of
_votingBlocksDuration
.Votes are made by sending vote transactions to the
AaveProtoGovernance
contract usingsubmitVoteByVoter()
.
Validating: At the end of the
_votingBlocksDuration
, if the voting_threshold
has been reached,the proposal is moved to the 'Validating' phase with a duration of
_validatingBlocksDuration
.If the
_threshold
has not been reached, then the proposal will remain in the 'Voting' phase until the_threshold
is reached.During the 'Validating' phase, anyone can challenge (and cancel invalid) votes by calling the
challengeVoters()
method. Votes are considered invalid if their vote token balance is currently lower than the vote token balance at the time of voting.This process, going from 'Validating' and back to 'Voting' can happen a maximum number of
_maxMovesToVotingAllowed
, after which it is considered 'Expired' if it has not passed.
Execution: At the end of
_validatingBlocksDuration
, the proposal is resolved and the status is changed to 'Executed'.If the votes
_threshold
has been reached then theexecute()
method of the proposal's_proposalExecutor
is called, implementing/executing the governance proposal code.If the votes
_threshold
has not been reached, then no proposal code is executed.
Deployed Contracts
All contract source code can be found in the Github repository.
For an example of a Governance proposal payload, see the Genesis Proposal Payload and Genesis Migration repository.
Audits
The Governance contracts have been audited by Consensys Diligence.
Integrating AAVE voting
To perform AAVE voting and governance in your integration, the following steps should be followed:
1. Getting a list of proposals and associated details
You can fetch the list of proposal IDs a few ways :
Off-chain: use the emitted event from
AaveProtoGovernance
contract:ProposalCreated()
On-chain: use
try...catch
pattern to iterate through proposal IDs, starting at index 0Via our GraphQL: query our subgraph to receive a list of proposals and their IDs
Once you have a list of the proposals, you can query for more proposal data:
On-chain: use
getProposalBasicData()
Via our GraphQL: query our subgraph to receive the proposal's details
2. Voting on proposals
Once you have the proposal ID, a vote can be made by simply submitting a transaction using submitVoteByVoter()
.
You can change the user's vote by calling submitVoteByVoter()
again with the new vote, or cancel the vote with cancelVoteByVoter()
and re-submitting.
There is also the possibility of submitting a vote by relayer if desired.
3. Getting the status of a proposal
Similar to what was mentioned above, you can retrieve associated proposal data such as current vote status and thresholds by calling getProposalBasicData()
or by querying our subgraph.
Other useful methods includes getLimitBlockOfProposal()
, getLeadingChoice()
, getVoterData()
, and getVotesData()
.
Relevant Methods
submitVoteByVoter()
Contract: AaveProtoGovernance
function submitVoteByVoter(uint256 _proposalId, uint256 _vote, IERC20 _asset)
Submits a vote by the caller.
The vote is only allowed if the _asset
is whitelisted in the AssetVotingWeightProvider
contract.
If the voter has already voted, their previous vote will be overridden.
cancelVoteByVoter()
Contract: AaveProtoGovernance
function cancelVoteByVoter(uint256 _proposalId)
Cancels a vote by the caller.
challengeVoters()
Contract: AaveProtoGovernance
function challengeVoters(uint256 _proposalId, address[] calldata _voters)
During the 'Validating' phase, anyone can call this method to challenge and cancel invalid votes. This is to prevent double-voting attacks.
A vote is considered invalid when the voter's current balance of the voting asset is less than the balance of the.same asset at the time of casting their vote.
E.g. Alice has a balance of 100 LEND, votes on Proposal 1, and sends 50 LEND to an exchange before the end of the 'Validating' phase. Her vote would become invalid as her current balance is less than her balance at the time of making the vote.
getLimitBlockOfProposal()
Contract: AaveProtoGovernance
function getLimitBlockOfProposal(uint256 _proposalId)
Gets the maximum block number that a proposal is potentially 'Resolvable'. If the current block number is greater than this value, then the proposal is 'Invalid'.
Returns
getLeadingChoice()
Contract: AaveProtoGovernance
function getLeadingChoice(uint256 _proposalId)
Gets the current leading choice in votes, i.e. the current majority of votes.
Returns
getProposalBasicData()
Contract: AaveProtoGovernance
function getProposalBasicData(uint256 _proposalId)
Gets the basic data of a proposal.
Returns
getVoterData()
Contract: AaveProtoGovernance
function getVoterData(uint256 _proposalId, address _voterAddress)
Gets the voting data of a particular voter for a proposal ID.
Returns
getVotesData()
Contract: AaveProtoGovernance
function getVotesData(uint256 _proposalId)
Gets the voting data, i.e. the cumulative votes of each choice, for a given proposal ID.
Returns
getGovParamsProvider()
Contract: AaveProtoGovernance
function getGovParamsProvider()
Returns the address of the GovernanceParamsProvider
contract.
Last updated