Merge branch '201-add-protocol-contracts-to-the-npm' into 'master'

Add protocol contracts to the npm

Closes #201

See merge request aave-tech/protocol-v2!224
This commit is contained in:
The-3D 2021-01-29 09:13:42 +00:00
commit 57d9d48bf8
3 changed files with 92 additions and 29 deletions

View File

@ -1,5 +1,10 @@
stages: stages:
- checks - checks
- prepare
- publish
variables:
IMAGE: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}
lint: lint:
stage: checks stage: checks
@ -24,7 +29,9 @@ test:
after_script: after_script:
- docker-compose -p ${CI_JOB_ID} -f docker-compose.test.yml run contracts-env npm run ci:clean - docker-compose -p ${CI_JOB_ID} -f docker-compose.test.yml run contracts-env npm run ci:clean
- docker-compose -p ${CI_JOB_ID} -f docker-compose.test.yml down - docker-compose -p ${CI_JOB_ID} -f docker-compose.test.yml down
only:
- master
- merge_requests
deploy-mainnet-fork: deploy-mainnet-fork:
tags: tags:
- aave-build-runner - aave-build-runner
@ -36,6 +43,9 @@ deploy-mainnet-fork:
after_script: after_script:
- docker-compose -p ${CI_JOB_ID} -f docker-compose.test.yml run contracts-env npm run ci:clean - docker-compose -p ${CI_JOB_ID} -f docker-compose.test.yml run contracts-env npm run ci:clean
- docker-compose -p ${CI_JOB_ID} -f docker-compose.test.yml down - docker-compose -p ${CI_JOB_ID} -f docker-compose.test.yml down
only:
- master
- merge_requests
certora-test: certora-test:
stage: checks stage: checks
@ -52,3 +62,31 @@ certora-test:
- certoraRun specs/harness/StableDebtTokenHarness.sol:StableDebtTokenHarness --solc_args "['--optimize']" --verify StableDebtTokenHarness:specs/StableDebtToken.spec --settings -assumeUnwindCond,-b=4 --cache StableDebtToken --cloud - certoraRun specs/harness/StableDebtTokenHarness.sol:StableDebtTokenHarness --solc_args "['--optimize']" --verify StableDebtTokenHarness:specs/StableDebtToken.spec --settings -assumeUnwindCond,-b=4 --cache StableDebtToken --cloud
- certoraRun specs/harness/UserConfigurationHarness.sol --verify UserConfigurationHarness:specs/UserConfiguration.spec --solc_args "['--optimize']" --settings -useBitVectorTheory --cache UserConfiguration --cloud - certoraRun specs/harness/UserConfigurationHarness.sol --verify UserConfigurationHarness:specs/UserConfiguration.spec --solc_args "['--optimize']" --settings -useBitVectorTheory --cache UserConfiguration --cloud
- certoraRun contracts/protocol/tokenization/VariableDebtToken.sol:VariableDebtToken specs/harness/LendingPoolHarnessForVariableDebtToken.sol --solc_args "['--optimize']" --link VariableDebtToken:POOL=LendingPoolHarnessForVariableDebtToken --verify VariableDebtToken:specs/VariableDebtToken.spec --settings -assumeUnwindCond,-useNonLinearArithmetic,-b=4 --cache VariableDebtToken --cloud - certoraRun contracts/protocol/tokenization/VariableDebtToken.sol:VariableDebtToken specs/harness/LendingPoolHarnessForVariableDebtToken.sol --solc_args "['--optimize']" --link VariableDebtToken:POOL=LendingPoolHarnessForVariableDebtToken --verify VariableDebtToken:specs/VariableDebtToken.spec --settings -assumeUnwindCond,-useNonLinearArithmetic,-b=4 --cache VariableDebtToken --cloud
only:
- master
- merge_requests
prepare:
stage: prepare
tags:
- docker-builder
script:
- docker build -t ${IMAGE} .
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker push ${IMAGE}
only:
- master
publish:
image: ${IMAGE}
tags:
- docker
stage: publish
script:
- npm ci
- echo //registry.npmjs.org/:_authToken=${NPM_V2_PACKAGES_TOKEN} > .npmrc
- npm run compile
- ${VERSION}
- npm publish --access public
only:
- master

