Skip to content

Commit

Permalink
DAO, LTD and KPK disassemble policy update
Browse files Browse the repository at this point in the history
  • Loading branch information
nledo committed Apr 29, 2024
1 parent 6752fad commit e8f9486
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 128 deletions.
197 changes: 95 additions & 102 deletions packages/sdk/src/presets/mainnet/GnosisDAO/deFiDisassembleGnosisDAO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,13 @@ import { HoldingsExitStrategy } from "../../helpers/ExitStrategies/HoldingsExitS
import { lidoExitStrategyAll } from "../../helpers/ExitStrategies/LidoExitStrategies"
import { staticEqual, staticOneOf } from "../../helpers/utils"
import { AVATAR } from "../../placeholders"
import { DAI, USDC, USDT, rETH, stETH, WETH, wstETH, aura, balancer, compound_v2, compound_v3, curve, uniswapv3 } from "../addresses"
import { ankrETH, DAI, ETHx, USDC, USDT, rETH, stETH, WETH, wstETH, aura, balancer, compound_v2, compound_v3, curve, uniswapv3 } from "../addresses"
import { RolePreset } from "../../types"
import { allowErc20Approve } from "../../helpers/erc20"

const preset = {
network: 1,
allow: [
//---------------------------------------------------------------------------------------------------------------------------------
// Lido
//---------------------------------------------------------------------------------------------------------------------------------

...lidoExitStrategyAll(),

//---------------------------------------------------------------------------------------------------------------------------------
// Holdings
//---------------------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -226,6 +220,95 @@ const preset = {
},
},

//---------------------------------------------------------------------------------------------------------------------------------
// Compound V2
//---------------------------------------------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------------------------------------------
// Compound V2 - USDC
//---------------------------------------------------------------------------------------------------------------------------------

// Withdrawing: sender redeems uint256 cTokens, it is called when MAX is withdrawn
allow.mainnet.compound_v2.cUSDC["redeem"](),

// Withdrawing: sender redeems cTokens in exchange for a specified amount of underlying asset (uint256), it is called when MAX isn't withdrawn
allow.mainnet.compound_v2.cUSDC["redeemUnderlying"](),

// Stop using as Collateral
allow.mainnet.compound_v2.comptroller["exitMarket"](compound_v2.cUSDC),

// Repay specified borrowed amount of underlying asset (uint256)
allow.mainnet.compound_v2.cUSDC["repayBorrow"](),

//---------------------------------------------------------------------------------------------------------------------------------
// Compound V2 - DAI
//---------------------------------------------------------------------------------------------------------------------------------

// Withdrawing: sender redeems uint256 cTokens, it is called when MAX is withdrawn
allow.mainnet.compound_v2.cDAI["redeem"](),

// Withdrawing: sender redeems cTokens in exchange for a specified amount of underlying asset (uint256), it is called when MAX isn't withdrawn
allow.mainnet.compound_v2.cDAI["redeemUnderlying"](),

// Stop using as Collateral
allow.mainnet.compound_v2.comptroller["exitMarket"](compound_v2.cDAI),

// Repay specified borrowed amount of underlying asset (uint256)
allow.mainnet.compound_v2.cDAI["repayBorrow"](),

//---------------------------------------------------------------------------------------------------------------------------------
// Compound V3
//---------------------------------------------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------------------------------------------
// Compound V3 - USDC
//---------------------------------------------------------------------------------------------------------------------------------

// Withdraw/Borrow
allow.mainnet.compound_v3.cUSDCv3["withdraw"](USDC),

//---------------------------------------------------------------------------------------------------------------------------------
// Compound V3 - ETH
//---------------------------------------------------------------------------------------------------------------------------------

// Withdraw
{
targetAddress: compound_v3.MainnetBulker,
signature: "invoke(bytes32[],bytes[])",
params: {
[0]: staticEqual(
"0x0000000000000000000000000000000000000000000000000000000000000040",
"bytes32"
), // Offset of bytes32[] from beginning 64=32*2
[1]: staticEqual(
"0x0000000000000000000000000000000000000000000000000000000000000080",
"bytes32"
), // Offset of bytes[] from beginning 128=32*4
[2]: staticEqual(
"0x0000000000000000000000000000000000000000000000000000000000000001",
"bytes32"
), // Length of bytes32[] = 1
[3]: staticEqual(
"0x414354494f4e5f57495448445241575f4e41544956455f544f4b454e00000000",
"bytes32"
), // ACTION_WITHDRAW_NATIVE_TOKEN Encoded
[4]: staticEqual(
"0x0000000000000000000000000000000000000000000000000000000000000001",
"bytes32"
), // Length of bytes[] = 1
[5]: staticEqual(
"0x0000000000000000000000000000000000000000000000000000000000000020",
"bytes32"
), // Offset of the first element of the bytes[] from beginning of bytes[] 32=32*1
[6]: staticEqual(
"0x0000000000000000000000000000000000000000000000000000000000000060",
"bytes32"
), // Length of the first element of the bytes[] 96=32*3
[7]: staticEqual(compound_v3.cUSDCv3, "address"),
[8]: staticEqual(AVATAR),
},
},

