|
| 1 | +// SPDX-License-Identifier: MIT |
| 2 | +pragma solidity ^0.8.27; |
| 3 | + |
| 4 | +import "forge-std/Script.sol"; |
| 5 | +import "forge-std/console2.sol"; |
| 6 | +import "../../utils/utils.sol"; |
| 7 | +import "../../../src/helpers/EtherFiOperationParameters.sol"; |
| 8 | + |
| 9 | +// Generate direct calldata for Operations Params updates: |
| 10 | +// forge script script/upgrades/priority-queue/SetPriorityQueueParams.s.sol --fork-url $MAINNET_RPC_URL -vvvv |
| 11 | +contract SetPriorityQueueParams is Script, Utils { |
| 12 | + EtherFiOperationParameters internal constant _OPERATION_PARAMS = |
| 13 | + EtherFiOperationParameters(payable(ETHERFI_OPERATION_PARAMETERS)); |
| 14 | + |
| 15 | + string internal constant _PRIORITY_WITHDRAWAL = "PRIORITY_WITHDRAWAL"; |
| 16 | + string internal constant _PRIORITY_USERS_FEE_BPS = "PRIORITY_USERS_FEE_BPS"; |
| 17 | + string internal constant _ORACLE = "ORACLE"; |
| 18 | + string internal constant _ESTIMATED_WD_TIME_SECONDS = "14400"; |
| 19 | + string internal constant _TEST_PRIORITY_USER = "0x6b6c4414f9fF7B1684380bc421A8b7036C040383"; |
| 20 | + address internal constant _PANKAJ_LEDGER = 0x1B7Fd9679B2678F7e01897E0A3BA9aF18dF4f71e; |
| 21 | + |
| 22 | + function run() external { |
| 23 | + _printCalldata(); |
| 24 | + _writeGnosisTxFiles(); |
| 25 | + _simulateOnFork(); |
| 26 | + } |
| 27 | + |
| 28 | + function _printCalldata() internal view { |
| 29 | + bytes memory a1 = abi.encodeWithSelector( |
| 30 | + EtherFiOperationParameters.updateTagAdmin.selector, |
| 31 | + _PRIORITY_WITHDRAWAL, |
| 32 | + ETHERFI_OPERATING_ADMIN, |
| 33 | + true |
| 34 | + ); |
| 35 | + bytes memory a2 = abi.encodeWithSelector( |
| 36 | + EtherFiOperationParameters.updateTagAdmin.selector, |
| 37 | + _PRIORITY_USERS_FEE_BPS, |
| 38 | + ETHERFI_OPERATING_ADMIN, |
| 39 | + true |
| 40 | + ); |
| 41 | + bytes memory a3 = abi.encodeWithSelector( |
| 42 | + EtherFiOperationParameters.updateTagAdmin.selector, |
| 43 | + _ORACLE, |
| 44 | + _PANKAJ_LEDGER, |
| 45 | + true |
| 46 | + ); |
| 47 | + |
| 48 | + bytes memory c1 = abi.encodeWithSelector( |
| 49 | + EtherFiOperationParameters.updateTagKeyValue.selector, |
| 50 | + _PRIORITY_WITHDRAWAL, |
| 51 | + "AUTO_FULFILL_LIMIT_ETH", |
| 52 | + "5000" |
| 53 | + ); |
| 54 | + bytes memory c2 = abi.encodeWithSelector( |
| 55 | + EtherFiOperationParameters.updateTagKeyValue.selector, |
| 56 | + _PRIORITY_WITHDRAWAL, |
| 57 | + "DAILY_CAP_PER_USER_ETH", |
| 58 | + "10000" |
| 59 | + ); |
| 60 | + bytes memory c3 = abi.encodeWithSelector( |
| 61 | + EtherFiOperationParameters.updateTagKeyValue.selector, |
| 62 | + _PRIORITY_WITHDRAWAL, |
| 63 | + "WEEKLY_CAP_PER_USER_ETH", |
| 64 | + "50000" |
| 65 | + ); |
| 66 | + bytes memory c4 = abi.encodeWithSelector( |
| 67 | + EtherFiOperationParameters.updateTagKeyValue.selector, |
| 68 | + _PRIORITY_WITHDRAWAL, |
| 69 | + "FINALIZED_NOT_CLAIMED_EXPIRY_DAYS", |
| 70 | + "5" |
| 71 | + ); |
| 72 | + bytes memory c5 = abi.encodeWithSelector( |
| 73 | + EtherFiOperationParameters.updateTagKeyValue.selector, |
| 74 | + _PRIORITY_WITHDRAWAL, |
| 75 | + "ESTIMATED_WD_TIME", |
| 76 | + _ESTIMATED_WD_TIME_SECONDS |
| 77 | + ); |
| 78 | + bytes memory c6 = abi.encodeWithSelector( |
| 79 | + EtherFiOperationParameters.updateTagKeyValue.selector, |
| 80 | + _PRIORITY_USERS_FEE_BPS, |
| 81 | + _TEST_PRIORITY_USER, |
| 82 | + "100" |
| 83 | + ); |
| 84 | + |
| 85 | + console2.log("Target (all direct calls):", address(_OPERATION_PARAMS)); |
| 86 | + console2.log(""); |
| 87 | + |
| 88 | + console2.log("A1) updateTagAdmin(PRIORITY_WITHDRAWAL, ETHERFI_OPERATING_ADMIN, true)"); |
| 89 | + console2.logBytes(a1); |
| 90 | + console2.log(""); |
| 91 | + |
| 92 | + console2.log("A2) updateTagAdmin(PRIORITY_USERS_FEE_BPS, ETHERFI_OPERATING_ADMIN, true)"); |
| 93 | + console2.logBytes(a2); |
| 94 | + console2.log(""); |
| 95 | + |
| 96 | + console2.log("A3) updateTagAdmin(ORACLE, 0x1B7Fd9679B2678F7e01897E0A3BA9aF18dF4f71e, true)"); |
| 97 | + console2.logBytes(a3); |
| 98 | + console2.log(""); |
| 99 | + |
| 100 | + console2.log("1) PRIORITY_WITHDRAWAL.AUTO_FULFILL_LIMIT_ETH = 5000"); |
| 101 | + console2.logBytes(c1); |
| 102 | + console2.log(""); |
| 103 | + |
| 104 | + console2.log("2) PRIORITY_WITHDRAWAL.DAILY_CAP_PER_USER_ETH = 10000"); |
| 105 | + console2.logBytes(c2); |
| 106 | + console2.log(""); |
| 107 | + |
| 108 | + console2.log("3) PRIORITY_WITHDRAWAL.WEEKLY_CAP_PER_USER_ETH = 50000"); |
| 109 | + console2.logBytes(c3); |
| 110 | + console2.log(""); |
| 111 | + |
| 112 | + console2.log("4) PRIORITY_WITHDRAWAL.FINALIZED_NOT_CLAIMED_EXPIRY_DAYS = 5"); |
| 113 | + console2.logBytes(c4); |
| 114 | + console2.log(""); |
| 115 | + |
| 116 | + console2.log("5) PRIORITY_WITHDRAWAL.ESTIMATED_WD_TIME = 14400"); |
| 117 | + console2.logBytes(c5); |
| 118 | + console2.log(""); |
| 119 | + |
| 120 | + console2.log("6) PRIORITY_USERS_FEE_BPS[0x6b6c4414f9fF7B1684380bc421A8b7036C040383] = 100"); |
| 121 | + console2.logBytes(c6); |
| 122 | + } |
| 123 | + |
| 124 | + function _simulateOnFork() internal { |
| 125 | + vm.startPrank(ETHERFI_OPERATING_ADMIN); |
| 126 | + _OPERATION_PARAMS.updateTagAdmin(_PRIORITY_WITHDRAWAL, ETHERFI_OPERATING_ADMIN, true); |
| 127 | + _OPERATION_PARAMS.updateTagAdmin(_PRIORITY_USERS_FEE_BPS, ETHERFI_OPERATING_ADMIN, true); |
| 128 | + _OPERATION_PARAMS.updateTagAdmin(_ORACLE, _PANKAJ_LEDGER, true); |
| 129 | + _OPERATION_PARAMS.updateTagKeyValue(_PRIORITY_WITHDRAWAL, "AUTO_FULFILL_LIMIT_ETH", "5000"); |
| 130 | + _OPERATION_PARAMS.updateTagKeyValue(_PRIORITY_WITHDRAWAL, "DAILY_CAP_PER_USER_ETH", "10000"); |
| 131 | + _OPERATION_PARAMS.updateTagKeyValue(_PRIORITY_WITHDRAWAL, "WEEKLY_CAP_PER_USER_ETH", "50000"); |
| 132 | + _OPERATION_PARAMS.updateTagKeyValue(_PRIORITY_WITHDRAWAL, "FINALIZED_NOT_CLAIMED_EXPIRY_DAYS", "5"); |
| 133 | + _OPERATION_PARAMS.updateTagKeyValue(_PRIORITY_WITHDRAWAL, "ESTIMATED_WD_TIME", _ESTIMATED_WD_TIME_SECONDS); |
| 134 | + _OPERATION_PARAMS.updateTagKeyValue(_PRIORITY_USERS_FEE_BPS, _TEST_PRIORITY_USER, "100"); |
| 135 | + vm.stopPrank(); |
| 136 | + } |
| 137 | + |
| 138 | + function _writeGnosisTxFiles() internal { |
| 139 | + address[] memory targets = new address[](9); |
| 140 | + uint256[] memory values = new uint256[](9); |
| 141 | + bytes[] memory data = new bytes[](9); |
| 142 | + |
| 143 | + for (uint256 i = 0; i < 9; i++) { |
| 144 | + targets[i] = address(_OPERATION_PARAMS); |
| 145 | + values[i] = 0; |
| 146 | + } |
| 147 | + |
| 148 | + data[0] = abi.encodeWithSelector( |
| 149 | + EtherFiOperationParameters.updateTagAdmin.selector, |
| 150 | + _PRIORITY_WITHDRAWAL, |
| 151 | + ETHERFI_OPERATING_ADMIN, |
| 152 | + true |
| 153 | + ); |
| 154 | + data[1] = abi.encodeWithSelector( |
| 155 | + EtherFiOperationParameters.updateTagAdmin.selector, |
| 156 | + _PRIORITY_USERS_FEE_BPS, |
| 157 | + ETHERFI_OPERATING_ADMIN, |
| 158 | + true |
| 159 | + ); |
| 160 | + data[2] = abi.encodeWithSelector( |
| 161 | + EtherFiOperationParameters.updateTagAdmin.selector, |
| 162 | + _ORACLE, |
| 163 | + _PANKAJ_LEDGER, |
| 164 | + true |
| 165 | + ); |
| 166 | + data[3] = abi.encodeWithSelector( |
| 167 | + EtherFiOperationParameters.updateTagKeyValue.selector, |
| 168 | + _PRIORITY_WITHDRAWAL, |
| 169 | + "AUTO_FULFILL_LIMIT_ETH", |
| 170 | + "5000" |
| 171 | + ); |
| 172 | + data[4] = abi.encodeWithSelector( |
| 173 | + EtherFiOperationParameters.updateTagKeyValue.selector, |
| 174 | + _PRIORITY_WITHDRAWAL, |
| 175 | + "DAILY_CAP_PER_USER_ETH", |
| 176 | + "10000" |
| 177 | + ); |
| 178 | + data[5] = abi.encodeWithSelector( |
| 179 | + EtherFiOperationParameters.updateTagKeyValue.selector, |
| 180 | + _PRIORITY_WITHDRAWAL, |
| 181 | + "WEEKLY_CAP_PER_USER_ETH", |
| 182 | + "50000" |
| 183 | + ); |
| 184 | + data[6] = abi.encodeWithSelector( |
| 185 | + EtherFiOperationParameters.updateTagKeyValue.selector, |
| 186 | + _PRIORITY_WITHDRAWAL, |
| 187 | + "FINALIZED_NOT_CLAIMED_EXPIRY_DAYS", |
| 188 | + "5" |
| 189 | + ); |
| 190 | + data[7] = abi.encodeWithSelector( |
| 191 | + EtherFiOperationParameters.updateTagKeyValue.selector, |
| 192 | + _PRIORITY_WITHDRAWAL, |
| 193 | + "ESTIMATED_WD_TIME", |
| 194 | + _ESTIMATED_WD_TIME_SECONDS |
| 195 | + ); |
| 196 | + data[8] = abi.encodeWithSelector( |
| 197 | + EtherFiOperationParameters.updateTagKeyValue.selector, |
| 198 | + _PRIORITY_USERS_FEE_BPS, |
| 199 | + _TEST_PRIORITY_USER, |
| 200 | + "100" |
| 201 | + ); |
| 202 | + |
| 203 | + writeSafeJson( |
| 204 | + "script/upgrades/priority-queue", |
| 205 | + "set-priority-queue-params.json", |
| 206 | + ETHERFI_OPERATING_ADMIN, |
| 207 | + targets, |
| 208 | + values, |
| 209 | + data, |
| 210 | + 1 |
| 211 | + ); |
| 212 | + } |
| 213 | +} |
0 commit comments