From 42b8711b3c25432c455c71c5da484ee34440fd12 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Wed, 14 Aug 2024 10:26:19 -0400 Subject: [PATCH] feat: update Sepolia Drippie config to latest (#10810) --- .../drippie/sepolia-faucet-bridges.json | 20 +++ .../drippie/sepolia-faucet-core.json | 20 +++ .../drippie/sepolia-ops.json | 51 ++++-- packages/contracts-bedrock/safe.json | 155 ++++++++++++++++++ .../periphery/drippie/DrippieConfig.s.sol | 32 +++- .../periphery/drippie/ManageDrippie.s.sol | 8 +- .../scripts/safe/forge-to-safe-json.ts | 124 ++++++++++++++ 7 files changed, 382 insertions(+), 28 deletions(-) create mode 100644 packages/contracts-bedrock/safe.json create mode 100644 packages/contracts-bedrock/scripts/safe/forge-to-safe-json.ts diff --git a/packages/contracts-bedrock/deploy-config-periphery/drippie/sepolia-faucet-bridges.json b/packages/contracts-bedrock/deploy-config-periphery/drippie/sepolia-faucet-bridges.json index 16eb71050d..30d3cdc444 100644 --- a/packages/contracts-bedrock/deploy-config-periphery/drippie/sepolia-faucet-bridges.json +++ b/packages/contracts-bedrock/deploy-config-periphery/drippie/sepolia-faucet-bridges.json @@ -2,6 +2,26 @@ "drippie": "0xd6F935Bd272BEE05bD64096D82970482EF16D64b", "gelato": "0x859E31b3848Ec384012EECc72C5c49821008296C", + "__comment": "Addresses of dripcheck contracts to be used in drips", + "dripchecks": [ + { + "00__name": "CheckBalanceLow", + "01__address": "0xaF8C77CfeB57620c4D9dCC81df75a1F0Da7064Af" + }, + { + "00__name": "CheckGelatoLow", + "01__address": "0x0fF11AfAC4146a0bABf7F9F042a22C8053a54674" + }, + { + "00__name": "CheckSecrets", + "01__address": "0x32c1e36E733913388076D7c3055300072814bF2A" + }, + { + "00__name": "CheckTrue", + "01__address": "0xcBCb3896Ddec35d91901768733C5d3738e10509F" + } + ], + "__comment": "Prefix is used to namespace drips so that drip management can be handled modularly", "prefix": "faucetbridged", diff --git a/packages/contracts-bedrock/deploy-config-periphery/drippie/sepolia-faucet-core.json b/packages/contracts-bedrock/deploy-config-periphery/drippie/sepolia-faucet-core.json index c7eba58a87..7b9e018133 100644 --- a/packages/contracts-bedrock/deploy-config-periphery/drippie/sepolia-faucet-core.json +++ b/packages/contracts-bedrock/deploy-config-periphery/drippie/sepolia-faucet-core.json @@ -2,6 +2,26 @@ "drippie": "0xd6F935Bd272BEE05bD64096D82970482EF16D64b", "gelato": "0x859E31b3848Ec384012EECc72C5c49821008296C", + "__comment": "Addresses of dripcheck contracts to be used in drips", + "dripchecks": [ + { + "00__name": "CheckBalanceLow", + "01__address": "0xaF8C77CfeB57620c4D9dCC81df75a1F0Da7064Af" + }, + { + "00__name": "CheckGelatoLow", + "01__address": "0x0fF11AfAC4146a0bABf7F9F042a22C8053a54674" + }, + { + "00__name": "CheckSecrets", + "01__address": "0x32c1e36E733913388076D7c3055300072814bF2A" + }, + { + "00__name": "CheckTrue", + "01__address": "0xcBCb3896Ddec35d91901768733C5d3738e10509F" + } + ], + "__comment": "Prefix is used to namespace drips so that drip management can be handled modularly", "prefix": "faucetcore", diff --git a/packages/contracts-bedrock/deploy-config-periphery/drippie/sepolia-ops.json b/packages/contracts-bedrock/deploy-config-periphery/drippie/sepolia-ops.json index 96210f4e23..3c5dc6346f 100644 --- a/packages/contracts-bedrock/deploy-config-periphery/drippie/sepolia-ops.json +++ b/packages/contracts-bedrock/deploy-config-periphery/drippie/sepolia-ops.json @@ -2,13 +2,33 @@ "drippie": "0xa0fF2a54AdC3fB33c44a141E67d194CF249258cb", "gelato": "0x2A6C106ae13B558BB9E2Ec64Bd2f1f7BEFF3A5E0", + "__comment": "Addresses of dripcheck contracts to be used in drips", + "dripchecks": [ + { + "00__name": "CheckBalanceLow", + "01__address": "0xaF8C77CfeB57620c4D9dCC81df75a1F0Da7064Af" + }, + { + "00__name": "CheckGelatoLow", + "01__address": "0x0fF11AfAC4146a0bABf7F9F042a22C8053a54674" + }, + { + "00__name": "CheckSecrets", + "01__address": "0x32c1e36E733913388076D7c3055300072814bF2A" + }, + { + "00__name": "CheckTrue", + "01__address": "0xcBCb3896Ddec35d91901768733C5d3738e10509F" + } + ], + "__comment": "Prefix is used to namespace drips so that drip management can be handled modularly", "prefix": "operations", "__comment": "Object attributes below are prefixed with numbers because of how foundry parses JSON into structs in alphabetical order", "drips": [ { - "00__name": "sequencer_v2", + "00__name": "sequencer_v4", "01__dripcheck": "CheckBalanceLow", "02__checkparams": { "01__target": "0x8F23BB38F531600e5d8FDDaAEC41F13FaB46E98c", @@ -20,7 +40,7 @@ "06__data": "" }, { - "00__name": "proposer_v2", + "00__name": "proposer_v3", "01__dripcheck": "CheckBalanceLow", "02__checkparams": { "01__target": "0x49277EE36A024120Ee218127354c4a3591dc90A9", @@ -32,7 +52,19 @@ "06__data": "" }, { - "00__name": "gelato_v2", + "00__name": "challenger_v2", + "01__dripcheck": "CheckBalanceLow", + "02__checkparams": { + "01__target": "0xffb026F67DA0869EB3ABB090cB7F015CE0925CdF", + "02__threshold": 1000000000000000000000 + }, + "03__recipient": "0x49277EE36A024120Ee218127354c4a3591dc90A9", + "04__value": 100000000000000000000, + "05__interval": 3600, + "06__data": "" + }, + { + "00__name": "gelato_v3", "01__dripcheck": "CheckGelatoLow", "02__checkparams": { "00__treasury": "0x7506C12a824d73D9b08564d5Afc22c949434755e", @@ -43,19 +75,6 @@ "04__value": 1000000000000000000, "05__interval": 86400, "06__data": "0x0000000000000000000000000Cd438409d5Cac9D2E076Ac7Bd0Bf2377E99BB6e4" - }, - { - "00__name": "secrets_v2", - "01__dripcheck": "CheckSecrets", - "02__checkparams": { - "00__delay": 43200, - "01__secretHashMustExist": "0x565fa8c7daa859353b5b328b97b12c7d66c5832b2a24d4e0f739a65ad266a46f", - "02__secretHashMustNotExist": "0xbc362b01d69a85dff1793803dde67df1f338f37a36fdc73dddf27283d215e614" - }, - "03__recipient": "0xCd438409d5Cac9D2E076Ac7Bd0Bf2377E99BB6e4", - "04__value": 1000000000000000000, - "05__interval": 3600, - "06__data": "" } ] } diff --git a/packages/contracts-bedrock/safe.json b/packages/contracts-bedrock/safe.json new file mode 100644 index 0000000000..1168ce3d51 --- /dev/null +++ b/packages/contracts-bedrock/safe.json @@ -0,0 +1,155 @@ +{ + "version": "1.0", + "chainId": "11155111", + "createdAt": 1718216278, + "meta": { + "name": "Transactions Batch", + "description": "", + "txBuilderVersion": "1.16.5", + "createdFromSafeAddress": "0x422c32c10b16c442426Eb7E93b07f7B521294565", + "createdFromOwnerAddress": "", + "checksum": "0xc2d69412777b9d9ba16c95d12f3aca13820b37a8db5f9d436f63058c48994cde" + }, + "transactions": [ + { + "to": "0xa0ff2a54adc3fb33c44a141e67d194cf249258cb", + "value": "0", + "data": "0x9bc94d010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000176f7065726174696f6e735f73657175656e6365725f7632000000000000000000", + "contractMethod": null, + "contractInputsValues": null + }, + { + "to": "0x2a6c106ae13b558bb9e2ec64bd2f1f7beff3a5e0", + "value": "0", + "data": "0xee8ca3b568c76a8fa53bf566fc0934edddf25deba2199a53772b6c3a05ce20f5b8d220f8", + "contractMethod": null, + "contractInputsValues": null + }, + { + "to": "0xa0ff2a54adc3fb33c44a141e67d194cf249258cb", + "value": "0", + "data": "0x9bc94d010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000166f7065726174696f6e735f70726f706f7365725f763200000000000000000000", + "contractMethod": null, + "contractInputsValues": null + }, + { + "to": "0x2a6c106ae13b558bb9e2ec64bd2f1f7beff3a5e0", + "value": "0", + "data": "0xee8ca3b5c790be67575b95a6b0c9f618fbdce9b72b6e7202233f0afe087bb641e3d1f0e8", + "contractMethod": null, + "contractInputsValues": null + }, + { + "to": "0xa0ff2a54adc3fb33c44a141e67d194cf249258cb", + "value": "0", + "data": "0x9bc94d010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000146f7065726174696f6e735f67656c61746f5f7632000000000000000000000000", + "contractMethod": null, + "contractInputsValues": null + }, + { + "to": "0x2a6c106ae13b558bb9e2ec64bd2f1f7beff3a5e0", + "value": "0", + "data": "0xee8ca3b5f666fe8af1ff0032744dcf71fbbeada5e47079f37425a8a0069350bbb508c3db", + "contractMethod": null, + "contractInputsValues": null + }, + { + "to": "0xa0ff2a54adc3fb33c44a141e67d194cf249258cb", + "value": "0", + "data": "0x9bc94d010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000186f7065726174696f6e735f6368616c6c656e6765725f76310000000000000000", + "contractMethod": null, + "contractInputsValues": null + }, + { + "to": "0x2a6c106ae13b558bb9e2ec64bd2f1f7beff3a5e0", + "value": "0", + "data": "0xee8ca3b53fa0ce0493ae4a3e182ec7ed727076c63bf2d7761a43e328e118b2afdf86afc3", + "contractMethod": null, + "contractInputsValues": null + }, + { + "to": "0xa0ff2a54adc3fb33c44a141e67d194cf249258cb", + "value": "0", + "data": "0xe551cdaa0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000176f7065726174696f6e735f73657175656e6365725f763400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e10000000000000000000000000af8c77cfeb57620c4d9dcc81df75a1f0da7064af00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000400000000000000000000000008f23bb38f531600e5d8fddaaec41f13fab46e98c00000000000000000000000000000000000000000000003635c9adc5dea00000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000008f23bb38f531600e5d8fddaaec41f13fab46e98c00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000056bc75e2d63100000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000", + "contractMethod": null, + "contractInputsValues": null + }, + { + "to": "0x2a6c106ae13b558bb9e2ec64bd2f1f7beff3a5e0", + "value": "0", + "data": "0x3323b467000000000000000000000000a0ff2a54adc3fb33c44a141e67d194cf249258cb000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006467148cd2000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000176f7065726174696f6e735f73657175656e6365725f763400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000176f7065726174696f6e735f73657175656e6365725f763400000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000057e40", + "contractMethod": null, + "contractInputsValues": null + }, + { + "to": "0xa0ff2a54adc3fb33c44a141e67d194cf249258cb", + "value": "0", + "data": "0x9bc94d010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000176f7065726174696f6e735f73657175656e6365725f7634000000000000000000", + "contractMethod": null, + "contractInputsValues": null + }, + { + "to": "0xa0ff2a54adc3fb33c44a141e67d194cf249258cb", + "value": "0", + "data": "0xe551cdaa0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000166f7065726174696f6e735f70726f706f7365725f76330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000015180000000000000000000000000af8c77cfeb57620c4d9dcc81df75a1f0da7064af00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000004000000000000000000000000049277ee36a024120ee218127354c4a3591dc90a90000000000000000000000000000000000000000000000056bc75e2d631000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000049277ee36a024120ee218127354c4a3591dc90a90000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000001158e460913d00000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000", + "contractMethod": null, + "contractInputsValues": null + }, + { + "to": "0x2a6c106ae13b558bb9e2ec64bd2f1f7beff3a5e0", + "value": "0", + "data": "0x3323b467000000000000000000000000a0ff2a54adc3fb33c44a141e67d194cf249258cb000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006467148cd2000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000166f7065726174696f6e735f70726f706f7365725f76330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000166f7065726174696f6e735f70726f706f7365725f76330000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083d600", + "contractMethod": null, + "contractInputsValues": null + }, + { + "to": "0xa0ff2a54adc3fb33c44a141e67d194cf249258cb", + "value": "0", + "data": "0x9bc94d010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000166f7065726174696f6e735f70726f706f7365725f763300000000000000000000", + "contractMethod": null, + "contractInputsValues": null + }, + { + "to": "0xa0ff2a54adc3fb33c44a141e67d194cf249258cb", + "value": "0", + "data": "0xe551cdaa0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000186f7065726174696f6e735f6368616c6c656e6765725f7632000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e10000000000000000000000000af8c77cfeb57620c4d9dcc81df75a1f0da7064af00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000ffb026f67da0869eb3abb090cb7f015ce0925cdf00000000000000000000000000000000000000000000003635c9adc5dea000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000049277ee36a024120ee218127354c4a3591dc90a900000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000056bc75e2d63100000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000", + "contractMethod": null, + "contractInputsValues": null + }, + { + "to": "0x2a6c106ae13b558bb9e2ec64bd2f1f7beff3a5e0", + "value": "0", + "data": "0x3323b467000000000000000000000000a0ff2a54adc3fb33c44a141e67d194cf249258cb000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006467148cd2000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000186f7065726174696f6e735f6368616c6c656e6765725f7632000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000186f7065726174696f6e735f6368616c6c656e6765725f7632000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000057e40", + "contractMethod": null, + "contractInputsValues": null + }, + { + "to": "0xa0ff2a54adc3fb33c44a141e67d194cf249258cb", + "value": "0", + "data": "0x9bc94d010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000186f7065726174696f6e735f6368616c6c656e6765725f76320000000000000000", + "contractMethod": null, + "contractInputsValues": null + }, + { + "to": "0xa0ff2a54adc3fb33c44a141e67d194cf249258cb", + "value": "0", + "data": "0xe551cdaa0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000146f7065726174696f6e735f67656c61746f5f7633000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000151800000000000000000000000000ff11afac4146a0babf7f9f042a22c8053a5467400000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000600000000000000000000000007506c12a824d73d9b08564d5afc22c949434755e0000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000cd438409d5cac9d2e076ac7bd0bf2377e99bb6e4000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000007506c12a824d73d9b08564d5afc22c949434755e00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000cd438409d5cac9d2e076ac7bd0bf2377e99bb6e400000000000000000000000000000000000000000000000000000000000000", + "contractMethod": null, + "contractInputsValues": null + }, + { + "to": "0x2a6c106ae13b558bb9e2ec64bd2f1f7beff3a5e0", + "value": "0", + "data": "0x3323b467000000000000000000000000a0ff2a54adc3fb33c44a141e67d194cf249258cb000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006467148cd2000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000146f7065726174696f6e735f67656c61746f5f763300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000146f7065726174696f6e735f67656c61746f5f763300000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083d600", + "contractMethod": null, + "contractInputsValues": null + }, + { + "to": "0xa0ff2a54adc3fb33c44a141e67d194cf249258cb", + "value": "0", + "data": "0x9bc94d010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000146f7065726174696f6e735f67656c61746f5f7633000000000000000000000000", + "contractMethod": null, + "contractInputsValues": null + } + ] +} \ No newline at end of file diff --git a/packages/contracts-bedrock/scripts/periphery/drippie/DrippieConfig.s.sol b/packages/contracts-bedrock/scripts/periphery/drippie/DrippieConfig.s.sol index cb7dfa6038..3ab115ba32 100644 --- a/packages/contracts-bedrock/scripts/periphery/drippie/DrippieConfig.s.sol +++ b/packages/contracts-bedrock/scripts/periphery/drippie/DrippieConfig.s.sol @@ -7,8 +7,6 @@ import { stdJson } from "forge-std/StdJson.sol"; import { IAutomate as IGelato } from "gelato/interfaces/IAutomate.sol"; -import { Artifacts } from "scripts/Artifacts.s.sol"; - import { Drippie } from "src/periphery/drippie/Drippie.sol"; import { CheckBalanceLow } from "src/periphery/drippie/dripchecks/CheckBalanceLow.sol"; import { CheckGelatoLow } from "src/periphery/drippie/dripchecks/CheckGelatoLow.sol"; @@ -16,10 +14,16 @@ import { CheckSecrets } from "src/periphery/drippie/dripchecks/CheckSecrets.sol" /// @title DrippieConfig /// @notice Loads Drippie configuration from a JSON file. -contract DrippieConfig is Script, Artifacts { +contract DrippieConfig is Script { /// @notice Error emitted when an unknown drip check is encountered. error UnknownDripCheck(string name); + /// @notice Struct describing a dripcheck. + struct DripCheck { + string name; + address addr; + } + /// @notice Drip configuration with only name and dripcheck. struct CoreDripConfig { string name; @@ -55,11 +59,11 @@ contract DrippieConfig is Script, Artifacts { /// @notice Mapping of drip names in the config. mapping(string => bool) public names; + /// @notice Mapping of dripcheck names to addresses. + mapping(string => address) public dripchecks; + /// @param _path Path to the configuration file. constructor(string memory _path) { - // Make sure artifacts are set up. - Artifacts.setUp(); - // Load the configuration file. console.log("DrippieConfig: reading file %s", _path); try vm.readFile(_path) returns (string memory data) { @@ -88,6 +92,12 @@ contract DrippieConfig is Script, Artifacts { CoreDripConfig[] memory corecfg = abi.decode(stdJson.parseRaw(_json, "$.drips"), (CoreDripConfig[])); console.log("DrippieConfig: found %d drips", corecfg.length); + // Load the dripchecks. + DripCheck[] memory checks = abi.decode(stdJson.parseRaw(_json, "$.dripchecks"), (DripCheck[])); + for (uint256 i = 0; i < checks.length; i++) { + dripchecks[checks[i].name] = checks[i].addr; + } + // Iterate and parse all of the drips. for (uint256 i = 0; i < corecfg.length; i++) { // Log so we know what's being loaded. @@ -98,7 +108,7 @@ contract DrippieConfig is Script, Artifacts { // Make sure the dripcheck is deployed. string memory dripcheck = corecfg[i].dripcheck; console.log("DrippieConfig: attempting to get address for %s", dripcheck); - mustGetAddress(dripcheck); + mustGetDripCheck(dripcheck); // Generate the base JSON path string. string memory p = string.concat("$.drips[", vm.toString(i), "]"); @@ -149,6 +159,14 @@ contract DrippieConfig is Script, Artifacts { return abi.encode(drips[_index]); } + /// @notice Retrieves the address of a dripcheck and reverts if it is not found. + /// @param _name Name of the dripcheck. + /// @return addr_ Address of the dripcheck. + function mustGetDripCheck(string memory _name) public view returns (address addr_) { + addr_ = dripchecks[_name]; + require(addr_ != address(0), "DrippieConfig: unknown dripcheck"); + } + /// @notice Check if two strings are equal. /// @param _a First string. /// @param _b Second string. diff --git a/packages/contracts-bedrock/scripts/periphery/drippie/ManageDrippie.s.sol b/packages/contracts-bedrock/scripts/periphery/drippie/ManageDrippie.s.sol index 1ae5f9ab01..903216b3d1 100644 --- a/packages/contracts-bedrock/scripts/periphery/drippie/ManageDrippie.s.sol +++ b/packages/contracts-bedrock/scripts/periphery/drippie/ManageDrippie.s.sol @@ -12,7 +12,6 @@ import { LibTaskId as GelatoTaskId } from "gelato/libraries/LibTaskId.sol"; import { GelatoBytes } from "gelato/vendor/gelato/GelatoBytes.sol"; import { Config } from "scripts/libraries/Config.sol"; -import { Artifacts } from "scripts/Artifacts.s.sol"; import { DrippieConfig } from "scripts/periphery/drippie/DrippieConfig.s.sol"; import { Drippie } from "src/periphery/drippie/Drippie.sol"; @@ -20,7 +19,7 @@ import { IDripCheck } from "src/periphery/drippie/IDripCheck.sol"; /// @title ManageDrippie /// @notice Script for managing drips in the Drippie contract. -contract ManageDrippie is Script, Artifacts { +contract ManageDrippie is Script { /// @notice Struct that contains the data for a Gelato task. struct GelatoTaskData { address taskCreator; @@ -41,8 +40,7 @@ contract ManageDrippie is Script, Artifacts { } /// @notice Sets up the deployment script. - function setUp() public override { - Artifacts.setUp(); + function setUp() public { cfg = new DrippieConfig(Config.deployConfigPath()); console.log("Config path: %s", Config.deployConfigPath()); } @@ -94,7 +92,7 @@ contract ManageDrippie is Script, Artifacts { _config: Drippie.DripConfig({ reentrant: false, interval: drip.interval, - dripcheck: IDripCheck(mustGetAddress(drip.dripcheck)), + dripcheck: IDripCheck(cfg.mustGetDripCheck(drip.dripcheck)), checkparams: drip.checkparams, actions: actions }) diff --git a/packages/contracts-bedrock/scripts/safe/forge-to-safe-json.ts b/packages/contracts-bedrock/scripts/safe/forge-to-safe-json.ts new file mode 100644 index 0000000000..d7e6cc0e93 --- /dev/null +++ b/packages/contracts-bedrock/scripts/safe/forge-to-safe-json.ts @@ -0,0 +1,124 @@ +import fs from 'fs' +import crypto from 'crypto' + +interface ForgeTransaction { + contractAddress: string + transaction: { + to: string + value: string + input: string + } +} + +interface ForgeTransactionFile { + transactions: ForgeTransaction[] + timestamp: number + chain: number +} + +interface SafeTransaction { + to: string + value: string + data: string + contractMethod: null + contractInputsValues: null +} + +interface SafeTransactionFile { + version: string + chainId: string + createdAt: number + meta: { + name: string + description: string + txBuilderVersion: string + createdFromSafeAddress: string + createdFromOwnerAddress: string + checksum: string + } + transactions: SafeTransaction[] +} + +/** + * Calculate the checksum for a safe transaction file. + * @param data The safe transaction file. + * @returns The checksum. + */ +const checksum = (data: SafeTransactionFile): string => { + const hash = crypto.createHash('sha256') + hash.update(JSON.stringify(data.transactions)) + return `0x${hash.digest('hex')}` +} + +/** + * Transform a forge transaction file into a safe transaction file. + * @param forge Forge transaction file. + * @param address Safe address. + * @returns Safe transaction file. + */ +const transform = ( + forge: ForgeTransactionFile, + address: string +): SafeTransactionFile => { + const transactions = forge.transactions.map((tx) => ({ + to: tx.contractAddress, + value: '0', + data: tx.transaction.input, + contractMethod: null, + contractInputsValues: null, + })) + + const safe: SafeTransactionFile = { + version: '1.0', + chainId: forge.chain.toString(), + createdAt: forge.timestamp, + meta: { + name: 'Transactions Batch', + description: '', + txBuilderVersion: '1.16.5', + createdFromSafeAddress: address, + createdFromOwnerAddress: '', + checksum: '', + }, + transactions, + } + + safe.meta.checksum = checksum(safe) + + return safe +} + +/** + * Get a required argument from the command line. + * @param name The argument name. + * @returns The argument value. + */ +const reqarg = (name: string) => { + const value = process.argv.find((arg) => arg.startsWith(`--${name}=`)) + if (!value) { + console.error(`Please provide --${name} argument`) + process.exit(1) + } + return value.split('=')[1] +} + +/** + * Main function. + */ +const main = () => { + const input = reqarg('input') + const output = reqarg('output') + const address = reqarg('safe') + + // Load the original forge transaction file. + const forge: ForgeTransactionFile = JSON.parse(fs.readFileSync(input, 'utf8')) + + // Transform the forge transaction file into a safe transaction file. + const safe = transform(forge, address) + + // Write the safe transaction file. + fs.writeFileSync(output, JSON.stringify(safe, null, 2), 'utf8') +} + +// Run the main function. +main()