View File

@ -39,6 +39,37 @@ A more detailed and technical description of the protocol can be found in this r
You can join at the [Discord](http://aave.com/discord) channel or at the [Governance Forum](https://governance.aave.com/) for asking questions about the protocol or talk about Aave with other peers. You can join at the [Discord](http://aave.com/discord) channel or at the [Governance Forum](https://governance.aave.com/) for asking questions about the protocol or talk about Aave with other peers.
## Getting Started
You can install `@aave/protocol-v2` as an NPM package in your Hardhat, Buidler or Truffle project to import the contracts and interfaces:
`npm install @aave/protocol-v2`
Import at Solidity files:
```
import {ILendingPool} from "@aave/protocol-v2/contracts/interfaces/ILendingPool.sol";
contract Misc {
function deposit(address pool, address token, address user, uint256 amount) {
ILendingPool(pool).deposit(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 LendingPoolV2Artifact = require('@aave/protocol-v2/artifacts/contracts/protocol/lendingpool/LendingPool.sol/LendingPool.json');
// Log the ABI into console
console.log(LendingPoolV2Artifact.abi)
```
## Setup ## 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`. 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`.

View File

@ -1,7 +1,11 @@
{ {
"name": "protocol-v2", "name": "@aave/protocol-v2",
"version": "1.0.0", "version": "1.0.1",
"description": "Aave Protocol V2 smart contracts", "description": "Aave Protocol V2 smart contracts",
"files": [
"contracts",
"artifacts"
],
"scripts": { "scripts": {
"run-env": "npm i && tail -f /dev/null", "run-env": "npm i && tail -f /dev/null",
"hardhat": "hardhat", "hardhat": "hardhat",
@ -63,7 +67,8 @@
"main:initialize-tokens": "npm run compile && hardhat --network main full:initialize-tokens --pool Aave", "main:initialize-tokens": "npm run compile && hardhat --network main full:initialize-tokens --pool Aave",
"kovan:initialize-tokens": "npm run compile && hardhat --network kovan full:initialize-tokens --pool Aave", "kovan:initialize-tokens": "npm run compile && hardhat --network kovan full:initialize-tokens --pool Aave",
"external:deploy-assets-kovan": "npm run compile && hardhat --network kovan external:deploy-new-asset --symbol ${SYMBOL} --verify", "external:deploy-assets-kovan": "npm run compile && hardhat --network kovan external:deploy-new-asset --symbol ${SYMBOL} --verify",
"external:deploy-assets-main": "npm run compile && hardhat --network main external:deploy-new-asset --symbol ${SYMBOL} --verify" "external:deploy-assets-main": "npm run compile && hardhat --network main external:deploy-new-asset --symbol ${SYMBOL} --verify",
"prepublishOnly": "npm run compile"
}, },
"devDependencies": { "devDependencies": {
"@nomiclabs/buidler": "^1.4.7", "@nomiclabs/buidler": "^1.4.7",
@ -119,33 +124,22 @@
}, },
"author": "Aave", "author": "Aave",
"contributors": [ "contributors": [
{ "Ernesto Boado <ernesto@aave.com>",
"name": "Emilio Frangella", "Emilio Frangella <emilio@aave.com>",
"email": "emilio@aave.com" "Andrey Kozlov <andrey@aave.com>",
}, "David Racero <david.k@aave.com>",
{ "Pol Sendra <pol@aave.com>",
"name": "Ernesto Boado", "David Truong <david@aave.com>"
"email": "ernesto@aave.com"
},
{
"name": "Andrey Kozlov",
"email": "andrey@aave.com"
},
{
"name": "David Racero",
"email": "david.k@aave.com"
},
{
"name": "Pol Sendra",
"email": "pol@aave.com"
},
{
"name": "David Truong",
"email": "david@aave.com"
}
], ],
"license": "AGPLv3", "license": "AGPLv3",
"dependencies": { "dependencies": {
"tmp-promise": "^3.0.2" "tmp-promise": "^3.0.2"
} },
"keywords": [
"aave",
"protocol",
"protocol-v2",
"ethereum",
"solidity"
]
} }