Skip to content

Commit

Permalink
fix: velodrome cl test deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
Van0k committed Jul 26, 2024
1 parent 4bd6e30 commit 6ed2df1
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 464 deletions.
66 changes: 42 additions & 24 deletions contracts/test/config/WETH_Optimism_config.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ contract CONFIG_OPTIMISM_WETH_V3 is IPoolV3DeployConfig {
PoolV3DeployParams({withdrawalFee: 0, totalDebtLimit: 150_000_000_000_000_000_000_000});

LinearIRMV3DeployParams _irm = LinearIRMV3DeployParams({
U_1: 70_00,
U_2: 90_00,
U_1: 7_000,
U_2: 9_000,
R_base: 0,
R_slope1: 2_00,
R_slope2: 2_50,
R_slope3: 60_00,
R_slope1: 200,
R_slope2: 250,
R_slope3: 6_000,
_isBorrowingMoreU2Forbidden: true
});

Expand All @@ -50,15 +50,16 @@ contract CONFIG_OPTIMISM_WETH_V3 is IPoolV3DeployConfig {
CreditManagerV3DeployParams[] _creditManagers;

constructor() {
_gaugeRates.push(GaugeRate({token: Tokens.WBTC, minRate: 4, maxRate: 40_00}));
_gaugeRates.push(GaugeRate({token: Tokens.USDC_e, minRate: 4, maxRate: 12_00}));
_gaugeRates.push(GaugeRate({token: Tokens.OP, minRate: 4, maxRate: 40_00}));
_gaugeRates.push(GaugeRate({token: Tokens.WLD, minRate: 80, maxRate: 50_00}));
_gaugeRates.push(GaugeRate({token: Tokens.SNX, minRate: 80, maxRate: 50_00}));
_gaugeRates.push(GaugeRate({token: Tokens.yvUSDC_e, minRate: 5, maxRate: 27_00}));
_gaugeRates.push(GaugeRate({token: Tokens.yvWETH, minRate: 4, maxRate: 5_00}));
_gaugeRates.push(GaugeRate({token: Tokens.wstETH, minRate: 4, maxRate: 5_00}));
_gaugeRates.push(GaugeRate({token: Tokens.rETH, minRate: 4, maxRate: 5_00}));
_gaugeRates.push(GaugeRate({token: Tokens.WBTC, minRate: 4, maxRate: 4_000}));
_gaugeRates.push(GaugeRate({token: Tokens.USDC_e, minRate: 4, maxRate: 1_200}));
_gaugeRates.push(GaugeRate({token: Tokens.OP, minRate: 4, maxRate: 4_000}));
_gaugeRates.push(GaugeRate({token: Tokens.WLD, minRate: 80, maxRate: 5_000}));
_gaugeRates.push(GaugeRate({token: Tokens.SNX, minRate: 80, maxRate: 5_000}));
_gaugeRates.push(GaugeRate({token: Tokens.yvUSDC_e, minRate: 5, maxRate: 2_700}));
_gaugeRates.push(GaugeRate({token: Tokens.yvWETH, minRate: 4, maxRate: 500}));
_gaugeRates.push(GaugeRate({token: Tokens.wstETH, minRate: 4, maxRate: 500}));
_gaugeRates.push(GaugeRate({token: Tokens.rETH, minRate: 4, maxRate: 500}));
_gaugeRates.push(GaugeRate({token: Tokens.ezETH, minRate: 4, maxRate: 500}));
_quotaLimits.push(PoolQuotaLimit({token: Tokens.WBTC, quotaIncreaseFee: 1, limit: 150_000_000_000_000_000_000}));
_quotaLimits.push(
PoolQuotaLimit({token: Tokens.USDC_e, quotaIncreaseFee: 1, limit: 1_000_000_000_000_000_000_000})
Expand All @@ -76,6 +77,9 @@ contract CONFIG_OPTIMISM_WETH_V3 is IPoolV3DeployConfig {
PoolQuotaLimit({token: Tokens.wstETH, quotaIncreaseFee: 0, limit: 1_000_000_000_000_000_000_000})
);
_quotaLimits.push(PoolQuotaLimit({token: Tokens.rETH, quotaIncreaseFee: 0, limit: 500_000_000_000_000_000_000}));
_quotaLimits.push(
PoolQuotaLimit({token: Tokens.ezETH, quotaIncreaseFee: 0, limit: 500_000_000_000_000_000_000})
);

{
/// CREDIT_MANAGER_0
Expand All @@ -94,19 +98,21 @@ contract CONFIG_OPTIMISM_WETH_V3 is IPoolV3DeployConfig {
cp.poolLimit = 700_000_000_000_000_000_000;

CollateralTokenHuman[] storage cts = cp.collateralTokens;
cts.push(CollateralTokenHuman({token: Tokens.USDC_e, lt: 94_00}));
cts.push(CollateralTokenHuman({token: Tokens.USDC_e, lt: 9_400}));

cts.push(CollateralTokenHuman({token: Tokens.WBTC, lt: 9_400}));

cts.push(CollateralTokenHuman({token: Tokens.WBTC, lt: 94_00}));
cts.push(CollateralTokenHuman({token: Tokens.OP, lt: 9_000}));

cts.push(CollateralTokenHuman({token: Tokens.OP, lt: 90_00}));
cts.push(CollateralTokenHuman({token: Tokens.yvUSDC_e, lt: 9_400}));

cts.push(CollateralTokenHuman({token: Tokens.yvUSDC_e, lt: 94_00}));
cts.push(CollateralTokenHuman({token: Tokens.wstETH, lt: 9_400}));

cts.push(CollateralTokenHuman({token: Tokens.wstETH, lt: 94_00}));
cts.push(CollateralTokenHuman({token: Tokens.rETH, lt: 9_400}));

cts.push(CollateralTokenHuman({token: Tokens.rETH, lt: 94_00}));
cts.push(CollateralTokenHuman({token: Tokens.ezETH, lt: 9_400}));

cts.push(CollateralTokenHuman({token: Tokens.yvWETH, lt: 94_00}));
cts.push(CollateralTokenHuman({token: Tokens.yvWETH, lt: 9_400}));
Contracts[] storage cs = cp.contracts;
cs.push(Contracts.UNISWAP_V3_ROUTER);
{
Expand Down Expand Up @@ -224,6 +230,18 @@ contract CONFIG_OPTIMISM_WETH_V3 is IPoolV3DeployConfig {
factory: 0xF1046053aa5682b4F9a81b5481394DA16BE5FF5a
})
);
cs.push(Contracts.VELODROME_CL_ROUTER);
{
UniswapV3Pair[] storage uv3p = cp.uniswapV3Pairs;
uv3p.push(
UniswapV3Pair({
router: Contracts.VELODROME_CL_ROUTER,
token0: Tokens.ezETH,
token1: Tokens.wstETH,
fee: 1
})
);
}
cs.push(Contracts.YEARN_USDC_E_VAULT);
cs.push(Contracts.YEARN_WETH_VAULT);
}
Expand All @@ -244,11 +262,11 @@ contract CONFIG_OPTIMISM_WETH_V3 is IPoolV3DeployConfig {
cp.poolLimit = 350_000_000_000_000_000_000;

CollateralTokenHuman[] storage cts = cp.collateralTokens;
cts.push(CollateralTokenHuman({token: Tokens.USDC_e, lt: 94_00}));
cts.push(CollateralTokenHuman({token: Tokens.USDC_e, lt: 9_400}));

cts.push(CollateralTokenHuman({token: Tokens.WLD, lt: 85_00}));
cts.push(CollateralTokenHuman({token: Tokens.WLD, lt: 8_500}));

cts.push(CollateralTokenHuman({token: Tokens.SNX, lt: 85_00}));
cts.push(CollateralTokenHuman({token: Tokens.SNX, lt: 8_500}));
Contracts[] storage cs = cp.contracts;
cs.push(Contracts.UNISWAP_V3_ROUTER);
{
Expand Down
17 changes: 17 additions & 0 deletions contracts/test/suites/LiveTestHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,23 @@ contract LiveTestHelper is IntegrationTestHelper {
vm.prank(CONFIGURATOR);
UniswapV3Adapter(pancakeswapV3Adapter).setPoolStatusBatch(pools);
}

for (uint256 i = 0; i < uniV3Pools.length; ++i) {
if (uniV3Pools[i].router != Contracts.VELODROME_CL_ROUTER) continue;
pools[i] = UniswapV3PoolStatus({
token0: tokenTestSuite.addressOf(uniV3Pools[i].token0),
token1: tokenTestSuite.addressOf(uniV3Pools[i].token1),
fee: uniV3Pools[i].fee,
allowed: true
});
}

address velodromeCLAdapter = getAdapter(creditManager, Contracts.VELODROME_CL_ROUTER);

if (velodromeCLAdapter != address(0)) {
vm.prank(CONFIGURATOR);
UniswapV3Adapter(velodromeCLAdapter).setPoolStatusBatch(pools);
}
}
// SIMPLE INTERFACE SWAPPERS
GenericSwapPair[] memory genericPairs = creditManagerParams.genericSwapPairs;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@gearbox-protocol/eslint-config": "^1.6.1",
"@gearbox-protocol/oracles-v3": "^1.10.3",
"@gearbox-protocol/prettier-config": "^1.5.0",
"@gearbox-protocol/sdk-gov": "^1.64.2",
"@gearbox-protocol/sdk-gov": "^2.12.0",
"@openzeppelin/contracts": "4.9.3",
"@redstone-finance/evm-connector": "0.2.5",
"@typechain/ethers-v5": "^10.1.0",
Expand Down
Loading

0 comments on commit 6ed2df1

Please sign in to comment.