Skip to content

akropolisio/akropolis

Repository files navigation

Akropolis+Yearn

Solidity contracts used in Akropolis Delphi yearn pools.

Testing and Development

Dependencies

Delphi contracts are compiled using [Solidity], however installation of the required Solidity versions is handled by Brownie.

Setup

To get started, first create and initialize a Python virtual environment. Next, clone the repo and install the developer dependencies:

git clone https://github.com/akropolisio/delphi-yearn.git
cd contracts
pip install -r requirements.txt

Run the command:

npm install

It executes several intallation steps:

  • install all npm dependencies
  • install all python dependencies (if not installed yet) including Brownie framework
  • install Brownie dependency packages (openzeppelin and yearn)
  • copy these packages to the working directory (see explanation below)
  • compile contracts
  • generate abi artifaacts (if needed)

Due to the existing bug in Brownie framework you may need to install the packages manually:

npm run clone-packages

Running the Tests

To run the entire suite:

brownie test

Security tools

See the instruction for running security tools upon Akropolis Delphi protocol. Slither, Echidna and Manticore are integrated.

Deployment

Create .env file with DEPLOYER_PRIVATE_KEY filled up. .env file also should contain ADMIN_PRIVATE_KEY in case of human-admin or PROXY_ADMIN_ADDRESS in case of AdminProxy contract already deployed. Leave both variables empty if new AdminProxy contract should be deployed.

For the local deployment run the command:

npm run deploy:devV1

or

brownie run deploy_vault_savingsV1.py

For the Rinkeby deployment firstly export Infura id:

export WEB3_INFURA_PROJECT_ID=b20c30c9e04c4a6bb1cd728ff589a15e

and run:

npm run deploy:rinkebyV1

or

brownie run deploy_vault_savingsV1.py --network rinkeby

Fork Mainnet

In order to perform mainnet-fork testing in automatic way you should perform next actions:

  1. If you want to work with Alchemy node (instead of slow Infurra node), first of all export host address (for example):
export ALCHEMY_ARCHIVE_NODE=https://eth-mainnet.alchemyapi.io/v2/3MsO_qdMuAz1ILi6KhiNZ-UO6lqq5mtA
  1. Infura project ID
export WEB3_INFURA_PROJECT_ID=<YOUR_PROJECT_ID>
  1. Also you need to export Etherscan token in order to be able to fetch the data (to get enough requests attempts):
export ETHERSCAN_TOKEN=<YOUR_ETHER_SCAN_TOKEN>
  1. After that add it to the mainnet-fork configuration:
npm run test:add-fork

Now you can run the test:

npm run test:swap-mainnet

Or you can run the console with the free emulation:

brownie console --network mainnet-fork

License

Copyright (c) 2020 A Labs Ltd., AGPL V3.0