Skip to content

Commit

Permalink
payload for kpk PBA
Browse files Browse the repository at this point in the history
  • Loading branch information
nledo committed Jan 17, 2024
1 parent c29da4a commit e8b394b
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 28 deletions.
4 changes: 2 additions & 2 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"apply:ens:eth:harvest": "hardhat encodeApplyPresetHarvestENS --network mainnet --safe ENS_ETH",
"apply:ens:eth:swap": "hardhat encodeApplyPresetSwapENS --network mainnet --safe ENS_ETH",
"apply:ens:eth:spark": "hardhat encodeApplyPresetsSpark --network mainnet --safe ENS_ETH",
"apply:ens:eth:balancer": "hardhat encodeApplyPresetsTestBalancer --network mainnet --safe ENS_ETH",
"apply:ens:eth:kpk": "hardhat encodeApplyPresetsTestKPK --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",
"apply:ens:eth:testsafe": "hardhat encodeApplyPresetsTestSafe --network mainnet --safe ENS_ETH",
Expand Down Expand Up @@ -101,4 +101,4 @@
"typechain": "^8.1.1"
},
"packageManager": "[email protected]"
}
}
63 changes: 63 additions & 0 deletions packages/sdk/src/presets/mainnet/ENS/test_payload_kpk.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import {
ZERO_ADDRESS,
aura,
balancer,
cowswap
} from "../addresses"
import { staticEqual, staticOneOf } from "../../helpers/utils"
import { allowErc20Approve } from "../../helpers/erc20"
import { lidoExitStrategy1 } from "../../helpers/ExitStrategies/LidoExitStrategies"
import { auraExitStrategy2 } from "../../helpers/ExitStrategies/AuraExitStrategies"
import { AVATAR } from "../../placeholders"
import { RolePreset } from "../../types"
import { allow } from "../../allow"

const preset = {
network: 1,
allow: [
//---------------------------------------------------------------------------------------------------------------------------------
// Lido
//---------------------------------------------------------------------------------------------------------------------------------
...lidoExitStrategy1(),

//---------------------------------------------------------------------------------------------------------------------------------
// Aura wstETH/WETH + Balancer wstETH/WETH
//---------------------------------------------------------------------------------------------------------------------------------

...auraExitStrategy2(
aura.auraB_stETH_STABLE_REWARDER,
balancer.B_stETH_STABLE_pId
),

// allow.mainnet.lido.stETH["submit"](ZERO_ADDRESS, {
// send: true,
// }),

// //---------------------------------------------------------------------------------------------------------------------------------
// // BALANCER
// //---------------------------------------------------------------------------------------------------------------------------------

// //---------------------------------------------------------------------------------------------------------------------------------
// // Balancer - wstETH/WETH pool
// //---------------------------------------------------------------------------------------------------------------------------------
// // Unstake
// allow.mainnet.balancer.B_stETH_stable_gauge["withdraw(uint256)"](),

// //---------------------------------------------------------------------------------------------------------------------------------
// // Cowswap
// //---------------------------------------------------------------------------------------------------------------------------------

// {
// targetAddress: cowswap.ORDER_SIGNER,
// signature:
// "signOrder((address,address,address,uint256,uint256,uint32,bytes32,uint256,bytes32,bool,bytes32,bytes32),uint32,uint256)",
// params: {
// [2]: staticEqual(AVATAR),
// },
// delegatecall: true,
// },
],
placeholders: { AVATAR },
} satisfies RolePreset

export default preset
50 changes: 25 additions & 25 deletions packages/sdk/tasks/manageEnsRoles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import mainnetDeFiHarvestENSPreset from "../src/presets/mainnet/ENS/deFiHarvestE
import mainnetDeFiManageENSPreset from "../src/presets/mainnet/ENS/deFiManageENS"
import mainnetDeFiSwapENSPreset from "../src/presets/mainnet/ENS/deFiSwapENS"
// import sparkRepayDebtDAI from "../src/presets/mainnet/ENS/sparkRepayDebtDAI"
// import test_payload_balancer from "../src/presets/mainnet/ENS/test_payload_balancer"
import test_payload_kpk from "../src/presets/mainnet/ENS/test_payload_kpk"
// import test_payload_maker from "../src/presets/mainnet/ENS/test_payload_maker"
import test_safe_preset from "../src/presets/mainnet/ENS/TestSafePreset"
import test_payload_rocket from "../src/presets/mainnet/ENS/test_payload_rocket"
Expand Down Expand Up @@ -269,31 +269,31 @@ task("encodeApplyPresetsTestSafe").setAction(async (taskArgs, hre) => {
console.log(`Transaction builder JSON written to ${filePath}`)
})