//---------------------------------------------------------------------------------------------------------------------------------
// CONVEX
//---------------------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -349,117 +432,27 @@ const preset = {
allow.mainnet.curve.steth_ng_f_pool["exchange(int128,int128,uint256,uint256)"](),

//---------------------------------------------------------------------------------------------------------------------------------
// Compound V2
//---------------------------------------------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------------------------------------------
// Compound V2 - USDC
//---------------------------------------------------------------------------------------------------------------------------------

// Withdrawing: sender redeems uint256 cTokens, it is called when MAX is withdrawn
allow.mainnet.compound_v2.cUSDC["redeem"](),

// Withdrawing: sender redeems cTokens in exchange for a specified amount of underlying asset (uint256), it is called when MAX isn't withdrawn
allow.mainnet.compound_v2.cUSDC["redeemUnderlying"](),

// Stop using as Collateral
allow.mainnet.compound_v2.comptroller["exitMarket"](compound_v2.cUSDC),

// Repay specified borrowed amount of underlying asset (uint256)
allow.mainnet.compound_v2.cUSDC["repayBorrow"](),

//---------------------------------------------------------------------------------------------------------------------------------
// Compound V2 - DAI
//---------------------------------------------------------------------------------------------------------------------------------

// Withdrawing: sender redeems uint256 cTokens, it is called when MAX is withdrawn
allow.mainnet.compound_v2.cDAI["redeem"](),

// Withdrawing: sender redeems cTokens in exchange for a specified amount of underlying asset (uint256), it is called when MAX isn't withdrawn
allow.mainnet.compound_v2.cDAI["redeemUnderlying"](),

// Stop using as Collateral
allow.mainnet.compound_v2.comptroller["exitMarket"](compound_v2.cDAI),

// Repay specified borrowed amount of underlying asset (uint256)
allow.mainnet.compound_v2.cDAI["repayBorrow"](),

//---------------------------------------------------------------------------------------------------------------------------------
// Compound V3
//---------------------------------------------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------------------------------------------
// Compound V3 - USDC
//---------------------------------------------------------------------------------------------------------------------------------

// Withdraw/Borrow
allow.mainnet.compound_v3.cUSDCv3["withdraw"](USDC),

//---------------------------------------------------------------------------------------------------------------------------------
// Compound V3 - ETH
// Lido
//---------------------------------------------------------------------------------------------------------------------------------

// Withdraw
{
targetAddress: compound_v3.MainnetBulker,
signature: "invoke(bytes32[],bytes[])",
params: {
[0]: staticEqual(
"0x0000000000000000000000000000000000000000000000000000000000000040",
"bytes32"
), // Offset of bytes32[] from beginning 64=32*2
[1]: staticEqual(
"0x0000000000000000000000000000000000000000000000000000000000000080",
"bytes32"
), // Offset of bytes[] from beginning 128=32*4
[2]: staticEqual(
"0x0000000000000000000000000000000000000000000000000000000000000001",
"bytes32"
), // Length of bytes32[] = 1
[3]: staticEqual(
"0x414354494f4e5f57495448445241575f4e41544956455f544f4b454e00000000",
"bytes32"
), // ACTION_WITHDRAW_NATIVE_TOKEN Encoded
[4]: staticEqual(
"0x0000000000000000000000000000000000000000000000000000000000000001",
"bytes32"
), // Length of bytes[] = 1
[5]: staticEqual(
"0x0000000000000000000000000000000000000000000000000000000000000020",
"bytes32"
), // Offset of the first element of the bytes[] from beginning of bytes[] 32=32*1
[6]: staticEqual(
"0x0000000000000000000000000000000000000000000000000000000000000060",
"bytes32"
), // Length of the first element of the bytes[] 96=32*3
[7]: staticEqual(compound_v3.cUSDCv3, "address"),
[8]: staticEqual(AVATAR),
},
},
...lidoExitStrategyAll(),

//---------------------------------------------------------------------------------------------------------------------------------
// Uniswap V3 - Swaps
//---------------------------------------------------------------------------------------------------------------------------------
...allowErc20Approve([DAI, USDC, USDT, WETH, wstETH], [uniswapv3.ROUTER_2]),
...allowErc20Approve([ankrETH, DAI, ETHx, USDC, USDT, WETH, wstETH], [uniswapv3.ROUTER_2]),

