mirror of
				https://github.com/Instadapp/aave-protocol-v2.git
				synced 2024-07-29 21:47:30 +00:00 
			
		
		
		
	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:
		
						commit
						57d9d48bf8
					
				|  | @ -1,5 +1,10 @@ | |||
| stages: | ||||
|   - checks | ||||
|   - prepare | ||||
|   - publish | ||||
| 
 | ||||
| variables: | ||||
|   IMAGE: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} | ||||
| 
 | ||||
| lint: | ||||
|   stage: checks | ||||
|  | @ -24,7 +29,9 @@ test: | |||
|   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 down | ||||
| 
 | ||||
|   only: | ||||
|     - master | ||||
|     - merge_requests | ||||
| deploy-mainnet-fork: | ||||
|   tags: | ||||
|     - aave-build-runner | ||||
|  | @ -36,6 +43,9 @@ deploy-mainnet-fork: | |||
|   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 down | ||||
|   only: | ||||
|     - master | ||||
|     - merge_requests | ||||
| 
 | ||||
| certora-test: | ||||
|   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/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 | ||||
|   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 | ||||
|  |  | |||
							
								
								
									
										31
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								README.md
									
									
									
									
									
								
							|  | @ -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. | ||||
| 
 | ||||
| ## 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 | ||||
| 
 | ||||
| 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`. | ||||
|  |  | |||
							
								
								
									
										50
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								package.json
									
									
									
									
									
								
							|  | @ -1,7 +1,11 @@ | |||
| { | ||||
|   "name": "protocol-v2", | ||||
|   "version": "1.0.0", | ||||
|   "name": "@aave/protocol-v2", | ||||
|   "version": "1.0.1", | ||||
|   "description": "Aave Protocol V2 smart contracts", | ||||
|   "files": [ | ||||
|     "contracts", | ||||
|     "artifacts" | ||||
|   ], | ||||
|   "scripts": { | ||||
|     "run-env": "npm i && tail -f /dev/null", | ||||
|     "hardhat": "hardhat", | ||||
|  | @ -63,7 +67,8 @@ | |||
|     "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", | ||||
|     "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": { | ||||
|     "@nomiclabs/buidler": "^1.4.7", | ||||
|  | @ -119,33 +124,22 @@ | |||
|   }, | ||||
|   "author": "Aave", | ||||
|   "contributors": [ | ||||
|     { | ||||
|       "name": "Emilio Frangella", | ||||
|       "email": "emilio@aave.com" | ||||
|     }, | ||||
|     { | ||||
|       "name": "Ernesto Boado", | ||||
|       "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" | ||||
|     } | ||||
|     "Ernesto Boado <ernesto@aave.com>", | ||||
|     "Emilio Frangella <emilio@aave.com>", | ||||
|     "Andrey Kozlov <andrey@aave.com>", | ||||
|     "David Racero <david.k@aave.com>", | ||||
|     "Pol Sendra <pol@aave.com>", | ||||
|     "David Truong <david@aave.com>" | ||||
|   ], | ||||
|   "license": "AGPLv3", | ||||
|   "dependencies": { | ||||
|     "tmp-promise": "^3.0.2" | ||||
|   } | ||||
|   }, | ||||
|   "keywords": [ | ||||
|     "aave", | ||||
|     "protocol", | ||||
|     "protocol-v2", | ||||
|     "ethereum", | ||||
|     "solidity" | ||||
|   ] | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 The-3D
						The-3D