ImmutableX ZkEvm Upgradeable Contracts

Hey.

Trying to deploy a basic wagering contract just for testing.

Proxy shows up as a EOA Account for some reason.

This is the script for the deploy:

// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.20;

import {Script} from "forge-std/Script.sol";
import {console} from "forge-std/console.sol";

import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";

import {WageringContract} from "../src/WageringContract.sol";

contract DefenderScript is Script {
    function setUp() public {}

    function run() public {
        address proxy =
            Upgrades.deployUUPSProxy("WageringContract.sol:WageringContract", abi.encodeCall(WageringContractV3.initialize, (0xC2dd1910ca7fe8B18D315b77bD56406E9d9764Ee, 0xC2dd1910ca7fe8B18D315b77bD56406E9d9764Ee, 0xC2dd1910ca7fe8B18D315b77bD56406E9d9764Ee, 0xC2dd1910ca7fe8B18D315b77bD56406E9d9764Ee, 3, 3, 0x40af4101c5Cdd511b76b28DaD188E5041ecF6d4f, 0xC2dd1910ca7fe8B18D315b77bD56406E9d9764Ee)));

        console.log("Deployed proxy to address", proxy);
    }
}

And this is the Upgrade script, which fails with an error "EvmError: Revert" with no other error information:

// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.20;

import {Script} from "forge-std/Script.sol";
import {console} from "forge-std/console.sol";

import {Upgrades, Options} from "openzeppelin-foundry-upgrades/Upgrades.sol";

import {WageringContractV3} from "../src/WageringContractV3.sol";

contract DefenderScript is Script {
    function setUp() public {}

    function run() public {
        Options memory opts;
        opts.referenceContract = "WageringContract.sol:WageringContract";

        Upgrades.upgradeProxy(
            0xdaE97900D4B184c5D2012dcdB658c008966466DD, 
            "WageringContractV3.sol:WageringContractV3", 
            abi.encodeCall(WageringContractV3.initialize, (0xC2dd1910ca7fe8B18D315b77bD56406E9d9764Ee, 0xC2dd1910ca7fe8B18D315b77bD56406E9d9764Ee, 0xC2dd1910ca7fe8B18D315b77bD56406E9d9764Ee, 0xC2dd1910ca7fe8B18D315b77bD56406E9d9764Ee, 3, 3, 0x40af4101c5Cdd511b76b28DaD188E5041ecF6d4f, 0xC2dd1910ca7fe8B18D315b77bD56406E9d9764Ee)),
            opts);

        console.log("Upgraded");
    }
}

The proxy, even if I run the deploy scripts multiple times it always returns the same address (the EOA one)

Running it like this:

forge script script/Deploy.s.sol --force --rpc-url wss://immutable-zkevm-testnet.drpc.org --private-key MY_PKEY --broadcast --verify -vvvv --ffi

Any help learning a bit more about upgradeable contracts?

Foundry runs a local simulation (and prints the result from this simulation in logging statements), before broadcasting. Perhaps the local simulation of deployUUPSProxy is working, but the proxy is not actually being broadcasted to the network, so it looks like an EOA when you view the address on the live network.

You may need to add vm.broadcast and/or vm.startBroadcast. See https://book.getfoundry.sh/tutorials/solidity-scripting

I was running it with the --broadcast flag before I switched to hardhat.

I meant your script also needs to have code to tell Foundry which parts to actually broadcast, even if you are already using the --broadcast flag.