Skip to content

Commit

Permalink
Deploy new tokens in local testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
NIC619 committed Jan 11, 2023
1 parent ba08f0e commit 2543445
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 14 deletions.
5 changes: 0 additions & 5 deletions test/RFQ.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import "contracts/MarketMakerProxy.sol";
import "contracts/RFQ.sol";
import "contracts/utils/SignatureValidator.sol";
import "test/mocks/MockERC1271Wallet.sol";
import "test/mocks/MockERC20.sol";
import "test/mocks/MockWETH.sol";
import "test/utils/BalanceSnapshot.sol";
import "test/utils/StrategySharedSetup.sol";
import { getEIP712Hash } from "test/utils/Sig.sol";
Expand Down Expand Up @@ -58,9 +56,6 @@ contract RFQTest is StrategySharedSetup {
// Setup
if (!vm.envBool("DEPLOYED")) {
// overwrite tokens with locally deployed mocks
weth = IERC20(address(new MockWETH("Wrapped ETH", "WETH", 18)));
usdt = new MockERC20("USDT", "USDT", 6);
dai = new MockERC20("DAI", "DAI", 18);
tokens = [weth, usdt, dai];
}
setUpSystemContracts();
Expand Down
36 changes: 27 additions & 9 deletions test/utils/Tokens.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ pragma solidity 0.7.6;

import "forge-std/Test.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./Addresses.sol";
import "test/mocks/MockERC20.sol";
import "test/mocks/MockWETH.sol";
import "test/utils/Addresses.sol";

contract Tokens is Test {
IERC20 public weth;
Expand All @@ -26,14 +28,30 @@ contract Tokens is Test {
lon = IERC20(vm.envAddress("LON_ADDRESS"));
ankreth = IERC20(vm.envAddress("ANKRETH_ADDRESS"));
} else {
// load ERC20s using constant address
weth = IERC20(WETH_ADDRESS);
usdt = IERC20(USDT_ADDRESS);
usdc = IERC20(USDC_ADDRESS);
dai = IERC20(DAI_ADDRESS);
wbtc = IERC20(WBTC_ADDRESS);
lon = IERC20(LON_ADDRESS);
ankreth = IERC20(ANKRETH_ADDRESS);
uint256 chainId;
assembly {
chainId := chainid()
}

if (chainId == 31337) {
// local testnet, deploy new ERC20s
weth = IERC20(address(new MockWETH("Wrapped ETH", "WETH", 18)));
usdt = new MockERC20("USDT", "USDT", 6);
usdc = new MockERC20("USDC", "USDC", 18);
dai = new MockERC20("DAI", "DAI", 18);
wbtc = new MockERC20("WBTC", "WBTC", 18);
lon = new MockERC20("LON", "LON", 18);
ankreth = new MockERC20("ANKRETH", "ANKRETH", 18);
} else {
// forked mainnet, load ERC20s using constant address
weth = IERC20(WETH_ADDRESS);
usdt = IERC20(USDT_ADDRESS);
usdc = IERC20(USDC_ADDRESS);
dai = IERC20(DAI_ADDRESS);
wbtc = IERC20(WBTC_ADDRESS);
lon = IERC20(LON_ADDRESS);
ankreth = IERC20(ANKRETH_ADDRESS);
}
}

tokens = [weth, usdt, usdc, dai, wbtc, lon, ankreth];
Expand Down
34 changes: 34 additions & 0 deletions test/utils/config/arbitrumMainnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"WETH_ADDRESS": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
"USDT_ADDRESS": "",
"USDC_ADDRESS": "",
"CRV_ADDRESS": "",
"TUSD_ADDRESS": "",
"DAI_ADDRESS": "",
"LON_ADDRESS": "",
"WBTC_ADDRESS": "",
"ANKRETH_ADDRESS": "",

"UNISWAP_V2_ADDRESS": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
"SUSHISWAP_ADDRESS": "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",
"UNISWAP_V3_ADDRESS": "0xE592427A0AEce92De3Edee1F18E0157C05861564",
"UNISWAP_V3_QUOTER_ADDRESS": "",
"CURVE_USDT_POOL_ADDRESS": "",
"CURVE_COMPOUND_POOL_ADDRESS": "",
"CURVE_Y_POOL_ADDRESS": "",
"CURVE_3_POOL_ADDRESS": "",
"CURVE_TRICRYPTO2_POOL_ADDRESS": "",
"CURVE_ANKRETH_POOL_ADDRESS": "",
"BALANCER_V2_ADDRESS": "",

"cDAI_ADDRESS": "",
"cUSDC_ADDRESS": "",
"yDAI_ADDRESS": "",
"yUSDC_ADDRESS": "",
"yUSDT_ADDRESS": "",
"yTUSD_ADDRESS": "",

"ARBITRUM_L1_GATEWAY_ROUTER_ADDR": "",
"ARBITRUM_L1_BRIDGE_ADDR": "",
"OPTIMISM_L1_STANDARD_BRIDGE_ADDR": ""
}
34 changes: 34 additions & 0 deletions test/utils/config/goerli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"WETH_ADDRESS": "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",
"USDT_ADDRESS": "",
"USDC_ADDRESS": "",
"CRV_ADDRESS": "",
"TUSD_ADDRESS": "",
"DAI_ADDRESS": "",
"LON_ADDRESS": "0x6dA0e6ABd44175f50C563cd8b860DD988A7C3433",
"WBTC_ADDRESS": "",
"ANKRETH_ADDRESS": "",

"UNISWAP_V2_ADDRESS": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
"SUSHISWAP_ADDRESS": "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",
"UNISWAP_V3_ADDRESS": "0xE592427A0AEce92De3Edee1F18E0157C05861564",
"UNISWAP_V3_QUOTER_ADDRESS": "",
"CURVE_USDT_POOL_ADDRESS": "",
"CURVE_COMPOUND_POOL_ADDRESS": "",
"CURVE_Y_POOL_ADDRESS": "",
"CURVE_3_POOL_ADDRESS": "",
"CURVE_TRICRYPTO2_POOL_ADDRESS": "",
"CURVE_ANKRETH_POOL_ADDRESS": "",
"BALANCER_V2_ADDRESS": "",

"cDAI_ADDRESS": "",
"cUSDC_ADDRESS": "",
"yDAI_ADDRESS": "",
"yUSDC_ADDRESS": "",
"yUSDT_ADDRESS": "",
"yTUSD_ADDRESS": "",

"ARBITRUM_L1_GATEWAY_ROUTER_ADDR": "0x4c7708168395aEa569453Fc36862D2ffcDaC588c",
"ARBITRUM_L1_BRIDGE_ADDR": "",
"OPTIMISM_L1_STANDARD_BRIDGE_ADDR": "0x636Af16bf2f682dD3109e60102b8E1A089FedAa8"
}

0 comments on commit 2543445

Please sign in to comment.