Skip to content

Commit 7368bcc

Browse files
authored
Merge pull request #625 from superform-xyz/hotFixPaymentHelperFTM
fix: hotfix paymentHelper FTM
2 parents a768b32 + 45a87a1 commit 7368bcc

File tree

5 files changed

+91
-4
lines changed

5 files changed

+91
-4
lines changed

script/forge-scripts/EnvironmentUtils.s.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ abstract contract EnvironmentUtils is AbstractDeploySingle {
3636
TARGET_CHAINS.push(OP);
3737
TARGET_CHAINS.push(BASE);
3838
TARGET_CHAINS.push(FANTOM);
39-
TARGET_CHAINS.push(LINEA);
40-
TARGET_CHAINS.push(BLAST);
39+
//TARGET_CHAINS.push(LINEA);
40+
//TARGET_CHAINS.push(BLAST);
4141

4242
if (useNewSalt) {
4343
salt = "SunNeverSetsOnSuperformRealmV2";

script/forge-scripts/misc/Abstract.ConfigureERC5115AndDisableAMBs.s.sol

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,64 @@ abstract contract AbstractConfigure5115FormAndDisableAMB is EnvironmentUtils {
263263
vm.stopBroadcast();
264264
}
265265

266+
function _configurePaymentHelperViaPaymentAdminFantom(
267+
uint256 env,
268+
uint256 i,
269+
uint256 trueIndex,
270+
Cycle cycle,
271+
uint64[] memory finalDeployedChains
272+
)
273+
internal
274+
{
275+
assert(salt.length > 0);
276+
UpdateVars memory vars;
277+
278+
vars.chainId = finalDeployedChains[i];
279+
cycle == Cycle.Dev ? vm.startBroadcast(deployerPrivateKey) : vm.startBroadcast();
280+
281+
uint256[] memory configTypes = new uint256[](12);
282+
configTypes[0] = 1;
283+
/// config type 2 skipped
284+
configTypes[1] = 3;
285+
configTypes[2] = 4;
286+
configTypes[3] = 5;
287+
configTypes[4] = 6;
288+
configTypes[5] = 7;
289+
configTypes[6] = 8;
290+
configTypes[7] = 9;
291+
configTypes[8] = 10;
292+
configTypes[9] = 11;
293+
configTypes[10] = 12;
294+
configTypes[11] = 13;
295+
vars.paymentHelper = PaymentHelper(_readContractsV1(env, chainNames[trueIndex], vars.chainId, "PaymentHelper"));
296+
297+
bytes[] memory configs = new bytes[](12);
298+
for (uint256 j; j < TARGET_CHAINS.length; j++) {
299+
vars.dstChainId = TARGET_CHAINS[j];
300+
if (vars.chainId != vars.dstChainId) {
301+
vars.dstTrueIndex = _getTrueIndex(vars.dstChainId);
302+
303+
/// @dev generate payment helper configs
304+
configs[0] = abi.encode(PRICE_FEEDS[vars.chainId][vars.dstChainId]);
305+
configs[1] = GAS_USED[vars.dstChainId][3];
306+
configs[2] = GAS_USED[vars.dstChainId][4];
307+
configs[3] = abi.encode(vars.dstChainId == ARBI ? 1_000_000 : 200_000);
308+
configs[4] = GAS_USED[vars.dstChainId][6];
309+
configs[5] = abi.encode(nativePrices[vars.dstTrueIndex]);
310+
configs[6] = abi.encode(gasPrices[vars.dstTrueIndex]);
311+
configs[7] = abi.encode(750);
312+
configs[8] = abi.encode(2_000_000);
313+
configs[9] = abi.encode(10_000);
314+
configs[10] = abi.encode(10_000);
315+
configs[11] = GAS_USED[vars.dstChainId][13];
316+
317+
vars.paymentHelper.batchUpdateRemoteChain(vars.dstChainId, configTypes, configs);
318+
}
319+
}
320+
321+
vm.stopBroadcast();
322+
}
323+
266324
function _configureProd(
267325
uint256 env,
268326
uint256 i,

script/forge-scripts/misc/Mainnet.ConfigureERC5115AndDisableAMBs.s.sol

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,27 @@ contract MainnetConfigure5115FormAndDisableAMB is AbstractConfigure5115FormAndDi
8585
_configurePaymentHelperViaPaymentAdmin(env, selectedChainIndex, trueIndex, Cycle.Prod, TARGET_CHAINS);
8686
}
8787

88+
function configureProdPaymentHelperViaPaymentAdminFantom(
89+
uint256 env,
90+
uint256 selectedChainIndex,
91+
uint256 useNewSalt
92+
)
93+
external
94+
{
95+
_setEnvironment(env, useNewSalt == 1 ? true : false);
96+
_preDeploymentSetup();
97+
98+
uint256 trueIndex;
99+
for (uint256 i = 0; i < chainIds.length; i++) {
100+
if (TARGET_CHAINS[selectedChainIndex] == chainIds[i]) {
101+
trueIndex = i;
102+
break;
103+
}
104+
}
105+
106+
_configurePaymentHelperViaPaymentAdminFantom(env, selectedChainIndex, trueIndex, Cycle.Prod, TARGET_CHAINS);
107+
}
108+
88109
function configure5115AndDisableAMB(uint256 env, uint256 selectedChainIndex, uint256 useNewSalt) external {
89110
_setEnvironment(env, useNewSalt == 1 ? true : false);
90111
_preDeploymentSetup();

script/utils/misc/run_script_mainnet_config5115AMB.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ wait
206206
FOUNDRY_PROFILE=production forge script script/forge-scripts/misc/Mainnet.ConfigureERC5115AndDisableAMBs.s.sol --sig "configureProdPayloadHelperv2( uint256,uint256, uint256)" 0 7 1 --rpc-url $FANTOM_RPC_URL --broadcast --slow --sender 0x1985df46791BEBb1e3ed9Ec60417F38CECc1D349
207207
wait
208208
comment
209-
210209
echo Configuring payment helper via payment admin: ...
211210

212211
export FIREBLOCKS_API_KEY=$(op read op://zry2qwhqux2w6qtjitg44xb7b4/V1_PAYMASTER_ACTION_KEY/credential)
@@ -215,6 +214,7 @@ export FOUNDRY_PROFILE=production
215214
export FIREBLOCKS_VAULT_ACCOUNT_IDS=13 #PaymentAdmin Staging
216215
export FIREBLOCKS_VAULT_ACCOUNT_IDS=5 #PaymentAdmin Prod
217216

217+
<<comment
218218
export FIREBLOCKS_RPC_URL=$ETHEREUM_RPC_URL
219219
220220
fireblocks-json-rpc --http -- forge script script/forge-scripts/misc/Mainnet.ConfigureERC5115AndDisableAMBs.s.sol --sig "configureProdPaymentHelperViaPaymentAdmin(uint256, uint256, uint256)" 0 0 0 \
@@ -263,3 +263,10 @@ fireblocks-json-rpc --http -- forge script script/forge-scripts/misc/Mainnet.Con
263263
--rpc-url {} --sender 0xD911673eAF0D3e15fe662D58De15511c5509bAbB --broadcast --unlocked --slow
264264
265265
wait
266+
comment
267+
export FIREBLOCKS_RPC_URL=$FANTOM_RPC_URL
268+
269+
fireblocks-json-rpc --http -- forge script script/forge-scripts/misc/Mainnet.ConfigureERC5115AndDisableAMBs.s.sol --sig "configureProdPaymentHelperViaPaymentAdminFantom(uint256, uint256, uint256)" 0 7 1 \
270+
--rpc-url {} --sender 0xD911673eAF0D3e15fe662D58De15511c5509bAbB --broadcast --unlocked --slow
271+
272+
wait

test/mainnet/SmokeTest.t.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
pragma solidity ^0.8.23;
33

44
import "test/utils/MainnetBaseSetup.sol";
5+
import "forge-std/console.sol";
56

67
contract SmokeTest is MainnetBaseSetup {
78
function setUp() public override {
@@ -490,7 +491,7 @@ contract SmokeTest is MainnetBaseSetup {
490491

491492
for (uint256 i; i < TARGET_DEPLOYMENT_CHAINS.length; ++i) {
492493
uint64 chainId = TARGET_DEPLOYMENT_CHAINS[i];
493-
494+
console.log("chainId", chainId);
494495
vm.selectFork(FORKS[chainId]);
495496
axelar = AxelarImplementation(getContract(chainId, "AxelarImplementation"));
496497

0 commit comments

Comments
 (0)