@aave/core-v3 中文文档教程

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

Build passcodecov

        .///.                .///.     //.            .//  `/////////////-
       `++:++`              .++:++`    :++`          `++:  `++:......---.`
      `/+: -+/`            `++- :+/`    /+/         `/+/   `++.
      /+/   :+/            /+:   /+/    `/+/        /+/`   `++.
  -::/++::`  /+:       -::/++::` `/+:    `++:      :++`    `++/:::::::::.
  -:+++::-`  `/+:      --++/---`  `++-    .++-    -++.     `++/:::::::::.
   -++.       .++-      -++`       .++.    .++.  .++-      `++.
  .++-         -++.    .++.         -++.    -++``++-       `++.
 `++:           :++`  .++-           :++`    :+//+:        `++:----------`
 -/:             :/-  -/:             :/.     ://:         `/////////////-

Aave Protocol v3

此存储库包含 Aave 协议 V3 的智能合约源代码和市场配置。 该存储库使用 Docker Compose 和 Hardhat 作为编译、测试和部署任务的开发环境。

What is Aave?

Aave 是一种去中心化的非托管流动性市场协议,用户可以作为供应商或借款人参与其中。 供应商向市场提供流动性以赚取被动收入,而借款人能够以超额抵押(永久)或抵押不足(单块流动性)的方式借款。

Documentation

请参阅技术论文的链接或访问 Aave 开发人员文档

Audits and Formal Verification

您可以在审计文件夹下找到所有审计报告

Round 1 - October 2021

Round 2 - December 2021

Formal Verification

Connect with the community

您可以加入 Discord 频道或在 治理论坛 提出有关协议的问题或与其他同行讨论 Aave。

Getting Started

您可以在 Hardhat 或 Truffle 项目中将 @aave/aave-v3-core 作为 NPM 包安装以导入合约和接口:

npm install @aave/aave-v3-core

在 Solidity 文件中导入:

import {IPool} from "@aave/aave-v3-core/contracts/interfaces/IPool.sol";

contract Misc {

  function supply(address pool, address token, address user, uint256 amount) public {
    IPool(pool).supply(token, amount, user, 0);
    {...}
  }
}

带有 ABI 和字节码的 JSON 工件也包含在 artifacts/ 目录中的捆绑 NPM 包中。

通过 Node JS require 导入 JSON 文件:

const PoolV3Artifact = require('@aave/aave-v3-core/artifacts/contracts/protocol/pool/Pool.sol/Pool.json');

// Log the ABI into console
console.log(PoolV3Artifact.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
# Add Alchemy or Infura provider keys, alchemy takes preference at the config level
ALCHEMY_KEY=""
INFURA_KEY=""


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

Test

您可以使用以下命令运行完整的测试套件:

# In one terminal
docker-compose up

# Open another tab or terminal
docker-compose exec contracts-env bash

# A new Bash terminal is prompted, connected to the container
npm run test

Build passcodecov

        .///.                .///.     //.            .//  `/////////////-
       `++:++`              .++:++`    :++`          `++:  `++:......---.`
      `/+: -+/`            `++- :+/`    /+/         `/+/   `++.
      /+/   :+/            /+:   /+/    `/+/        /+/`   `++.
  -::/++::`  /+:       -::/++::` `/+:    `++:      :++`    `++/:::::::::.
  -:+++::-`  `/+:      --++/---`  `++-    .++-    -++.     `++/:::::::::.
   -++.       .++-      -++`       .++.    .++.  .++-      `++.
  .++-         -++.    .++.         -++.    -++``++-       `++.
 `++:           :++`  .++-           :++`    :+//+:        `++:----------`
 -/:             :/-  -/:             :/.     ://:         `/////////////-

Aave Protocol v3

This repository contains the smart contracts source code and markets configuration for Aave Protocol V3. The repository uses Docker Compose and Hardhat as development environment for compilation, testing and deployment tasks.

What is Aave?

Aave is a decentralized non-custodial liquidity markets protocol where users can participate as suppliers or borrowers. Suppliers provide liquidity to the market to earn a passive income, while borrowers are able to borrow in an overcollateralized (perpetually) or undercollateralized (one-block liquidity) fashion.

Documentation

See the link to the technical paper or visit the Aave Developer docs

Audits and Formal Verification

You can find all audit reports under the audits folder

Round 1 - October 2021

Round 2 - December 2021

Formal Verification

Connect with the community

You can join at the Discord channel or at the Governance Forum for asking questions about the protocol or talk about Aave with other peers.

Getting Started

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

npm install @aave/aave-v3-core

Import at Solidity files:

import {IPool} from "@aave/aave-v3-core/contracts/interfaces/IPool.sol";

contract Misc {

  function supply(address pool, address token, address user, uint256 amount) public {
    IPool(pool).supply(token, amount, user, 0);
    {...}
  }
}

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 PoolV3Artifact = require('@aave/aave-v3-core/artifacts/contracts/protocol/pool/Pool.sol/Pool.json');

// Log the ABI into console
console.log(PoolV3Artifact.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
# Add Alchemy or Infura provider keys, alchemy takes preference at the config level
ALCHEMY_KEY=""
INFURA_KEY=""


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

Test

You can run the full test suite with the following commands:

# In one terminal
docker-compose up

# Open another tab or terminal
docker-compose exec contracts-env bash

# A new Bash terminal is prompted, connected to the container
npm run test
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文