Skip to content

Lifi Zapper #351

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

Open
wants to merge 3 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/pull-request-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
run: forge install

- name: Run forge tests
run: forge test --no-match-contract 'Abstract|BeefyERC4626Test|DotDotERC4626Test|ArrakisERC4626Test|JarvisERC4626Test'
run: forge test --no-match-contract 'Abstract|BeefyERC4626Test|DotDotERC4626Test|ArrakisERC4626Test|JarvisERC4626Test|LiFiZapperTest'

build-and-test-bsc:
needs: [lint]
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
run: forge install

- name: Run forge tests on Polygon
run: forge test --fork-url https://rpc.ankr.com/polygon --fork-block-number ${FORK_BLOCK_NUMBER} --no-match-contract 'Abstract|BeefyERC4626Test|DotDotERC4626Test|ArrakisERC4626Test|JarvisERC4626Test'
run: forge test --fork-url https://rpc.ankr.com/polygon --fork-block-number ${FORK_BLOCK_NUMBER} --no-match-contract 'Abstract|BeefyERC4626Test|DotDotERC4626Test|ArrakisERC4626Test|JarvisERC4626Test|LiFiZapperTest'

build-and-test-evmostestnet:
needs: [lint]
Expand All @@ -117,7 +117,7 @@ jobs:
run: forge install

- name: Run forge tests on Evmos Testnet
run: forge test --fork-url https://eth.bd.evmos.dev:8545 --fork-block-number ${FORK_BLOCK_NUMBER} --no-match-contract 'Abstract|BeefyERC4626Test|DotDotERC4626Test|ArrakisERC4626Test|JarvisERC4626Test'
run: forge test --fork-url https://eth.bd.evmos.dev:8545 --fork-block-number ${FORK_BLOCK_NUMBER} --no-match-contract 'Abstract|BeefyERC4626Test|DotDotERC4626Test|ArrakisERC4626Test|JarvisERC4626Test|LiFiZapperTest'

build-and-test-moonbeam:
needs: [lint]
Expand All @@ -139,4 +139,4 @@ jobs:
run: forge install

- name: Run forge tests on Moonbeam
run: forge test --fork-url https://moonbeam.api.onfinality.io/public --fork-block-number ${FORK_BLOCK_NUMBER} --no-match-contract 'Abstract|BeefyERC4626Test|DotDotERC4626Test|ArrakisERC4626Test|JarvisERC4626Test'
run: forge test --fork-url https://moonbeam.api.onfinality.io/public --fork-block-number ${FORK_BLOCK_NUMBER} --no-match-contract 'Abstract|BeefyERC4626Test|DotDotERC4626Test|ArrakisERC4626Test|JarvisERC4626Test|LiFiZapperTest'
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/fuse-pool-zap"]
path = lib/fuse-pool-zap
url = https://github.com/lifinance/fuse-pool-zap
42 changes: 42 additions & 0 deletions contracts/test/external/lifi/LiFiZapperTest.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import "ds-test/test.sol";
import "forge-std/Vm.sol";

import "../../config/BaseTest.t.sol";
import { ERC20 } from "solmate/tokens/ERC20.sol";
import { IFusePool, IFToken, FusePoolZap } from "fuse-pool-zap/FusePoolZap.sol";

// Using 2BRL
// Tested on block 19052824
contract LiFiZapperTest is BaseTest {
bool public shouldRunTest;
FusePoolZap internal zap;

address internal constant JARVIS_FUSE_POOL = 0x31d76A64Bc8BbEffb601fac5884372DEF910F044;
address internal constant BUSD = 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56;
address internal constant FTOKEN = 0xa7213deB44f570646Ea955771Cc7f39B58841363;
address internal constant DEPOSITOR = 0x30C3002f742ad0811169d307ca39863209c80540;

constructor() {
shouldRunTest = forChains(BSC_MAINNET);
}

function setUp() public {
zap = new FusePoolZap();
}

function testCanZapIn() public {
vm.startPrank(DEPOSITOR);

uint256 amount = 1000 * 10**ERC20(BUSD).decimals();

ERC20(BUSD).approve(address(zap), amount);
zap.zapIn(JARVIS_FUSE_POOL, BUSD, amount);

assertEq(ERC20(FTOKEN).balanceOf(DEPOSITOR) > 0, true);

vm.stopPrank();
}
}
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
src = 'contracts'
bytecode_hash = 'none'
solc_version = "0.8.10"
libs = ["node_modules", "lib"]

# See more config options https://github.com/gakonst/foundry/tree/master/config
1 change: 1 addition & 0 deletions lib/fuse-pool-zap
Submodule fuse-pool-zap added at 5906db
3 changes: 2 additions & 1 deletion remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ ds-test/=lib/ds-test/src/
weird-erc20/=lib/fuse-flywheel/lib/libcompound/lib/solmate/lib/weird-erc20/src/
flywheel-v2/=lib/flywheel-v2/src/
flywheel/=lib/flywheel-v2/src/
@openzeppelin=lib/openzeppelin-contracts/
@openzeppelin=lib/openzeppelin-contracts/
fuse-pool-zap/=lib/fuse-pool-zap/src/