Skip to content

Commit

Permalink
DAO, LTD and KPK disassemble policy update for GC
Browse files Browse the repository at this point in the history
  • Loading branch information
nledo committed May 6, 2024
1 parent c3d86c2 commit 56ad340
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { network } from "hardhat"
import { allow } from "../../allow"
import { auraExitStrategy2 } from "../../helpers/ExitStrategies/AuraExitStrategies"
import { balancerExitStrategy1 } from "../../helpers/ExitStrategies/BalancerExitStrategies"
import { HoldingsExitStrategy, WstEthExitStrategy1 } from "../../helpers/ExitStrategies/HoldingsExitStrategies"
import { HoldingsExitStrategy, sDaiExitStrategy, WstEthExitStrategy1 } from "../../helpers/ExitStrategies/HoldingsExitStrategies"
import { staticEqual, staticOneOf } from "../../helpers/utils"
import { AVATAR } from "../../placeholders"
import { RolePreset } from "../../types"
Expand All @@ -13,7 +13,6 @@ import {
sDAI,
USDC,
USDT,
WBTC,
WETH,
wstETH,
WXDAI,
Expand All @@ -34,6 +33,8 @@ const preset = {

...HoldingsExitStrategy(100), // 100 = Gnosis Chain

...sDaiExitStrategy(100), // Only adds sDAI as buy and sell token

...WstEthExitStrategy1(100), // wstETH -> WETH

//---------------------------------------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { allow } from "../../allow"
import { auraExitStrategy2 } from "../../helpers/ExitStrategies/AuraExitStrategies"
import { balancerExitStrategy1 } from "../../helpers/ExitStrategies/BalancerExitStrategies"
import { WstEthExitStrategy1 } from "../../helpers/ExitStrategies/HoldingsExitStrategies"
import { HoldingsExitStrategy, sDaiExitStrategy, WstEthExitStrategy1 } from "../../helpers/ExitStrategies/HoldingsExitStrategies"
import { AVATAR } from "../../placeholders"
import { RolePreset } from "../../types"
import { EURe, sDAI, USDC, USDT, WETH, wstETH, WXDAI, x3CRV, aura, balancer, curve, realt } from "../addresses"
Expand All @@ -16,6 +16,10 @@ const preset = {
// Holdings
//---------------------------------------------------------------------------------------------------------------------------------

...HoldingsExitStrategy(100), // 100 = Gnosis Chain

...sDaiExitStrategy(100), // Only adds sDAI as buy and sell token

...WstEthExitStrategy1(100), // wstETH -> WETH

//---------------------------------------------------------------------------------------------------------------------------------
Expand Down
11 changes: 11 additions & 0 deletions packages/sdk/src/presets/gnosisChain/KPK/deFiDisassembleKPK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,22 @@ 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"
import { HoldingsExitStrategy, sDaiExitStrategy, WstEthExitStrategy1 } from "../../helpers/ExitStrategies/HoldingsExitStrategies"


const preset = {
network: 100,
allow: [
//---------------------------------------------------------------------------------------------------------------------------------
// Holdings
//---------------------------------------------------------------------------------------------------------------------------------

...HoldingsExitStrategy(100), // 100 = Gnosis Chain

...sDaiExitStrategy(100), // Only adds sDAI as buy and sell token

...WstEthExitStrategy1(100), // wstETH -> WETH

//---------------------------------------------------------------------------------------------------------------------------------
// Balancer
//---------------------------------------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,60 @@ export const WstEthExitStrategy1 = (
return permissions
}

// IMPORTANT: THIS FUNCTION ONLY ADDS sDAI AS BOTH BUY AND SELL TOKEN. IF THIS PERMISSION IS NOT SHARED
// WITH OTHER HOLDINGS STRATEGIES THEN IT'S USELESS.
export const sDaiExitStrategy = (
blockchainId: NetworkId
): PresetAllowEntry[] => {
const permissions: PresetAllowEntry[] = []

switch (blockchainId) {
case 1:
permissions.push(
...allowErc20Approve(
[mainnetAddresses.sDAI],
[mainnetAddresses.cowswap.GPv2_VAULT_RELAYER]
),

{
targetAddress: mainnetAddresses.cowswap.ORDER_SIGNER,
signature:
"signOrder((address,address,address,uint256,uint256,uint32,bytes32,uint256,bytes32,bool,bytes32,bytes32),uint32,uint256)",
params: {
[0]: staticEqual(mainnetAddresses.sDAI, "address"),
[1]: staticEqual(mainnetAddresses.sDAI, "address"),
[2]: staticEqual(AVATAR),
},
delegatecall: true,
}
)
break

case 100:
permissions.push(
...allowErc20Approve(
[gnoAddresses.sDAI],
[gnoAddresses.cowswap.GPv2_VAULT_RELAYER]
),

{
targetAddress: gnoAddresses.cowswap.ORDER_SIGNER,
signature:
"signOrder((address,address,address,uint256,uint256,uint32,bytes32,uint256,bytes32,bool,bytes32,bytes32),uint32,uint256)",
params: {
[0]: staticEqual(gnoAddresses.sDAI, "address"),
[1]: staticEqual(gnoAddresses.sDAI, "address"),
[2]: staticEqual(AVATAR),
},
delegatecall: true,
}
)
break
}

return permissions
}

export const HoldingsExitStrategy = (
blockchainId: NetworkId
): PresetAllowEntry[] => {
Expand Down
1 change: 1 addition & 0 deletions packages/sdk/src/presets/mainnet/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const rETH = "0xae78736Cd615f374D3085123A210448E74Fc6393"
export const rETH2 = "0x20BC832ca081b91433ff6c17f85701B6e92486c5"
export const RPL = "0xD33526068D116cE69F19A9ee46F0bd304F21A51f"
export const SAFE = "0x5aFE3855358E112B5647B952709E6165e1c1eEEe"
export const sDAI = "0x83F20F44975D03b1b09e64809B757c47f942BEeA"
export const sETH2 = "0xFe2e637202056d30016725477c5da089Ab0A043A"
export const stETH = "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84"
export const sUSD = "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51"
Expand Down

0 comments on commit 56ad340

Please sign in to comment.