Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FuseERC4626 Vaults : unit & integration tests #6

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

eswak
Copy link

@eswak eswak commented Mar 28, 2022

This PR adds npm scripts to run unit and integration tests :

  • npm run test to run unit tests
  • npm run test:integration to run integration tests with a fixed block number
  • npm run test:integration:latest to run integration tests using the latest block

Unit tests are added for FuseERC4626 :
image

And integration tests are added for Fuse ERC4626 :
image

returns (uint256)
{
require(amount != 0, "ZERO_ASSETS"); // Deposit 0 makes no sense
require(amount <= type(uint128).max, "MANY_ASSETS"); // Check for overly large values
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why add this uint128 check? I don't think its necessary

Copy link
Author

@eswak eswak Mar 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on large values the CToken fails with MINT_EXCHANGE_CALCULATION_FAILED and there can be issues with wadMul, better to put a boundary (uint128.max is pretty large already)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right but its gas intensive to add. In practice token values don't get this large

@eswak
Copy link
Author

eswak commented Apr 6, 2022

Deploy script :

#!/usr/bin/env bash

RPC_URL=http://127.0.0.1:8545/
PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

CTOKEN_FEIRARI_FEI=0xd8553552f8868C1Ef160eEdf031cF0BCf9686945
CTOKEN_FEIRARI_DAI=0x7e9cE3CAa9910cc048590801e64174957Ed41d43
CTOKEN_FEIRARI_LUSD=0x647A36d421183a0a9Fa62717a64B664a24E469C7

# Deploy contracts
VAULT_FEI=$(forge create FuseERC4626 --constructor-args $CTOKEN_FEIRARI_FEI 'Fuse Pool 8 FEI ERC4626 Vault' '4626-fFEI-8' --rpc-url $RPC_URL --private-key $PRIVATE_KEY | grep 'Deployed to:' | awk '{print $NF}')
VAULT_DAI=$(forge create FuseERC4626 --constructor-args $CTOKEN_FEIRARI_DAI 'Fuse Pool 8 DAI ERC4626 Vault' '4626-fDAI-8' --rpc-url $RPC_URL --private-key $PRIVATE_KEY | grep 'Deployed to:' | awk '{print $NF}')
VAULT_LUSD=$(forge create FuseERC4626 --constructor-args $CTOKEN_FEIRARI_LUSD 'Fuse Pool 8 LUSD ERC4626 Vault' '4626-fLUSD-8' --rpc-url $RPC_URL --private-key $PRIVATE_KEY | grep 'Deployed to:' | awk '{print $NF}')

# Print contract addresses
echo "Deployed addresses:"
echo "  VAULT_FEI=$VAULT_FEI"
echo "  VAULT_DAI=$VAULT_DAI"
echo "  VAULT_LUSD=$VAULT_LUSD"
echo ""

@eswak
Copy link
Author

eswak commented Apr 11, 2022

Deployed :

VAULT_FEI=0xf486608dbc7dd0eb80e4b9fa0fdb03e40f414030
VAULT_DAI=0xba63738c2e476b1a0cfb6b41a7b85d304d032454
VAULT_LUSD=0x83e556baea9b5fa5f131bc89a4c7282ca240b156

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants