diff --git a/contracts/scripts/deploy-gateway.sh b/contracts/scripts/deploy-gateway.sh index 653d85ebb..bc68e37b2 100755 --- a/contracts/scripts/deploy-gateway.sh +++ b/contracts/scripts/deploy-gateway.sh @@ -2,13 +2,16 @@ set -eux +DEPLOY_RPC_URL="${DEPLOY_RPC_URL:-${ETH_WS_ENDPOINT}}" + forge script scripts/upgrade/DeployGateway.sol:DeployGateway \ --chain "${ETH_NETWORK}" \ - --rpc-url "${ETH_WS_ENDPOINT}" \ + --rpc-url "${DEPLOY_RPC_URL}" \ --private-key "${PRIVATE_KEY}" \ --etherscan-api-key "${ETHERSCAN_API_KEY}" \ --verifier "etherscan" \ --verify \ --retries 20 \ --broadcast \ + --slow \ -vvvvv diff --git a/contracts/scripts/upgrade/DeployGateway.sol b/contracts/scripts/upgrade/DeployGateway.sol index b7fcc1102..24df009c4 100644 --- a/contracts/scripts/upgrade/DeployGateway.sol +++ b/contracts/scripts/upgrade/DeployGateway.sol @@ -4,7 +4,7 @@ pragma solidity 0.8.33; import {AgentExecutor} from "../../src/AgentExecutor.sol"; import {Gateway202509} from "../../src/upgrade/Gateway202509.sol"; -import {GatewaySepolia202601} from "../../src/upgrade/Gateway202601.sepolia.sol"; +import {GatewaySepolia202602} from "../../src/upgrade/Gateway202602.sepolia.sol"; import {Gateway} from "../../src/Gateway.sol"; import {ParaID} from "../../src/Types.sol"; import {Script} from "forge-std/Script.sol"; @@ -14,8 +14,6 @@ import {console} from "forge-std/console.sol"; contract DeployGateway is Script { using stdJson for string; - address beefyClient = 0x1817874feAb3ce053d0F40AbC23870DB35C2AFfc; - function run() public { vm.startBroadcast(); @@ -25,12 +23,14 @@ contract DeployGateway is Script { keccak256(abi.encodePacked(vm.envString("NODE_ENV"))) == keccak256(abi.encodePacked("polkadot_mainnet")) ) { + address beefyClient = 0x1817874feAb3ce053d0F40AbC23870DB35C2AFfc; gatewayLogic = new Gateway202509(address(beefyClient), address(executor)); } else if ( keccak256(abi.encodePacked(vm.envString("NODE_ENV"))) == keccak256(abi.encodePacked("westend_sepolia")) ) { - gatewayLogic = new GatewaySepolia202601(address(beefyClient), address(executor)); + address beefyClient = 0xA04460B1D8bBef33F54edB2C3115e3E4D41237A6; + gatewayLogic = new GatewaySepolia202602(address(beefyClient), address(executor)); } console.log("Gateway contract address: %s", address(gatewayLogic)); diff --git a/contracts/src/upgrade/Gateway202602.sepolia.sol b/contracts/src/upgrade/Gateway202602.sepolia.sol new file mode 100644 index 000000000..03eabfddc --- /dev/null +++ b/contracts/src/upgrade/Gateway202602.sepolia.sol @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2023 Snowfork +pragma solidity 0.8.33; + +import "../Gateway.sol"; + +// New Gateway logic contract with an fee initializer +contract GatewaySepolia202602 is Gateway { + constructor(address beefyClient, address agentExecutor) Gateway(beefyClient, agentExecutor) {} + + // Override parent initializer to prevent re-initialization of storage. + function initialize(bytes calldata) external view override { + // Ensure that arbitrary users cannot initialize storage in this logic contract. + if (ERC1967.load() == address(0)) { + revert Unauthorized(); + } + } +}