diff --git a/package.json b/package.json index e09803e..1dd8a34 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gammaswap/v1-staking", - "version": "0.10.6", + "version": "0.10.7", "description": "Staking contracts for GammaSwapV1 protocol", "scripts": { "hardhat": "hardhat", @@ -50,9 +50,9 @@ "typescript": ">=4.5.0" }, "dependencies": { - "@gammaswap/v1-core": "^1.2.11", - "@gammaswap/v1-implementations": "^1.2.11", - "@gammaswap/v1-periphery": "^1.2.14", + "@gammaswap/v1-core": "^1.2.16", + "@gammaswap/v1-implementations": "^1.2.15", + "@gammaswap/v1-periphery": "^1.2.16", "@layerzerolabs/lz-sdk": "^0.0.38", "@layerzerolabs/solidity-examples": "^0.0.13", "@layerzerolabs/ua-utils": "^0.0.4", diff --git a/test/foundry/StakingRouter.t.sol b/test/foundry/StakingRouter.t.sol index 5892237..5063e98 100644 --- a/test/foundry/StakingRouter.t.sol +++ b/test/foundry/StakingRouter.t.sol @@ -67,8 +67,9 @@ contract StakingRouterTest is CPMMGammaSwapSetup { assertGt(pool.totalSupply(), 0); } - function testFailStakeInvalidAssetInPool() public { + function testStakeInvalidAssetInPoolError() public { vm.startPrank(user1); + vm.expectRevert(); stakingRouter.stakeLp(address(weth), address(esGs), 1000e18); vm.stopPrank(); } diff --git a/test/foundry/fixtures/CPMMGammaSwapSetup.sol b/test/foundry/fixtures/CPMMGammaSwapSetup.sol index d0be3e3..ef8debd 100644 --- a/test/foundry/fixtures/CPMMGammaSwapSetup.sol +++ b/test/foundry/fixtures/CPMMGammaSwapSetup.sol @@ -6,6 +6,7 @@ import "@gammaswap/v1-core/contracts/base/PoolViewer.sol"; import "@gammaswap/v1-implementations/contracts/pools/CPMMGammaPool.sol"; import "@gammaswap/v1-implementations/contracts/strategies/cpmm/lending/CPMMBorrowStrategy.sol"; import "@gammaswap/v1-implementations/contracts/strategies/cpmm/lending/CPMMRepayStrategy.sol"; +import "@gammaswap/v1-implementations/contracts/strategies/cpmm/rebalance/CPMMRebalanceStrategy.sol"; import "@gammaswap/v1-implementations/contracts/strategies/cpmm/liquidation/CPMMLiquidationStrategy.sol"; import "@gammaswap/v1-implementations/contracts/strategies/cpmm/liquidation/CPMMBatchLiquidationStrategy.sol"; import "@gammaswap/v1-implementations/contracts/strategies/cpmm/CPMMShortStrategy.sol"; @@ -21,6 +22,7 @@ contract CPMMGammaSwapSetup is UniswapSetup, RouterSetup { CPMMBorrowStrategy public longStrategy; CPMMRepayStrategy public repayStrategy; + CPMMRebalanceStrategy public rebalanceStrategy; CPMMShortStrategy public shortStrategy; CPMMLiquidationStrategy public liquidationStrategy; CPMMBatchLiquidationStrategy public batchLiquidationStrategy; @@ -64,13 +66,28 @@ contract CPMMGammaSwapSetup is UniswapSetup, RouterSetup { viewer = new PoolViewer(); longStrategy = new CPMMBorrowStrategy(address(mathLib), maxTotalApy, 2252571, 997, 1000, address(0), baseRate, optimalUtilRate, slope1, slope2); repayStrategy = new CPMMRepayStrategy(address(mathLib), maxTotalApy, 2252571, 997, 1000, address(0), baseRate, optimalUtilRate, slope1, slope2); + rebalanceStrategy = new CPMMRebalanceStrategy(address(mathLib), maxTotalApy, 2252571, 997, 1000, address(0), baseRate, optimalUtilRate, slope1, slope2); shortStrategy = new CPMMShortStrategy(maxTotalApy, 2252571, baseRate, optimalUtilRate, slope1, slope2); liquidationStrategy = new CPMMLiquidationStrategy(address(0), address(mathLib), maxTotalApy, 2252571, 997, 1000, address(0), baseRate, optimalUtilRate, slope1, slope2); batchLiquidationStrategy = new CPMMBatchLiquidationStrategy(address(0), address(mathLib), maxTotalApy, 2252571, 997, 1000, address(0), baseRate, optimalUtilRate, slope1, slope2); bytes32 cfmmHash = hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f'; // UniV2Pair init_code_hash - protocol = new CPMMGammaPool(PROTOCOL_ID, address(factory), address(longStrategy), address(repayStrategy), address(shortStrategy), - address(liquidationStrategy), address(batchLiquidationStrategy), address(viewer), address(0), address(0), address(uniFactory), cfmmHash); + ICPMMGammaPool.InitializationParams memory params = ICPMMGammaPool.InitializationParams({ + protocolId: PROTOCOL_ID, + factory: address(factory), + borrowStrategy: address(longStrategy), + repayStrategy: address(repayStrategy), + rebalanceStrategy: address(rebalanceStrategy), + shortStrategy: address(shortStrategy), + liquidationStrategy: address(liquidationStrategy), + batchLiquidationStrategy: address(batchLiquidationStrategy), + viewer: address(viewer), + externalRebalanceStrategy: address(0), + externalLiquidationStrategy: address(0), + cfmmFactory: address(uniFactory), + cfmmInitCodeHash: cfmmHash + }); + protocol = new CPMMGammaPool(params); factory.addProtocol(address(protocol)); diff --git a/yarn.lock b/yarn.lock index 40b43bc..a238cb1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -444,10 +444,10 @@ "@ethersproject/properties" "^5.7.0" "@ethersproject/strings" "^5.7.0" -"@gammaswap/v1-core@^1.2.11": - version "1.2.11" - resolved "https://npm.pkg.github.com/download/@gammaswap/v1-core/1.2.11/354d4cd420d1bab50ae41711da757a7de563911e#354d4cd420d1bab50ae41711da757a7de563911e" - integrity sha512-BqEeNJb80xG0E7lfy/4ZUfeP0Q1bEoEQnmv58rJp98wtQ/FBQIXDEDKsjzUJdDDE6oa7p/ZJzo+zkFhbInuoKg== +"@gammaswap/v1-core@^1.2.16": + version "1.2.16" + resolved "https://npm.pkg.github.com/download/@gammaswap/v1-core/1.2.16/c2b0db6f20caaccb7c6059a70a8e65f6cb072551#c2b0db6f20caaccb7c6059a70a8e65f6cb072551" + integrity sha512-ZnH3H7KlxRbxhjbSH199JSiPpK6j/7F6JtBoFRz+zTJP+lf8RQwwj6TmTa8dwMI1tLPeUx4zxV9W0IKCPuCesw== dependencies: "@openzeppelin/contracts" "^4.7.0" @@ -458,19 +458,12 @@ dependencies: "@openzeppelin/contracts" "^4.7.0" -"@gammaswap/v1-core@^1.2.9": - version "1.2.9" - resolved "https://npm.pkg.github.com/download/@gammaswap/v1-core/1.2.9/f04530c73d78435d599645bf53c916d16f1f85cb#f04530c73d78435d599645bf53c916d16f1f85cb" - integrity sha512-IjlSZz6Ln37LWwJqg4OaPRFdQIgIH3ZVpgvpuodpOCz9r6GS0vl8TFUCOtY2gCebWrYwwqxELWWPM3/C+49hBQ== - dependencies: - "@openzeppelin/contracts" "^4.7.0" - -"@gammaswap/v1-implementations@^1.2.11": - version "1.2.11" - resolved "https://npm.pkg.github.com/download/@gammaswap/v1-implementations/1.2.11/edbb7952f59feb67b665090d1347742e85aa49d3#edbb7952f59feb67b665090d1347742e85aa49d3" - integrity sha512-NFk6avKZ/oKf5XjDyFkygxYSAiPyMsngdybV8Mv5NIJH0bxWN3zQ++1p7B+bzaFBkGP3aGgOjudsGYC12QobJA== +"@gammaswap/v1-implementations@^1.2.15": + version "1.2.15" + resolved "https://npm.pkg.github.com/download/@gammaswap/v1-implementations/1.2.15/d9ff3f513e02c1d6998f3b0eb226a63f9289c935#d9ff3f513e02c1d6998f3b0eb226a63f9289c935" + integrity sha512-rc2HydKSLa4lh+8LHdNioWkmNCEqST+6MJICKguouqMZIh5sw/nlAwMZ+e5dUGmz83y2xm3Rwi91ahO7fvnJzg== dependencies: - "@gammaswap/v1-core" "^1.2.11" + "@gammaswap/v1-core" "^1.2.16" "@openzeppelin/contracts" "^4.7.0" "@gammaswap/v1-implementations@^1.2.8": @@ -490,12 +483,12 @@ "@gammaswap/v1-staking" "^0.3.9" "@openzeppelin/contracts" "^4.7.0" -"@gammaswap/v1-periphery@^1.2.14": - version "1.2.14" - resolved "https://npm.pkg.github.com/download/@gammaswap/v1-periphery/1.2.14/892ccb723d4bcb2b577cba2b5c1c70198957ba73#892ccb723d4bcb2b577cba2b5c1c70198957ba73" - integrity sha512-qoA1ExTaXh+5ua3i443Rt44kuypfpKSXorx/0U9fDv3wc5IeAzoQXLzfe7rKScgQdbSTH0e8ezudjqIqPvnLOg== +"@gammaswap/v1-periphery@^1.2.16": + version "1.2.16" + resolved "https://npm.pkg.github.com/download/@gammaswap/v1-periphery/1.2.16/40a84a2ab30325ae108e44cb7fe436e96d9e83df#40a84a2ab30325ae108e44cb7fe436e96d9e83df" + integrity sha512-wl5GBk9pY2MTMFVIJEmivfMymsXw9GjoNIinXJsRa2cRsQSuhBkJVXi7oHGv6nOaS4k5R/PbYPOQjT5k14LgFQ== dependencies: - "@gammaswap/v1-core" "^1.2.9" + "@gammaswap/v1-core" "^1.2.16" "@gammaswap/v1-staking" "^0.9.0" "@openzeppelin/contracts" "^4.7.0"