From c3d86c21331dfa084fc318c19247c8e5ed08741a Mon Sep 17 00:00:00 2001 From: nledo Date: Thu, 2 May 2024 18:54:19 -0300 Subject: [PATCH] DAO, LTD and KPK disassemble policy update for GC --- packages/sdk/package.json | 1 + .../GnosisDAO/deFiDisassembleGnosisDAO.ts | 611 +++++++++--------- .../GnosisLTD/deFiDisassembleGnosisLTD.ts | 369 +++++------ .../gnosisChain/KPK/deFiDisassembleKPK.ts | 167 +++++ .../sdk/src/presets/gnosisChain/addresses.ts | 1 + packages/sdk/tasks/manageKarpatkeyRoles.ts | 46 ++ 6 files changed, 694 insertions(+), 501 deletions(-) create mode 100644 packages/sdk/src/presets/gnosisChain/KPK/deFiDisassembleKPK.ts diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 9ab0dd114..ff4781664 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -48,6 +48,7 @@ "apply:ens:eth:swap": "hardhat encodeApplyPresetSwapENS --network mainnet --safe ENS_ETH", "apply:ens:eth:spark": "hardhat encodeApplyPresetsSpark --network mainnet --safe ENS_ETH", "apply:kpk:eth:disassemble": "hardhat encodeApplyPresetsDisassembleKPKmainnet --network mainnet --safe KPK_ETH", + "apply:kpk:gno:disassemble": "hardhat encodeApplyPresetsDisassembleKPKgnosis --network xdai --safe KPK_GNO", "apply:ens:eth:univ3": "hardhat encodeApplyPresetsTestUniV3 --network mainnet --safe ENS_ETH", "apply:ens:eth:maker": "hardhat encodeApplyPresetsTestMaker --network mainnet --safe ENS_ETH", "apply:ens:eth:rocket": "hardhat encodeApplyPresetsTestRocket --network mainnet --safe ENS_ETH", diff --git a/packages/sdk/src/presets/gnosisChain/GnosisDAO/deFiDisassembleGnosisDAO.ts b/packages/sdk/src/presets/gnosisChain/GnosisDAO/deFiDisassembleGnosisDAO.ts index 657795f84..295badf4b 100644 --- a/packages/sdk/src/presets/gnosisChain/GnosisDAO/deFiDisassembleGnosisDAO.ts +++ b/packages/sdk/src/presets/gnosisChain/GnosisDAO/deFiDisassembleGnosisDAO.ts @@ -8,15 +8,22 @@ import { staticEqual, staticOneOf } from "../../helpers/utils" import { AVATAR } from "../../placeholders" import { RolePreset } from "../../types" import { + EURe, GNO, + sDAI, USDC, USDT, WBTC, WETH, + wstETH, WXDAI, aura, balancer, + curve, + x3CRV } from "../addresses" +import { allowErc20Approve } from "../../helpers/erc20" + const preset = { network: 100, @@ -29,6 +36,289 @@ const preset = { ...WstEthExitStrategy1(100), // wstETH -> WETH + //--------------------------------------------------------------------------------------------------------------------------------- + // Agave + //--------------------------------------------------------------------------------------------------------------------------------- + + //--------------------------------------------------------------------------------------------------------------------------------- + // Agave - XDAI + //--------------------------------------------------------------------------------------------------------------------------------- + + allow.gnosis.agave.lending_pool["setUserUseReserveAsCollateral"](WXDAI), + allow.gnosis.agave.wxdai_gateway["repayETH"](undefined, undefined, AVATAR, { + send: true, + }), + allow.gnosis.agave.wxdai_gateway["withdrawETH"](undefined, AVATAR), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Agave - GNO/WETH/USDC/USDT + //--------------------------------------------------------------------------------------------------------------------------------- + + allow.gnosis.agave.lending_pool["setUserUseReserveAsCollateral"]({ + oneOf: [GNO, WETH, USDC, USDT], + }), + allow.gnosis.agave.lending_pool["repay"]( + { + oneOf: [GNO, WETH, USDC, USDT], + }, + undefined, + undefined, + AVATAR + ), + allow.gnosis.agave.lending_pool["withdraw"]( + { + oneOf: [GNO, WETH, USDC, USDT], + }, + undefined, + AVATAR + ), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Agave - Staking + //--------------------------------------------------------------------------------------------------------------------------------- + + allow.gnosis.agave.stkAGVE["redeem"](AVATAR), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Aura wstETH/WETH + Balancer wstETH/WETH + //--------------------------------------------------------------------------------------------------------------------------------- + + ...auraExitStrategy2( + aura.aurabb_WETH_wstETH_REWARDER, + balancer.bb_WETH_wstETH_pId + ), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Aura COW/GNO + Balancer COW/GNO + //--------------------------------------------------------------------------------------------------------------------------------- + + ...auraExitStrategy2( + aura.aura50COW_50GNO_REWARDER, + balancer.B_50COW_50GNO_pId + ), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Aura EURe/sDAI + Balancer EURe/sDAI + //--------------------------------------------------------------------------------------------------------------------------------- + + ...auraExitStrategy2(aura.auraEURe_sDAI_REWARDER, balancer.B_EURe_sDAI_pId), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Aura sBAL3 + Balancer sBAL3 + //--------------------------------------------------------------------------------------------------------------------------------- + + ...auraExitStrategy2(aura.aurasBAL3_REWARDER, balancer.sBAL3_pId), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer + //--------------------------------------------------------------------------------------------------------------------------------- + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer wstETH/GNO + //--------------------------------------------------------------------------------------------------------------------------------- + + ...balancerExitStrategy1(balancer.B_50wstETH_50GNO_pId), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer wstETH/sDAI + //--------------------------------------------------------------------------------------------------------------------------------- + + ...balancerExitStrategy1(balancer.B_50sDAI_50wstETH_pId), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer WETH/wstETH + //--------------------------------------------------------------------------------------------------------------------------------- + + // Already considered (Aura) + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer staBAL3/wstETH + //--------------------------------------------------------------------------------------------------------------------------------- + + ...balancerExitStrategy1(balancer.B_50USD_50wstETH_pId), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer sBAL3 + //--------------------------------------------------------------------------------------------------------------------------------- + + // Already considered (Aura) + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer wstETH/BAL/AURA + //--------------------------------------------------------------------------------------------------------------------------------- + + ...balancerExitStrategy1(balancer.B_50wstETH_25BAL_25AURA_pId), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer WETH/BAL/GNO/wxDAI + //--------------------------------------------------------------------------------------------------------------------------------- + + ...balancerExitStrategy1(balancer.B_25WETH_25BAL_25GNO_25wxDAI_pId), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer wstETH/COW + //--------------------------------------------------------------------------------------------------------------------------------- + + ...balancerExitStrategy1(balancer.B_50wstETH_50COW_pId), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer stEUR/EURe + //--------------------------------------------------------------------------------------------------------------------------------- + + ...balancerExitStrategy1(balancer.B_stEUR_EURe_pId), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer AGVE/GNO + //--------------------------------------------------------------------------------------------------------------------------------- + + ...balancerExitStrategy1(balancer.B_50AGVE_50GNO_pId), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer BAL/GNO/wstETH/WETH/WXDAI + //--------------------------------------------------------------------------------------------------------------------------------- + + ...balancerExitStrategy1(balancer.BAL_GNO_wstETH_WETH_WXDAI_pId), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer EURe/staBAL3 + //--------------------------------------------------------------------------------------------------------------------------------- + + ...balancerExitStrategy1(balancer.B_EURe_staBAL3_pId), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer staBAL3 + //--------------------------------------------------------------------------------------------------------------------------------- + + ...balancerExitStrategy1(balancer.staBAL3_pId), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer WETH/wstETH + //--------------------------------------------------------------------------------------------------------------------------------- + ...allowErc20Approve([WETH, wstETH], [balancer.VAULT]), + { + targetAddress: balancer.VAULT, + signature: + "swap((bytes32,uint8,address,address,uint256,bytes),(address,bool,address,bool),uint256,uint256)", + params: { + [0]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000e0", + "bytes32" + ), // Offset of the tuple from beginning 224=32*7 + [1]: staticEqual(AVATAR), // recipient + [3]: staticEqual(AVATAR), // sender + [7]: staticEqual( + "0xbad20c15a773bf03ab973302f61fabcea5101f0a000000000000000000000034", + "bytes32" + ), + [9]: staticOneOf([WETH, wstETH], "address"), // Asset in + [10]: staticOneOf([WETH, wstETH], "address"), // Asset out + [12]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000c0", + "bytes32" + ), // Offset of bytes from beginning of tuple 192=32*6 + [13]: staticEqual( + "0x0000000000000000000000000000000000000000000000000000000000000000", + "bytes32" + ), // bytes (userData) = for all current Balancer pools this can be left empty + }, + }, + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer sBAL3 - Swaps + //--------------------------------------------------------------------------------------------------------------------------------- + ...allowErc20Approve([sDAI, USDC, USDT], [balancer.VAULT]), + { + targetAddress: balancer.VAULT, + signature: + "swap((bytes32,uint8,address,address,uint256,bytes),(address,bool,address,bool),uint256,uint256)", + params: { + [0]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000e0", + "bytes32" + ), // Offset of the tuple from beginning 224=32*7 + [1]: staticEqual(AVATAR), // recipient + [3]: staticEqual(AVATAR), // sender + [7]: staticEqual( + "0x7644fa5d0ea14fcf3e813fdf93ca9544f8567655000000000000000000000066", + "bytes32" + ), + [9]: staticOneOf([sDAI, USDC, USDT], "address"), // Asset in + [10]: staticOneOf([sDAI, USDC, USDT], "address"), // Asset out + [12]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000c0", + "bytes32" + ), // Offset of bytes from beginning of tuple 192=32*6 + [13]: staticEqual( + "0x0000000000000000000000000000000000000000000000000000000000000000", + "bytes32" + ), // bytes (userData) = for all current Balancer pools this can be left empty + }, + }, + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer staBAL3 - Swaps + //--------------------------------------------------------------------------------------------------------------------------------- + ...allowErc20Approve([USDC, USDT, WXDAI], [balancer.VAULT]), + { + targetAddress: balancer.VAULT, + signature: + "swap((bytes32,uint8,address,address,uint256,bytes),(address,bool,address,bool),uint256,uint256)", + params: { + [0]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000e0", + "bytes32" + ), // Offset of the tuple from beginning 224=32*7 + [1]: staticEqual(AVATAR), // recipient + [3]: staticEqual(AVATAR), // sender + [7]: staticEqual( + "0x2086f52651837600180de173b09470f54ef7491000000000000000000000004f", + "bytes32" + ), + [9]: staticOneOf([USDC, USDT, WXDAI], "address"), // Asset in + [10]: staticOneOf([USDC, USDT, WXDAI], "address"), // Asset out + [12]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000c0", + "bytes32" + ), // Offset of bytes from beginning of tuple 192=32*6 + [13]: staticEqual( + "0x0000000000000000000000000000000000000000000000000000000000000000", + "bytes32" + ), // bytes (userData) = for all current Balancer pools this can be left empty + }, + }, + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer staBAL3/wstETH - Swaps + //--------------------------------------------------------------------------------------------------------------------------------- + ...allowErc20Approve([balancer.staBAL3, wstETH], [balancer.VAULT]), + { + targetAddress: balancer.VAULT, + signature: + "swap((bytes32,uint8,address,address,uint256,bytes),(address,bool,address,bool),uint256,uint256)", + params: { + [0]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000e0", + "bytes32" + ), // Offset of the tuple from beginning 224=32*7 + [1]: staticEqual(AVATAR), // recipient + [3]: staticEqual(AVATAR), // sender + [7]: staticEqual( + "0xeb30c85cc528537f5350cf5684ce6a4538e13394000200000000000000000059", + "bytes32" + ), + [9]: staticOneOf([balancer.sBAL3, wstETH], "address"), // Asset in + [10]: staticOneOf([balancer.sBAL3, wstETH], "address"), // Asset out + [12]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000c0", + "bytes32" + ), // Offset of bytes from beginning of tuple 192=32*6 + [13]: staticEqual( + "0x0000000000000000000000000000000000000000000000000000000000000000", + "bytes32" + ), // bytes (userData) = for all current Balancer pools this can be left empty + }, + }, + //--------------------------------------------------------------------------------------------------------------------------------- // Curve //--------------------------------------------------------------------------------------------------------------------------------- @@ -37,42 +327,10 @@ const preset = { // Curve 3pool //--------------------------------------------------------------------------------------------------------------------------------- - // Remove Liquidity - // { - // targetAddress: x3CRV_POOL, - // signature: "remove_liquidity(uint256,uint256[3])", - // }, allow.gnosis.curve.x3CRV_pool["remove_liquidity"](), - - // Remove Liquidity of One Coin - // { - // targetAddress: x3CRV_POOL, - // signature: "remove_liquidity_one_coin(uint256,int128,uint256)", - // }, allow.gnosis.curve.x3CRV_pool["remove_liquidity_one_coin"](), - - // Remove Liquidity Imbalance - // { - // targetAddress: x3CRV_POOL, - // signature: "remove_liquidity_imbalance(uint256[3],uint256)", - // }, allow.gnosis.curve.x3CRV_pool["remove_liquidity_imbalance"](), - - // Unstake - // { - // targetAddress: x3CRV_GAUGE, - // signature: "withdraw(uint256)", - // }, allow.gnosis.curve.x3CRV_gauge["withdraw(uint256)"](), - - // NO EVIDENCE OF BEING USED - // { - // targetAddress: x3CRV_GAUGE, - // signature: "withdraw(uint256,address,bool)", - // params: { - // [1]: staticEqual(AVATAR), - // }, - // }, allow.gnosis.curve.x3CRV_gauge["withdraw(uint256,address,bool)"]( undefined, AVATAR @@ -82,55 +340,17 @@ const preset = { // Curve EURe/x3CRV //--------------------------------------------------------------------------------------------------------------------------------- - // Remove Liquidity - // { - // targetAddress: crvEUReUSD_POOL, - // signature: "remove_liquidity(uint256,uint256[2])", - // }, allow.gnosis.curve.crvEUReUSD_pool[ "remove_liquidity(uint256,uint256[2])" ](), - - // Remove Liquidity (Underlying, using ZAP) - // { - // targetAddress: crvEUReUSD_ZAP, - // signature: "remove_liquidity(uint256,uint256[4])", - // }, allow.gnosis.curve.crvEUReUSD_zap["remove_liquidity(uint256,uint256[4])"](), - - // Remove Liquidity of One Coin - // { - // targetAddress: crvEUReUSD_POOL, - // signature: "remove_liquidity_one_coin(uint256,uint256,uint256)", - // }, allow.gnosis.curve.crvEUReUSD_pool[ "remove_liquidity_one_coin(uint256,uint256,uint256)" ](), - - // Remove Liquidity of One Coin (Underlying, using ZAP) - // { - // targetAddress: crvEUReUSD_ZAP, - // signature: "remove_liquidity_one_coin(uint256,uint256,uint256)", - // }, allow.gnosis.curve.crvEUReUSD_zap[ "remove_liquidity_one_coin(uint256,uint256,uint256)" ](), - - // Unstake - // { - // targetAddress: crvEUReUSD_GAUGE, - // signature: "withdraw(uint256)", - // }, allow.gnosis.curve.crvEUReUSD_gauge["withdraw(uint256)"](), - - // NO EVIDENCE OF BEING USED - // { - // targetAddress: crvEUReUSD_GAUGE, - // signature: "withdraw(uint256,address,bool)", - // params: { - // [1]: staticEqual(AVATAR), - // }, - // }, allow.gnosis.curve.crvEUReUSD_gauge["withdraw(uint256,address,bool)"]( undefined, AVATAR @@ -140,24 +360,16 @@ const preset = { // Curve sGNO/GNO //--------------------------------------------------------------------------------------------------------------------------------- - // Remove Liquidity allow.gnosis.curve.sgnoCRV_lp_pool[ "remove_liquidity(uint256,uint256[2])" ](), - - // Remove Liquidity of One Coin allow.gnosis.curve.sgnoCRV_lp_pool[ "remove_liquidity_one_coin(uint256,int128,uint256)" ](), - - // Remove Liquidity Imbalance Coin allow.gnosis.curve.sgnoCRV_lp_pool[ "remove_liquidity_imbalance(uint256[2],uint256)" ](), - - // Unstake allow.gnosis.curve.sgnoCRV_gauge["withdraw(uint256)"](), - // NO EVIDENCE OF BEING USED allow.gnosis.curve.sgnoCRV_gauge["withdraw(uint256,address,bool)"]( undefined, AVATAR @@ -167,23 +379,13 @@ const preset = { // Curve tricrypto //--------------------------------------------------------------------------------------------------------------------------------- - // Remove Liquidity allow.gnosis.curve.crv3crypto_pool["remove_liquidity"](), - - // Remove Liquidity (Underlying, using ZAP) allow.gnosis.curve.crv3crypto_zap["remove_liquidity(uint256,uint256[5])"](), - - // Remove Liquidity of One Coin allow.gnosis.curve.crv3crypto_pool["remove_liquidity_one_coin"](), - - // Remove Liquidity of One Coin (Underlying, using ZAP) allow.gnosis.curve.crv3crypto_zap[ "remove_liquidity_one_coin(uint256,uint256,uint256)" ](), - - // Unstake allow.gnosis.curve.crv3crypto_gauge["withdraw(uint256)"](), - // NO EVIDENCE OF BEING USED allow.gnosis.curve.crv3crypto_gauge["withdraw(uint256,address,bool)"]( undefined, AVATAR @@ -193,24 +395,16 @@ const preset = { // Curve rGNO/sGNO //--------------------------------------------------------------------------------------------------------------------------------- - // Remove Liquidity allow.gnosis.curve.rgnoCRV_lp_pool[ "remove_liquidity(uint256,uint256[2])" ](), - - // Remove Liquidity of One Coin allow.gnosis.curve.rgnoCRV_lp_pool[ "remove_liquidity_one_coin(uint256,int128,uint256)" ](), - - // Remove Liquidity Imbalance Coin allow.gnosis.curve.rgnoCRV_lp_pool[ "remove_liquidity_imbalance(uint256[2],uint256)" ](), - - // Unstake allow.gnosis.curve.rgnoCRV_gauge["withdraw(uint256)"](), - // NO EVIDENCE OF BEING USED allow.gnosis.curve.rgnoCRV_gauge["withdraw(uint256,address,bool)"]( undefined, AVATAR @@ -220,70 +414,44 @@ const preset = { // Curve MAI/x3CRV //--------------------------------------------------------------------------------------------------------------------------------- - // Remove Liquidity - // { - // targetAddress: MAIx3CRV_LP_POOL, - // signature: "remove_liquidity(uint256,uint256[2])", - // }, allow.gnosis.curve.MAIx3CRV_lp_pool[ "remove_liquidity(uint256,uint256[2])" ](), - - // Remove Liquidity (Underlying, using ZAP) - // { - // targetAddress: FACTORY_METAPOOLS_ZAP, - // signature: "remove_liquidity(address,uint256,uint256[4])", - // }, allow.gnosis.curve.factory_metapools_zap[ "remove_liquidity(address,uint256,uint256[4])" ](), - - // Remove Liquidity of One Coin - // { - // targetAddress: MAIx3CRV_LP_POOL, - // signature: "remove_liquidity_one_coin(uint256,int128,uint256)", - // }, allow.gnosis.curve.MAIx3CRV_lp_pool[ "remove_liquidity_one_coin(uint256,int128,uint256)" ](), - - // Remove Liquidity of One Coin (Underlying, using ZAP) - // { - // targetAddress: FACTORY_METAPOOLS_ZAP, - // signature: "remove_liquidity_one_coin(address,uint256,int128,uint256)", - // }, allow.gnosis.curve.factory_metapools_zap[ "remove_liquidity_one_coin(address,uint256,int128,uint256)" ](), - - // Unstake - // { - // targetAddress: MAIx3CRV_GAUGE, - // signature: "withdraw(uint256)", - // }, allow.gnosis.curve.MAIx3CRV_gauge["withdraw(uint256)"](), - - // NO EVIDENCE OF BEING USED - // { - // targetAddress: MAIx3CRV_GAUGE, - // signature: "withdraw(uint256,address,bool)", - // params: { - // [1]: staticEqual(AVATAR), - // }, - // }, allow.gnosis.curve.MAIx3CRV_gauge["withdraw(uint256,address,bool)"]( undefined, AVATAR ), //--------------------------------------------------------------------------------------------------------------------------------- - // Honeyswap + // Curve - 3pool - Swaps //--------------------------------------------------------------------------------------------------------------------------------- + ...allowErc20Approve([USDC, USDT, WXDAI], [curve.x3CRV_POOL]), + + allow.gnosis.curve.x3CRV_pool["exchange"](), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Curve - EURe/x3CRV - Swaps + //--------------------------------------------------------------------------------------------------------------------------------- + ...allowErc20Approve([EURe, x3CRV], [curve.crvEUReUSD_POOL]), + ...allowErc20Approve([EURe, USDC, USDT, WXDAI], [curve.crvEUReUSD_ZAP]), + + allow.gnosis.curve.crvEUReUSD_pool["exchange(uint256,uint256,uint256,uint256)"](), + allow.gnosis.curve.crvEUReUSD_zap["exchange_underlying(uint256,uint256,uint256,uint256)"](), + //--------------------------------------------------------------------------------------------------------------------------------- // Honeyswap //--------------------------------------------------------------------------------------------------------------------------------- - // Remove Liquidity allow.gnosis.honeyswap.router["removeLiquidity"]( undefined, undefined, @@ -297,7 +465,6 @@ const preset = { // Swapr //--------------------------------------------------------------------------------------------------------------------------------- - // Remove Liquidity allow.gnosis.swapr.router["removeLiquidity"]( undefined, undefined, @@ -306,7 +473,6 @@ const preset = { undefined, AVATAR ), - allow.gnosis.swapr.router["removeLiquidityWithPermit"]( undefined, undefined, @@ -315,8 +481,6 @@ const preset = { undefined, AVATAR ), - - // Remove Liquidity using XDAI allow.gnosis.swapr.router["removeLiquidityETH"]( undefined, undefined, @@ -324,7 +488,6 @@ const preset = { undefined, AVATAR ), - allow.gnosis.swapr.router["removeLiquidityETHWithPermit"]( undefined, undefined, @@ -337,7 +500,6 @@ const preset = { // SushiSwap //--------------------------------------------------------------------------------------------------------------------------------- - // Remove Liquidity allow.gnosis.sushiswap.router["removeLiquidity"]( undefined, undefined, @@ -346,7 +508,6 @@ const preset = { undefined, AVATAR ), - allow.gnosis.sushiswap.router["removeLiquidityWithPermit"]( undefined, undefined, @@ -355,173 +516,11 @@ const preset = { undefined, AVATAR ), - - // Unstake and Claim Rewards allow.gnosis.sushiswap.minichef_v2["withdrawAndHarvest"]( undefined, undefined, AVATAR - ), - - //--------------------------------------------------------------------------------------------------------------------------------- - // Agave - //--------------------------------------------------------------------------------------------------------------------------------- - - //--------------------------------------------------------------------------------------------------------------------------------- - // Agave - XDAI - //--------------------------------------------------------------------------------------------------------------------------------- - - // Set/Unset (bool "useAsCollateral" = True / "useAsCollateral" = False) WXDAI as Collateral (Set) - allow.gnosis.agave.lending_pool["setUserUseReserveAsCollateral"](WXDAI), - - // Repay - allow.gnosis.agave.wxdai_gateway["repayETH"](undefined, undefined, AVATAR, { - send: true, - }), - - // Withdraw - allow.gnosis.agave.wxdai_gateway["withdrawETH"](undefined, AVATAR), - - //--------------------------------------------------------------------------------------------------------------------------------- - // Agave - GNO/WETH/USDC/USDT - //--------------------------------------------------------------------------------------------------------------------------------- - - // Set/Unset (bool "useAsCollateral" = True / "useAsCollateral" = False) the token as Collateral (Set) - allow.gnosis.agave.lending_pool["setUserUseReserveAsCollateral"]({ - oneOf: [GNO, WETH, USDC, USDT], - }), - - // Repay - allow.gnosis.agave.lending_pool["repay"]( - { - oneOf: [GNO, WETH, USDC, USDT], - }, - undefined, - undefined, - AVATAR - ), - - // Withdraw - allow.gnosis.agave.lending_pool["withdraw"]( - { - oneOf: [GNO, WETH, USDC, USDT], - }, - undefined, - AVATAR - ), - - //--------------------------------------------------------------------------------------------------------------------------------- - // Agave - Staking - //--------------------------------------------------------------------------------------------------------------------------------- - - // Unstake - allow.gnosis.agave.stkAGVE["redeem"](AVATAR), - - //--------------------------------------------------------------------------------------------------------------------------------- - // Aura wstETH/WETH + Balancer wstETH/WETH - //--------------------------------------------------------------------------------------------------------------------------------- - - ...auraExitStrategy2( - aura.aurabb_WETH_wstETH_REWARDER, - balancer.bb_WETH_wstETH_pId - ), - - //--------------------------------------------------------------------------------------------------------------------------------- - // Aura COW/GNO + Balancer COW/GNO - //--------------------------------------------------------------------------------------------------------------------------------- - - ...auraExitStrategy2( - aura.aura50COW_50GNO_REWARDER, - balancer.B_50COW_50GNO_pId - ), - - //--------------------------------------------------------------------------------------------------------------------------------- - // Aura EURe/sDAI + Balancer EURe/sDAI - //--------------------------------------------------------------------------------------------------------------------------------- - - ...auraExitStrategy2(aura.auraEURe_sDAI_REWARDER, balancer.B_EURe_sDAI_pId), - - //--------------------------------------------------------------------------------------------------------------------------------- - // Balancer - //--------------------------------------------------------------------------------------------------------------------------------- - - //--------------------------------------------------------------------------------------------------------------------------------- - // Balancer wstETH/GNO - //--------------------------------------------------------------------------------------------------------------------------------- - - ...balancerExitStrategy1(balancer.B_50wstETH_50GNO_pId), - - //--------------------------------------------------------------------------------------------------------------------------------- - // Balancer wstETH/sDAI - //--------------------------------------------------------------------------------------------------------------------------------- - - ...balancerExitStrategy1(balancer.B_50sDAI_50wstETH_pId), - - //--------------------------------------------------------------------------------------------------------------------------------- - // Balancer WETH/wstETH - //--------------------------------------------------------------------------------------------------------------------------------- - - // Already considered (Aura) - - //--------------------------------------------------------------------------------------------------------------------------------- - // Balancer staBAL3/wstETH - //--------------------------------------------------------------------------------------------------------------------------------- - - ...balancerExitStrategy1(balancer.B_50USD_50wstETH_pId), - - //--------------------------------------------------------------------------------------------------------------------------------- - // Balancer sBAL3 - //--------------------------------------------------------------------------------------------------------------------------------- - - ...balancerExitStrategy1(balancer.sBAL3_pId), - - //--------------------------------------------------------------------------------------------------------------------------------- - // Balancer wstETH/BAL/AURA - //--------------------------------------------------------------------------------------------------------------------------------- - - ...balancerExitStrategy1(balancer.B_50wstETH_25BAL_25AURA_pId), - - //--------------------------------------------------------------------------------------------------------------------------------- - // Balancer WETH/BAL/GNO/wxDAI - //--------------------------------------------------------------------------------------------------------------------------------- - - ...balancerExitStrategy1(balancer.B_25WETH_25BAL_25GNO_25wxDAI_pId), - - //--------------------------------------------------------------------------------------------------------------------------------- - // Balancer wstETH/COW - //--------------------------------------------------------------------------------------------------------------------------------- - - ...balancerExitStrategy1(balancer.B_50wstETH_50COW_pId), - - //--------------------------------------------------------------------------------------------------------------------------------- - // Balancer stEUR/EURe - //--------------------------------------------------------------------------------------------------------------------------------- - - ...balancerExitStrategy1(balancer.B_stEUR_EURe_pId), - - //--------------------------------------------------------------------------------------------------------------------------------- - // Balancer AGVE/GNO - //--------------------------------------------------------------------------------------------------------------------------------- - - ...balancerExitStrategy1(balancer.B_50AGVE_50GNO_pId), - - //--------------------------------------------------------------------------------------------------------------------------------- - // Balancer BAL/GNO/wstETH/WETH/WXDAI - //--------------------------------------------------------------------------------------------------------------------------------- - - ...balancerExitStrategy1(balancer.BAL_GNO_wstETH_WETH_WXDAI_pId), - - //--------------------------------------------------------------------------------------------------------------------------------- - // Balancer EURe/staBAL3 - //--------------------------------------------------------------------------------------------------------------------------------- - - ...balancerExitStrategy1(balancer.B_EURe_staBAL3_pId), - - //--------------------------------------------------------------------------------------------------------------------------------- - // Balancer staBAL3 - //--------------------------------------------------------------------------------------------------------------------------------- - - ...balancerExitStrategy1(balancer.staBAL3_pId), + ) ], placeholders: { AVATAR }, } satisfies RolePreset diff --git a/packages/sdk/src/presets/gnosisChain/GnosisLTD/deFiDisassembleGnosisLTD.ts b/packages/sdk/src/presets/gnosisChain/GnosisLTD/deFiDisassembleGnosisLTD.ts index 4f5ddd04c..943b00996 100644 --- a/packages/sdk/src/presets/gnosisChain/GnosisLTD/deFiDisassembleGnosisLTD.ts +++ b/packages/sdk/src/presets/gnosisChain/GnosisLTD/deFiDisassembleGnosisLTD.ts @@ -4,7 +4,10 @@ import { balancerExitStrategy1 } from "../../helpers/ExitStrategies/BalancerExit import { WstEthExitStrategy1 } from "../../helpers/ExitStrategies/HoldingsExitStrategies" import { AVATAR } from "../../placeholders" import { RolePreset } from "../../types" -import { aura, balancer, WXDAI, realt } from "../addresses" +import { EURe, sDAI, USDC, USDT, WETH, wstETH, WXDAI, x3CRV, aura, balancer, curve, realt } from "../addresses" +import { allowErc20Approve } from "../../helpers/erc20" +import { staticEqual, staticOneOf } from "../../helpers/utils" + const preset = { network: 100, @@ -46,34 +49,132 @@ const preset = { ...balancerExitStrategy1(balancer.B_50EURe_50GBPe_pId), //--------------------------------------------------------------------------------------------------------------------------------- - // SushiSwap - //--------------------------------------------------------------------------------------------------------------------------------- - - // Remove Liquidity - allow.gnosis.sushiswap.router["removeLiquidity"]( - undefined, - undefined, - undefined, - undefined, - undefined, - AVATAR - ), - - allow.gnosis.sushiswap.router["removeLiquidityWithPermit"]( - undefined, - undefined, - undefined, - undefined, - undefined, - AVATAR - ), - - // Unstake and Claim Rewards - allow.gnosis.sushiswap.minichef_v2["withdrawAndHarvest"]( - undefined, - undefined, - AVATAR - ), + // Balancer WETH/wstETH + //--------------------------------------------------------------------------------------------------------------------------------- + ...allowErc20Approve([WETH, wstETH], [balancer.VAULT]), + { + targetAddress: balancer.VAULT, + signature: + "swap((bytes32,uint8,address,address,uint256,bytes),(address,bool,address,bool),uint256,uint256)", + params: { + [0]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000e0", + "bytes32" + ), // Offset of the tuple from beginning 224=32*7 + [1]: staticEqual(AVATAR), // recipient + [3]: staticEqual(AVATAR), // sender + [7]: staticEqual( + "0xbad20c15a773bf03ab973302f61fabcea5101f0a000000000000000000000034", + "bytes32" + ), + [9]: staticOneOf([WETH, wstETH], "address"), // Asset in + [10]: staticOneOf([WETH, wstETH], "address"), // Asset out + [12]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000c0", + "bytes32" + ), // Offset of bytes from beginning of tuple 192=32*6 + [13]: staticEqual( + "0x0000000000000000000000000000000000000000000000000000000000000000", + "bytes32" + ), // bytes (userData) = for all current Balancer pools this can be left empty + }, + }, + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer sBAL3 - Swaps + //--------------------------------------------------------------------------------------------------------------------------------- + ...allowErc20Approve([sDAI, USDC, USDT], [balancer.VAULT]), + { + targetAddress: balancer.VAULT, + signature: + "swap((bytes32,uint8,address,address,uint256,bytes),(address,bool,address,bool),uint256,uint256)", + params: { + [0]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000e0", + "bytes32" + ), // Offset of the tuple from beginning 224=32*7 + [1]: staticEqual(AVATAR), // recipient + [3]: staticEqual(AVATAR), // sender + [7]: staticEqual( + "0x7644fa5d0ea14fcf3e813fdf93ca9544f8567655000000000000000000000066", + "bytes32" + ), + [9]: staticOneOf([sDAI, USDC, USDT], "address"), // Asset in + [10]: staticOneOf([sDAI, USDC, USDT], "address"), // Asset out + [12]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000c0", + "bytes32" + ), // Offset of bytes from beginning of tuple 192=32*6 + [13]: staticEqual( + "0x0000000000000000000000000000000000000000000000000000000000000000", + "bytes32" + ), // bytes (userData) = for all current Balancer pools this can be left empty + }, + }, + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer staBAL3 - Swaps + //--------------------------------------------------------------------------------------------------------------------------------- + ...allowErc20Approve([USDC, USDT, WXDAI], [balancer.VAULT]), + { + targetAddress: balancer.VAULT, + signature: + "swap((bytes32,uint8,address,address,uint256,bytes),(address,bool,address,bool),uint256,uint256)", + params: { + [0]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000e0", + "bytes32" + ), // Offset of the tuple from beginning 224=32*7 + [1]: staticEqual(AVATAR), // recipient + [3]: staticEqual(AVATAR), // sender + [7]: staticEqual( + "0x2086f52651837600180de173b09470f54ef7491000000000000000000000004f", + "bytes32" + ), + [9]: staticOneOf([USDC, USDT, WXDAI], "address"), // Asset in + [10]: staticOneOf([USDC, USDT, WXDAI], "address"), // Asset out + [12]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000c0", + "bytes32" + ), // Offset of bytes from beginning of tuple 192=32*6 + [13]: staticEqual( + "0x0000000000000000000000000000000000000000000000000000000000000000", + "bytes32" + ), // bytes (userData) = for all current Balancer pools this can be left empty + }, + }, + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer staBAL3/wstETH - Swaps + //--------------------------------------------------------------------------------------------------------------------------------- + ...allowErc20Approve([balancer.staBAL3, wstETH], [balancer.VAULT]), + { + targetAddress: balancer.VAULT, + signature: + "swap((bytes32,uint8,address,address,uint256,bytes),(address,bool,address,bool),uint256,uint256)", + params: { + [0]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000e0", + "bytes32" + ), // Offset of the tuple from beginning 224=32*7 + [1]: staticEqual(AVATAR), // recipient + [3]: staticEqual(AVATAR), // sender + [7]: staticEqual( + "0xeb30c85cc528537f5350cf5684ce6a4538e13394000200000000000000000059", + "bytes32" + ), + [9]: staticOneOf([balancer.sBAL3, wstETH], "address"), // Asset in + [10]: staticOneOf([balancer.sBAL3, wstETH], "address"), // Asset out + [12]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000c0", + "bytes32" + ), // Offset of bytes from beginning of tuple 192=32*6 + [13]: staticEqual( + "0x0000000000000000000000000000000000000000000000000000000000000000", + "bytes32" + ), // bytes (userData) = for all current Balancer pools this can be left empty + }, + }, //--------------------------------------------------------------------------------------------------------------------------------- // Curve @@ -83,42 +184,10 @@ const preset = { // Curve 3pool //--------------------------------------------------------------------------------------------------------------------------------- - // Remove Liquidity - // { - // targetAddress: x3CRV_POOL, - // signature: "remove_liquidity(uint256,uint256[3])", - // }, allow.gnosis.curve.x3CRV_pool["remove_liquidity"](), - - // Remove Liquidity of One Coin - // { - // targetAddress: x3CRV_POOL, - // signature: "remove_liquidity_one_coin(uint256,int128,uint256)", - // }, allow.gnosis.curve.x3CRV_pool["remove_liquidity_one_coin"](), - - // Remove Liquidity Imbalance - // { - // targetAddress: x3CRV_POOL, - // signature: "remove_liquidity_imbalance(uint256[3],uint256)", - // }, allow.gnosis.curve.x3CRV_pool["remove_liquidity_imbalance"](), - - // Unstake - // { - // targetAddress: x3CRV_GAUGE, - // signature: "withdraw(uint256)", - // }, allow.gnosis.curve.x3CRV_gauge["withdraw(uint256)"](), - - // NO EVIDENCE OF BEING USED - // { - // targetAddress: x3CRV_GAUGE, - // signature: "withdraw(uint256,address,bool)", - // params: { - // [1]: staticEqual(AVATAR), - // }, - // }, allow.gnosis.curve.x3CRV_gauge["withdraw(uint256,address,bool)"]( undefined, AVATAR @@ -128,55 +197,17 @@ const preset = { // Curve EURe/x3CRV //--------------------------------------------------------------------------------------------------------------------------------- - // Remove Liquidity - // { - // targetAddress: crvEUReUSD_POOL, - // signature: "remove_liquidity(uint256,uint256[2])", - // }, allow.gnosis.curve.crvEUReUSD_pool[ "remove_liquidity(uint256,uint256[2])" ](), - - // Remove Liquidity (Underlying, using ZAP) - // { - // targetAddress: crvEUReUSD_ZAP, - // signature: "remove_liquidity(uint256,uint256[4])", - // }, allow.gnosis.curve.crvEUReUSD_zap["remove_liquidity(uint256,uint256[4])"](), - - // Remove Liquidity of One Coin - // { - // targetAddress: crvEUReUSD_POOL, - // signature: "remove_liquidity_one_coin(uint256,uint256,uint256)", - // }, allow.gnosis.curve.crvEUReUSD_pool[ "remove_liquidity_one_coin(uint256,uint256,uint256)" ](), - - // Remove Liquidity of One Coin (Underlying, using ZAP) - // { - // targetAddress: crvEUReUSD_ZAP, - // signature: "remove_liquidity_one_coin(uint256,uint256,uint256)", - // }, allow.gnosis.curve.crvEUReUSD_zap[ "remove_liquidity_one_coin(uint256,uint256,uint256)" ](), - - // Unstake - // { - // targetAddress: crvEUReUSD_GAUGE, - // signature: "withdraw(uint256)", - // }, allow.gnosis.curve.crvEUReUSD_gauge["withdraw(uint256)"](), - - // NO EVIDENCE OF BEING USED - // { - // targetAddress: crvEUReUSD_GAUGE, - // signature: "withdraw(uint256,address,bool)", - // params: { - // [1]: staticEqual(AVATAR), - // }, - // }, allow.gnosis.curve.crvEUReUSD_gauge["withdraw(uint256,address,bool)"]( undefined, AVATAR @@ -186,24 +217,16 @@ const preset = { // Curve sGNO/GNO //--------------------------------------------------------------------------------------------------------------------------------- - // Remove Liquidity allow.gnosis.curve.sgnoCRV_lp_pool[ "remove_liquidity(uint256,uint256[2])" ](), - - // Remove Liquidity of One Coin allow.gnosis.curve.sgnoCRV_lp_pool[ "remove_liquidity_one_coin(uint256,int128,uint256)" ](), - - // Remove Liquidity Imbalance Coin allow.gnosis.curve.sgnoCRV_lp_pool[ "remove_liquidity_imbalance(uint256[2],uint256)" ](), - - // Unstake allow.gnosis.curve.sgnoCRV_gauge["withdraw(uint256)"](), - // NO EVIDENCE OF BEING USED allow.gnosis.curve.sgnoCRV_gauge["withdraw(uint256,address,bool)"]( undefined, AVATAR @@ -212,24 +235,13 @@ const preset = { //--------------------------------------------------------------------------------------------------------------------------------- // Curve tricrypto //--------------------------------------------------------------------------------------------------------------------------------- - - // Remove Liquidity allow.gnosis.curve.crv3crypto_pool["remove_liquidity"](), - - // Remove Liquidity (Underlying, using ZAP) allow.gnosis.curve.crv3crypto_zap["remove_liquidity(uint256,uint256[5])"](), - - // Remove Liquidity of One Coin allow.gnosis.curve.crv3crypto_pool["remove_liquidity_one_coin"](), - - // Remove Liquidity of One Coin (Underlying, using ZAP) allow.gnosis.curve.crv3crypto_zap[ "remove_liquidity_one_coin(uint256,uint256,uint256)" ](), - - // Unstake allow.gnosis.curve.crv3crypto_gauge["withdraw(uint256)"](), - // NO EVIDENCE OF BEING USED allow.gnosis.curve.crv3crypto_gauge["withdraw(uint256,address,bool)"]( undefined, AVATAR @@ -239,24 +251,16 @@ const preset = { // Curve rGNO/sGNO //--------------------------------------------------------------------------------------------------------------------------------- - // Remove Liquidity allow.gnosis.curve.rgnoCRV_lp_pool[ "remove_liquidity(uint256,uint256[2])" ](), - - // Remove Liquidity of One Coin allow.gnosis.curve.rgnoCRV_lp_pool[ "remove_liquidity_one_coin(uint256,int128,uint256)" ](), - - // Remove Liquidity Imbalance Coin allow.gnosis.curve.rgnoCRV_lp_pool[ "remove_liquidity_imbalance(uint256[2],uint256)" ](), - - // Unstake allow.gnosis.curve.rgnoCRV_gauge["withdraw(uint256)"](), - // NO EVIDENCE OF BEING USED allow.gnosis.curve.rgnoCRV_gauge["withdraw(uint256,address,bool)"]( undefined, AVATAR @@ -266,100 +270,63 @@ const preset = { // Curve MAI/x3CRV //--------------------------------------------------------------------------------------------------------------------------------- - // Remove Liquidity - // { - // targetAddress: MAIx3CRV_LP_POOL, - // signature: "remove_liquidity(uint256,uint256[2])", - // }, allow.gnosis.curve.MAIx3CRV_lp_pool[ "remove_liquidity(uint256,uint256[2])" ](), - - // Remove Liquidity (Underlying, using ZAP) - // { - // targetAddress: FACTORY_METAPOOLS_ZAP, - // signature: "remove_liquidity(address,uint256,uint256[4])", - // }, allow.gnosis.curve.factory_metapools_zap[ "remove_liquidity(address,uint256,uint256[4])" ](), - - // Remove Liquidity of One Coin - // { - // targetAddress: MAIx3CRV_LP_POOL, - // signature: "remove_liquidity_one_coin(uint256,int128,uint256)", - // }, allow.gnosis.curve.MAIx3CRV_lp_pool[ "remove_liquidity_one_coin(uint256,int128,uint256)" ](), - - // Remove Liquidity of One Coin (Underlying, using ZAP) - // { - // targetAddress: FACTORY_METAPOOLS_ZAP, - // signature: "remove_liquidity_one_coin(address,uint256,int128,uint256)", - // }, allow.gnosis.curve.factory_metapools_zap[ "remove_liquidity_one_coin(address,uint256,int128,uint256)" ](), - - // Unstake - // { - // targetAddress: MAIx3CRV_GAUGE, - // signature: "withdraw(uint256)", - // }, allow.gnosis.curve.MAIx3CRV_gauge["withdraw(uint256)"](), - - // NO EVIDENCE OF BEING USED - // { - // targetAddress: MAIx3CRV_GAUGE, - // signature: "withdraw(uint256,address,bool)", - // params: { - // [1]: staticEqual(AVATAR), - // }, - // }, allow.gnosis.curve.MAIx3CRV_gauge["withdraw(uint256,address,bool)"]( undefined, AVATAR ), + //--------------------------------------------------------------------------------------------------------------------------------- + // Curve - 3pool - Swaps + //--------------------------------------------------------------------------------------------------------------------------------- + ...allowErc20Approve([USDC, USDT, WXDAI], [curve.x3CRV_POOL]), + + allow.gnosis.curve.x3CRV_pool["exchange"](), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Curve - EURe/x3CRV - Swaps + //--------------------------------------------------------------------------------------------------------------------------------- + ...allowErc20Approve([EURe, x3CRV], [curve.crvEUReUSD_POOL]), + ...allowErc20Approve([EURe, USDC, USDT, WXDAI], [curve.crvEUReUSD_ZAP]), + + allow.gnosis.curve.crvEUReUSD_pool["exchange(uint256,uint256,uint256,uint256)"](), + allow.gnosis.curve.crvEUReUSD_zap["exchange_underlying(uint256,uint256,uint256,uint256)"](), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Honeyswap + //--------------------------------------------------------------------------------------------------------------------------------- + + allow.gnosis.honeyswap.router["removeLiquidity"]( + undefined, + undefined, + undefined, + undefined, + undefined, + AVATAR + ), + //--------------------------------------------------------------------------------------------------------------------------------- // RealT //--------------------------------------------------------------------------------------------------------------------------------- - // Set/Unset (bool "useAsCollateral" = True / "useAsCollateral" = False) WXDAI as Collateral (Set) - // { - // targetAddress: REALT_LENDING_POOL, - // signature: "setUserUseReserveAsCollateral(address,bool)", - // params: { - // [0]: staticEqual(WXDAI, "address") - // } - // }, allow.gnosis.realt.lending_pool["setUserUseReserveAsCollateral"](WXDAI), - - // Withdraw XDAI - // { - // targetAddress: REALT_GATEWAY, - // signature: "withdrawETH(address,uint256,address)", - // params: { - // [0]: staticEqual(REALT_LENDING_POOL, "address"), - // [2]: staticEqual(AVATAR), - // } - // }, allow.gnosis.realt.gateway["withdrawETH"]( realt.LENDING_POOL, undefined, AVATAR ), - - // Repay Debt - // { - // targetAddress: REALT_GATEWAY, - // signature: "repayETH(address,uint256,uint256,address)", - // params: { - // [0]: staticEqual(REALT_LENDING_POOL, "address"), - // [3]: staticEqual(AVATAR), - // } - // }, allow.gnosis.realt.gateway["repayETH"]( realt.LENDING_POOL, undefined, @@ -368,11 +335,18 @@ const preset = { ), //--------------------------------------------------------------------------------------------------------------------------------- - // Honeyswap + // SushiSwap //--------------------------------------------------------------------------------------------------------------------------------- - // Remove Liquidity - allow.gnosis.honeyswap.router["removeLiquidity"]( + allow.gnosis.sushiswap.router["removeLiquidity"]( + undefined, + undefined, + undefined, + undefined, + undefined, + AVATAR + ), + allow.gnosis.sushiswap.router["removeLiquidityWithPermit"]( undefined, undefined, undefined, @@ -380,6 +354,11 @@ const preset = { undefined, AVATAR ), + allow.gnosis.sushiswap.minichef_v2["withdrawAndHarvest"]( + undefined, + undefined, + AVATAR + ) ], placeholders: { AVATAR }, } satisfies RolePreset diff --git a/packages/sdk/src/presets/gnosisChain/KPK/deFiDisassembleKPK.ts b/packages/sdk/src/presets/gnosisChain/KPK/deFiDisassembleKPK.ts new file mode 100644 index 000000000..d9217fd94 --- /dev/null +++ b/packages/sdk/src/presets/gnosisChain/KPK/deFiDisassembleKPK.ts @@ -0,0 +1,167 @@ +import { allow } from "../../allow" +import { AVATAR } from "../../placeholders" +import { RolePreset } from "../../types" +import { EURe, sDAI, USDC, USDT, WETH, wstETH, WXDAI, x3CRV, balancer, curve } from "../addresses" +import { allowErc20Approve } from "../../helpers/erc20" +import { staticEqual, staticOneOf } from "../../helpers/utils" + + +const preset = { + network: 100, + allow: [ + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer + //--------------------------------------------------------------------------------------------------------------------------------- + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer WETH/wstETH + //--------------------------------------------------------------------------------------------------------------------------------- + ...allowErc20Approve([WETH, wstETH], [balancer.VAULT]), + { + targetAddress: balancer.VAULT, + signature: + "swap((bytes32,uint8,address,address,uint256,bytes),(address,bool,address,bool),uint256,uint256)", + params: { + [0]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000e0", + "bytes32" + ), // Offset of the tuple from beginning 224=32*7 + [1]: staticEqual(AVATAR), // recipient + [3]: staticEqual(AVATAR), // sender + [7]: staticEqual( + "0xbad20c15a773bf03ab973302f61fabcea5101f0a000000000000000000000034", + "bytes32" + ), + [9]: staticOneOf([WETH, wstETH], "address"), // Asset in + [10]: staticOneOf([WETH, wstETH], "address"), // Asset out + [12]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000c0", + "bytes32" + ), // Offset of bytes from beginning of tuple 192=32*6 + [13]: staticEqual( + "0x0000000000000000000000000000000000000000000000000000000000000000", + "bytes32" + ), // bytes (userData) = for all current Balancer pools this can be left empty + }, + }, + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer sBAL3 - Swaps + //--------------------------------------------------------------------------------------------------------------------------------- + ...allowErc20Approve([sDAI, USDC, USDT], [balancer.VAULT]), + { + targetAddress: balancer.VAULT, + signature: + "swap((bytes32,uint8,address,address,uint256,bytes),(address,bool,address,bool),uint256,uint256)", + params: { + [0]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000e0", + "bytes32" + ), // Offset of the tuple from beginning 224=32*7 + [1]: staticEqual(AVATAR), // recipient + [3]: staticEqual(AVATAR), // sender + [7]: staticEqual( + "0x7644fa5d0ea14fcf3e813fdf93ca9544f8567655000000000000000000000066", + "bytes32" + ), + [9]: staticOneOf([sDAI, USDC, USDT], "address"), // Asset in + [10]: staticOneOf([sDAI, USDC, USDT], "address"), // Asset out + [12]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000c0", + "bytes32" + ), // Offset of bytes from beginning of tuple 192=32*6 + [13]: staticEqual( + "0x0000000000000000000000000000000000000000000000000000000000000000", + "bytes32" + ), // bytes (userData) = for all current Balancer pools this can be left empty + }, + }, + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer staBAL3 - Swaps + //--------------------------------------------------------------------------------------------------------------------------------- + ...allowErc20Approve([USDC, USDT, WXDAI], [balancer.VAULT]), + { + targetAddress: balancer.VAULT, + signature: + "swap((bytes32,uint8,address,address,uint256,bytes),(address,bool,address,bool),uint256,uint256)", + params: { + [0]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000e0", + "bytes32" + ), // Offset of the tuple from beginning 224=32*7 + [1]: staticEqual(AVATAR), // recipient + [3]: staticEqual(AVATAR), // sender + [7]: staticEqual( + "0x2086f52651837600180de173b09470f54ef7491000000000000000000000004f", + "bytes32" + ), + [9]: staticOneOf([USDC, USDT, WXDAI], "address"), // Asset in + [10]: staticOneOf([USDC, USDT, WXDAI], "address"), // Asset out + [12]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000c0", + "bytes32" + ), // Offset of bytes from beginning of tuple 192=32*6 + [13]: staticEqual( + "0x0000000000000000000000000000000000000000000000000000000000000000", + "bytes32" + ), // bytes (userData) = for all current Balancer pools this can be left empty + }, + }, + + //--------------------------------------------------------------------------------------------------------------------------------- + // Balancer staBAL3/wstETH - Swaps + //--------------------------------------------------------------------------------------------------------------------------------- + ...allowErc20Approve([balancer.staBAL3, wstETH], [balancer.VAULT]), + { + targetAddress: balancer.VAULT, + signature: + "swap((bytes32,uint8,address,address,uint256,bytes),(address,bool,address,bool),uint256,uint256)", + params: { + [0]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000e0", + "bytes32" + ), // Offset of the tuple from beginning 224=32*7 + [1]: staticEqual(AVATAR), // recipient + [3]: staticEqual(AVATAR), // sender + [7]: staticEqual( + "0xeb30c85cc528537f5350cf5684ce6a4538e13394000200000000000000000059", + "bytes32" + ), + [9]: staticOneOf([balancer.sBAL3, wstETH], "address"), // Asset in + [10]: staticOneOf([balancer.sBAL3, wstETH], "address"), // Asset out + [12]: staticEqual( + "0x00000000000000000000000000000000000000000000000000000000000000c0", + "bytes32" + ), // Offset of bytes from beginning of tuple 192=32*6 + [13]: staticEqual( + "0x0000000000000000000000000000000000000000000000000000000000000000", + "bytes32" + ), // bytes (userData) = for all current Balancer pools this can be left empty + }, + }, + + //--------------------------------------------------------------------------------------------------------------------------------- + // Curve + //--------------------------------------------------------------------------------------------------------------------------------- + + //--------------------------------------------------------------------------------------------------------------------------------- + // Curve - 3pool - Swaps + //--------------------------------------------------------------------------------------------------------------------------------- + ...allowErc20Approve([USDC, USDT, WXDAI], [curve.x3CRV_POOL]), + + allow.gnosis.curve.x3CRV_pool["exchange"](), + + //--------------------------------------------------------------------------------------------------------------------------------- + // Curve - EURe/x3CRV - Swaps + //--------------------------------------------------------------------------------------------------------------------------------- + ...allowErc20Approve([EURe, x3CRV], [curve.crvEUReUSD_POOL]), + ...allowErc20Approve([EURe, USDC, USDT, WXDAI], [curve.crvEUReUSD_ZAP]), + + allow.gnosis.curve.crvEUReUSD_pool["exchange(uint256,uint256,uint256,uint256)"](), + allow.gnosis.curve.crvEUReUSD_zap["exchange_underlying(uint256,uint256,uint256,uint256)"](), + ], + placeholders: { AVATAR }, +} satisfies RolePreset + +export default preset \ No newline at end of file diff --git a/packages/sdk/src/presets/gnosisChain/addresses.ts b/packages/sdk/src/presets/gnosisChain/addresses.ts index 7ac954678..07040a4b9 100644 --- a/packages/sdk/src/presets/gnosisChain/addresses.ts +++ b/packages/sdk/src/presets/gnosisChain/addresses.ts @@ -25,6 +25,7 @@ export const PNK = "0x37b60f4E9A31A64cCc0024dce7D0fD07eAA0F7B3" // Bridged export const QI = "0xdFA46478F9e5EA86d57387849598dbFB2e964b02" export const RAI = "0xd7a28Aa9c470e7e9D8c676BCd5dd2f40c5683afa" // Bridged export const rGNO = "0x6aC78efae880282396a335CA2F79863A1e6831D4" +export const sDAI = "0xaf204776c7245bF4147c2612BF6e5972Ee483701" export const sGNO = "0xA4eF9Da5BA71Cc0D2e5E877a910A37eC43420445" export const SUSHI = "0x2995D1317DcD4f0aB89f4AE60F3f020A4F17C7CE" // Bridged export const stkAGVE = "0x610525b415c1BFAeAB1a3fc3d85D87b92f048221" diff --git a/packages/sdk/tasks/manageKarpatkeyRoles.ts b/packages/sdk/tasks/manageKarpatkeyRoles.ts index e431f0380..ee857aa0a 100644 --- a/packages/sdk/tasks/manageKarpatkeyRoles.ts +++ b/packages/sdk/tasks/manageKarpatkeyRoles.ts @@ -12,6 +12,7 @@ import { encodeApplyPresetTxBuilder } from "../src/applyPreset" // import gnosisChainDeFiHarvestPreset from "../src/presets/gnosisChain/deFiHarvest" // import gnosisChainDeFiManagePreset from "../src/presets/gnosisChain/deFiManage" import mainnetDeFiDisassembleKPKPreset from "../src/presets/mainnet/KPK/deFiDisassembleKPK" +import gnosisChainDeFiDisassembleKPKPreset from "../src/presets/gnosisChain/KPK/deFiDisassembleKPK" import gnosisChainDeFiManagePreset from "../src/presets/gnosisChain/deFiManageTest" import mainnetDeFiManageTestPreset from "../src/presets/mainnet/deFiManageTest" import { NetworkId } from "../src/types" @@ -55,6 +56,25 @@ export const KPK_ADDRESSES = { }, }, + KPK_GNO: { + AVATAR: "0x58e6c7ab55Aa9012eAccA16d1ED4c15795669E1C", + MODULE: "0x31624fBEdE7e9F9F93a123F8BC9C030C98F32Ef4", + MANAGER: "0xA3801af0D95Ad8e751b378C50ac86a47986b0110", // Used as DISASSEMBLER + REVOKER: "", + HARVESTER: "", + DISASSEMBLER: "", + SWAPPER: "", + NETWORK: 100, + BRIDGED_SAFE: "0x0000000000000000000000000000000000000000", + ROLE_IDS: { + MANAGER: 1, + REVOKER: 2, + HARVESTER: 3, + DISASSEMBLER: 4, + SWAPPER: 5, + }, + }, + SANTI_TEST_GNO: { // AVATAR: "0x3AD295402978659427C179Fb30f319bF6a2c8678", AVATAR: "0x9a18b276e86844A05587e1C822D2311D51d1c7F9", @@ -262,3 +282,29 @@ task("encodeApplyPresetsDisassembleKPKmainnet").setAction(async (taskArgs, hre) writeFileSync(filePath, JSON.stringify(txBatches, undefined, 2)) console.log(`Transaction builder JSON written to ${filePath}`) }) + +task("encodeApplyPresetsDisassembleKPKgnosis").setAction(async (taskArgs, hre) => { + const { config } = await processArgs(taskArgs, hre) + const txBatches = await encodeApplyPresetTxBuilder( + config.MODULE, + config.ROLE_IDS.MANAGER, + gnosisChainDeFiDisassembleKPKPreset, + { AVATAR: config.AVATAR }, + { + network: config.NETWORK as NetworkId, + } + ) + + const filePath = path.join( + __dirname, + "..", + "/presets-output/gnosis/KPK/txDataDisassembleKPKgnosis.json" + ) + if (!existsSync(filePath)) { + // Create the directory structure if it doesn't exist + mkdirSync(path.dirname(filePath), { recursive: true }) + } + // Write the JSON data to the file + writeFileSync(filePath, JSON.stringify(txBatches, undefined, 2)) + console.log(`Transaction builder JSON written to ${filePath}`) +}) \ No newline at end of file