diff --git a/deployments/stage_addresses.json b/deployments/stage_addresses.json index 0967ef42..103ae35c 100644 --- a/deployments/stage_addresses.json +++ b/deployments/stage_addresses.json @@ -1 +1,48 @@ -{} +{ + "43": { + "AddressResolver": "0xf3046B22F98C25305E8040286fB1b33378BA10a1", + "AddressResolverImpl": "0x208dC31cd6042a09bbFDdB31614A337a51b870ba", + "AuctionManager": "0x5d6d4DCb0F719F01441377F633F3EdD186e19360", + "AuctionManagerImpl": "0xF4D3BDe438416938217d4624c82AEbEb46CeD371", + "DeliveryHelper": "0x39bC71cC9AfeeA50B0638532e45b0462A5e62111", + "DeliveryHelperImpl": "0x8F18fC10a8b40b548C6F04Fb252481c783A9ace0", + "ERC1967Factory": "0x47116C0E101C4c1b5f21f0A57A86c0aa3F14D994", + "FeesManager": "0x603723100172D30171B7Fd9870ba80F8baf6FaD4", + "FeesManagerImpl": "0x8662FC08dEC7c61Dd3432fAF45a5bC024BB60B00", + "startBlock": 157, + "WatcherPrecompile": "0x4b5BcB38014cBdf852Ae6429871E0b1Ac0a05Df8", + "WatcherPrecompileImpl": "0x3cf47Ad0F040dFF1208E649C8f8e23e6B5A08916" + }, + "84532": { + "ContractFactoryPlug": "0x693bcDb114a57302Cd687b8Af1bD7583ee56748C", + "FastSwitchboard": "0xf0f51Ba62284A98AbB5D447487d5E6B536DB9B72", + "FeesPlug": "0xe3332D21b49d9347913cca2316FcC1b34fa16914", + "Socket": "0x6D54668ba18B425a1DbFC0BD720145c0aeE97f65", + "SocketBatcher": "0xC559BABEbcD92278E91a545308190E4761efc347", + "startBlock": 22449147 + }, + "421614": { + "ContractFactoryPlug": "0x78E3A5d21d0dB60bf0A585Cc2105043F919A404b", + "FastSwitchboard": "0x1448E643AbA68a0F1E4C5a3996bA2a355ce3EA8B", + "FeesPlug": "0x89324F93d852cB4fcDC4Ee202456be466ce096bb", + "Socket": "0xaFBD45A4D8378Bd2893F46d2f42e912F653B8777", + "SocketBatcher": "0x5966fc2e475Ddd0a098c3eCF1A3A1EF5036eCF7e", + "startBlock": 127843398 + }, + "11155111": { + "ContractFactoryPlug": "0xfaf8a3f8f4221398F3eC765836e8BF4A3d975962", + "FastSwitchboard": "0x0d7994B4aAc7cbdFAFEAED0B9B51E7de0586ec6f", + "FeesPlug": "0x7E33B305e12aD0E73B3aedBE67A53B7818732d7d", + "Socket": "0xe3332D21b49d9347913cca2316FcC1b34fa16914", + "SocketBatcher": "0x693bcDb114a57302Cd687b8Af1bD7583ee56748C", + "startBlock": 7797136 + }, + "11155420": { + "ContractFactoryPlug": "0xaD2b8b14DaF98555A0BFC43e70E3AFD6C0743701", + "FastSwitchboard": "0x19618cB6C20b2512dFC5E207301Af0514B9533FD", + "FeesPlug": "0x09FfC007E730fbfEA6e09dC19396CddB7d329FC1", + "Socket": "0x89366513CA2eAc43B9E7a825D69BE8Fee495Ece5", + "SocketBatcher": "0xC8db322fD39D5c6F30Ca925C32a7986c4eA0c421", + "startBlock": 24431972 + } +} diff --git a/deployments/stage_verification.json b/deployments/stage_verification.json index 0967ef42..030eaa6b 100644 --- a/deployments/stage_verification.json +++ b/deployments/stage_verification.json @@ -1 +1,166 @@ -{} +{ + "43": [ + [ + "0xF4D3BDe438416938217d4624c82AEbEb46CeD371", + "AuctionManager", + "contracts/protocol/payload-delivery/AuctionManager.sol", + [] + ], + [ + "0x8F18fC10a8b40b548C6F04Fb252481c783A9ace0", + "DeliveryHelper", + "contracts/protocol/payload-delivery/app-gateway/DeliveryHelper.sol", + [] + ], + [ + "0x8662FC08dEC7c61Dd3432fAF45a5bC024BB60B00", + "FeesManager", + "contracts/protocol/payload-delivery/FeesManager.sol", + [] + ], + [ + "0x3cf47Ad0F040dFF1208E649C8f8e23e6B5A08916", + "WatcherPrecompile", + "contracts/protocol/watcherPrecompile/WatcherPrecompile.sol", + [] + ], + [ + "0x208dC31cd6042a09bbFDdB31614A337a51b870ba", + "AddressResolver", + "contracts/protocol/AddressResolver.sol", + [] + ], + [ + "0x47116C0E101C4c1b5f21f0A57A86c0aa3F14D994", + "ERC1967Factory", + "lib/solady/src/utils/ERC1967Factory.sol", + [] + ], + [ + "0x12103e799d8887034d4560A960C2410ceE751004", + "AuctionManager", + "contracts/protocol/payload-delivery/AuctionManager.sol", + [] + ], + [ + "0xB08306a7D8733CB027dD679AdbfdF64cD52670eb", + "DeliveryHelper", + "contracts/protocol/payload-delivery/app-gateway/DeliveryHelper.sol", + [] + ], + [ + "0xE3A4c7Fb21196425C635B2b12e90F010BCD12Fec", + "FeesManager", + "contracts/protocol/payload-delivery/FeesManager.sol", + [] + ], + [ + "0x279284d399cFB4cF91f2ebe461f43C6DF020148f", + "WatcherPrecompile", + "contracts/protocol/watcherPrecompile/WatcherPrecompile.sol", + [] + ], + [ + "0x82c52D85543029C618B1F0E2fA5f194D2c4DfA2A", + "AddressResolver", + "contracts/protocol/AddressResolver.sol", + [] + ], + [ + "0xC3a6C7Ae16831b86C084CeC8192A14b6c3b53649", + "ERC1967Factory", + "lib/solady/src/utils/ERC1967Factory.sol", + [] + ] + ], + "84532": [ + [ + "0x693bcDb114a57302Cd687b8Af1bD7583ee56748C", + "ContractFactoryPlug", + "contracts/protocol/payload-delivery/ContractFactoryPlug.sol", + [ + "0x6D54668ba18B425a1DbFC0BD720145c0aeE97f65", + "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" + ] + ], + [ + "0xe3332D21b49d9347913cca2316FcC1b34fa16914", + "FeesPlug", + "contracts/protocol/payload-delivery/FeesPlug.sol", + [ + "0x6D54668ba18B425a1DbFC0BD720145c0aeE97f65", + "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" + ] + ], + [ + "0xf0f51Ba62284A98AbB5D447487d5E6B536DB9B72", + "FastSwitchboard", + "contracts/protocol/socket/switchboard/FastSwitchboard.sol", + [ + 84532, + "0x6D54668ba18B425a1DbFC0BD720145c0aeE97f65", + "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18" + ] + ], + [ + "0xC559BABEbcD92278E91a545308190E4761efc347", + "SocketBatcher", + "contracts/protocol/socket/SocketBatcher.sol", + [ + "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", + "0x6D54668ba18B425a1DbFC0BD720145c0aeE97f65" + ] + ], + [ + "0x6D54668ba18B425a1DbFC0BD720145c0aeE97f65", + "Socket", + "contracts/protocol/socket/Socket.sol", + [ + 84532, + "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", + "EVMX" + ] + ] + ], + "421614": [], + "7625382": [ + [ + "0xF4D3BDe438416938217d4624c82AEbEb46CeD371", + "AuctionManager", + "contracts/protocol/payload-delivery/AuctionManager.sol", + [] + ], + [ + "0x8F18fC10a8b40b548C6F04Fb252481c783A9ace0", + "DeliveryHelper", + "contracts/protocol/payload-delivery/app-gateway/DeliveryHelper.sol", + [] + ], + [ + "0x8662FC08dEC7c61Dd3432fAF45a5bC024BB60B00", + "FeesManager", + "contracts/protocol/payload-delivery/FeesManager.sol", + [] + ], + [ + "0x3cf47Ad0F040dFF1208E649C8f8e23e6B5A08916", + "WatcherPrecompile", + "contracts/protocol/watcherPrecompile/WatcherPrecompile.sol", + [] + ], + [ + "0x208dC31cd6042a09bbFDdB31614A337a51b870ba", + "AddressResolver", + "contracts/protocol/AddressResolver.sol", + [] + ], + [ + "0x47116C0E101C4c1b5f21f0A57A86c0aa3F14D994", + "ERC1967Factory", + "lib/solady/src/utils/ERC1967Factory.sol", + [] + ] + ], + "11155111": [], + "11155420": [] +} diff --git a/foundry.toml b/foundry.toml index 2b0a2d73..a252544a 100644 --- a/foundry.toml +++ b/foundry.toml @@ -7,9 +7,3 @@ ffi = true optimizer = true optimizer_runs = 200 evm_version = 'paris' - -# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options -[etherscan] -7625382 = { key = "empty", url = "https://evms.cloud.blockscout.com/api?" } -421614 = { key = "${ARBISCAN_API_KEY}", url = "https://api-sepolia.arbiscan.io/api?" } -11155420 = { key = "${OPTIMISM_API_KEY}", url = "https://optimism-sepolia.blockscout.com/api?" } diff --git a/hardhat-scripts/config/config.ts b/hardhat-scripts/config/config.ts index 00c7985d..6cea0d30 100644 --- a/hardhat-scripts/config/config.ts +++ b/hardhat-scripts/config/config.ts @@ -26,14 +26,19 @@ export const logConfig = () => { export const chains: Array = [ ChainSlug.ARBITRUM_SEPOLIA, ChainSlug.OPTIMISM_SEPOLIA, - ChainSlug.SEPOLIA, + // ChainSlug.SEPOLIA, ChainSlug.BASE_SEPOLIA, ]; - +export const EVM_CHAIN_ID_MAP: Record = { + [DeploymentMode.LOCAL]: 7625382, + [DeploymentMode.DEV]: 7625382, + [DeploymentMode.STAGE]: 43, + [DeploymentMode.PROD]: 3605, +} export const auctionEndDelaySeconds = 0; export const watcher = "0xb62505feacC486e809392c65614Ce4d7b051923b"; export const MAX_FEES = ethers.utils.parseEther("0.001"); -export const EVMX_CHAIN_ID = 7625382; +export const EVMX_CHAIN_ID = EVM_CHAIN_ID_MAP[mode]; export const MAX_LIMIT = 100; export const BID_TIMEOUT = 600; export const EXPIRY_TIME = 300; diff --git a/hardhat-scripts/deploy/1.deploy.ts b/hardhat-scripts/deploy/1.deploy.ts index 1b1353e9..f00e6fad 100644 --- a/hardhat-scripts/deploy/1.deploy.ts +++ b/hardhat-scripts/deploy/1.deploy.ts @@ -1,17 +1,17 @@ import { - ChainSlug, - DeploymentMode, ChainAddressesObj, + ChainSlug } from "@socket.tech/socket-protocol-common"; import { config } from "dotenv"; import { Contract, Signer, Wallet, providers } from "ethers"; +import { formatEther } from "ethers/lib/utils"; import { ethers } from "hardhat"; import { BID_TIMEOUT, EVMX_CHAIN_ID, EXPIRY_TIME, MAX_LIMIT } from "../config"; import { auctionEndDelaySeconds, chains, - mode, logConfig, + mode, } from "../config/config"; import { CORE_CONTRACTS, @@ -32,10 +32,26 @@ let EVMxOwner: string; const main = async () => { logConfig(); + await logBalances(); await deployEVMxContracts(); await deploySocketContracts(); }; +const logBalances = async () => { + const evmxDeployer = new ethers.Wallet(process.env.WATCHER_PRIVATE_KEY as string); + const socketDeployer = new ethers.Wallet(process.env.SOCKET_SIGNER_KEY as string); + let provider = getProviderFromChainSlug(EVMX_CHAIN_ID as ChainSlug); + const evmxBalance = await provider.getBalance(evmxDeployer.address); + console.log(`EVMx Deployer ${evmxDeployer.address} balance on ${EVMX_CHAIN_ID}:`, formatEther(evmxBalance)); + await Promise.all(chains.map(async (chain) => { + const provider = getProviderFromChainSlug(chain); + const socketBalance = await provider.getBalance(socketDeployer.address); + console.log(`Socket Deployer ${socketDeployer.address} balance on ${chain}:`, formatEther(socketBalance)); + })); +}; + + + const deployEVMxContracts = async () => { try { let addresses: DeploymentAddresses; diff --git a/hardhat-scripts/deploy/5.upload.ts b/hardhat-scripts/deploy/5.upload.ts index cd34b7d6..1e08325e 100644 --- a/hardhat-scripts/deploy/5.upload.ts +++ b/hardhat-scripts/deploy/5.upload.ts @@ -8,7 +8,7 @@ import { import { config as dotenvConfig } from "dotenv"; import fs from "fs"; import path from "path"; -import { EVMX_CHAIN_ID, mode } from "../config/config"; +import { EVMX_CHAIN_ID, mode, chains } from "../config/config"; dotenvConfig(); @@ -100,11 +100,8 @@ export let config: S3Config = { }, //@ts-ignore supportedChainSlugs: [ - ChainSlug.ARBITRUM_SEPOLIA, - ChainSlug.OPTIMISM_SEPOLIA, - ChainSlug.SEPOLIA, + ...chains, EVMX_CHAIN_ID, - ChainSlug.BASE_SEPOLIA, ], }; // Read the addresses.json file @@ -141,5 +138,5 @@ async function uploadToS3(data: any, fileName: string = getFileName()) { } // Upload config to S3 -uploadToS3(config, "pocConfig.json"); -// uploadToS3(config); +// uploadToS3(config, "pocConfig.json"); +uploadToS3(config); diff --git a/testScript.sh b/testScript.sh index 456bd718..d1515c5b 100644 --- a/testScript.sh +++ b/testScript.sh @@ -12,8 +12,11 @@ source .env && forge script script/counter/deployEVMxCounterApp.s.sol --broadcas source .env && forge script script/counter/DeployCounterOnchain.s.sol --broadcast --skip-simulation ## set limits for the app gateway using API source .env && cast send $APP_GATEWAY "deployContracts(uint32)" 421614 --private-key $PRIVATE_KEY --legacy --gas-price 0 -source .env && cast send $APP_GATEWAY "incrementCounters(address[])" '[0x18a93d520879524e0c215b64f05914da5883540f]' --private-key $PRIVATE_KEY --legacy --gas-price 0 +cast call $APP_GATEWAY "getOnChainAddress(bytes32,uint32)(address)" 0x5ab1536adcb0c297300e651c684f844c311727059d17eb2be15c313b5839b9eb 421614 +cast call $APP_GATEWAY "forwarderAddresses(bytes32,uint32)(address)" 0x5ab1536adcb0c297300e651c684f844c311727059d17eb2be15c313b5839b9eb 421614 +source .env && cast send $APP_GATEWAY "incrementCounters(address[])" '[0xB491b4b9343471d79d33A7c45Dc4d0a7EA818F93]' --private-key $PRIVATE_KEY --legacy --gas-price 0 source .env && cast send $APP_GATEWAY "readCounters(address[])" '[0x18a93d520879524e0c215b64f05914da5883540f]' --private-key $PRIVATE_KEY --legacy --gas-price 0 +source .env && cast send $APP_GATEWAY "withdrawFeeTokens(uint32,address,uint256,address)" 421614 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE 987793576908782 0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18 --private-key $PRIVATE_KEY --legacy --gas-price 0 forge script script/counter/incrementCounters.s.sol --broadcast --skip-simulation forge script script/counter/checkCounters.s.sol --broadcast --skip-simulation