@aave/governance-v2 中文文档教程

发布于 3年前 浏览 21 项目主页 更新于 3年前

Aave Governance v2

Architecture

governance-v2-architecture

Audits

Aave Governance V2 已由​​ Peckshied 审核,最终报告 此处

Planned configurations for mainnet

AaveGovernanceV2

  • voting delay (time between a proposal is submitted and the voting is opened): 0 blocks, as for us this process is done beforehand in the governance forum
  • guardian: Aave Guardian multisig
  • executors whitelisted: Executor (short) and Executor (long)
  • owner (entity able to change the strategy, voting delay and authorize/unauthorize executors): Executor 2, the long timelock

Executor (short)

它将控制整个 Aave 协议 v1、v1 中使用的代币分发器、收取 v1 费用的合约、AAVE 的储备生态系统以及此时间锁本身的任何更改

  • admin (the only address enable to interact with this executor): Aave Governance v2
  • delay (time between a proposals passes and its actions get executed): 1 day
  • grace period (time after the delay during which the proposal can be executed): 5 days
  • proposition threshold: 0.5%
  • voting duration: 3 days
  • vote differential: 0.5%
  • quorum: 2%

Executor (long)

它将控制 AAVE 令牌、stkAAVE 的可升级性、Governance v2 参数的任何更改以及此时间锁本身参数的任何更改

  • admin: Aave Governance v2
  • delay: 7 days
  • grace period: 5 days
  • proposition threshold: 2%
  • voting duration: 10 days
  • vote differential: 15%
  • quorum: 20%

Governance strategy (the contract determining how the voting/proposition powers are calculated)

  • Based on AAVE+stkAAVE
  • Voting and proposition power are: balanceOfAAVE + delegationReceivedOfAAVE + balanceOfstkAAVE + delegationReceivedOfstkAAVE (with delegation being voting or proposition depending on the case)
  • Total voting and proposition supply: AAVE supply

Getting Started

您可以安装 @aave/governance-v2 作为在 Hardhat、Buidler 或 Truffle 项目中导入合同和接口的

NPM

import {IAaveGovernanceV2} from "@aave/governance-v2/contracts/interfaces/IAaveGovernanceV2.sol";

contract Misc {

  function vote(uint256 proposal, bool support) {
    IAaveGovernanceV2(pool).submitVote(proposal, support);
    {...}
  }
}

包 在 artifacts/ 目录中捆绑 NPM 包。

通过 Node JS require 导入 JSON 文件:

const GovernanceV2Artifact = require('@aave/governance-v2/artifacts/contracts/governance/AaveGovernanceV2.sol/AaveGovernanceV2.json');

// Log the ABI into console
console.log(GovernanceV2Artifact.abi)

Setup

存储库使用 Docker Compose 来管理敏感密钥并加载配置。 在测试或部署等任何操作之前,您必须运行 docker-compose up 以启动 contracts-env 容器,然后通过 docker- 连接到容器控制台编写 exec contracts-env bash

按照接下来的步骤设置存储库:

  • Install docker and docker-compose
  • Create an enviroment file named .env and fill the next enviroment variables
# Mnemonic, only first address will be used
MNEMONIC=""

# Add Alchemy or Infura provider keys, alchemy takes preference at the config level
ALCHEMY_KEY=""
INFURA_KEY=""

# Optional Etherscan key, for automatize the verification of the contracts at Etherscan
ETHERSCAN_KEY=""

# Optional, if you plan to use Tenderly scripts
TENDERLY_PROJECT=""
TENDERLY_USERNAME=""

Test

要运行测试套件,请运行:

docker-compose run contracts-env npm run test

要运行覆盖率,请运行:

docker-compose run contracts-env npm run coverage

Aave Governance v2

Architecture

governance-v2-architecture

Audits

The Aave Governance V2 has been audited by Peckshied, with the final report here

Planned configurations for mainnet

AaveGovernanceV2

  • voting delay (time between a proposal is submitted and the voting is opened): 0 blocks, as for us this process is done beforehand in the governance forum
  • guardian: Aave Guardian multisig
  • executors whitelisted: Executor (short) and Executor (long)
  • owner (entity able to change the strategy, voting delay and authorize/unauthorize executors): Executor 2, the long timelock

Executor (short)

It will control the whole Aave protocol v1, the token distributor used in v1, the contract collecting the fees of v1, the Reserve Ecosystem of AAVE and any change in this timelock itself

  • admin (the only address enable to interact with this executor): Aave Governance v2
  • delay (time between a proposals passes and its actions get executed): 1 day
  • grace period (time after the delay during which the proposal can be executed): 5 days
  • proposition threshold: 0.5%
  • voting duration: 3 days
  • vote differential: 0.5%
  • quorum: 2%

Executor (long)

It will control the upgradeability of the AAVE token, the stkAAVE, any change in the parameters of the Governance v2 and any change in the parameters of this timelock itself

  • admin: Aave Governance v2
  • delay: 7 days
  • grace period: 5 days
  • proposition threshold: 2%
  • voting duration: 10 days
  • vote differential: 15%
  • quorum: 20%

Governance strategy (the contract determining how the voting/proposition powers are calculated)

  • Based on AAVE+stkAAVE
  • Voting and proposition power are: balanceOfAAVE + delegationReceivedOfAAVE + balanceOfstkAAVE + delegationReceivedOfstkAAVE (with delegation being voting or proposition depending on the case)
  • Total voting and proposition supply: AAVE supply

Getting Started

You can install @aave/governance-v2 as an NPM package in your Hardhat, Buidler or Truffle project to import the contracts and interfaces:

npm install @aave/governance-v2

Import at Solidity files:

import {IAaveGovernanceV2} from "@aave/governance-v2/contracts/interfaces/IAaveGovernanceV2.sol";

contract Misc {

  function vote(uint256 proposal, bool support) {
    IAaveGovernanceV2(pool).submitVote(proposal, support);
    {...}
  }
}

The JSON artifacts with the ABI and Bytecode are also included into the bundled NPM package at artifacts/ directory.

Import JSON file via Node JS require:

const GovernanceV2Artifact = require('@aave/governance-v2/artifacts/contracts/governance/AaveGovernanceV2.sol/AaveGovernanceV2.json');

// Log the ABI into console
console.log(GovernanceV2Artifact.abi)

Setup

The repository uses Docker Compose to manage sensitive keys and load the configuration. Prior any action like test or deploy, you must run docker-compose up to start the contracts-env container, and then connect to the container console via docker-compose exec contracts-env bash.

Follow the next steps to setup the repository:

  • Install docker and docker-compose
  • Create an enviroment file named .env and fill the next enviroment variables
# Mnemonic, only first address will be used
MNEMONIC=""

# Add Alchemy or Infura provider keys, alchemy takes preference at the config level
ALCHEMY_KEY=""
INFURA_KEY=""

# Optional Etherscan key, for automatize the verification of the contracts at Etherscan
ETHERSCAN_KEY=""

# Optional, if you plan to use Tenderly scripts
TENDERLY_PROJECT=""
TENDERLY_USERNAME=""

Test

For running the test suite, run:

docker-compose run contracts-env npm run test

For running coverage, run:

docker-compose run contracts-env npm run coverage
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文