{
targetAddress: uniswapv3.ROUTER_2,
signature:
"exactInputSingle((address,address,uint24,address,uint256,uint256,uint160))",
params: {
[0]: staticOneOf(
[
DAI,
USDC,
USDT,
WETH,
wstETH
],
"address"
),
[ankrETH, DAI, ETHx, USDC, USDT, WETH, wstETH], "address"),
[1]: staticOneOf([DAI, USDC, USDT, WETH, wstETH], "address"),
[3]: staticEqual(AVATAR),
},
send: true,
},
],
placeholders: { AVATAR },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ import { staticEqual, staticOneOf } from "../../helpers/utils"
const preset = {
network: 1,
allow: [
//---------------------------------------------------------------------------------------------------------------------------------
// Lido
//---------------------------------------------------------------------------------------------------------------------------------

...lidoExitStrategyAll(),

//---------------------------------------------------------------------------------------------------------------------------------
// Holdings
//---------------------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -208,6 +202,12 @@ const preset = {

allow.mainnet.curve.steth_ng_f_pool["exchange(int128,int128,uint256,uint256)"](),

//---------------------------------------------------------------------------------------------------------------------------------
// Lido
//---------------------------------------------------------------------------------------------------------------------------------

...lidoExitStrategyAll(),

//---------------------------------------------------------------------------------------------------------------------------------
// Uniswap V3 - Swaps
//---------------------------------------------------------------------------------------------------------------------------------
Expand All @@ -219,18 +219,11 @@ const preset = {
"exactInputSingle((address,address,uint24,address,uint256,uint256,uint160))",
params: {
[0]: staticOneOf(
[
DAI,
USDC,
USDT,
WETH,
wstETH
],
"address"
),
[DAI, USDC, USDT, WETH, wstETH], "address"),
[1]: staticOneOf([DAI, USDC, USDT, WETH, wstETH], "address"),
[3]: staticEqual(AVATAR),
},
send: true,
},
],
placeholders: { AVATAR },
Expand Down
20 changes: 9 additions & 11 deletions packages/sdk/src/presets/mainnet/KPK/deFiDisassembleKPK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ import {
stETH,
WETH,
wstETH,
E_ADDRESS,
aura,
balancer,
cowswap,
curve,
uniswapv3
} from "../addresses"
import { staticEqual, staticOneOf } from "../../helpers/utils"
import { allowErc20Approve } from "../../helpers/erc20"
import { HoldingsExitStrategy } from "../../helpers/ExitStrategies/HoldingsExitStrategies"
import { lidoExitStrategyAll } from "../../helpers/ExitStrategies/LidoExitStrategies"
import { auraExitStrategy2 } from "../../helpers/ExitStrategies/AuraExitStrategies"
import { AVATAR } from "../../placeholders"
Expand All @@ -24,6 +23,12 @@ import { allow } from "../../allow"
const preset = {
network: 1,
allow: [
//---------------------------------------------------------------------------------------------------------------------------------
// Holdings
//---------------------------------------------------------------------------------------------------------------------------------

...HoldingsExitStrategy(1), // 1 = mainnet

//---------------------------------------------------------------------------------------------------------------------------------
// Lido
//---------------------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -204,18 +209,11 @@ const preset = {
"exactInputSingle((address,address,uint24,address,uint256,uint256,uint160))",
params: {
[0]: staticOneOf(
[
DAI,
USDC,
USDT,
WETH,
wstETH
],
"address"
),
[DAI, USDC, USDT, WETH, wstETH], "address"),
[1]: staticOneOf([DAI, USDC, USDT, WETH, wstETH], "address"),
[3]: staticEqual(AVATAR),
},
send: true,
},
],
placeholders: { AVATAR },
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/presets/mainnet/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const E_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
// Tokens
export const AAVE = "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9"
export const aETHc = "0xE95A203B1a91a908F9B9CE46459d101078c2c3cb"
export const ankrETH = "0xE95A203B1a91a908F9B9CE46459d101078c2c3cb"
export const AURA = "0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF"
export const auraBAL = "0x616e8BfA43F920657B3497DBf40D6b1A02D4608d"
export const BAL = "0xba100000625a3754423978a60c9317c58a424e3D"
Expand All @@ -16,6 +17,7 @@ export const CVX = "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B"
export const D2D = "0x43D4A3cd90ddD2F8f4f693170C9c8098163502ad"
export const DAI = "0x6B175474E89094C44Da98b954EedeAC495271d0F"
export const ENS = "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72"
export const ETHx = "0xA35b1B31Ce002FBF2058D22F30f95D405200A15b"
export const FIS = "0xef3A930e1FfFFAcd2fc13434aC81bD278B0ecC8d"
export const FLX = "0x6243d8CEA23066d098a15582d81a598b4e8391F4"
export const FRAX = "0x853d955aCEf822Db058eb8505911ED77F175b99e"
Expand Down

0 comments on commit e8f9486

Please sign in to comment.