IPOR smart contracts
- Install
Foundry
from https://getfoundry.sh/ - Install
python3-pip
. - Install
solc-select
using pip:pip3 install solc-select
- Install
node
(v16.15.0) andnpm
(v8.5.5). - Install
truffle
:npm install -g truffle
- Install
jq
- Check truffle binary execution permission. Run
chmod +x truffle
in binary dir if execution flag is missing. - Run
sudo apt-get install build-essential
- Clone
ipor-protocol
repository. - In directory
ipor-protocol
configure.env
file based on.env-local.j2
WARNING! Optional: You can setupcd ipor-protocol cp .env-local.j2 .env
GLOBAL_AWS_PROFILE
env variable with the name of Your local AWS profile. Its only needed when publishing migration results to S3. - Run local
Ethereum
node. The assumption is thatEthereum
node is a local instance ofanvil
fromFoundry
and will be available athttp://localhost:8545
withchainId = 31337
- Execute script
./run.sh
with specific command, like below:mc
- migrate Smart Contracts to blockchain from the first migrationm
- migrate Smart Contracts to blockchain from the last migration
- Migration is executed with the use of Truffle
- In
.env
file setup migration folderSC_MIGRATION_DIRECTORY
which should point to one of subfolder in folder./ipor-protocol/migrations/envs
- In
.env
file setup network nameETH_BC_NETWORK_NAME
which should correspond to one of network names defined intruffle-config.js
- In command line execute
./run.sh m
for incremental migration or./run.sh mc
if you want to migrate all new smart contracts from scratch
- On remote server all parameters in
.env
are already prepared, you should not modify them without consultation with IT Team. - Connect to server by ssh
cd repos/ipor-protocol
git pull
./run.sh m mlogs
./run.sh p
exit
npm run test
npx hardhat coverage
Coverage reports available in coverage
folder.
export FORK_ENABLED=true; npx hardhat coverage --testfiles "test/vault/mainnet-fork/stanley-aave-dai.ts"
Notice! npx hardhat coverage
not includes coverage from tests in mainnet fork, this test coverage should be executed separately on every file.
npx hardhat test test/MiltonSpread.test.js
npx hardhat test --logs
npm run export-errorCodes
Run in command line: truffle run contract-size
Run in command line: yarn run hardhat docgen --theme markdown
docker pull trailofbits/eth-security-toolbox
- go to main project folder
docker run -it --platform linux/amd64 -v ../ipor-protocol:/share trailofbits/eth-security-toolbox
cd /share
npm install
slither . --solc-remaps @openzeppelin/=$(pwd)/node_modules/@openzeppelin/ < Optional --print human-summary >