diff --git a/config_scripts/test_daiMainnetScript.ts b/config_scripts/test_daiMainnetScript.ts new file mode 100644 index 00000000..64b33075 --- /dev/null +++ b/config_scripts/test_daiMainnetScript.ts @@ -0,0 +1,9 @@ +import { + PoolV3CoreConfigurator, + testDaiConfigMainnet, +} from "@gearbox-protocol/sdk-gov"; + +const poolCfg = PoolV3CoreConfigurator.new(testDaiConfigMainnet); +console.error(poolCfg.toString()); + +console.log(poolCfg.deployConfig()); diff --git a/contracts/test/config/TEST_DAI_Mainnet_config.sol b/contracts/test/config/TEST_DAI_Mainnet_config.sol index 124475bc..5e1d9051 100644 --- a/contracts/test/config/TEST_DAI_Mainnet_config.sol +++ b/contracts/test/config/TEST_DAI_Mainnet_config.sol @@ -3,7 +3,7 @@ // (c) Gearbox Holdings, 2022 pragma solidity ^0.8.17; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {Contracts} from "@gearbox-protocol/sdk-gov/contracts/SupportedContracts.sol"; import { LinearIRMV3DeployParams, @@ -24,7 +24,7 @@ import { contract CONFIG_MAINNET_DAI_TEST_V3 is IPoolV3DeployConfig { string public constant id = "mainnet-dai-test-v3"; uint256 public constant chainId = 1; - Tokens public constant underlying = Tokens.DAI; + uint256 public constant underlying = TOKEN_DAI; bool public constant supportsQuotas = true; uint256 public constant getAccountAmount = 100_000_000_000_000_000_000_000; @@ -52,16 +52,16 @@ contract CONFIG_MAINNET_DAI_TEST_V3 is IPoolV3DeployConfig { CreditManagerV3DeployParams[] _creditManagers; constructor() { - _gaugeRates.push(GaugeRate({token: Tokens.USDS, minRate: 4, maxRate: 1_500})); - _gaugeRates.push(GaugeRate({token: Tokens.stkUSDS, minRate: 4, maxRate: 1_500})); - _gaugeRates.push(GaugeRate({token: Tokens.SKY, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_USDS, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_stkUSDS, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_SKY, minRate: 4, maxRate: 1_500})); _quotaLimits.push( - PoolQuotaLimit({token: Tokens.USDS, quotaIncreaseFee: 1, limit: 10_000_000_000_000_000_000_000_000}) + PoolQuotaLimit({token: TOKEN_USDS, quotaIncreaseFee: 1, limit: 10_000_000_000_000_000_000_000_000}) ); _quotaLimits.push( - PoolQuotaLimit({token: Tokens.stkUSDS, quotaIncreaseFee: 1, limit: 10_000_000_000_000_000_000_000_000}) + PoolQuotaLimit({token: TOKEN_stkUSDS, quotaIncreaseFee: 1, limit: 10_000_000_000_000_000_000_000_000}) ); - _quotaLimits.push(PoolQuotaLimit({token: Tokens.SKY, quotaIncreaseFee: 1, limit: 0})); + _quotaLimits.push(PoolQuotaLimit({token: TOKEN_SKY, quotaIncreaseFee: 1, limit: 0})); { /// CREDIT_MANAGER_0 @@ -81,20 +81,18 @@ contract CONFIG_MAINNET_DAI_TEST_V3 is IPoolV3DeployConfig { cp.name = "Test Credit Manager"; CollateralTokenHuman[] storage cts = cp.collateralTokens; - cts.push(CollateralTokenHuman({token: Tokens.USDS, lt: 9_000})); + cts.push(CollateralTokenHuman({token: TOKEN_USDS, lt: 9_000})); - cts.push(CollateralTokenHuman({token: Tokens.stkUSDS, lt: 9_000})); + cts.push(CollateralTokenHuman({token: TOKEN_stkUSDS, lt: 9_000})); - cts.push(CollateralTokenHuman({token: Tokens.SKY, lt: 0})); + cts.push(CollateralTokenHuman({token: TOKEN_SKY, lt: 0})); Contracts[] storage cs = cp.contracts; cs.push(Contracts.DAI_USDS); cs.push(Contracts.SKY_STAKING_REWARDS); cs.push(Contracts.UNISWAP_V2_ROUTER); { GenericSwapPair[] storage gsp = cp.adapterConfig.genericSwapPairs; - gsp.push( - GenericSwapPair({router: Contracts.UNISWAP_V2_ROUTER, token0: Tokens.SKY, token1: Tokens.USDS}) - ); + gsp.push(GenericSwapPair({router: Contracts.UNISWAP_V2_ROUTER, token0: TOKEN_SKY, token1: TOKEN_USDS})); } } } diff --git a/contracts/test/config/TEST_WETH_Mainnet_config.sol b/contracts/test/config/TEST_WETH_Mainnet_config.sol index c9d3ae9d..546d3b47 100644 --- a/contracts/test/config/TEST_WETH_Mainnet_config.sol +++ b/contracts/test/config/TEST_WETH_Mainnet_config.sol @@ -3,7 +3,7 @@ // (c) Gearbox Holdings, 2022 pragma solidity ^0.8.17; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {Contracts} from "@gearbox-protocol/sdk-gov/contracts/SupportedContracts.sol"; import { LinearIRMV3DeployParams, @@ -24,7 +24,7 @@ import { contract CONFIG_MAINNET_WETH_TEST_V3 is IPoolV3DeployConfig { string public constant id = "mainnet-weth-test-v3"; uint256 public constant chainId = 1; - Tokens public constant underlying = Tokens.WETH; + uint256 public constant underlying = TOKEN_WETH; bool public constant supportsQuotas = true; uint256 public constant getAccountAmount = 50_000_000_000_000_000_000; @@ -52,27 +52,67 @@ contract CONFIG_MAINNET_WETH_TEST_V3 is IPoolV3DeployConfig { CreditManagerV3DeployParams[] _creditManagers; constructor() { - _gaugeRates.push(GaugeRate({token: Tokens.steCRV, minRate: 4, maxRate: 1_500})); - _gaugeRates.push(GaugeRate({token: Tokens.STETH, minRate: 4, maxRate: 1_500})); - _gaugeRates.push(GaugeRate({token: Tokens.wstETH, minRate: 4, maxRate: 1_500})); - _gaugeRates.push(GaugeRate({token: Tokens.steakLRT, minRate: 4, maxRate: 1_500})); - _gaugeRates.push(GaugeRate({token: Tokens.rsETH, minRate: 4, maxRate: 1_500})); - _gaugeRates.push(GaugeRate({token: Tokens.PT_rsETH_26SEP2024, minRate: 4, maxRate: 1_500})); - _quotaLimits.push(PoolQuotaLimit({token: Tokens.steCRV, quotaIncreaseFee: 0, limit: 0})); + _gaugeRates.push(GaugeRate({token: TOKEN_LDO, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_CRV, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_CVX, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_steCRV, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_cvxsteCRV, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_rsETH_WETH, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_trenSTETH, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_Re7LRT, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_rstETH, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_amphrETH, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_STETH, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_stkcvxsteCRV, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_wstETH, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_steakLRT, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_rsETH, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_PT_rsETH_26SEP2024, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_USDC, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_WBTC, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_pufETHwstE, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_pufETH, minRate: 4, maxRate: 1_500})); + _gaugeRates.push(GaugeRate({token: TOKEN_zpufETH, minRate: 4, maxRate: 1_500})); + _quotaLimits.push(PoolQuotaLimit({token: TOKEN_LDO, quotaIncreaseFee: 0, limit: 0})); + _quotaLimits.push(PoolQuotaLimit({token: TOKEN_CRV, quotaIncreaseFee: 0, limit: 0})); + _quotaLimits.push(PoolQuotaLimit({token: TOKEN_CVX, quotaIncreaseFee: 0, limit: 0})); + _quotaLimits.push(PoolQuotaLimit({token: TOKEN_steCRV, quotaIncreaseFee: 0, limit: 0})); + _quotaLimits.push(PoolQuotaLimit({token: TOKEN_cvxsteCRV, quotaIncreaseFee: 0, limit: 0})); + _quotaLimits.push(PoolQuotaLimit({token: TOKEN_rsETH_WETH, quotaIncreaseFee: 0, limit: 0})); + _quotaLimits.push(PoolQuotaLimit({token: TOKEN_trenSTETH, quotaIncreaseFee: 0, limit: 0})); + _quotaLimits.push(PoolQuotaLimit({token: TOKEN_Re7LRT, quotaIncreaseFee: 0, limit: 0})); + _quotaLimits.push(PoolQuotaLimit({token: TOKEN_rstETH, quotaIncreaseFee: 0, limit: 0})); + _quotaLimits.push(PoolQuotaLimit({token: TOKEN_amphrETH, quotaIncreaseFee: 0, limit: 0})); _quotaLimits.push( - PoolQuotaLimit({token: Tokens.STETH, quotaIncreaseFee: 0, limit: 4_000_000_000_000_000_000_000}) + PoolQuotaLimit({token: TOKEN_STETH, quotaIncreaseFee: 0, limit: 4_000_000_000_000_000_000_000}) ); _quotaLimits.push( - PoolQuotaLimit({token: Tokens.wstETH, quotaIncreaseFee: 0, limit: 4_000_000_000_000_000_000_000}) + PoolQuotaLimit({token: TOKEN_stkcvxsteCRV, quotaIncreaseFee: 0, limit: 4_000_000_000_000_000_000_000}) ); _quotaLimits.push( - PoolQuotaLimit({token: Tokens.steakLRT, quotaIncreaseFee: 0, limit: 4_000_000_000_000_000_000_000}) + PoolQuotaLimit({token: TOKEN_wstETH, quotaIncreaseFee: 0, limit: 4_000_000_000_000_000_000_000}) ); _quotaLimits.push( - PoolQuotaLimit({token: Tokens.rsETH, quotaIncreaseFee: 0, limit: 4_000_000_000_000_000_000_000}) + PoolQuotaLimit({token: TOKEN_steakLRT, quotaIncreaseFee: 0, limit: 4_000_000_000_000_000_000_000}) ); _quotaLimits.push( - PoolQuotaLimit({token: Tokens.PT_rsETH_26SEP2024, quotaIncreaseFee: 0, limit: 4_000_000_000_000_000_000_000}) + PoolQuotaLimit({token: TOKEN_rsETH, quotaIncreaseFee: 0, limit: 4_000_000_000_000_000_000_000}) + ); + _quotaLimits.push( + PoolQuotaLimit({token: TOKEN_PT_rsETH_26SEP2024, quotaIncreaseFee: 0, limit: 4_000_000_000_000_000_000_000}) + ); + _quotaLimits.push( + PoolQuotaLimit({token: TOKEN_USDC, quotaIncreaseFee: 0, limit: 4_000_000_000_000_000_000_000}) + ); + _quotaLimits.push( + PoolQuotaLimit({token: TOKEN_WBTC, quotaIncreaseFee: 0, limit: 4_000_000_000_000_000_000_000}) + ); + _quotaLimits.push(PoolQuotaLimit({token: TOKEN_pufETHwstE, quotaIncreaseFee: 0, limit: 0})); + _quotaLimits.push( + PoolQuotaLimit({token: TOKEN_pufETH, quotaIncreaseFee: 0, limit: 4_000_000_000_000_000_000_000}) + ); + _quotaLimits.push( + PoolQuotaLimit({token: TOKEN_zpufETH, quotaIncreaseFee: 0, limit: 4_000_000_000_000_000_000_000}) ); { @@ -90,27 +130,102 @@ contract CONFIG_MAINNET_WETH_TEST_V3 is IPoolV3DeployConfig { cp.expirable = false; cp.skipInit = false; cp.poolLimit = 5_000_000_000_000_000_000_000; + cp.name = "Test Credit Manager"; CollateralTokenHuman[] storage cts = cp.collateralTokens; - cts.push(CollateralTokenHuman({token: Tokens.STETH, lt: 9_000})); + cts.push(CollateralTokenHuman({token: TOKEN_USDC, lt: 9_000})); + + cts.push(CollateralTokenHuman({token: TOKEN_WBTC, lt: 9_000})); + + cts.push(CollateralTokenHuman({token: TOKEN_STETH, lt: 9_000})); + + cts.push(CollateralTokenHuman({token: TOKEN_wstETH, lt: 9_000})); + + cts.push(CollateralTokenHuman({token: TOKEN_steakLRT, lt: 9_000})); - cts.push(CollateralTokenHuman({token: Tokens.wstETH, lt: 9_000})); + cts.push(CollateralTokenHuman({token: TOKEN_rsETH, lt: 9_000})); - cts.push(CollateralTokenHuman({token: Tokens.steakLRT, lt: 9_000})); + cts.push(CollateralTokenHuman({token: TOKEN_PT_rsETH_26SEP2024, lt: 9_000})); - cts.push(CollateralTokenHuman({token: Tokens.rsETH, lt: 9_000})); + cts.push(CollateralTokenHuman({token: TOKEN_stkcvxsteCRV, lt: 9_000})); - cts.push(CollateralTokenHuman({token: Tokens.PT_rsETH_26SEP2024, lt: 9_000})); + cts.push(CollateralTokenHuman({token: TOKEN_pufETH, lt: 9_000})); - cts.push(CollateralTokenHuman({token: Tokens.steCRV, lt: 0})); + cts.push(CollateralTokenHuman({token: TOKEN_zpufETH, lt: 9_000})); + + cts.push(CollateralTokenHuman({token: TOKEN_steCRV, lt: 0})); + + cts.push(CollateralTokenHuman({token: TOKEN_cvxsteCRV, lt: 0})); + + cts.push(CollateralTokenHuman({token: TOKEN_rsETH_WETH, lt: 0})); + + cts.push(CollateralTokenHuman({token: TOKEN_trenSTETH, lt: 0})); + + cts.push(CollateralTokenHuman({token: TOKEN_Re7LRT, lt: 0})); + + cts.push(CollateralTokenHuman({token: TOKEN_rstETH, lt: 0})); + + cts.push(CollateralTokenHuman({token: TOKEN_amphrETH, lt: 0})); + + cts.push(CollateralTokenHuman({token: TOKEN_LDO, lt: 0})); + + cts.push(CollateralTokenHuman({token: TOKEN_CRV, lt: 0})); + + cts.push(CollateralTokenHuman({token: TOKEN_CVX, lt: 0})); + + cts.push(CollateralTokenHuman({token: TOKEN_pufETHwstE, lt: 0})); Contracts[] storage cs = cp.contracts; + cs.push(Contracts.UNISWAP_V3_ROUTER); + { + UniswapV3Pair[] storage uv3p = cp.adapterConfig.uniswapV3Pairs; + uv3p.push( + UniswapV3Pair({ + router: Contracts.UNISWAP_V3_ROUTER, + token0: TOKEN_WETH, + token1: TOKEN_WBTC, + fee: 3000 + }) + ); + uv3p.push( + UniswapV3Pair({ + router: Contracts.UNISWAP_V3_ROUTER, + token0: TOKEN_WETH, + token1: TOKEN_USDC, + fee: 500 + }) + ); + uv3p.push( + UniswapV3Pair({ + router: Contracts.UNISWAP_V3_ROUTER, + token0: TOKEN_WETH, + token1: TOKEN_CRV, + fee: 3000 + }) + ); + uv3p.push( + UniswapV3Pair({ + router: Contracts.UNISWAP_V3_ROUTER, + token0: TOKEN_WETH, + token1: TOKEN_CRV, + fee: 10000 + }) + ); + uv3p.push( + UniswapV3Pair({ + router: Contracts.UNISWAP_V3_ROUTER, + token0: TOKEN_WETH, + token1: TOKEN_CVX, + fee: 10000 + }) + ); + } cs.push(Contracts.PENDLE_ROUTER); PendlePair[] storage pendp = cp.adapterConfig.pendlePairs; pendp.push( PendlePair({ market: 0x6b4740722e46048874d84306B2877600ABCea3Ae, - inputToken: Tokens.rsETH, - pendleToken: Tokens.PT_rsETH_26SEP2024, + inputToken: TOKEN_rsETH, + pendleToken: TOKEN_PT_rsETH_26SEP2024, status: 1 }) ); @@ -127,10 +242,14 @@ contract CONFIG_MAINNET_WETH_TEST_V3 is IPoolV3DeployConfig { cs.push(Contracts.MELLOW_STEAKHOUSE_VAULT); { MellowUnderlyingConfig[] storage mu = cp.adapterConfig.mellowUnderlyings; - mu.push(MellowUnderlyingConfig({vault: Contracts.MELLOW_STEAKHOUSE_VAULT, underlying: Tokens.wstETH})); + mu.push(MellowUnderlyingConfig({vault: Contracts.MELLOW_STEAKHOUSE_VAULT, underlying: TOKEN_wstETH})); } cs.push(Contracts.LIDO_WSTETH); cs.push(Contracts.CURVE_STETH_GATEWAY); + cs.push(Contracts.CURVE_PUFETH_WSTETH_POOL); + cs.push(Contracts.CONVEX_BOOSTER); + cs.push(Contracts.CONVEX_STECRV_POOL); + cs.push(Contracts.ZIRCUIT_POOL); } } diff --git a/contracts/test/helpers/BalanceComparator.sol b/contracts/test/helpers/BalanceComparator.sol index f5a8a777..aca50d76 100644 --- a/contracts/test/helpers/BalanceComparator.sol +++ b/contracts/test/helpers/BalanceComparator.sol @@ -3,7 +3,7 @@ // (c) Gearbox Foundation, 2023. pragma solidity ^0.8.10; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; @@ -14,7 +14,7 @@ import {TokensTestSuite} from "@gearbox-protocol/core-v3/contracts/test/suites/T struct BalanceBackup { string stage; - Tokens token; + uint256 token; uint256 balance; } @@ -24,13 +24,13 @@ contract BalanceComparator is Test { error StageNotAllowed(string); TokensTestSuite public tokenTestSuite; - Tokens[] public tokensToTrack; - mapping(string => mapping(Tokens => mapping(address => uint256))) savedBalances; + uint256[] public tokensToTrack; + mapping(string => mapping(uint256 => mapping(address => uint256))) savedBalances; string[] public stages; mapping(string => bool) _allowedStages; - constructor(string[] memory _stages, Tokens[] memory _tokensToTrack, TokensTestSuite _tokenTestSuite) { + constructor(string[] memory _stages, uint256[] memory _tokensToTrack, TokensTestSuite _tokenTestSuite) { tokenTestSuite = _tokenTestSuite; uint256 len = _tokensToTrack.length; unchecked { @@ -53,7 +53,7 @@ contract BalanceComparator is Test { uint256 len = tokensToTrack.length; unchecked { for (uint256 i; i < len; ++i) { - Tokens t = tokensToTrack[i]; + uint256 t = tokensToTrack[i]; uint256 balance = IERC20(tokenTestSuite.addressOf(t)).balanceOf(holder); savedBalances[stage][t][holder] = balance; } @@ -68,7 +68,7 @@ contract BalanceComparator is Test { for (uint256 j; j < lenStages; ++j) { for (uint256 i; i < len; ++i) { - Tokens t = tokensToTrack[i]; + uint256 t = tokensToTrack[i]; string memory stage = stages[j]; result[i + j * len] = @@ -97,7 +97,7 @@ contract BalanceComparator is Test { unchecked { for (uint256 j; j < lenStages; ++j) { for (uint256 i; i < len; ++i) { - Tokens t = tokensToTrack[i]; + uint256 t = tokensToTrack[i]; string memory stage = stages[j]; if (expectedError == 0) { diff --git a/contracts/test/helpers/BalanceHelper.sol b/contracts/test/helpers/BalanceHelper.sol index e4589dbe..3d42d33b 100644 --- a/contracts/test/helpers/BalanceHelper.sol +++ b/contracts/test/helpers/BalanceHelper.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.10; import {TokensTestSuite} from "@gearbox-protocol/core-v3/contracts/test/suites/TokensTestSuite.sol"; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {BalanceEngine} from "@gearbox-protocol/core-v3/contracts/test/helpers/BalanceEngine.sol"; diff --git a/contracts/test/helpers/CreditFacadeTestHelper.sol b/contracts/test/helpers/CreditFacadeTestHelper.sol index 16f8e999..6df903d1 100644 --- a/contracts/test/helpers/CreditFacadeTestHelper.sol +++ b/contracts/test/helpers/CreditFacadeTestHelper.sol @@ -6,14 +6,14 @@ pragma solidity ^0.8.17; import {TokensTestSuite} from "@gearbox-protocol/core-v3/contracts/test/suites/TokensTestSuite.sol"; import {PriceFeedMock} from "@gearbox-protocol/core-v3/contracts/test/mocks/oracles/PriceFeedMock.sol"; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {IntegrationTestHelper} from "@gearbox-protocol/core-v3/contracts/test/helpers/IntegrationTestHelper.sol"; import "../lib/constants.sol"; contract CreditFacadeTestHelper is IntegrationTestHelper { - function addCollateral(address, /*creditAccount*/ Tokens t, uint256 amount) internal { + function addCollateral(address, /*creditAccount*/ uint256 t, uint256 amount) internal { tokenTestSuite.mint(t, USER, amount); tokenTestSuite.approve(t, USER, address(creditManager)); diff --git a/contracts/test/live/Env.sol b/contracts/test/live/Env.sol index d2ca2072..73404f17 100644 --- a/contracts/test/live/Env.sol +++ b/contracts/test/live/Env.sol @@ -5,7 +5,7 @@ pragma solidity ^0.8.17; import {LiveTestHelper} from "../suites/LiveTestHelper.sol"; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import "forge-std/console.sol"; contract Live_LidoEquivalenceTest is LiveTestHelper { diff --git a/contracts/test/live/adapters/aave/Live_AaveV2LendingPoolEquivalenceTest.sol b/contracts/test/live/adapters/aave/Live_AaveV2LendingPoolEquivalenceTest.sol index 2c03108f..e9dccc26 100644 --- a/contracts/test/live/adapters/aave/Live_AaveV2LendingPoolEquivalenceTest.sol +++ b/contracts/test/live/adapters/aave/Live_AaveV2LendingPoolEquivalenceTest.sol @@ -13,7 +13,7 @@ import {IAaveV2_LendingPoolAdapter} from "../../../../interfaces/aave/IAaveV2_Le import {ILendingPool} from "../../../../integrations/aave/ILendingPool.sol"; import {IAToken} from "../../../../integrations/aave/IAToken.sol"; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {Contracts} from "@gearbox-protocol/sdk-gov/contracts/SupportedContracts.sol"; import {MultiCall} from "@gearbox-protocol/core-v2/contracts/libraries/MultiCall.sol"; @@ -38,7 +38,7 @@ contract Live_AaveV2LendingPoolEquivalenceTest is LiveTestHelper { BalanceComparator comparator; function prepareComparator(address aToken, address underlying) internal { - Tokens[2] memory tokensToTrack = [tokenTestSuite.tokenIndexes(underlying), tokenTestSuite.tokenIndexes(aToken)]; + uint256[2] memory tokensToTrack = [tokenTestSuite.tokenIndexes(underlying), tokenTestSuite.tokenIndexes(aToken)]; // STAGES string[4] memory stages = ["after_deposit", "after_depositDiff", "after_withdraw", "after_withdrawDiff"]; @@ -54,7 +54,7 @@ contract Live_AaveV2LendingPoolEquivalenceTest is LiveTestHelper { } len = tokensToTrack.length; - Tokens[] memory _tokensToTrack = new Tokens[](len); + uint256[] memory _tokensToTrack = new uint256[](len); unchecked { for (uint256 i; i < len; ++i) { _tokensToTrack[i] = tokensToTrack[i]; @@ -180,6 +180,6 @@ contract Live_AaveV2LendingPoolEquivalenceTest is LiveTestHelper { } function test_diag_pf() public attachOrLiveTest { - emit log_uint(priceOracle.getPrice(tokenTestSuite.addressOf(Tokens.ezETH))); + emit log_uint(priceOracle.getPrice(tokenTestSuite.addressOf(TOKEN_ezETH))); } } diff --git a/contracts/test/live/adapters/aave/Live_AaveV2WrappedATokenEquivalenceTest.sol b/contracts/test/live/adapters/aave/Live_AaveV2WrappedATokenEquivalenceTest.sol index dc12560f..720b81ce 100644 --- a/contracts/test/live/adapters/aave/Live_AaveV2WrappedATokenEquivalenceTest.sol +++ b/contracts/test/live/adapters/aave/Live_AaveV2WrappedATokenEquivalenceTest.sol @@ -12,7 +12,7 @@ import {IAToken} from "../../../../integrations/aave/IAToken.sol"; import {AdapterType} from "@gearbox-protocol/sdk-gov/contracts/AdapterType.sol"; import {IAdapter} from "@gearbox-protocol/core-v2/contracts/interfaces/IAdapter.sol"; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {Contracts} from "@gearbox-protocol/sdk-gov/contracts/SupportedContracts.sol"; import {MultiCall} from "@gearbox-protocol/core-v2/contracts/libraries/MultiCall.sol"; @@ -41,7 +41,7 @@ contract Live_AaveV2WrappedATokenEquivalenceTest is LiveTestHelper { address aToken = WrappedAToken(waToken).aToken(); address underlying = WrappedAToken(waToken).underlying(); - Tokens[3] memory tokensToTrack = [ + uint256[3] memory tokensToTrack = [ tokenTestSuite.tokenIndexes(waToken), tokenTestSuite.tokenIndexes(underlying), tokenTestSuite.tokenIndexes(aToken) @@ -68,7 +68,7 @@ contract Live_AaveV2WrappedATokenEquivalenceTest is LiveTestHelper { } len = tokensToTrack.length; - Tokens[] memory _tokensToTrack = new Tokens[](len); + uint256[] memory _tokensToTrack = new uint256[](len); unchecked { for (uint256 i; i < len; ++i) { _tokensToTrack[i] = tokensToTrack[i]; diff --git a/contracts/test/live/adapters/balancer/Live_BalancerV2EquivalenceTest.sol b/contracts/test/live/adapters/balancer/Live_BalancerV2EquivalenceTest.sol index a8fc76e3..91364b52 100644 --- a/contracts/test/live/adapters/balancer/Live_BalancerV2EquivalenceTest.sol +++ b/contracts/test/live/adapters/balancer/Live_BalancerV2EquivalenceTest.sol @@ -30,7 +30,7 @@ import { import {IAsset} from "../../../../integrations/balancer/IAsset.sol"; import {BalancerV2_Calls, BalancerV2_Multicaller} from "../../../multicall/balancer/BalancerV2_Calls.sol"; -import {Tokens, TokenType} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {Contracts} from "@gearbox-protocol/sdk-gov/contracts/SupportedContracts.sol"; import {MultiCall} from "@gearbox-protocol/core-v2/contracts/libraries/MultiCall.sol"; @@ -548,7 +548,7 @@ contract Live_BalancerV2EquivalenceTest is LiveTestHelper { tokensToTrack = tokensToTrack.trim(); - Tokens[] memory _tokensToTrack = new Tokens[](tokensToTrack.length); + uint256[] memory _tokensToTrack = new uint256[](tokensToTrack.length); for (uint256 j = 0; j < tokensToTrack.length; ++j) { _tokensToTrack[j] = tokenTestSuite.tokenIndexes(tokensToTrack[j]); @@ -592,10 +592,10 @@ contract Live_BalancerV2EquivalenceTest is LiveTestHelper { if (balancerVaultAdapter == address(0)) return; - for (uint256 i = 0; i < uint256(type(Tokens).max); ++i) { - if (tokenTestSuite.tokenTypes(Tokens(i)) != TokenType.BALANCER_LP_TOKEN) continue; + for (uint256 i = 0; i < NUM_TOKENS; ++i) { + if (tokenTestSuite.tokenTypes(i) != TokenType.BALANCER_LP_TOKEN) continue; - address pool = tokenTestSuite.addressOf(Tokens(i)); + address pool = tokenTestSuite.addressOf(i); bytes32 poolId = IBalancerWeightedPool(pool).getPoolId(); if (IBalancerV2VaultAdapter(balancerVaultAdapter).poolStatus(poolId) == PoolStatus.NOT_ALLOWED) continue; diff --git a/contracts/test/live/adapters/camelot/Live_CamelotV3EquivalenceTest.sol b/contracts/test/live/adapters/camelot/Live_CamelotV3EquivalenceTest.sol index 3736a71c..84be1109 100644 --- a/contracts/test/live/adapters/camelot/Live_CamelotV3EquivalenceTest.sol +++ b/contracts/test/live/adapters/camelot/Live_CamelotV3EquivalenceTest.sol @@ -8,7 +8,7 @@ import {ICreditFacadeV3} from "@gearbox-protocol/core-v3/contracts/interfaces/IC import {ICamelotV3Router} from "../../../../integrations/camelot/ICamelotV3Router.sol"; import {ICamelotV3Adapter, ICamelotV3AdapterTypes} from "../../../../interfaces/camelot/ICamelotV3Adapter.sol"; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {Contracts} from "@gearbox-protocol/sdk-gov/contracts/SupportedContracts.sol"; import {MultiCall} from "@gearbox-protocol/core-v2/contracts/libraries/MultiCall.sol"; @@ -31,7 +31,7 @@ contract Live_CamelotV3EquivalenceTest is LiveTestHelper { /// HELPER function prepareComparator() internal { - Tokens[2] memory tokensToTrack = [Tokens.WETH, Tokens.USDC]; + uint256[2] memory tokensToTrack = [TOKEN_WETH, TOKEN_USDC]; // STAGES string[8] memory stages = [ @@ -56,7 +56,7 @@ contract Live_CamelotV3EquivalenceTest is LiveTestHelper { } len = tokensToTrack.length; - Tokens[] memory _tokensToTrack = new Tokens[](len); + uint256[] memory _tokensToTrack = new uint256[](len); unchecked { for (uint256 i; i < len; ++i) { _tokensToTrack[i] = tokensToTrack[i]; @@ -74,8 +74,8 @@ contract Live_CamelotV3EquivalenceTest is LiveTestHelper { ICamelotV3Router.ExactInputSingleParams memory exactInputSingleParams = ICamelotV3Router .ExactInputSingleParams({ - tokenIn: tokenTestSuite.addressOf(Tokens.WETH), - tokenOut: tokenTestSuite.addressOf(Tokens.USDC), + tokenIn: tokenTestSuite.addressOf(TOKEN_WETH), + tokenOut: tokenTestSuite.addressOf(TOKEN_USDC), recipient: creditAccount, deadline: block.timestamp + 3600, amountIn: WAD, @@ -96,8 +96,8 @@ contract Live_CamelotV3EquivalenceTest is LiveTestHelper { ICamelotV3AdapterTypes.ExactDiffInputSingleParams memory exactDiffInputSingleParams = ICamelotV3AdapterTypes .ExactDiffInputSingleParams({ - tokenIn: tokenTestSuite.addressOf(Tokens.WETH), - tokenOut: tokenTestSuite.addressOf(Tokens.USDC), + tokenIn: tokenTestSuite.addressOf(TOKEN_WETH), + tokenOut: tokenTestSuite.addressOf(TOKEN_USDC), deadline: block.timestamp + 3600, leftoverAmount: 20 * WAD, rateMinRAY: 0, @@ -120,7 +120,7 @@ contract Live_CamelotV3EquivalenceTest is LiveTestHelper { comparator.takeSnapshot("after_exactDiffInputSingleSupportingFeeOnTransferTokens", creditAccount); ICamelotV3Router.ExactInputParams memory exactInputParams = ICamelotV3Router.ExactInputParams({ - path: abi.encodePacked(tokenTestSuite.addressOf(Tokens.WETH), tokenTestSuite.addressOf(Tokens.USDC)), + path: abi.encodePacked(tokenTestSuite.addressOf(TOKEN_WETH), tokenTestSuite.addressOf(TOKEN_USDC)), recipient: creditAccount, deadline: block.timestamp + 3600, amountIn: WAD, @@ -131,7 +131,7 @@ contract Live_CamelotV3EquivalenceTest is LiveTestHelper { ICamelotV3AdapterTypes.ExactDiffInputParams memory exactDiffInputParams = ICamelotV3AdapterTypes .ExactDiffInputParams({ - path: abi.encodePacked(tokenTestSuite.addressOf(Tokens.WETH), tokenTestSuite.addressOf(Tokens.USDC)), + path: abi.encodePacked(tokenTestSuite.addressOf(TOKEN_WETH), tokenTestSuite.addressOf(TOKEN_USDC)), deadline: block.timestamp + 3600, leftoverAmount: 10 * WAD, rateMinRAY: 0 @@ -141,8 +141,8 @@ contract Live_CamelotV3EquivalenceTest is LiveTestHelper { ICamelotV3Router.ExactOutputSingleParams memory exactOutputSingleParams = ICamelotV3Router .ExactOutputSingleParams({ - tokenIn: tokenTestSuite.addressOf(Tokens.WETH), - tokenOut: tokenTestSuite.addressOf(Tokens.USDC), + tokenIn: tokenTestSuite.addressOf(TOKEN_WETH), + tokenOut: tokenTestSuite.addressOf(TOKEN_USDC), fee: 0, recipient: creditAccount, deadline: block.timestamp + 3600, @@ -156,7 +156,7 @@ contract Live_CamelotV3EquivalenceTest is LiveTestHelper { comparator.takeSnapshot("after_exactOutputSingle", creditAccount); ICamelotV3Router.ExactOutputParams memory exactOutputParams = ICamelotV3Router.ExactOutputParams({ - path: abi.encodePacked(tokenTestSuite.addressOf(Tokens.WETH), tokenTestSuite.addressOf(Tokens.USDC)), + path: abi.encodePacked(tokenTestSuite.addressOf(TOKEN_WETH), tokenTestSuite.addressOf(TOKEN_USDC)), recipient: creditAccount, deadline: block.timestamp + 3600, amountOut: 100 * 10 ** 6, @@ -173,8 +173,8 @@ contract Live_CamelotV3EquivalenceTest is LiveTestHelper { router.exactInputSingle( ICamelotV3Router.ExactInputSingleParams({ - tokenIn: tokenTestSuite.addressOf(Tokens.WETH), - tokenOut: tokenTestSuite.addressOf(Tokens.USDC), + tokenIn: tokenTestSuite.addressOf(TOKEN_WETH), + tokenOut: tokenTestSuite.addressOf(TOKEN_USDC), recipient: creditAccount, deadline: block.timestamp + 3600, amountIn: WAD, @@ -187,8 +187,8 @@ contract Live_CamelotV3EquivalenceTest is LiveTestHelper { router.exactInputSingleSupportingFeeOnTransferTokens( ICamelotV3Router.ExactInputSingleParams({ - tokenIn: tokenTestSuite.addressOf(Tokens.WETH), - tokenOut: tokenTestSuite.addressOf(Tokens.USDC), + tokenIn: tokenTestSuite.addressOf(TOKEN_WETH), + tokenOut: tokenTestSuite.addressOf(TOKEN_USDC), recipient: creditAccount, deadline: block.timestamp + 3600, amountIn: WAD, @@ -199,11 +199,11 @@ contract Live_CamelotV3EquivalenceTest is LiveTestHelper { comparator.takeSnapshot("after_exactInputSingleSupportingFeeOnTransferTokens", creditAccount); - uint256 balanceToSwap = tokenTestSuite.balanceOf(Tokens.WETH, creditAccount) - 20 * WAD; + uint256 balanceToSwap = tokenTestSuite.balanceOf(TOKEN_WETH, creditAccount) - 20 * WAD; router.exactInputSingle( ICamelotV3Router.ExactInputSingleParams({ - tokenIn: tokenTestSuite.addressOf(Tokens.WETH), - tokenOut: tokenTestSuite.addressOf(Tokens.USDC), + tokenIn: tokenTestSuite.addressOf(TOKEN_WETH), + tokenOut: tokenTestSuite.addressOf(TOKEN_USDC), recipient: creditAccount, deadline: block.timestamp + 3600, amountIn: balanceToSwap, @@ -213,11 +213,11 @@ contract Live_CamelotV3EquivalenceTest is LiveTestHelper { ); comparator.takeSnapshot("after_exactDiffInputSingle", creditAccount); - balanceToSwap = tokenTestSuite.balanceOf(Tokens.WETH, creditAccount) - 19 * WAD; + balanceToSwap = tokenTestSuite.balanceOf(TOKEN_WETH, creditAccount) - 19 * WAD; router.exactInputSingleSupportingFeeOnTransferTokens( ICamelotV3Router.ExactInputSingleParams({ - tokenIn: tokenTestSuite.addressOf(Tokens.WETH), - tokenOut: tokenTestSuite.addressOf(Tokens.USDC), + tokenIn: tokenTestSuite.addressOf(TOKEN_WETH), + tokenOut: tokenTestSuite.addressOf(TOKEN_USDC), recipient: creditAccount, deadline: block.timestamp + 3600, amountIn: balanceToSwap, @@ -229,7 +229,7 @@ contract Live_CamelotV3EquivalenceTest is LiveTestHelper { router.exactInput( ICamelotV3Router.ExactInputParams({ - path: abi.encodePacked(tokenTestSuite.addressOf(Tokens.WETH), tokenTestSuite.addressOf(Tokens.USDC)), + path: abi.encodePacked(tokenTestSuite.addressOf(TOKEN_WETH), tokenTestSuite.addressOf(TOKEN_USDC)), recipient: creditAccount, deadline: block.timestamp + 3600, amountIn: WAD, @@ -238,10 +238,10 @@ contract Live_CamelotV3EquivalenceTest is LiveTestHelper { ); comparator.takeSnapshot("after_exactInput", creditAccount); - balanceToSwap = tokenTestSuite.balanceOf(Tokens.WETH, creditAccount) - 10 * WAD; + balanceToSwap = tokenTestSuite.balanceOf(TOKEN_WETH, creditAccount) - 10 * WAD; router.exactInput( ICamelotV3Router.ExactInputParams({ - path: abi.encodePacked(tokenTestSuite.addressOf(Tokens.WETH), tokenTestSuite.addressOf(Tokens.USDC)), + path: abi.encodePacked(tokenTestSuite.addressOf(TOKEN_WETH), tokenTestSuite.addressOf(TOKEN_USDC)), recipient: creditAccount, deadline: block.timestamp + 3600, amountIn: balanceToSwap, @@ -252,8 +252,8 @@ contract Live_CamelotV3EquivalenceTest is LiveTestHelper { router.exactOutputSingle( ICamelotV3Router.ExactOutputSingleParams({ - tokenIn: tokenTestSuite.addressOf(Tokens.WETH), - tokenOut: tokenTestSuite.addressOf(Tokens.USDC), + tokenIn: tokenTestSuite.addressOf(TOKEN_WETH), + tokenOut: tokenTestSuite.addressOf(TOKEN_USDC), fee: 0, recipient: creditAccount, deadline: block.timestamp + 3600, @@ -266,7 +266,7 @@ contract Live_CamelotV3EquivalenceTest is LiveTestHelper { router.exactOutput( ICamelotV3Router.ExactOutputParams({ - path: abi.encodePacked(tokenTestSuite.addressOf(Tokens.WETH), tokenTestSuite.addressOf(Tokens.USDC)), + path: abi.encodePacked(tokenTestSuite.addressOf(TOKEN_WETH), tokenTestSuite.addressOf(TOKEN_USDC)), recipient: creditAccount, deadline: block.timestamp + 3600, amountOut: 100 * 10 ** 6, @@ -284,7 +284,7 @@ contract Live_CamelotV3EquivalenceTest is LiveTestHelper { function openCreditAccountWithWeth(uint256 amount) internal returns (address creditAccount) { vm.prank(USER); creditAccount = creditFacade.openCreditAccount(USER, MultiCallBuilder.build(), 0); - tokenTestSuite.mint(Tokens.WETH, creditAccount, amount); + tokenTestSuite.mint(TOKEN_WETH, creditAccount, amount); } /// @dev [L-CAMV3ET-1]: CamelotV3 adapter and normal account works identically @@ -298,20 +298,20 @@ contract Live_CamelotV3EquivalenceTest is LiveTestHelper { if ( routerAdapter == address(0) || !ICamelotV3Adapter(routerAdapter).isPoolAllowed( - tokenTestSuite.addressOf(Tokens.WETH), tokenTestSuite.addressOf(Tokens.USDC) + tokenTestSuite.addressOf(TOKEN_WETH), tokenTestSuite.addressOf(TOKEN_USDC) ) ) { return; } tokenTestSuite.approve( - tokenTestSuite.addressOf(Tokens.WETH), + tokenTestSuite.addressOf(TOKEN_WETH), creditAccount, supportedContracts.addressOf(Contracts.CAMELOT_V3_ROUTER) ); tokenTestSuite.approve( - tokenTestSuite.addressOf(Tokens.USDC), + tokenTestSuite.addressOf(TOKEN_USDC), creditAccount, supportedContracts.addressOf(Contracts.CAMELOT_V3_ROUTER) ); diff --git a/contracts/test/live/adapters/compound/Live_CompoundV2EquivalenceTest.sol b/contracts/test/live/adapters/compound/Live_CompoundV2EquivalenceTest.sol index 120588c8..2f5cd220 100644 --- a/contracts/test/live/adapters/compound/Live_CompoundV2EquivalenceTest.sol +++ b/contracts/test/live/adapters/compound/Live_CompoundV2EquivalenceTest.sol @@ -14,7 +14,7 @@ import {ICErc20, ICErc20Actions} from "../../../../integrations/compound/ICErc20 import {ICompoundV2_CTokenAdapter} from "../../../../interfaces/compound/ICompoundV2_CTokenAdapter.sol"; import {CompoundV2_Calls, CompoundV2_Multicaller} from "../../../multicall/compound/CompoundV2_Calls.sol"; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {Contracts} from "@gearbox-protocol/sdk-gov/contracts/SupportedContracts.sol"; import {MultiCall} from "@gearbox-protocol/core-v2/contracts/libraries/MultiCall.sol"; @@ -120,7 +120,7 @@ contract Live_CompoundV2EquivalenceTest is LiveTestHelper { tokensToTrack[0] = underlying; tokensToTrack[1] = ICompoundV2_CTokenAdapter(cTokenAdapter).targetContract(); - Tokens[] memory _tokensToTrack = new Tokens[](tokensToTrack.length); + uint256[] memory _tokensToTrack = new uint256[](tokensToTrack.length); for (uint256 j = 0; j < tokensToTrack.length; ++j) { _tokensToTrack[j] = tokenTestSuite.tokenIndexes(tokensToTrack[j]); @@ -145,9 +145,7 @@ contract Live_CompoundV2EquivalenceTest is LiveTestHelper { uint256 snapshot0 = vm.snapshot(); address underlying = ICompoundV2_CTokenAdapter(adapters[i])._gearboxAdapterType() - == AdapterType.COMPOUND_V2_CETHER - ? tokenTestSuite.addressOf(Tokens.WETH) - : ICErc20(adapters[i]).underlying(); + == AdapterType.COMPOUND_V2_CETHER ? tokenTestSuite.addressOf(TOKEN_WETH) : ICErc20(adapters[i]).underlying(); address creditAccount = openCreditAccountWithUnderlying(underlying, 3000 * 10 ** IERC20Metadata(underlying).decimals()); diff --git a/contracts/test/live/adapters/convex/Live_ConvexEquivalenceTest.t.sol b/contracts/test/live/adapters/convex/Live_ConvexEquivalenceTest.t.sol index 7ebc0cf0..8f2fd039 100644 --- a/contracts/test/live/adapters/convex/Live_ConvexEquivalenceTest.t.sol +++ b/contracts/test/live/adapters/convex/Live_ConvexEquivalenceTest.t.sol @@ -19,7 +19,7 @@ import {ConvexV1_BoosterCalls, ConvexV1_BoosterMulticaller} from "../../../multi import {IAdapter} from "@gearbox-protocol/core-v2/contracts/interfaces/IAdapter.sol"; import {AdapterType} from "@gearbox-protocol/sdk-gov/contracts/AdapterType.sol"; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {Contracts} from "@gearbox-protocol/sdk-gov/contracts/SupportedContracts.sol"; import {MultiCall} from "@gearbox-protocol/core-v2/contracts/libraries/MultiCall.sol"; @@ -232,7 +232,7 @@ contract Live_ConvexEquivalenceTest is LiveTestHelper { tokensToTrack = tokensToTrack.trim(); - Tokens[] memory _tokensToTrack = new Tokens[](tokensToTrack.length); + uint256[] memory _tokensToTrack = new uint256[](tokensToTrack.length); for (uint256 j = 0; j < tokensToTrack.length; ++j) { _tokensToTrack[j] = tokenTestSuite.tokenIndexes(tokensToTrack[j]); diff --git a/contracts/test/live/adapters/curve/Live_CurveEquivalenceTest.sol b/contracts/test/live/adapters/curve/Live_CurveEquivalenceTest.sol index 4e3b5e35..98e738e6 100644 --- a/contracts/test/live/adapters/curve/Live_CurveEquivalenceTest.sol +++ b/contracts/test/live/adapters/curve/Live_CurveEquivalenceTest.sol @@ -20,7 +20,7 @@ import {IAdapter} from "@gearbox-protocol/core-v2/contracts/interfaces/IAdapter. import {AdapterType} from "@gearbox-protocol/sdk-gov/contracts/AdapterType.sol"; import {AddressList} from "@gearbox-protocol/core-v3/contracts/test/lib/AddressList.sol"; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {Contracts} from "@gearbox-protocol/sdk-gov/contracts/SupportedContracts.sol"; import {MultiCall} from "@gearbox-protocol/core-v2/contracts/libraries/MultiCall.sol"; @@ -125,7 +125,7 @@ contract Live_CurveEquivalenceTest is LiveTestHelper { tokensToTrack = tokensToTrack.trim(); - Tokens[] memory _tokensToTrack = new Tokens[](tokensToTrack.length); + uint256[] memory _tokensToTrack = new uint256[](tokensToTrack.length); for (uint256 j = 0; j < tokensToTrack.length; ++j) { _tokensToTrack[j] = tokenTestSuite.tokenIndexes(tokensToTrack[j]); diff --git a/contracts/test/live/adapters/erc4626/Live_ERC4626EquivalenceTest.sol b/contracts/test/live/adapters/erc4626/Live_ERC4626EquivalenceTest.sol index 2a3bea30..7d017f4b 100644 --- a/contracts/test/live/adapters/erc4626/Live_ERC4626EquivalenceTest.sol +++ b/contracts/test/live/adapters/erc4626/Live_ERC4626EquivalenceTest.sol @@ -14,7 +14,7 @@ import {IERC4626} from "@openzeppelin/contracts/interfaces/IERC4626.sol"; import {IERC4626Adapter} from "../../../../interfaces/erc4626/IERC4626Adapter.sol"; import {ERC4626_Calls, ERC4626_Multicaller} from "../../../multicall/erc4626/ERC4626_Calls.sol"; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {Contracts} from "@gearbox-protocol/sdk-gov/contracts/SupportedContracts.sol"; import {MultiCall} from "@gearbox-protocol/core-v2/contracts/libraries/MultiCall.sol"; @@ -143,7 +143,7 @@ contract Live_ERC4626EquivalenceTest is LiveTestHelper { tokensToTrack[0] = IERC4626Adapter(vaultAdapter).asset(); tokensToTrack[1] = IERC4626Adapter(vaultAdapter).targetContract(); - Tokens[] memory _tokensToTrack = new Tokens[](tokensToTrack.length); + uint256[] memory _tokensToTrack = new uint256[](tokensToTrack.length); for (uint256 j = 0; j < tokensToTrack.length; ++j) { _tokensToTrack[j] = tokenTestSuite.tokenIndexes(tokensToTrack[j]); diff --git a/contracts/test/live/adapters/lido/Live_LidoEquivalenceTest.sol b/contracts/test/live/adapters/lido/Live_LidoEquivalenceTest.sol index 4d66c61f..82ec013f 100644 --- a/contracts/test/live/adapters/lido/Live_LidoEquivalenceTest.sol +++ b/contracts/test/live/adapters/lido/Live_LidoEquivalenceTest.sol @@ -11,7 +11,7 @@ import {ILidoV1Adapter} from "../../../../interfaces/lido/ILidoV1Adapter.sol"; import {LidoV1Gateway} from "../../../../helpers/lido/LidoV1_WETHGateway.sol"; import {LidoV1_Calls, LidoV1_Multicaller} from "../../../multicall/lido/LidoV1_Calls.sol"; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {Contracts} from "@gearbox-protocol/sdk-gov/contracts/SupportedContracts.sol"; import {MultiCall} from "@gearbox-protocol/core-v2/contracts/libraries/MultiCall.sol"; @@ -32,7 +32,7 @@ contract Live_LidoEquivalenceTest is LiveTestHelper { /// HELPER function prepareComparator() internal { - Tokens[2] memory tokensToTrack = [Tokens.WETH, Tokens.STETH]; + uint256[2] memory tokensToTrack = [TOKEN_WETH, TOKEN_STETH]; // STAGES string[2] memory stages = ["after_submit", "after_submitDiff"]; @@ -48,7 +48,7 @@ contract Live_LidoEquivalenceTest is LiveTestHelper { } len = tokensToTrack.length; - Tokens[] memory _tokensToTrack = new Tokens[](len); + uint256[] memory _tokensToTrack = new uint256[](len); unchecked { for (uint256 i; i < len; ++i) { _tokensToTrack[i] = tokensToTrack[i]; @@ -77,7 +77,7 @@ contract Live_LidoEquivalenceTest is LiveTestHelper { lido.submit(WAD, DUMB_ADDRESS); comparator.takeSnapshot("after_submit", creditAccount); - uint256 remainingBalance = tokenTestSuite.balanceOf(Tokens.WETH, creditAccount); + uint256 remainingBalance = tokenTestSuite.balanceOf(TOKEN_WETH, creditAccount); lido.submit(remainingBalance - WAD, DUMB_ADDRESS); comparator.takeSnapshot("after_submitDiff", creditAccount); @@ -91,7 +91,7 @@ contract Live_LidoEquivalenceTest is LiveTestHelper { vm.prank(USER); creditAccount = creditFacade.openCreditAccount(USER, MultiCallBuilder.build(), 0); - tokenTestSuite.mint(Tokens.WETH, creditAccount, amount); + tokenTestSuite.mint(TOKEN_WETH, creditAccount, amount); } /// @dev [L-LDOET-1]: Lido adapter and normal account works identically @@ -106,12 +106,12 @@ contract Live_LidoEquivalenceTest is LiveTestHelper { if (lidoAdapter == address(0)) return; tokenTestSuite.approve( - tokenTestSuite.addressOf(Tokens.WETH), + tokenTestSuite.addressOf(TOKEN_WETH), creditAccount, supportedContracts.addressOf(Contracts.LIDO_STETH_GATEWAY) ); tokenTestSuite.approve( - tokenTestSuite.addressOf(Tokens.STETH), + tokenTestSuite.addressOf(TOKEN_STETH), creditAccount, supportedContracts.addressOf(Contracts.LIDO_STETH_GATEWAY) ); diff --git a/contracts/test/live/adapters/lido/Live_WstETHV1Adapter.t.sol b/contracts/test/live/adapters/lido/Live_WstETHV1Adapter.t.sol index 1dbfeb3a..15f921e0 100644 --- a/contracts/test/live/adapters/lido/Live_WstETHV1Adapter.t.sol +++ b/contracts/test/live/adapters/lido/Live_WstETHV1Adapter.t.sol @@ -11,7 +11,7 @@ import {IwstETHV1Adapter} from "../../../../interfaces/lido/IwstETHV1Adapter.sol import {IwstETH} from "../../../../integrations/lido/IwstETH.sol"; import {WstETHV1_Calls, WstETHV1_Multicaller} from "../../../multicall/lido/WstETHV1_Calls.sol"; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {Contracts} from "@gearbox-protocol/sdk-gov/contracts/SupportedContracts.sol"; import {MultiCall} from "@gearbox-protocol/core-v2/contracts/libraries/MultiCall.sol"; @@ -30,7 +30,7 @@ contract LiveWstETHV1AdapterTest is LiveTestHelper { BalanceComparator comparator; function prepareComparator() internal { - Tokens[2] memory tokensToTrack = [Tokens.wstETH, Tokens.STETH]; + uint256[2] memory tokensToTrack = [TOKEN_wstETH, TOKEN_STETH]; // STAGES string[4] memory stages = ["after_wrap", "after_wrapDiff", "after_unwrap", "after_unwrapDiff"]; @@ -46,7 +46,7 @@ contract LiveWstETHV1AdapterTest is LiveTestHelper { } len = tokensToTrack.length; - Tokens[] memory _tokensToTrack = new Tokens[](len); + uint256[] memory _tokensToTrack = new uint256[](len); unchecked { for (uint256 i; i < len; ++i) { _tokensToTrack[i] = tokensToTrack[i]; @@ -83,14 +83,14 @@ contract LiveWstETHV1AdapterTest is LiveTestHelper { wsteth.unwrap(WAD); comparator.takeSnapshot("after_unwrap", creditAccount); - uint256 remainingBalance = tokenTestSuite.balanceOf(Tokens.wstETH, creditAccount); + uint256 remainingBalance = tokenTestSuite.balanceOf(TOKEN_wstETH, creditAccount); wsteth.unwrap(remainingBalance - WAD); comparator.takeSnapshot("after_unwrapDiff", creditAccount); wsteth.wrap(WAD); comparator.takeSnapshot("after_wrap", creditAccount); - remainingBalance = tokenTestSuite.balanceOf(Tokens.STETH, creditAccount); + remainingBalance = tokenTestSuite.balanceOf(TOKEN_STETH, creditAccount); wsteth.wrap(remainingBalance - WAD); comparator.takeSnapshot("after_wrapDiff", creditAccount); @@ -104,7 +104,7 @@ contract LiveWstETHV1AdapterTest is LiveTestHelper { vm.prank(USER); creditAccount = creditFacade.openCreditAccount(USER, MultiCallBuilder.build(), 0); - tokenTestSuite.mint(Tokens.wstETH, creditAccount, amount); + tokenTestSuite.mint(TOKEN_wstETH, creditAccount, amount); } /// @dev [L-WSEET-1]: wstETH adapter and normal account works identically @@ -119,10 +119,10 @@ contract LiveWstETHV1AdapterTest is LiveTestHelper { if (wstethAdapter == address(0)) return; tokenTestSuite.approve( - tokenTestSuite.addressOf(Tokens.wstETH), creditAccount, supportedContracts.addressOf(Contracts.LIDO_WSTETH) + tokenTestSuite.addressOf(TOKEN_wstETH), creditAccount, supportedContracts.addressOf(Contracts.LIDO_WSTETH) ); tokenTestSuite.approve( - tokenTestSuite.addressOf(Tokens.STETH), creditAccount, supportedContracts.addressOf(Contracts.LIDO_WSTETH) + tokenTestSuite.addressOf(TOKEN_STETH), creditAccount, supportedContracts.addressOf(Contracts.LIDO_WSTETH) ); uint256 snapshot = vm.snapshot(); diff --git a/contracts/test/live/adapters/mellow/Live_MellowVaultEquivalenceTest.t.sol b/contracts/test/live/adapters/mellow/Live_MellowVaultEquivalenceTest.t.sol index 3c7dce3f..ca5f204c 100644 --- a/contracts/test/live/adapters/mellow/Live_MellowVaultEquivalenceTest.t.sol +++ b/contracts/test/live/adapters/mellow/Live_MellowVaultEquivalenceTest.t.sol @@ -12,7 +12,7 @@ import {IMellowVault} from "../../../../integrations/mellow/IMellowVault.sol"; import {IMellowVaultAdapter} from "../../../../interfaces/mellow/IMellowVaultAdapter.sol"; import {MellowVault_Calls, MellowVault_Multicaller} from "../../../multicall/mellow/MellowVault_Calls.sol"; -import {Tokens, TokenType} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {Contracts} from "@gearbox-protocol/sdk-gov/contracts/SupportedContracts.sol"; import {MultiCall} from "@gearbox-protocol/core-v2/contracts/libraries/MultiCall.sol"; @@ -119,7 +119,7 @@ contract Live_MellowVaultAdapterTest is LiveTestHelper { tokensToTrack[i + 1] = underlyings[i]; } - Tokens[] memory _tokensToTrack = new Tokens[](tokensToTrack.length); + uint256[] memory _tokensToTrack = new uint256[](tokensToTrack.length); for (uint256 j = 0; j < tokensToTrack.length; j++) { _tokensToTrack[j] = tokenTestSuite.tokenIndexes(tokensToTrack[j]); diff --git a/contracts/test/live/adapters/pendle/Live_PendleRouterEquivalenceTest.t.sol b/contracts/test/live/adapters/pendle/Live_PendleRouterEquivalenceTest.t.sol index e57a7eee..75c92b5c 100644 --- a/contracts/test/live/adapters/pendle/Live_PendleRouterEquivalenceTest.t.sol +++ b/contracts/test/live/adapters/pendle/Live_PendleRouterEquivalenceTest.t.sol @@ -29,7 +29,7 @@ import { } from "../../../../interfaces/pendle/IPendleRouterAdapter.sol"; import {PendleRouter_Calls, PendleRouter_Multicaller} from "../../../multicall/pendle/PendleRouter_Calls.sol"; -import {Tokens, TokenType} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {Contracts} from "@gearbox-protocol/sdk-gov/contracts/SupportedContracts.sol"; import {MultiCall} from "@gearbox-protocol/core-v2/contracts/libraries/MultiCall.sol"; @@ -264,7 +264,7 @@ contract Live_PendleRouterAdapterTest is LiveTestHelper { tokensToTrack[0] = inputToken; tokensToTrack[1] = pendleToken; - Tokens[] memory _tokensToTrack = new Tokens[](tokensToTrack.length); + uint256[] memory _tokensToTrack = new uint256[](tokensToTrack.length); for (uint256 j = 0; j < tokensToTrack.length; j++) { _tokensToTrack[j] = tokenTestSuite.tokenIndexes(tokensToTrack[j]); diff --git a/contracts/test/live/adapters/uniswap/Live_UniswapV2EquivalenceTest.sol b/contracts/test/live/adapters/uniswap/Live_UniswapV2EquivalenceTest.sol index 0e25f7e1..4dc9080f 100644 --- a/contracts/test/live/adapters/uniswap/Live_UniswapV2EquivalenceTest.sol +++ b/contracts/test/live/adapters/uniswap/Live_UniswapV2EquivalenceTest.sol @@ -8,7 +8,7 @@ import {ICreditFacadeV3} from "@gearbox-protocol/core-v3/contracts/interfaces/IC import {IUniswapV2Router02} from "../../../../integrations/uniswap/IUniswapV2Router02.sol"; import {IUniswapV2Adapter} from "../../../../interfaces/uniswap/IUniswapV2Adapter.sol"; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {Contracts} from "@gearbox-protocol/sdk-gov/contracts/SupportedContracts.sol"; import {MultiCall} from "@gearbox-protocol/core-v2/contracts/libraries/MultiCall.sol"; @@ -31,7 +31,7 @@ contract Live_UniswapV2EquivalenceTest is LiveTestHelper { /// HELPER function prepareComparator() internal { - Tokens[2] memory tokensToTrack = [Tokens.WETH, Tokens.USDC]; + uint256[2] memory tokensToTrack = [TOKEN_WETH, TOKEN_USDC]; // STAGES string[3] memory stages = @@ -48,7 +48,7 @@ contract Live_UniswapV2EquivalenceTest is LiveTestHelper { } len = tokensToTrack.length; - Tokens[] memory _tokensToTrack = new Tokens[](len); + uint256[] memory _tokensToTrack = new uint256[](len); unchecked { for (uint256 i; i < len; ++i) { _tokensToTrack[i] = tokensToTrack[i]; @@ -65,8 +65,8 @@ contract Live_UniswapV2EquivalenceTest is LiveTestHelper { vm.startPrank(USER); address[] memory path = new address[](2); - path[0] = tokenTestSuite.addressOf(Tokens.WETH); - path[1] = tokenTestSuite.addressOf(Tokens.USDC); + path[0] = tokenTestSuite.addressOf(TOKEN_WETH); + path[1] = tokenTestSuite.addressOf(TOKEN_USDC); creditFacade.multicall( creditAccount, @@ -99,8 +99,8 @@ contract Live_UniswapV2EquivalenceTest is LiveTestHelper { vm.startPrank(creditAccount); address[] memory path = new address[](2); - path[0] = tokenTestSuite.addressOf(Tokens.WETH); - path[1] = tokenTestSuite.addressOf(Tokens.USDC); + path[0] = tokenTestSuite.addressOf(TOKEN_WETH); + path[1] = tokenTestSuite.addressOf(TOKEN_USDC); router.swapTokensForExactTokens( 100 * 10 ** 6, type(uint256).max, path, creditAccount, block.timestamp + 3600 @@ -110,7 +110,7 @@ contract Live_UniswapV2EquivalenceTest is LiveTestHelper { router.swapExactTokensForTokens(WAD, 0, path, creditAccount, block.timestamp + 3600); comparator.takeSnapshot("after_swapExactTokensForTokens", creditAccount); - uint256 balanceToSwap = tokenTestSuite.balanceOf(Tokens.WETH, creditAccount) - WAD; + uint256 balanceToSwap = tokenTestSuite.balanceOf(TOKEN_WETH, creditAccount) - WAD; router.swapExactTokensForTokens(balanceToSwap, 0, path, creditAccount, block.timestamp + 3600); comparator.takeSnapshot("after_swapDiffTokensForTokens", creditAccount); @@ -123,7 +123,7 @@ contract Live_UniswapV2EquivalenceTest is LiveTestHelper { function openCreditAccountWithWeth(uint256 amount) internal returns (address creditAccount) { vm.prank(USER); creditAccount = creditFacade.openCreditAccount(USER, MultiCallBuilder.build(), 0); - tokenTestSuite.mint(Tokens.WETH, creditAccount, amount); + tokenTestSuite.mint(TOKEN_WETH, creditAccount, amount); } /// @dev [L-UV2ET-1]: UniswapV2 adapter and normal account works identically @@ -137,20 +137,20 @@ contract Live_UniswapV2EquivalenceTest is LiveTestHelper { if ( routerAdapter == address(0) || !IUniswapV2Adapter(routerAdapter).isPairAllowed( - tokenTestSuite.addressOf(Tokens.WETH), tokenTestSuite.addressOf(Tokens.USDC) + tokenTestSuite.addressOf(TOKEN_WETH), tokenTestSuite.addressOf(TOKEN_USDC) ) ) { return; } tokenTestSuite.approve( - tokenTestSuite.addressOf(Tokens.WETH), + tokenTestSuite.addressOf(TOKEN_WETH), creditAccount, supportedContracts.addressOf(Contracts.UNISWAP_V2_ROUTER) ); tokenTestSuite.approve( - tokenTestSuite.addressOf(Tokens.USDC), + tokenTestSuite.addressOf(TOKEN_USDC), creditAccount, supportedContracts.addressOf(Contracts.UNISWAP_V2_ROUTER) ); diff --git a/contracts/test/live/adapters/uniswap/Live_UniswapV3EquivalenceTest.sol b/contracts/test/live/adapters/uniswap/Live_UniswapV3EquivalenceTest.sol index 6d3dfd66..eca78d90 100644 --- a/contracts/test/live/adapters/uniswap/Live_UniswapV3EquivalenceTest.sol +++ b/contracts/test/live/adapters/uniswap/Live_UniswapV3EquivalenceTest.sol @@ -8,7 +8,7 @@ import {ICreditFacadeV3} from "@gearbox-protocol/core-v3/contracts/interfaces/IC import {ISwapRouter} from "../../../../integrations/uniswap/IUniswapV3.sol"; import {IUniswapV3Adapter, IUniswapV3AdapterTypes} from "../../../../interfaces/uniswap/IUniswapV3Adapter.sol"; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {Contracts} from "@gearbox-protocol/sdk-gov/contracts/SupportedContracts.sol"; import {MultiCall} from "@gearbox-protocol/core-v2/contracts/libraries/MultiCall.sol"; @@ -31,7 +31,7 @@ contract Live_UniswapV3EquivalenceTest is LiveTestHelper { /// HELPER function prepareComparator() internal { - Tokens[2] memory tokensToTrack = [Tokens.WETH, Tokens.USDC]; + uint256[2] memory tokensToTrack = [TOKEN_WETH, TOKEN_USDC]; // STAGES string[6] memory stages = [ @@ -54,7 +54,7 @@ contract Live_UniswapV3EquivalenceTest is LiveTestHelper { } len = tokensToTrack.length; - Tokens[] memory _tokensToTrack = new Tokens[](len); + uint256[] memory _tokensToTrack = new uint256[](len); unchecked { for (uint256 i; i < len; ++i) { _tokensToTrack[i] = tokensToTrack[i]; @@ -71,8 +71,8 @@ contract Live_UniswapV3EquivalenceTest is LiveTestHelper { vm.startPrank(USER); ISwapRouter.ExactInputSingleParams memory exactInputSingleParams = ISwapRouter.ExactInputSingleParams({ - tokenIn: tokenTestSuite.addressOf(Tokens.WETH), - tokenOut: tokenTestSuite.addressOf(Tokens.USDC), + tokenIn: tokenTestSuite.addressOf(TOKEN_WETH), + tokenOut: tokenTestSuite.addressOf(TOKEN_USDC), fee: 500, recipient: creditAccount, deadline: block.timestamp + 3600, @@ -88,8 +88,8 @@ contract Live_UniswapV3EquivalenceTest is LiveTestHelper { IUniswapV3AdapterTypes.ExactDiffInputSingleParams memory exactDiffInputSingleParams = IUniswapV3AdapterTypes .ExactDiffInputSingleParams({ - tokenIn: tokenTestSuite.addressOf(Tokens.WETH), - tokenOut: tokenTestSuite.addressOf(Tokens.USDC), + tokenIn: tokenTestSuite.addressOf(TOKEN_WETH), + tokenOut: tokenTestSuite.addressOf(TOKEN_USDC), fee: 500, deadline: block.timestamp + 3600, leftoverAmount: 20 * WAD, @@ -104,8 +104,8 @@ contract Live_UniswapV3EquivalenceTest is LiveTestHelper { ISwapRouter.ExactInputParams memory exactInputParams = ISwapRouter.ExactInputParams({ path: abi.encodePacked( - tokenTestSuite.addressOf(Tokens.WETH), uint24(500), tokenTestSuite.addressOf(Tokens.USDC) - ), + tokenTestSuite.addressOf(TOKEN_WETH), uint24(500), tokenTestSuite.addressOf(TOKEN_USDC) + ), recipient: creditAccount, deadline: block.timestamp + 3600, amountIn: WAD, @@ -117,8 +117,8 @@ contract Live_UniswapV3EquivalenceTest is LiveTestHelper { IUniswapV3AdapterTypes.ExactDiffInputParams memory exactDiffInputParams = IUniswapV3AdapterTypes .ExactDiffInputParams({ path: abi.encodePacked( - tokenTestSuite.addressOf(Tokens.WETH), uint24(500), tokenTestSuite.addressOf(Tokens.USDC) - ), + tokenTestSuite.addressOf(TOKEN_WETH), uint24(500), tokenTestSuite.addressOf(TOKEN_USDC) + ), deadline: block.timestamp + 3600, leftoverAmount: 10 * WAD, rateMinRAY: 0 @@ -127,8 +127,8 @@ contract Live_UniswapV3EquivalenceTest is LiveTestHelper { comparator.takeSnapshot("after_exactDiffInput", creditAccount); ISwapRouter.ExactOutputSingleParams memory exactOutputSingleParams = ISwapRouter.ExactOutputSingleParams({ - tokenIn: tokenTestSuite.addressOf(Tokens.WETH), - tokenOut: tokenTestSuite.addressOf(Tokens.USDC), + tokenIn: tokenTestSuite.addressOf(TOKEN_WETH), + tokenOut: tokenTestSuite.addressOf(TOKEN_USDC), fee: 500, recipient: creditAccount, deadline: block.timestamp + 3600, @@ -143,8 +143,8 @@ contract Live_UniswapV3EquivalenceTest is LiveTestHelper { ISwapRouter.ExactOutputParams memory exactOutputParams = ISwapRouter.ExactOutputParams({ path: abi.encodePacked( - tokenTestSuite.addressOf(Tokens.WETH), uint24(500), tokenTestSuite.addressOf(Tokens.USDC) - ), + tokenTestSuite.addressOf(TOKEN_WETH), uint24(500), tokenTestSuite.addressOf(TOKEN_USDC) + ), recipient: creditAccount, deadline: block.timestamp + 3600, amountOut: 100 * 10 ** 6, @@ -161,8 +161,8 @@ contract Live_UniswapV3EquivalenceTest is LiveTestHelper { router.exactInputSingle( ISwapRouter.ExactInputSingleParams({ - tokenIn: tokenTestSuite.addressOf(Tokens.WETH), - tokenOut: tokenTestSuite.addressOf(Tokens.USDC), + tokenIn: tokenTestSuite.addressOf(TOKEN_WETH), + tokenOut: tokenTestSuite.addressOf(TOKEN_USDC), fee: 500, recipient: creditAccount, deadline: block.timestamp + 3600, @@ -174,11 +174,11 @@ contract Live_UniswapV3EquivalenceTest is LiveTestHelper { comparator.takeSnapshot("after_exactInputSingle", creditAccount); - uint256 balanceToSwap = tokenTestSuite.balanceOf(Tokens.WETH, creditAccount) - 20 * WAD; + uint256 balanceToSwap = tokenTestSuite.balanceOf(TOKEN_WETH, creditAccount) - 20 * WAD; router.exactInputSingle( ISwapRouter.ExactInputSingleParams({ - tokenIn: tokenTestSuite.addressOf(Tokens.WETH), - tokenOut: tokenTestSuite.addressOf(Tokens.USDC), + tokenIn: tokenTestSuite.addressOf(TOKEN_WETH), + tokenOut: tokenTestSuite.addressOf(TOKEN_USDC), fee: 500, recipient: creditAccount, deadline: block.timestamp + 3600, @@ -192,8 +192,8 @@ contract Live_UniswapV3EquivalenceTest is LiveTestHelper { router.exactInput( ISwapRouter.ExactInputParams({ path: abi.encodePacked( - tokenTestSuite.addressOf(Tokens.WETH), uint24(500), tokenTestSuite.addressOf(Tokens.USDC) - ), + tokenTestSuite.addressOf(TOKEN_WETH), uint24(500), tokenTestSuite.addressOf(TOKEN_USDC) + ), recipient: creditAccount, deadline: block.timestamp + 3600, amountIn: WAD, @@ -202,12 +202,12 @@ contract Live_UniswapV3EquivalenceTest is LiveTestHelper { ); comparator.takeSnapshot("after_exactInput", creditAccount); - balanceToSwap = tokenTestSuite.balanceOf(Tokens.WETH, creditAccount) - 10 * WAD; + balanceToSwap = tokenTestSuite.balanceOf(TOKEN_WETH, creditAccount) - 10 * WAD; router.exactInput( ISwapRouter.ExactInputParams({ path: abi.encodePacked( - tokenTestSuite.addressOf(Tokens.WETH), uint24(500), tokenTestSuite.addressOf(Tokens.USDC) - ), + tokenTestSuite.addressOf(TOKEN_WETH), uint24(500), tokenTestSuite.addressOf(TOKEN_USDC) + ), recipient: creditAccount, deadline: block.timestamp + 3600, amountIn: balanceToSwap, @@ -218,8 +218,8 @@ contract Live_UniswapV3EquivalenceTest is LiveTestHelper { router.exactOutputSingle( ISwapRouter.ExactOutputSingleParams({ - tokenIn: tokenTestSuite.addressOf(Tokens.WETH), - tokenOut: tokenTestSuite.addressOf(Tokens.USDC), + tokenIn: tokenTestSuite.addressOf(TOKEN_WETH), + tokenOut: tokenTestSuite.addressOf(TOKEN_USDC), fee: 500, recipient: creditAccount, deadline: block.timestamp + 3600, @@ -233,8 +233,8 @@ contract Live_UniswapV3EquivalenceTest is LiveTestHelper { router.exactOutput( ISwapRouter.ExactOutputParams({ path: abi.encodePacked( - tokenTestSuite.addressOf(Tokens.WETH), uint24(500), tokenTestSuite.addressOf(Tokens.USDC) - ), + tokenTestSuite.addressOf(TOKEN_WETH), uint24(500), tokenTestSuite.addressOf(TOKEN_USDC) + ), recipient: creditAccount, deadline: block.timestamp + 3600, amountOut: 100 * 10 ** 6, @@ -252,7 +252,7 @@ contract Live_UniswapV3EquivalenceTest is LiveTestHelper { function openCreditAccountWithWeth(uint256 amount) internal returns (address creditAccount) { vm.prank(USER); creditAccount = creditFacade.openCreditAccount(USER, MultiCallBuilder.build(), 0); - tokenTestSuite.mint(Tokens.WETH, creditAccount, amount); + tokenTestSuite.mint(TOKEN_WETH, creditAccount, amount); } /// @dev [L-UV3ET-1]: UniswapV3 adapter and normal account works identically @@ -266,20 +266,20 @@ contract Live_UniswapV3EquivalenceTest is LiveTestHelper { if ( routerAdapter == address(0) || !IUniswapV3Adapter(routerAdapter).isPoolAllowed( - tokenTestSuite.addressOf(Tokens.WETH), tokenTestSuite.addressOf(Tokens.USDC), 500 + tokenTestSuite.addressOf(TOKEN_WETH), tokenTestSuite.addressOf(TOKEN_USDC), 500 ) ) { return; } tokenTestSuite.approve( - tokenTestSuite.addressOf(Tokens.WETH), + tokenTestSuite.addressOf(TOKEN_WETH), creditAccount, supportedContracts.addressOf(Contracts.UNISWAP_V3_ROUTER) ); tokenTestSuite.approve( - tokenTestSuite.addressOf(Tokens.USDC), + tokenTestSuite.addressOf(TOKEN_USDC), creditAccount, supportedContracts.addressOf(Contracts.UNISWAP_V3_ROUTER) ); diff --git a/contracts/test/live/adapters/velodrome/Live_VelodromeV2EquivalenceTest.sol b/contracts/test/live/adapters/velodrome/Live_VelodromeV2EquivalenceTest.sol index 456ec4a9..645b4d46 100644 --- a/contracts/test/live/adapters/velodrome/Live_VelodromeV2EquivalenceTest.sol +++ b/contracts/test/live/adapters/velodrome/Live_VelodromeV2EquivalenceTest.sol @@ -8,7 +8,7 @@ import {ICreditFacadeV3} from "@gearbox-protocol/core-v3/contracts/interfaces/IC import {IVelodromeV2Router, Route} from "../../../../integrations/velodrome/IVelodromeV2Router.sol"; import {IVelodromeV2RouterAdapter} from "../../../../interfaces/velodrome/IVelodromeV2RouterAdapter.sol"; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {Contracts} from "@gearbox-protocol/sdk-gov/contracts/SupportedContracts.sol"; import {MultiCall} from "@gearbox-protocol/core-v2/contracts/libraries/MultiCall.sol"; @@ -36,7 +36,7 @@ contract Live_VelodromeV2EquivalenceTest is LiveTestHelper { /// HELPER function prepareComparator() internal { - Tokens[2] memory tokensToTrack = [Tokens.OP, Tokens.USDC]; + uint256[2] memory tokensToTrack = [TOKEN_OP, TOKEN_USDC]; // STAGES string[2] memory stages = ["after_swapExactTokensForTokens", "after_swapDiffTokensForTokens"]; @@ -52,7 +52,7 @@ contract Live_VelodromeV2EquivalenceTest is LiveTestHelper { } len = tokensToTrack.length; - Tokens[] memory _tokensToTrack = new Tokens[](len); + uint256[] memory _tokensToTrack = new uint256[](len); unchecked { for (uint256 i; i < len; ++i) { _tokensToTrack[i] = tokensToTrack[i]; @@ -71,8 +71,8 @@ contract Live_VelodromeV2EquivalenceTest is LiveTestHelper { Route[] memory routes = new Route[](1); routes[0] = Route({ - from: tokenTestSuite.addressOf(Tokens.OP), - to: tokenTestSuite.addressOf(Tokens.USDC), + from: tokenTestSuite.addressOf(TOKEN_OP), + to: tokenTestSuite.addressOf(TOKEN_USDC), stable: false, factory: DEFAULT_VELODROME_V2_FACTORY }); @@ -100,8 +100,8 @@ contract Live_VelodromeV2EquivalenceTest is LiveTestHelper { Route[] memory routes = new Route[](1); routes[0] = Route({ - from: tokenTestSuite.addressOf(Tokens.OP), - to: tokenTestSuite.addressOf(Tokens.USDC), + from: tokenTestSuite.addressOf(TOKEN_OP), + to: tokenTestSuite.addressOf(TOKEN_USDC), stable: false, factory: DEFAULT_VELODROME_V2_FACTORY }); @@ -109,7 +109,7 @@ contract Live_VelodromeV2EquivalenceTest is LiveTestHelper { router.swapExactTokensForTokens(WAD, 0, routes, creditAccount, block.timestamp + 3600); comparator.takeSnapshot("after_swapExactTokensForTokens", creditAccount); - uint256 balanceToSwap = tokenTestSuite.balanceOf(Tokens.OP, creditAccount) - WAD; + uint256 balanceToSwap = tokenTestSuite.balanceOf(TOKEN_OP, creditAccount) - WAD; router.swapExactTokensForTokens(balanceToSwap, 0, routes, creditAccount, block.timestamp + 3600); comparator.takeSnapshot("after_swapDiffTokensForTokens", creditAccount); @@ -122,7 +122,7 @@ contract Live_VelodromeV2EquivalenceTest is LiveTestHelper { function openCreditAccountWithOP(uint256 amount) internal returns (address creditAccount) { vm.prank(USER); creditAccount = creditFacade.openCreditAccount(USER, MultiCallBuilder.build(), 0); - tokenTestSuite.mint(Tokens.OP, creditAccount, amount); + tokenTestSuite.mint(TOKEN_OP, creditAccount, amount); } /// @dev [L-VELO2ET-1]: VelodromeV2 adapter and normal account works identically @@ -134,8 +134,8 @@ contract Live_VelodromeV2EquivalenceTest is LiveTestHelper { if ( routerAdapter == address(0) || !IVelodromeV2RouterAdapter(routerAdapter).isPoolAllowed( - tokenTestSuite.addressOf(Tokens.OP), - tokenTestSuite.addressOf(Tokens.USDC), + tokenTestSuite.addressOf(TOKEN_OP), + tokenTestSuite.addressOf(TOKEN_USDC), false, DEFAULT_VELODROME_V2_FACTORY ) @@ -146,7 +146,7 @@ contract Live_VelodromeV2EquivalenceTest is LiveTestHelper { address creditAccount = openCreditAccountWithOP(100 * WAD); tokenTestSuite.approve( - tokenTestSuite.addressOf(Tokens.OP), + tokenTestSuite.addressOf(TOKEN_OP), creditAccount, supportedContracts.addressOf(Contracts.VELODROME_V2_ROUTER) ); diff --git a/contracts/test/live/adapters/yearn/Live_YearnEquivalenceTest.sol b/contracts/test/live/adapters/yearn/Live_YearnEquivalenceTest.sol index b4e9fd10..24f29dc4 100644 --- a/contracts/test/live/adapters/yearn/Live_YearnEquivalenceTest.sol +++ b/contracts/test/live/adapters/yearn/Live_YearnEquivalenceTest.sol @@ -14,7 +14,7 @@ import {YearnV2_Calls, YearnV2_Multicaller} from "../../../multicall/yearn/Yearn import {IAdapter} from "@gearbox-protocol/core-v2/contracts/interfaces/IAdapter.sol"; import {AdapterType} from "@gearbox-protocol/sdk-gov/contracts/AdapterType.sol"; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {Contracts} from "@gearbox-protocol/sdk-gov/contracts/SupportedContracts.sol"; import {MultiCall} from "@gearbox-protocol/core-v2/contracts/libraries/MultiCall.sol"; @@ -143,7 +143,7 @@ contract Live_YearnEquivalenceTest is LiveTestHelper { tokensToTrack[0] = IYearnV2Adapter(vaultAdapter).token(); tokensToTrack[1] = IYearnV2Adapter(vaultAdapter).targetContract(); - Tokens[] memory _tokensToTrack = new Tokens[](tokensToTrack.length); + uint256[] memory _tokensToTrack = new uint256[](tokensToTrack.length); for (uint256 j = 0; j < tokensToTrack.length; ++j) { _tokensToTrack[j] = tokenTestSuite.tokenIndexes(tokensToTrack[j]); diff --git a/contracts/test/suites/AdapterDeployer.sol b/contracts/test/suites/AdapterDeployer.sol index c86abb53..89427403 100644 --- a/contracts/test/suites/AdapterDeployer.sol +++ b/contracts/test/suites/AdapterDeployer.sol @@ -8,7 +8,7 @@ import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {ICreditManagerV3} from "@gearbox-protocol/core-v3/contracts/interfaces/ICreditManagerV3.sol"; import {ICreditConfiguratorV3} from "@gearbox-protocol/core-v3/contracts/interfaces/ICreditConfiguratorV3.sol"; // CONFIG -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {AdapterData} from "@gearbox-protocol/sdk-gov/contracts/AdapterData.sol"; import {SupportedContracts, Contracts} from "@gearbox-protocol/sdk-gov/contracts/SupportedContracts.sol"; @@ -126,9 +126,8 @@ contract AdapterDeployer is AdapterData, Test { adapter = address(new LidoV1Adapter(address(creditManager), targetContract)); targetContract = LidoV1Adapter(adapter).targetContract(); } else if (at == AdapterType.LIDO_WSTETH_V1) { - adapter = address( - new WstETHV1Adapter(address(creditManager), tokenTestSuite.addressOf(Tokens.wstETH)) - ); + adapter = + address(new WstETHV1Adapter(address(creditManager), tokenTestSuite.addressOf(TOKEN_wstETH))); } else if (at == AdapterType.COMPOUND_V2_CERC20) { adapter = address(new CompoundV2_CErc20Adapter(address(creditManager), targetContract)); } else if (at == AdapterType.COMPOUND_V2_CETHER) { diff --git a/contracts/test/suites/LiveTestHelper.sol b/contracts/test/suites/LiveTestHelper.sol index b43c2702..bb56fa78 100644 --- a/contracts/test/suites/LiveTestHelper.sol +++ b/contracts/test/suites/LiveTestHelper.sol @@ -10,7 +10,7 @@ import {ICreditFacadeV3} from "@gearbox-protocol/core-v3/contracts/interfaces/IC import {IVersion} from "@gearbox-protocol/core-v2/contracts/interfaces/IVersion.sol"; import {DegenNFTV2} from "@gearbox-protocol/core-v2/contracts/tokens/DegenNFTV2.sol"; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {SupportedContracts, Contracts} from "@gearbox-protocol/sdk-gov/contracts/SupportedContracts.sol"; import { IPoolV3DeployConfig, @@ -392,65 +392,9 @@ contract LiveTestHelper is IntegrationTestHelper { return !Pausable(pool).paused() && !Pausable(creditFacade).paused(); } - function _setUp() public virtual liveTest { - // lts = new LiveEnvTestSuite(); - // MAINNET_CONFIGURATOR = lts.ROOT_ADDRESS(); - // tokenTestSuite = lts.tokenTestSuite(); - // supportedContracts = lts.supportedContracts(); - - // TODO: CHANGE - } - - // function getUniV2() internal view returns (IUniswapV2Router02) { - // return IUniswapV2Router02(supportedContracts.addressOf(Contracts.UNISWAP_V2_ROUTER)); - // } - - // function swapEthToTokens(address onBehalfOf, Tokens t, uint256 amount) internal { - // vm.startPrank(onBehalfOf); - - // getUniV2().swapExactETHForTokens{value: amount}( - // 0, arrayOf(tokenTestSuite.addressOf(Tokens.WETH), tokenTestSuite.addressOf(t)), onBehalfOf, block.timestamp - // ); - - // vm.stopPrank(); - // } - - // // [TODO]: add new lib for arrayOf - // function arrayOf(address addr0, address addr1) internal pure returns (address[] memory result) { - // result = new address[](2); - // result[0] = addr0; - // result[1] = addr1; - // } - - // function getTokensOfType(TokenType tokenType) internal view returns (Tokens[] memory tokens) { - // uint256 tokenCount = tokenTestSuite.tokenCount(); - - // uint256[] memory temp = new uint256[](tokenCount); - // uint256 found; - - // for (uint256 i = 0; i < tokenCount; ++i) { - // if (tokenTestSuite.tokenTypes(Tokens(i)) == tokenType) { - // temp[found] = i; - // ++found; - // } - // } - - // tokens = new Tokens[](found); - - // for (uint256 i = 0; i < found; ++i) { - // tokens[i] = Tokens(temp[i]); - // } - // } + function _setUp() public virtual liveTest {} function getAdapter(address creditManager, Contracts target) public view returns (address) { return ICreditManagerV3(creditManager).contractToAdapter(supportedContracts.addressOf(target)); } - - // function getAdapter(Tokens underlying, Contracts target) public view returns (address) { - // return _creditManagers[underlying][0].contractToAdapter(supportedContracts.addressOf(target)); - // } - - // function getAdapter(Tokens underlying, Contracts target, uint256 cmIdx) public view returns (address) { - // return _creditManagers[underlying][cmIdx].contractToAdapter(supportedContracts.addressOf(target)); - // } } diff --git a/contracts/test/suites/ZapperLiveTestHelper.sol b/contracts/test/suites/ZapperLiveTestHelper.sol index 4214685c..944838fc 100644 --- a/contracts/test/suites/ZapperLiveTestHelper.sol +++ b/contracts/test/suites/ZapperLiveTestHelper.sol @@ -6,7 +6,7 @@ pragma solidity ^0.8.17; import {IERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol"; import {PoolV3} from "@gearbox-protocol/core-v3/contracts/pool/PoolV3.sol"; -import {Tokens} from "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; import {IZapper} from "../../interfaces/zappers/IZapper.sol"; import {IZapperRegister} from "../../interfaces/zappers/IZapperRegister.sol"; @@ -112,7 +112,7 @@ contract ZapperLiveTestHelper is LiveTestHelper { } // WETH zapper - if (underlying == tokenTestSuite.addressOf(Tokens.WETH)) { + if (underlying == tokenTestSuite.addressOf(TOKEN_WETH)) { zapperRegister.addZapper(address(new WETHDepositZapper(pool))); if (farmingPool != address(0)) { zapperRegister.addZapper(address(new WETHFarmingZapper(pool, farmingPool))); @@ -120,10 +120,8 @@ contract ZapperLiveTestHelper is LiveTestHelper { } // wstETH zapper - if ( - underlying == tokenTestSuite.addressOf(Tokens.wstETH) - && tokenTestSuite.addressOf(Tokens.STETH) != address(0) - ) { + if (underlying == tokenTestSuite.addressOf(TOKEN_wstETH) && tokenTestSuite.addressOf(TOKEN_STETH) != address(0)) + { zapperRegister.addZapper(address(new WstETHDepositZapper(pool))); if (farmingPool != address(0)) { zapperRegister.addZapper(address(new WstETHFarmingZapper(pool, farmingPool))); @@ -134,22 +132,22 @@ contract ZapperLiveTestHelper is LiveTestHelper { function _attachState() internal { // TODO: Would be nice to have this information stored in sdk-gov instead. // Not exactly clear how to test in case farming pool is not deployed yet. - farmingPools[tokenTestSuite.addressOf(Tokens.dWETHV3)] = tokenTestSuite.addressOf(Tokens.sdWETHV3); - farmingPools[tokenTestSuite.addressOf(Tokens.dWBTCV3)] = tokenTestSuite.addressOf(Tokens.sdWBTCV3); - farmingPools[tokenTestSuite.addressOf(Tokens.dUSDCV3)] = tokenTestSuite.addressOf(Tokens.sdUSDCV3); - farmingPools[tokenTestSuite.addressOf(Tokens.dUSDTV3)] = tokenTestSuite.addressOf(Tokens.sdUSDTV3); - farmingPools[tokenTestSuite.addressOf(Tokens.dDAIV3)] = tokenTestSuite.addressOf(Tokens.sdDAIV3); - farmingPools[tokenTestSuite.addressOf(Tokens.dGHOV3)] = tokenTestSuite.addressOf(Tokens.sdGHOV3); - - legacyPools[tokenTestSuite.addressOf(Tokens.DAI)] = _getLegacyPool(Tokens.DAI); - legacyPools[tokenTestSuite.addressOf(Tokens.WETH)] = _getLegacyPool(Tokens.WETH); - legacyPools[tokenTestSuite.addressOf(Tokens.WBTC)] = _getLegacyPool(Tokens.WBTC); - legacyPools[tokenTestSuite.addressOf(Tokens.USDC)] = _getLegacyPool(Tokens.USDC); - legacyPools[tokenTestSuite.addressOf(Tokens.FRAX)] = _getLegacyPool(Tokens.FRAX); - legacyPools[tokenTestSuite.addressOf(Tokens.wstETH)] = _getLegacyPool(Tokens.wstETH); + farmingPools[tokenTestSuite.addressOf(TOKEN_dWETHV3)] = tokenTestSuite.addressOf(TOKEN_sdWETHV3); + farmingPools[tokenTestSuite.addressOf(TOKEN_dWBTCV3)] = tokenTestSuite.addressOf(TOKEN_sdWBTCV3); + farmingPools[tokenTestSuite.addressOf(TOKEN_dUSDCV3)] = tokenTestSuite.addressOf(TOKEN_sdUSDCV3); + farmingPools[tokenTestSuite.addressOf(TOKEN_dUSDTV3)] = tokenTestSuite.addressOf(TOKEN_sdUSDTV3); + farmingPools[tokenTestSuite.addressOf(TOKEN_dDAIV3)] = tokenTestSuite.addressOf(TOKEN_sdDAIV3); + farmingPools[tokenTestSuite.addressOf(TOKEN_dGHOV3)] = tokenTestSuite.addressOf(TOKEN_sdGHOV3); + + legacyPools[tokenTestSuite.addressOf(TOKEN_DAI)] = _getLegacyPool(TOKEN_DAI); + legacyPools[tokenTestSuite.addressOf(TOKEN_WETH)] = _getLegacyPool(TOKEN_WETH); + legacyPools[tokenTestSuite.addressOf(TOKEN_WBTC)] = _getLegacyPool(TOKEN_WBTC); + legacyPools[tokenTestSuite.addressOf(TOKEN_USDC)] = _getLegacyPool(TOKEN_USDC); + legacyPools[tokenTestSuite.addressOf(TOKEN_FRAX)] = _getLegacyPool(TOKEN_FRAX); + legacyPools[tokenTestSuite.addressOf(TOKEN_wstETH)] = _getLegacyPool(TOKEN_wstETH); } - function _getLegacyPool(Tokens t) internal view returns (address) { + function _getLegacyPool(uint256 t) internal view returns (address) { address token = tokenTestSuite.addressOf(t); if (token == address(0)) return address(0); (bool success, bytes memory result) = token.staticcall(abi.encodeWithSignature("owner()")); diff --git a/contracts/test/unit/helpers/compound/CompoundV2_CEtherGateway.unit.t.sol b/contracts/test/unit/helpers/compound/CompoundV2_CEtherGateway.unit.t.sol index eb915b67..aec82c13 100644 --- a/contracts/test/unit/helpers/compound/CompoundV2_CEtherGateway.unit.t.sol +++ b/contracts/test/unit/helpers/compound/CompoundV2_CEtherGateway.unit.t.sol @@ -9,7 +9,8 @@ import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {IWETH} from "@gearbox-protocol/core-v2/contracts/interfaces/external/IWETH.sol"; import {ZeroAddressException} from "@gearbox-protocol/core-v3/contracts/interfaces/IExceptions.sol"; -import {TokensTestSuite, Tokens} from "@gearbox-protocol/core-v3/contracts/test/suites/TokensTestSuite.sol"; +import "@gearbox-protocol/sdk-gov/contracts/Tokens.sol"; +import {TokensTestSuite} from "@gearbox-protocol/core-v3/contracts/test/suites/TokensTestSuite.sol"; import {CEtherGateway} from "../../../../helpers/compound/CompoundV2_CEtherGateway.sol"; import {ICompoundV2_Exceptions} from "../../../../interfaces/compound/ICompoundV2_CTokenAdapter.sol"; @@ -33,7 +34,7 @@ contract CEtherGatewayUnitTest is Test, ICompoundV2_Exceptions { function setUp() public { tokensTestSuite = new TokensTestSuite(); - weth = IWETH(tokensTestSuite.addressOf(Tokens.WETH)); + weth = IWETH(tokensTestSuite.addressOf(TOKEN_WETH)); // initial exchange rate 0.02 cETH per ETH, 5% yearly interest ceth = new CEtherMock(0.02 ether, 0.05 ether); @@ -71,8 +72,8 @@ contract CEtherGatewayUnitTest is Test, ICompoundV2_Exceptions { /// @notice U:[CEG-3]: `mint` works as expected function test_U_CEG_03_mint_works_as_expected() public { uint256 mintAmount = 10 ether; - tokensTestSuite.mint(Tokens.WETH, user, mintAmount); - tokensTestSuite.approve(Tokens.WETH, user, address(gateway), mintAmount); + tokensTestSuite.mint(TOKEN_WETH, user, mintAmount); + tokensTestSuite.approve(TOKEN_WETH, user, address(gateway), mintAmount); uint256 cethBalanceExpected = mintAmount * 1 ether / ceth.exchangeRateCurrent(); @@ -147,8 +148,8 @@ contract CEtherGatewayUnitTest is Test, ICompoundV2_Exceptions { /// @dev Deposits given amount of WETH to cETH through gateway for user function _mintCEther(uint256 mintAmount) internal returns (uint256 cethBalance) { - tokensTestSuite.mint(Tokens.WETH, user, mintAmount); - tokensTestSuite.approve(Tokens.WETH, user, address(gateway), mintAmount); + tokensTestSuite.mint(TOKEN_WETH, user, mintAmount); + tokensTestSuite.approve(TOKEN_WETH, user, address(gateway), mintAmount); vm.prank(user); gateway.mint(WETH_AMOUNT); diff --git a/package.json b/package.json index d3cb0e95..007b7093 100644 --- a/package.json +++ b/package.json @@ -35,11 +35,11 @@ "@commitlint/cli": "^17.1.2", "@commitlint/config-conventional": "^17.1.0", "@gearbox-protocol/core-v2": "1.19.0-base.10", - "@gearbox-protocol/core-v3": "^1.50.0", + "@gearbox-protocol/core-v3": "^1.51.0", "@gearbox-protocol/eslint-config": "^1.6.1", - "@gearbox-protocol/oracles-v3": "^1.11.1", + "@gearbox-protocol/oracles-v3": "^1.12.1", "@gearbox-protocol/prettier-config": "^1.5.0", - "@gearbox-protocol/sdk-gov": "^2.24.0", + "@gearbox-protocol/sdk-gov": "^2.28.0", "@openzeppelin/contracts": "4.9.3", "@redstone-finance/evm-connector": "0.2.5", "@typechain/ethers-v5": "^10.1.0", diff --git a/yarn.lock b/yarn.lock index 07a4c249..25b05d04 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1031,10 +1031,10 @@ resolved "https://registry.yarnpkg.com/@gearbox-protocol/core-v2/-/core-v2-1.19.0-base.10.tgz#a21bce9eac4ca1783f5fcb4322b1c1257158d2de" integrity sha512-S9reS5zGt+cKxEdQppVCU0cZEmnSqx8DaoloY6KXqCsAedVJvwNUoCHnLjh9s/oWyOHa37qExN1QohntNQyB2Q== -"@gearbox-protocol/core-v3@^1.50.0": - version "1.50.0" - resolved "https://registry.yarnpkg.com/@gearbox-protocol/core-v3/-/core-v3-1.50.0.tgz#1327ed3a265ccfd6da02bcef165d0d347247d19e" - integrity sha512-c7APqdL3lt9XswPUl1/Obr+VJp7pYOte6azQbXsEm2oRDvFQ3KYq++mvk2dG/9mdK/PVAM/USKlKcqSrKqOrmA== +"@gearbox-protocol/core-v3@^1.51.0": + version "1.51.0" + resolved "https://registry.yarnpkg.com/@gearbox-protocol/core-v3/-/core-v3-1.51.0.tgz#c7e61bbaa7187648834ac03ae34b3337c567d5a9" + integrity sha512-DqY+3f/MWrtlIS+PlUMg0k4NdWPoVtjKmpyqAPO3GytZq4wqwTnJ3Xqni/IAyqxIPQBGIEvuiLeHkdVaQmpYyA== "@gearbox-protocol/eslint-config@^1.6.1": version "1.6.1" @@ -1051,10 +1051,10 @@ eslint-plugin-simple-import-sort "^7.0.0" eslint-plugin-unused-imports "^2.0.0" -"@gearbox-protocol/oracles-v3@^1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@gearbox-protocol/oracles-v3/-/oracles-v3-1.11.1.tgz#9e2cf660ff5845f736cf4b5a6a903a6603e61d62" - integrity sha512-ff69kZ8GHVg9ZFXDhtCSclmic0hAI5JNOTXuLojdKGkNnxGXks0vm4qNw0xEemD01IhW/M0cWkY44iX/dtMk1A== +"@gearbox-protocol/oracles-v3@^1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@gearbox-protocol/oracles-v3/-/oracles-v3-1.12.1.tgz#897623a71bbaa4e96f999d13342093a9d22f1d0c" + integrity sha512-B6ep1O53zmWXIzr+5mWHxLynSPnDRWbi/p/DADJor4ClkwhkjIqG8R+q06ooC2EbT74+KmwK8KNLRrDvfLT3Mw== dependencies: redstone-protocol "^1.0.5" @@ -1063,10 +1063,10 @@ resolved "https://registry.yarnpkg.com/@gearbox-protocol/prettier-config/-/prettier-config-1.5.0.tgz#4df8e9fd2305fee6ab8c1417a02e31343836932a" integrity sha512-FUoprSsBdZyBjgxXCKL6mTkbeUJytaLzPJqIOoQpDmBRTX0seCc2o5I9PI9tySoRIlNnd/XXnKCXq1xHDEGbxw== -"@gearbox-protocol/sdk-gov@^2.24.0": - version "2.24.0" - resolved "https://registry.yarnpkg.com/@gearbox-protocol/sdk-gov/-/sdk-gov-2.24.0.tgz#beac0328625bf81d12e5afde679cc2356c34299b" - integrity sha512-tStCaH3bN2ZCx3sQye/xNjO3zjiyj/V2Elama8qICxKOIGuWdKLwgIX7H+hxGAOBw7lEw5ypELkKZ/mH+eT3YA== +"@gearbox-protocol/sdk-gov@^2.28.0": + version "2.28.0" + resolved "https://registry.yarnpkg.com/@gearbox-protocol/sdk-gov/-/sdk-gov-2.28.0.tgz#f858222b0d4bf2661e7213d250f96e112aee8ce3" + integrity sha512-qwvXZALpqYRAc77B6ZC0OSIDk6uEX8Z1B10yfN10ETBvftnDvMwJ6XVhVt/RyRgeW0vqh0W6T4F/y2PFiiW0bw== dependencies: ethers "6.12.1" humanize-duration-ts "^2.1.1"