Skip to content

Commit

Permalink
feat: add cCOP fork tests
Browse files Browse the repository at this point in the history
  • Loading branch information
philbow61 authored and chapati23 committed Nov 5, 2024
1 parent 8722c6d commit a27e906
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 8 additions & 5 deletions test/fork/BaseForkTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { FixidityLib } from "celo/contracts/common/FixidityLib.sol";
// Interfaces
import { IBiPoolManager } from "contracts/interfaces/IBiPoolManager.sol";
import { IBreakerBox } from "contracts/interfaces/IBreakerBox.sol";
import { IERC20 } from "contracts/interfaces/IERC20.sol";
import { IBroker } from "contracts/interfaces/IBroker.sol";
import { ICeloProxy } from "contracts/interfaces/ICeloProxy.sol";
import { IOwnable } from "contracts/interfaces/IOwnable.sol";
Expand Down Expand Up @@ -119,14 +120,16 @@ abstract contract BaseForkTest is Test {

function mint(address asset, address to, uint256 amount, bool updateSupply) public {
if (asset == lookup("GoldToken")) {
if (!updateSupply) {
revert("BaseForkTest: can't mint GoldToken without updating supply");
}
vm.prank(address(0));
IMint(asset).mint(to, amount);
// with L2 Celo, we need to transfer GoldToken to the user manually from the reserve
transferCeloFromReserve(to, amount);
return;
}

deal(asset, to, amount, updateSupply);
}

function transferCeloFromReserve(address to, uint256 amount) internal {
vm.prank(address(reserve));
IERC20(lookup("GoldToken")).transfer(to, amount);
}
}
4 changes: 3 additions & 1 deletion test/fork/ForkTests.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import { GoodDollarTradingLimitsForkTest } from "./GoodDollar/TradingLimitsForkT
import { GoodDollarSwapForkTest } from "./GoodDollar/SwapForkTest.sol";
import { GoodDollarExpansionForkTest } from "./GoodDollar/ExpansionForkTest.sol";

contract Alfajores_ChainForkTest is ChainForkTest(ALFAJORES_ID, 1, uints(15)) {}
contract Alfajores_ChainForkTest is ChainForkTest(ALFAJORES_ID, 1, uints(16)) {}

contract Alfajores_P0E00_ExchangeForkTest is ExchangeForkTest(ALFAJORES_ID, 0, 0) {}

Expand Down Expand Up @@ -77,6 +77,8 @@ contract Alfajores_P0E13_ExchangeForkTest is ExchangeForkTest(ALFAJORES_ID, 0, 1

contract Alfajores_P0E14_ExchangeForkTest is ExchangeForkTest(ALFAJORES_ID, 0, 14) {}

contract Alfajores_P0E15_ExchangeForkTest is ExchangeForkTest(ALFAJORES_ID, 0, 15) {}

contract Celo_ChainForkTest is ChainForkTest(CELO_ID, 1, uints(15)) {}

contract Celo_P0E00_ExchangeForkTest is ExchangeForkTest(CELO_ID, 0, 0) {}
Expand Down

0 comments on commit a27e906

Please sign in to comment.