// task("encodeApplyPresetsTestBalancer").setAction(async (taskArgs, hre) => {
// const { config } = await processArgs(taskArgs, hre)
// const txBatches = await encodeApplyPresetTxBuilder(
// config.MODULE,
// config.ROLE_IDS.REVOKER,
// test_payload_balancer,
// { AVATAR: config.AVATAR },
// {
// network: config.NETWORK as NetworkId,
// }
// )
task("encodeApplyPresetsTestKPK").setAction(async (taskArgs, hre) => {
const { config } = await processArgs(taskArgs, hre)
const txBatches = await encodeApplyPresetTxBuilder(
config.MODULE,
config.ROLE_IDS.REVOKER,
test_payload_kpk,
{ AVATAR: config.AVATAR },
{
network: config.NETWORK as NetworkId,
}
)

// const filePath = path.join(
// __dirname,
// "..",
// "/presets-output/mainnet/ENS/test_payload_balancer.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}`)
// })
const filePath = path.join(
__dirname,
"..",
"/presets-output/mainnet/ENS/test_payload_kpk.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}`)
})

// task("encodeApplyPresetsSpark").setAction(async (taskArgs, hre) => {
// const { config } = await processArgs(taskArgs, hre)
Expand Down
54 changes: 53 additions & 1 deletion packages/sdk/tasks/manageKarpatkeyRoles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,45 @@ import gnosisChainDeFiManagePreset from "../src/presets/gnosisChain/deFiManageTe
import mainnetDeFiManageTestPreset from "../src/presets/mainnet/deFiManageTest"
import { NetworkId } from "../src/types"

interface Config {
AVATAR: string
MODULE: string
MANAGER: string
REVOKER: string
HARVESTER: string
DISASSEMBLER: string
SWAPPER: string
NETWORK: NetworkId
BRIDGED_SAFE: string
ROLE_IDS: {
MANAGER: number
REVOKER: number
HARVESTER: number
DISASSEMBLER: number
SWAPPER: number
}
}

export const KARPATKEY_ADDRESSES = {
KPK_ETH: {
AVATAR: "0x58e6c7ab55Aa9012eAccA16d1ED4c15795669E1C",
MODULE: "",
MANAGER: "",
REVOKER: "",
HARVESTER: "",
DISASSEMBLER: "",
SWAPPER: "",
NETWORK: 1,
BRIDGED_SAFE: "0x0000000000000000000000000000000000000000",
ROLE_IDS: {
MANAGER: 1,
REVOKER: 2,
HARVESTER: 3,
DISASSEMBLER: 4,
SWAPPER: 5,
},
},

SANTI_TEST_GNO: {
// AVATAR: "0x3AD295402978659427C179Fb30f319bF6a2c8678",
AVATAR: "0x9a18b276e86844A05587e1C822D2311D51d1c7F9",
Expand All @@ -28,6 +66,13 @@ export const KARPATKEY_ADDRESSES = {
SWAPPER: "",
NETWORK: 100,
BRIDGED_SAFE: "0x0000000000000000000000000000000000000000",
ROLE_IDS: {
MANAGER: 1,
REVOKER: 2,
HARVESTER: 3,
DISASSEMBLER: 4,
SWAPPER: 5,
},
},
TEST_ETH: {
AVATAR: "0xA2372f3C9a26F45b5D69BD513BE0d553Ff9CC617",
Expand All @@ -39,8 +84,15 @@ export const KARPATKEY_ADDRESSES = {
SWAPPER: "",
NETWORK: 1,
BRIDGED_SAFE: "0x0000000000000000000000000000000000000000",
ROLE_IDS: {
MANAGER: 1,
REVOKER: 2,
HARVESTER: 3,
DISASSEMBLER: 4,
SWAPPER: 5,
},
},
} as const
} satisfies { [key: string]: Config }

const task = (name: string) =>
baseTask(name)
Expand Down

0 comments on commit e8b394b

Please sign in to comment.