Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion contracts/scripts/deploy-gateway.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions contracts/scripts/upgrade/DeployGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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();

Expand All @@ -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));
Expand Down
18 changes: 18 additions & 0 deletions contracts/src/upgrade/Gateway202602.sepolia.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2023 Snowfork <hello@snowfork.com>
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();
}
}
}