From 77e179cb3a17f84e88181e2e2c3908e71a7df9d9 Mon Sep 17 00:00:00 2001 From: Akash Date: Wed, 4 Jun 2025 14:20:49 +0530 Subject: [PATCH 1/7] chore: cleaned up unused events --- contracts/evmx/interfaces/IWatcher.sol | 7 ------- src/enums.ts | 4 ++-- src/events.ts | 4 ++-- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/contracts/evmx/interfaces/IWatcher.sol b/contracts/evmx/interfaces/IWatcher.sol index 9aea4486..d601d8d7 100644 --- a/contracts/evmx/interfaces/IWatcher.sol +++ b/contracts/evmx/interfaces/IWatcher.sol @@ -11,13 +11,6 @@ import "./IPromiseResolver.sol"; /// @notice Interface for the Watcher Precompile system that handles payload verification and execution /// @dev Defines core functionality for payload processing and promise resolution interface IWatcher { - /// @notice Emitted when a new call is made to an app gateway - /// @param triggerId The unique identifier for the trigger - event CalledAppGateway(bytes32 triggerId); - - /// @notice Emitted when a call to an app gateway fails - /// @param triggerId The unique identifier for the trigger - event AppGatewayCallFailed(bytes32 triggerId); function requestHandler__() external view returns (IRequestHandler); diff --git a/src/enums.ts b/src/enums.ts index cb7af5e4..f54d3ba8 100644 --- a/src/enums.ts +++ b/src/enums.ts @@ -16,8 +16,8 @@ export enum Events { FeesDeposited = "FeesDeposited", // Watcher - CalledAppGateway = "CalledAppGateway", - AppGatewayCallFailed = "AppGatewayCallFailed", + TriggerFailed = "TriggerFailed", + TriggerSucceeded = "TriggerSucceeded", // PromiseResolver PromiseResolved = "PromiseResolved", diff --git a/src/events.ts b/src/events.ts index c115e6bf..8a7874dd 100644 --- a/src/events.ts +++ b/src/events.ts @@ -10,8 +10,8 @@ export const socketEvents = [ export const feesPlugEvents = [Events.FeesDeposited]; export const watcherEvents = [ - Events.CalledAppGateway, - Events.AppGatewayCallFailed, + Events.TriggerFailed, + Events.TriggerSucceeded, ]; export const promiseResolverEvents = [ From c38bb18de990c4e7f0073387ac8ad795aad9963c Mon Sep 17 00:00:00 2001 From: Akash Date: Wed, 4 Jun 2025 14:21:07 +0530 Subject: [PATCH 2/7] feat: added support for better trace --- foundry.toml | 49 ++++++++++++++++++++ hardhat-scripts/misc-scripts/createLabels.ts | 46 ++++++++++++++++++ package.json | 5 +- setupInfraContracts.sh | 1 + 4 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 hardhat-scripts/misc-scripts/createLabels.ts diff --git a/foundry.toml b/foundry.toml index 6c926318..67e2cdf5 100644 --- a/foundry.toml +++ b/foundry.toml @@ -8,3 +8,52 @@ optimizer = true optimizer_runs = 200 evm_version = 'paris' via_ir = false + + + + +[labels] +0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d = "ContractFactoryPlug" +0xbDE0D2da12F703Ccd275d721214745BccDCAD124 = "FastSwitchboard" +0x5F77550E3072c913A20B2fbdAb14026fe0E8B450 = "FeesPlug" +0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a = "Socket" +0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38 = "SocketBatcher" +0x935b06902cA5C8bb4C76e18738561c294D377A93 = "AddressResolver" +0xD1586EaaA0d473E6655c11A927cE4FbED648F3BF = "AddressResolverImpl" +0xECa623A443F21B705714D4A0f810d0A5D135FF6F = "AsyncDeployer" +0x1B0ea1b79B526dD3d5889Bb33Dbd24f790C23102 = "AsyncDeployerImpl" +0xD044f27A9c5EE4f92EF0e38685276adFDF13E90E = "AuctionManager" +0xC72BE9e639DA23570fa1eF2fF2cb7901a081916F = "AuctionManagerImpl" +0x72f4C225B4B4f0F9608a50aEe17dA9e11dcb94b2 = "Configurations" +0x351De7e4275dA7f49F75363e4E7ea86Dfe050501 = "ConfigurationsImpl" +0x5E9d1072B60D6c752B1593F5937393413372E5eF = "DeployForwarder" +0x1b7752F0039E80Aa38f7CF8b5d18798dD2ac1597 = "DeployForwarderImpl" +0x526796AC60e45CBB9b17c654C9447Baf160C084d = "ERC1967Factory" +0xA07208F9e7aE243F922317ab6604DC9F86822406 = "FeesManager" +0xbD22EDD6559B28614f44D1c768EC26491CDE1cDD = "FeesManagerImpl" +0xe2054B575664dfDBD7a7FbAf2B12420ae88DE0FF = "FeesPool" +0x38e24A2F157817b830F36A35b862F24B1494d1aD = "PromiseResolver" +0x39b5D3FBBa1BC28438e25955aaB412C7576eCd61 = "ReadPrecompile" +0x2E928C000bdC1f90716B05cE2D7182C9FA081d31 = "RequestHandler" +0xD38ae1a6C410c7681ac464bd60009198406035Ed = "RequestHandlerImpl" +0xb14a7763f09eCbd47bC5230D6170547a22834a82 = "SchedulePrecompile" +0x4C846eCa55ad8cF19B9D5d906225da7b565174C1 = "Watcher" +0x2920F4FB50343EF2b33096650cE234E8aF9E8556 = "WatcherImpl" +0x393007B660a00970b25E34FEd6506CE96120f8e2 = "WritePrecompile" +0x0026c4736E57fE2817b53f6df1E0808c3a61984d = "WritePrecompileImpl" +0x3aac37DC85C522c09A3DDdA44D181E6aCCD2f9F0 = "ContractFactoryPlug" +0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2 = "FastSwitchboard" +0xfE34ACE07836F7F05f485EAc7122D0CD58BAC047 = "FeesPlug" +0x9EDfb162b725CF6d628D68af200cAe8b624111eD = "SocketBatcher" +0x87cC19AedD434ebD3B74FfdC073CAeC7dC1E92EA = "ContractFactoryPlug" +0x5aA84ffE5eCCB5263d1AE6aEd5682EAb39Bc7036 = "FastSwitchboard" +0xa09217Cfc47F399C382E982778f6128685e13aD4 = "Socket" +0x80568677f2B092bd974657FE47Fc8531bfE5DBDC = "SocketBatcher" +0xe2904171afCeC319236cc051c81202677F7Aac1B = "ContractFactoryPlug" +0x82833e5ac997F8f9c426949595d49702E3b08414 = "FastSwitchboard" +0x468cA4bB968FD86eD752A7bD453c6869E27204f0 = "Socket" +0x977B8aB88A7159130457adA4b7078208Ab4fB111 = "SocketBatcher" +0x705A4DD80D7203BF78AcAf3BA1851D1A80fA3d89 = "ContractFactoryPlug" +0x74388051BcCfA2D28690a98242A259aD94f2B1f3 = "FastSwitchboard" +0x790E894C59d6275503e2Ff4ba95A42E38c071195 = "Socket" +0xa13B9b5e797e13316B23EfC01E506c8c0c2BFeF2 = "SocketBatcher" diff --git a/hardhat-scripts/misc-scripts/createLabels.ts b/hardhat-scripts/misc-scripts/createLabels.ts new file mode 100644 index 00000000..950b6c59 --- /dev/null +++ b/hardhat-scripts/misc-scripts/createLabels.ts @@ -0,0 +1,46 @@ +// scripts/generate-labels.ts +import fs from 'fs'; +import path from 'path'; +import { getAddresses } from '../utils'; +import { mode } from '../config'; + + +function generateFoundryLabels() { + // Read deployed addresses + const deployedAddresses = getAddresses(mode); + + // Read existing foundry.toml + const foundryPath = path.join(__dirname, "../../foundry.toml"); + let foundryContent = fs.existsSync(foundryPath) + ? fs.readFileSync(foundryPath, 'utf8') + : ''; + + // Remove existing [labels] section + foundryContent = foundryContent.replace(/\[labels\][\s\S]*?(?=\[|$)/g, ''); + + // Generate new labels section + let labelsSection = '\n[labels]\n'; + + // Track seen addresses to avoid duplicates + const seenAddresses = new Set(); + + // Loop through each chain's addresses + for (const [chainId, contracts] of Object.entries(deployedAddresses)) { + // Loop through each contract in the chain + for (const [contractName, address] of Object.entries(contracts)) { + if (typeof address === 'string' && !seenAddresses.has(address)) { + seenAddresses.add(address); + labelsSection += `${address} = "${contractName}"\n`; + } + } + } + + // Append labels section + foundryContent += labelsSection; + + // Write back to foundry.toml + fs.writeFileSync(foundryPath, foundryContent); + console.log('✅ Updated foundry.toml with contract labels'); +} + +generateFoundryLabels(); \ No newline at end of file diff --git a/package.json b/package.json index a30b0517..eef350b0 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "publishConfig": { "access": "public" }, - "version": "1.1.21", + "version": "1.1.22", "description": "socket protocol", "scripts": { "build": "yarn abi && tsc --project lib.tsconfig.json", @@ -19,7 +19,8 @@ "lintContracts": "prettier \"./**\" --write --plugin=prettier-plugin-solidity", "compile": "forge build", "deploy": "bash setupInfraContracts.sh", - "publish-core": "yarn build && yarn publish --patch --no-git-tag-version" + "publish-core": "yarn build && yarn publish --patch --no-git-tag-version", + "trace":"npx hardhat run hardhat-scripts/misc-scripts/createLabels.ts --no-compile && cast run --la " }, "pre-commit": [], "author": "", diff --git a/setupInfraContracts.sh b/setupInfraContracts.sh index 989eabaa..f8fb2d4b 100644 --- a/setupInfraContracts.sh +++ b/setupInfraContracts.sh @@ -14,5 +14,6 @@ time npx hardhat run hardhat-scripts/deploy/9.setupTransmitter.ts --no-compile time npx hardhat run hardhat-scripts/misc-scripts/errorCodes.ts --no-compile time npx hardhat run hardhat-scripts/misc-scripts/eventTopics.ts --no-compile time npx hardhat run hardhat-scripts/misc-scripts/functionSigs.ts --no-compile +time npx hardhat run hardhat-scripts/misc-scripts/createLabels.ts --no-compile time npx hardhat run hardhat-scripts/verify/verify.ts --no-compile yarn lint \ No newline at end of file From b973416697c9afe4368e0b8a5ddd5198eb88be07 Mon Sep 17 00:00:00 2001 From: Akash Date: Wed, 4 Jun 2025 17:02:13 +0530 Subject: [PATCH 3/7] feat: arbitrum fees deposit script --- foundry.toml | 3 +- hardhat-scripts/misc-scripts/createLabels.ts | 4 +++ script/helpers/DepositCreditMainnet.s.sol | 36 ++++++++++++++++++++ 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 script/helpers/DepositCreditMainnet.s.sol diff --git a/foundry.toml b/foundry.toml index 67e2cdf5..5d3291aa 100644 --- a/foundry.toml +++ b/foundry.toml @@ -10,8 +10,6 @@ evm_version = 'paris' via_ir = false - - [labels] 0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d = "ContractFactoryPlug" 0xbDE0D2da12F703Ccd275d721214745BccDCAD124 = "FastSwitchboard" @@ -57,3 +55,4 @@ via_ir = false 0x74388051BcCfA2D28690a98242A259aD94f2B1f3 = "FastSwitchboard" 0x790E894C59d6275503e2Ff4ba95A42E38c071195 = "Socket" 0xa13B9b5e797e13316B23EfC01E506c8c0c2BFeF2 = "SocketBatcher" +0xe2C2494Ea3eb297a2fe05d1d787f17dB5ad3368D = "APP_GATEWAY" diff --git a/hardhat-scripts/misc-scripts/createLabels.ts b/hardhat-scripts/misc-scripts/createLabels.ts index 950b6c59..29fcb676 100644 --- a/hardhat-scripts/misc-scripts/createLabels.ts +++ b/hardhat-scripts/misc-scripts/createLabels.ts @@ -34,6 +34,10 @@ function generateFoundryLabels() { } } } + // Add APP_GATEWAY label if environment variable exists + if (process.env.APP_GATEWAY) { + labelsSection += `${process.env.APP_GATEWAY} = "APP_GATEWAY"\n`; + } // Append labels section foundryContent += labelsSection; diff --git a/script/helpers/DepositCreditMainnet.s.sol b/script/helpers/DepositCreditMainnet.s.sol new file mode 100644 index 00000000..5472f2e7 --- /dev/null +++ b/script/helpers/DepositCreditMainnet.s.sol @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-3.0-only +pragma solidity ^0.8.21; + +import {Script} from "forge-std/Script.sol"; +import {console} from "forge-std/console.sol"; +import {FeesPlug} from "../../contracts/evmx/plugs/FeesPlug.sol"; +import {TestUSDC} from "../../contracts/evmx/mocks/TestUSDC.sol"; +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +// source .env && forge script script/helpers/DepositCreditAndNative.s.sol --broadcast --skip-simulation +contract DepositCredit is Script { + function run() external { + uint256 feesAmount = 1000000; // 1 USDC + vm.createSelectFork(vm.envString("ARBITRUM_RPC")); + + uint256 privateKey = vm.envUint("PRIVATE_KEY"); + vm.startBroadcast(privateKey); + FeesPlug feesPlug = FeesPlug(payable(vm.envAddress("ARBITRUM_FEES_PLUG"))); + address appGateway = vm.envAddress("APP_GATEWAY"); + IERC20 USDCContract = IERC20(vm.envAddress("ARBITRUM_USDC")); + + // approve fees plug to spend test USDC + USDCContract.approve(address(feesPlug), feesAmount); + + address sender = vm.addr(privateKey); + console.log("Sender address:", sender); + uint256 balance = USDCContract.balanceOf(sender); + console.log("Sender USDC balance:", balance); + if (balance < feesAmount) { + revert("Sender does not have enough USDC"); + } + console.log("App Gateway:", appGateway); + console.log("Fees Plug:", address(feesPlug)); + console.log("Fees Amount:", feesAmount); + feesPlug.depositCredit(address(USDCContract), appGateway, feesAmount); + } +} From 2e6f7b21fa041ca6d3e01658218544e968cd3612 Mon Sep 17 00:00:00 2001 From: Akash Date: Wed, 4 Jun 2025 22:34:34 +0530 Subject: [PATCH 4/7] fix: trace script --- foundry.toml | 27 ++------- hardhat-scripts/deploy/8.setupEnv.ts | 16 +++--- hardhat-scripts/misc-scripts/createLabels.ts | 58 +++++++++++++------- hardhat-scripts/utils/accounts.ts | 12 ---- hardhat-scripts/utils/address.ts | 3 +- hardhat-scripts/utils/index.ts | 1 - package.json | 2 +- script/helpers/DepositCreditMainnet.s.sol | 4 +- setupInfraContracts.sh | 6 +- src/events.ts | 5 +- trace.sh | 10 ++++ 11 files changed, 69 insertions(+), 75 deletions(-) delete mode 100644 hardhat-scripts/utils/accounts.ts create mode 100644 trace.sh diff --git a/foundry.toml b/foundry.toml index 5d3291aa..4bf19fb7 100644 --- a/foundry.toml +++ b/foundry.toml @@ -9,13 +9,7 @@ optimizer_runs = 200 evm_version = 'paris' via_ir = false - [labels] -0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d = "ContractFactoryPlug" -0xbDE0D2da12F703Ccd275d721214745BccDCAD124 = "FastSwitchboard" -0x5F77550E3072c913A20B2fbdAb14026fe0E8B450 = "FeesPlug" -0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a = "Socket" -0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38 = "SocketBatcher" 0x935b06902cA5C8bb4C76e18738561c294D377A93 = "AddressResolver" 0xD1586EaaA0d473E6655c11A927cE4FbED648F3BF = "AddressResolverImpl" 0xECa623A443F21B705714D4A0f810d0A5D135FF6F = "AsyncDeployer" @@ -39,20 +33,9 @@ via_ir = false 0x2920F4FB50343EF2b33096650cE234E8aF9E8556 = "WatcherImpl" 0x393007B660a00970b25E34FEd6506CE96120f8e2 = "WritePrecompile" 0x0026c4736E57fE2817b53f6df1E0808c3a61984d = "WritePrecompileImpl" -0x3aac37DC85C522c09A3DDdA44D181E6aCCD2f9F0 = "ContractFactoryPlug" -0xa33ACE59E4b0d9a45Cd4a3F0DBAB86D87BDd67e2 = "FastSwitchboard" -0xfE34ACE07836F7F05f485EAc7122D0CD58BAC047 = "FeesPlug" -0x9EDfb162b725CF6d628D68af200cAe8b624111eD = "SocketBatcher" -0x87cC19AedD434ebD3B74FfdC073CAeC7dC1E92EA = "ContractFactoryPlug" -0x5aA84ffE5eCCB5263d1AE6aEd5682EAb39Bc7036 = "FastSwitchboard" -0xa09217Cfc47F399C382E982778f6128685e13aD4 = "Socket" -0x80568677f2B092bd974657FE47Fc8531bfE5DBDC = "SocketBatcher" -0xe2904171afCeC319236cc051c81202677F7Aac1B = "ContractFactoryPlug" -0x82833e5ac997F8f9c426949595d49702E3b08414 = "FastSwitchboard" -0x468cA4bB968FD86eD752A7bD453c6869E27204f0 = "Socket" -0x977B8aB88A7159130457adA4b7078208Ab4fB111 = "SocketBatcher" -0x705A4DD80D7203BF78AcAf3BA1851D1A80fA3d89 = "ContractFactoryPlug" -0x74388051BcCfA2D28690a98242A259aD94f2B1f3 = "FastSwitchboard" -0x790E894C59d6275503e2Ff4ba95A42E38c071195 = "Socket" -0xa13B9b5e797e13316B23EfC01E506c8c0c2BFeF2 = "SocketBatcher" +0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d = "ContractFactoryPlug" +0xbDE0D2da12F703Ccd275d721214745BccDCAD124 = "FastSwitchboard" +0x5F77550E3072c913A20B2fbdAb14026fe0E8B450 = "FeesPlug" +0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a = "Socket" +0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38 = "SocketBatcher" 0xe2C2494Ea3eb297a2fe05d1d787f17dB5ad3368D = "APP_GATEWAY" diff --git a/hardhat-scripts/deploy/8.setupEnv.ts b/hardhat-scripts/deploy/8.setupEnv.ts index d8bc7ead..d2b6bca5 100644 --- a/hardhat-scripts/deploy/8.setupEnv.ts +++ b/hardhat-scripts/deploy/8.setupEnv.ts @@ -1,8 +1,8 @@ -import { ChainSlug, Contracts } from "../../src"; +import { ChainAddressesObj, ChainSlug, Contracts, EVMxAddressesObj } from "../../src"; import fs from "fs"; import path from "path"; import { EVMX_CHAIN_ID, mode } from "../config/config"; -import { getAddresses } from "../utils"; +import { getAddresses } from "../utils/address"; import { getFeeTokens } from "../constants"; const envFilePath = path.join(__dirname, "../../.env"); @@ -16,8 +16,8 @@ const lines = envContent.split("\n"); // Get the latest addresses const latestAddresses = getAddresses(mode); -const latestEVMxAddresses = latestAddresses[EVMX_CHAIN_ID]; - +const latestEVMxAddresses = latestAddresses[EVMX_CHAIN_ID] as EVMxAddressesObj; +const arbSepoliaAddresses = latestAddresses[ChainSlug.ARBITRUM_SEPOLIA] as ChainAddressesObj; // Create a new array to hold the updated lines const updatedLines = lines.map((line) => { if (line.startsWith("ADDRESS_RESOLVER=")) { @@ -30,22 +30,22 @@ const updatedLines = lines.map((line) => { return `FEES_MANAGER=${latestEVMxAddresses[Contracts.FeesManager]}`; } else if (line.startsWith("ARBITRUM_SOCKET=")) { return `ARBITRUM_SOCKET=${ - latestAddresses[ChainSlug.ARBITRUM_SEPOLIA][Contracts.Socket] + arbSepoliaAddresses[Contracts.Socket] }`; } else if (line.startsWith("ARBITRUM_SWITCHBOARD=")) { return `ARBITRUM_SWITCHBOARD=${ - latestAddresses[ChainSlug.ARBITRUM_SEPOLIA][Contracts.FastSwitchboard] + arbSepoliaAddresses[Contracts.FastSwitchboard] }`; } else if (line.startsWith("ARBITRUM_FEES_PLUG=")) { const feesPlug = - latestAddresses[ChainSlug.ARBITRUM_SEPOLIA][Contracts.FeesPlug]; + arbSepoliaAddresses[Contracts.FeesPlug]; if (feesPlug) { return `ARBITRUM_FEES_PLUG=${feesPlug}`; } else { return line; } } else if (line.startsWith("ARBITRUM_TEST_USDC=")) { - const testUSDC = getFeeTokens(mode, ChainSlug.ARBITRUM_SEPOLIA)[0]; + const testUSDC = getFeeTokens(mode, ChainSlug.ARBITRUM_SEPOLIA)[0] as string; if (testUSDC) { return `ARBITRUM_TEST_USDC=${testUSDC}`; } else { diff --git a/hardhat-scripts/misc-scripts/createLabels.ts b/hardhat-scripts/misc-scripts/createLabels.ts index 29fcb676..49966ad1 100644 --- a/hardhat-scripts/misc-scripts/createLabels.ts +++ b/hardhat-scripts/misc-scripts/createLabels.ts @@ -1,39 +1,53 @@ // scripts/generate-labels.ts -import fs from 'fs'; -import path from 'path'; -import { getAddresses } from '../utils'; -import { mode } from '../config'; +import fs from "fs"; +import path from "path"; +import { getAddresses } from "../utils/address"; +import { EVMX_CHAIN_ID, mode } from "../config"; - -function generateFoundryLabels() { +function generateFoundryLabels(chainSlug?: string) { // Read deployed addresses const deployedAddresses = getAddresses(mode); + console.log(`chainSlug: ${chainSlug}`); // Read existing foundry.toml const foundryPath = path.join(__dirname, "../../foundry.toml"); - let foundryContent = fs.existsSync(foundryPath) - ? fs.readFileSync(foundryPath, 'utf8') - : ''; + let foundryContent = fs.existsSync(foundryPath) + ? fs.readFileSync(foundryPath, "utf8") + : ""; // Remove existing [labels] section - foundryContent = foundryContent.replace(/\[labels\][\s\S]*?(?=\[|$)/g, ''); + foundryContent = foundryContent.replace(/\[labels\][\s\S]*?(?=\[|$)/g, ""); // Generate new labels section - let labelsSection = '\n[labels]\n'; + let labelsSection = "[labels]\n"; + + const chainIds = [EVMX_CHAIN_ID]; + if (chainSlug) { + const additionalChainId = parseInt(chainSlug, 10); + if (isNaN(additionalChainId)) { + console.error(`❌ Invalid chain ID: ${chainSlug}`); + process.exit(1); + } + chainIds.push(additionalChainId); + } - // Track seen addresses to avoid duplicates - const seenAddresses = new Set(); + for (const chainId of chainIds) { + const chainAddresses = deployedAddresses[chainId]; - // Loop through each chain's addresses - for (const [chainId, contracts] of Object.entries(deployedAddresses)) { - // Loop through each contract in the chain - for (const [contractName, address] of Object.entries(contracts)) { - if (typeof address === 'string' && !seenAddresses.has(address)) { - seenAddresses.add(address); + if (!chainAddresses) { + console.error(`❌ No addresses found for chain ${chainId}`); + process.exit(1); + } + + // Add all addresses to the labels section + for (const [contractName, address] of Object.entries(chainAddresses)) { + if (typeof address === "string") { labelsSection += `${address} = "${contractName}"\n`; } } + console.log(`✅ Added labels for chain ${chainId}`); } + // Add APP_GATEWAY label if environment variable exists if (process.env.APP_GATEWAY) { labelsSection += `${process.env.APP_GATEWAY} = "APP_GATEWAY"\n`; @@ -44,7 +58,9 @@ function generateFoundryLabels() { // Write back to foundry.toml fs.writeFileSync(foundryPath, foundryContent); - console.log('✅ Updated foundry.toml with contract labels'); + console.log("✅ Updated foundry.toml with contract labels"); } -generateFoundryLabels(); \ No newline at end of file +// Get chainSlug from command line arguments +const chainSlug = process.argv[2]; +generateFoundryLabels(chainSlug); diff --git a/hardhat-scripts/utils/accounts.ts b/hardhat-scripts/utils/accounts.ts deleted file mode 100644 index b1f579d6..00000000 --- a/hardhat-scripts/utils/accounts.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { HardhatRuntimeEnvironment } from "hardhat/types/runtime"; - -export default async function accounts( - params: any, - hre: HardhatRuntimeEnvironment -): Promise { - const [account] = await hre.ethers.getSigners(); - - console.log( - `Balance for 1st account ${await account.getAddress()}: ${await account.getBalance()}` - ); -} diff --git a/hardhat-scripts/utils/address.ts b/hardhat-scripts/utils/address.ts index f1476c41..4ac48774 100644 --- a/hardhat-scripts/utils/address.ts +++ b/hardhat-scripts/utils/address.ts @@ -1,7 +1,8 @@ import dev_addresses from "../../deployments/dev_addresses.json"; import stage_addresses from "../../deployments/stage_addresses.json"; import local_addresses from "../../deployments/local_addresses.json"; -import { ChainAddressesObj, DeploymentMode, EVMxAddressesObj } from "../../src"; +import { ChainAddressesObj, EVMxAddressesObj } from "../../src/types"; +import { DeploymentMode } from "../../src/enums"; export const getAddresses = ( mode: DeploymentMode diff --git a/hardhat-scripts/utils/index.ts b/hardhat-scripts/utils/index.ts index b53a8577..3a506d73 100644 --- a/hardhat-scripts/utils/index.ts +++ b/hardhat-scripts/utils/index.ts @@ -1,7 +1,6 @@ export * from "./address"; export * from "./networks"; export * from "./overrides"; -export * from "./accounts"; export * from "./deployUtils"; export * from "./sign"; export * from "./gatewayId"; diff --git a/package.json b/package.json index eef350b0..b61572d5 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "compile": "forge build", "deploy": "bash setupInfraContracts.sh", "publish-core": "yarn build && yarn publish --patch --no-git-tag-version", - "trace":"npx hardhat run hardhat-scripts/misc-scripts/createLabels.ts --no-compile && cast run --la " + "trace":"bash trace.sh" }, "pre-commit": [], "author": "", diff --git a/script/helpers/DepositCreditMainnet.s.sol b/script/helpers/DepositCreditMainnet.s.sol index 5472f2e7..4e1a8e33 100644 --- a/script/helpers/DepositCreditMainnet.s.sol +++ b/script/helpers/DepositCreditMainnet.s.sol @@ -5,7 +5,7 @@ import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; import {FeesPlug} from "../../contracts/evmx/plugs/FeesPlug.sol"; import {TestUSDC} from "../../contracts/evmx/mocks/TestUSDC.sol"; -import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import "solady/tokens/ERC20.sol"; // source .env && forge script script/helpers/DepositCreditAndNative.s.sol --broadcast --skip-simulation contract DepositCredit is Script { function run() external { @@ -16,7 +16,7 @@ contract DepositCredit is Script { vm.startBroadcast(privateKey); FeesPlug feesPlug = FeesPlug(payable(vm.envAddress("ARBITRUM_FEES_PLUG"))); address appGateway = vm.envAddress("APP_GATEWAY"); - IERC20 USDCContract = IERC20(vm.envAddress("ARBITRUM_USDC")); + ERC20 USDCContract = ERC20(vm.envAddress("ARBITRUM_USDC")); // approve fees plug to spend test USDC USDCContract.approve(address(feesPlug), feesAmount); diff --git a/setupInfraContracts.sh b/setupInfraContracts.sh index f8fb2d4b..c08fed42 100644 --- a/setupInfraContracts.sh +++ b/setupInfraContracts.sh @@ -8,12 +8,12 @@ time npx hardhat run hardhat-scripts/deploy/3.configureChains.ts --no-compile time npx hardhat run hardhat-scripts/deploy/4.configureEVMx.ts --no-compile time npx hardhat run hardhat-scripts/deploy/5.fundTransfers.ts --no-compile time npx hardhat run hardhat-scripts/deploy/6.connect.ts --no-compile -time npx hardhat run hardhat-scripts/deploy/7.upload.ts --no-compile -time npx hardhat run hardhat-scripts/deploy/8.setupEnv.ts --no-compile +time npx ts-node hardhat-scripts/deploy/7.upload.ts +time npx ts-node hardhat-scripts/deploy/8.setupEnv.ts time npx hardhat run hardhat-scripts/deploy/9.setupTransmitter.ts --no-compile time npx hardhat run hardhat-scripts/misc-scripts/errorCodes.ts --no-compile time npx hardhat run hardhat-scripts/misc-scripts/eventTopics.ts --no-compile time npx hardhat run hardhat-scripts/misc-scripts/functionSigs.ts --no-compile -time npx hardhat run hardhat-scripts/misc-scripts/createLabels.ts --no-compile +time npx ts-node hardhat-scripts/misc-scripts/createLabels.ts time npx hardhat run hardhat-scripts/verify/verify.ts --no-compile yarn lint \ No newline at end of file diff --git a/src/events.ts b/src/events.ts index 8a7874dd..1d57f1aa 100644 --- a/src/events.ts +++ b/src/events.ts @@ -9,10 +9,7 @@ export const socketEvents = [ export const feesPlugEvents = [Events.FeesDeposited]; -export const watcherEvents = [ - Events.TriggerFailed, - Events.TriggerSucceeded, -]; +export const watcherEvents = [Events.TriggerFailed, Events.TriggerSucceeded]; export const promiseResolverEvents = [ Events.PromiseResolved, diff --git a/trace.sh b/trace.sh new file mode 100644 index 00000000..96ef63e2 --- /dev/null +++ b/trace.sh @@ -0,0 +1,10 @@ +echo "chainSlug: $1" +echo "txHash: $2" +echo "rpcUrl: $3" +npx ts-node hardhat-scripts/misc-scripts/createLabels.ts $1 +cast run --la $2 --rpc-url $3 + +# usage : +# yarn trace +# Example : +# yarn trace 10 0x129f0f8dc131d59b88aa05d1bb136665480eb9e98ab11796f1f60fc7d4179b8d $ARBITRUM_RPC \ No newline at end of file From 01f18521c128340dccaea61114aadf7c5f497535 Mon Sep 17 00:00:00 2001 From: Akash Date: Fri, 6 Jun 2025 20:41:25 +0530 Subject: [PATCH 5/7] chore: cleanup --- EventTopics.md | 2 - foundry.toml | 53 ++++++++++------------- hardhat-scripts/deploy/8.setupEnv.ts | 23 ++++++---- hardhat.config.ts | 1 - script/counter/DeployEVMxCounterApp.s.sol | 2 +- script/helpers/DepositCredit.s.sol | 2 +- 6 files changed, 41 insertions(+), 42 deletions(-) diff --git a/EventTopics.md b/EventTopics.md index be6695ea..c94cd569 100644 --- a/EventTopics.md +++ b/EventTopics.md @@ -214,8 +214,6 @@ | Event | Arguments | Topic | | ---------------------------- | ---------------------------------------- | -------------------------------------------------------------------- | -| `AppGatewayCallFailed` | `(triggerId: bytes32)` | `0xcaf8475fdade8465ea31672463949e6cf1797fdcdd11eeddbbaf857e1e5907b7` | -| `CalledAppGateway` | `(triggerId: bytes32)` | `0xf659ffb3875368f54fb4ab8f5412ac4518af79701a48076f7a58d4448e4bdd0b` | | `Initialized` | `(version: uint64)` | `0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2` | | `OwnershipHandoverCanceled` | `(pendingOwner: address)` | `0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92` | | `OwnershipHandoverRequested` | `(pendingOwner: address)` | `0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d` | diff --git a/foundry.toml b/foundry.toml index 4bf19fb7..6d1a2709 100644 --- a/foundry.toml +++ b/foundry.toml @@ -10,32 +10,27 @@ evm_version = 'paris' via_ir = false [labels] -0x935b06902cA5C8bb4C76e18738561c294D377A93 = "AddressResolver" -0xD1586EaaA0d473E6655c11A927cE4FbED648F3BF = "AddressResolverImpl" -0xECa623A443F21B705714D4A0f810d0A5D135FF6F = "AsyncDeployer" -0x1B0ea1b79B526dD3d5889Bb33Dbd24f790C23102 = "AsyncDeployerImpl" -0xD044f27A9c5EE4f92EF0e38685276adFDF13E90E = "AuctionManager" -0xC72BE9e639DA23570fa1eF2fF2cb7901a081916F = "AuctionManagerImpl" -0x72f4C225B4B4f0F9608a50aEe17dA9e11dcb94b2 = "Configurations" -0x351De7e4275dA7f49F75363e4E7ea86Dfe050501 = "ConfigurationsImpl" -0x5E9d1072B60D6c752B1593F5937393413372E5eF = "DeployForwarder" -0x1b7752F0039E80Aa38f7CF8b5d18798dD2ac1597 = "DeployForwarderImpl" -0x526796AC60e45CBB9b17c654C9447Baf160C084d = "ERC1967Factory" -0xA07208F9e7aE243F922317ab6604DC9F86822406 = "FeesManager" -0xbD22EDD6559B28614f44D1c768EC26491CDE1cDD = "FeesManagerImpl" -0xe2054B575664dfDBD7a7FbAf2B12420ae88DE0FF = "FeesPool" -0x38e24A2F157817b830F36A35b862F24B1494d1aD = "PromiseResolver" -0x39b5D3FBBa1BC28438e25955aaB412C7576eCd61 = "ReadPrecompile" -0x2E928C000bdC1f90716B05cE2D7182C9FA081d31 = "RequestHandler" -0xD38ae1a6C410c7681ac464bd60009198406035Ed = "RequestHandlerImpl" -0xb14a7763f09eCbd47bC5230D6170547a22834a82 = "SchedulePrecompile" -0x4C846eCa55ad8cF19B9D5d906225da7b565174C1 = "Watcher" -0x2920F4FB50343EF2b33096650cE234E8aF9E8556 = "WatcherImpl" -0x393007B660a00970b25E34FEd6506CE96120f8e2 = "WritePrecompile" -0x0026c4736E57fE2817b53f6df1E0808c3a61984d = "WritePrecompileImpl" -0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d = "ContractFactoryPlug" -0xbDE0D2da12F703Ccd275d721214745BccDCAD124 = "FastSwitchboard" -0x5F77550E3072c913A20B2fbdAb14026fe0E8B450 = "FeesPlug" -0x5e1641B190B71ECCc85b1ECe934F31cD9b3dcF7a = "Socket" -0xaC61f5696e0E2636dA7bD69827380f2Ab41A3C38 = "SocketBatcher" -0xe2C2494Ea3eb297a2fe05d1d787f17dB5ad3368D = "APP_GATEWAY" +0x67790E222c41b0E787C278e757b7c40f03Fa5709 = "AddressResolver" +0x89C928379fED43B7117b852931e2968ce39C8380 = "AddressResolverImpl" +0x1C70bc3043667e884222B8835E0Ae554eb512810 = "AsyncDeployer" +0x09a762309c63a4e19cd3d822aA340Fe964Ba9C92 = "AsyncDeployerImpl" +0xC12aDF88dfc116CAF88816d150FE498843dABEEe = "AuctionManager" +0x55b76897b3BF6ED04188cbaa7DC21ae14b35D3eE = "AuctionManagerImpl" +0x377431bD1A3321C401542C8B1EC6E0c23E125042 = "Configurations" +0xDe5DedAe6e17f906D1269D5e84BEfB06F3926310 = "ConfigurationsImpl" +0xd48218b2DafF9063177b0c6Bae229ec6C5f086a9 = "DeployForwarder" +0x8e178161BB3B36a28C15DFBe3142afF8757B8993 = "DeployForwarderImpl" +0x870fCA8803bEFd119B1317AFB6794F97af7e515e = "ERC1967Factory" +0x761A9024D267006061ec943d02e3949678906f3E = "FeesManager" +0x29C583B64FD2d7b70f8F6253C2a28D60af364Cb5 = "FeesManagerImpl" +0x9De353dD1131aB4e502590D3a1832652FA316268 = "FeesPool" +0x73b1B3dF6C71e0aa912f9d6933920D4461ae9718 = "PromiseResolver" +0x58f49313816c1876417EE53De8F5de047359fB2C = "ReadPrecompile" +0x63a6D7096b5a2F5c9Ce7D8632A7A2034A85b7F01 = "RequestHandler" +0x593f4844ceEA828bC6d9D78A0ef7Ce64F42190dC = "RequestHandlerImpl" +0xF77d2059a66026Efac11334D30372429553CAaC3 = "SchedulePrecompile" +0xe4D1B4B8c0eEE90ac1f5314e758446CBa201BBA8 = "Watcher" +0x7726e559A5129A9174f89F7E2029f7212B66dD13 = "WatcherImpl" +0xd8be408E271EEe9d3D0f28305bB9b6003589E1A9 = "WritePrecompile" +0xE24c4b0f67f566Fa558b3FE85f1780CD330f1F4D = "WritePrecompileImpl" +0x4Faa9C39f4E1C5be5f9c2e3F5AC8774da3b7B1C2 = "APP_GATEWAY" diff --git a/hardhat-scripts/deploy/8.setupEnv.ts b/hardhat-scripts/deploy/8.setupEnv.ts index d2b6bca5..89551488 100644 --- a/hardhat-scripts/deploy/8.setupEnv.ts +++ b/hardhat-scripts/deploy/8.setupEnv.ts @@ -1,4 +1,9 @@ -import { ChainAddressesObj, ChainSlug, Contracts, EVMxAddressesObj } from "../../src"; +import { + ChainAddressesObj, + ChainSlug, + Contracts, + EVMxAddressesObj, +} from "../../src"; import fs from "fs"; import path from "path"; import { EVMX_CHAIN_ID, mode } from "../config/config"; @@ -17,7 +22,9 @@ const lines = envContent.split("\n"); // Get the latest addresses const latestAddresses = getAddresses(mode); const latestEVMxAddresses = latestAddresses[EVMX_CHAIN_ID] as EVMxAddressesObj; -const arbSepoliaAddresses = latestAddresses[ChainSlug.ARBITRUM_SEPOLIA] as ChainAddressesObj; +const arbSepoliaAddresses = latestAddresses[ + ChainSlug.ARBITRUM_SEPOLIA +] as ChainAddressesObj; // Create a new array to hold the updated lines const updatedLines = lines.map((line) => { if (line.startsWith("ADDRESS_RESOLVER=")) { @@ -29,23 +36,23 @@ const updatedLines = lines.map((line) => { } else if (line.startsWith("FEES_MANAGER=")) { return `FEES_MANAGER=${latestEVMxAddresses[Contracts.FeesManager]}`; } else if (line.startsWith("ARBITRUM_SOCKET=")) { - return `ARBITRUM_SOCKET=${ - arbSepoliaAddresses[Contracts.Socket] - }`; + return `ARBITRUM_SOCKET=${arbSepoliaAddresses[Contracts.Socket]}`; } else if (line.startsWith("ARBITRUM_SWITCHBOARD=")) { return `ARBITRUM_SWITCHBOARD=${ arbSepoliaAddresses[Contracts.FastSwitchboard] }`; } else if (line.startsWith("ARBITRUM_FEES_PLUG=")) { - const feesPlug = - arbSepoliaAddresses[Contracts.FeesPlug]; + const feesPlug = arbSepoliaAddresses[Contracts.FeesPlug]; if (feesPlug) { return `ARBITRUM_FEES_PLUG=${feesPlug}`; } else { return line; } } else if (line.startsWith("ARBITRUM_TEST_USDC=")) { - const testUSDC = getFeeTokens(mode, ChainSlug.ARBITRUM_SEPOLIA)[0] as string; + const testUSDC = getFeeTokens( + mode, + ChainSlug.ARBITRUM_SEPOLIA + )[0] as string; if (testUSDC) { return `ARBITRUM_TEST_USDC=${testUSDC}`; } else { diff --git a/hardhat.config.ts b/hardhat.config.ts index 74627321..f9745fe6 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -16,7 +16,6 @@ import type { import { resolve } from "path"; import fs from "fs"; -import "./hardhat-scripts/utils/accounts"; import { getJsonRpcUrl } from "./hardhat-scripts/utils/networks"; import { ChainId, diff --git a/script/counter/DeployEVMxCounterApp.s.sol b/script/counter/DeployEVMxCounterApp.s.sol index 96111337..50a81c25 100644 --- a/script/counter/DeployEVMxCounterApp.s.sol +++ b/script/counter/DeployEVMxCounterApp.s.sol @@ -16,7 +16,7 @@ contract CounterDeploy is Script { vm.startBroadcast(deployerPrivateKey); // Setting fee payment on Arbitrum Sepolia - uint256 fees = 10 ether; + uint256 fees = 1 ether; CounterAppGateway gateway = new CounterAppGateway(addressResolver, fees); diff --git a/script/helpers/DepositCredit.s.sol b/script/helpers/DepositCredit.s.sol index 767d5aac..b8d432f8 100644 --- a/script/helpers/DepositCredit.s.sol +++ b/script/helpers/DepositCredit.s.sol @@ -9,7 +9,7 @@ import {TestUSDC} from "../../contracts/evmx/mocks/TestUSDC.sol"; // source .env && forge script script/helpers/DepositCreditAndNative.s.sol --broadcast --skip-simulation contract DepositCredit is Script { function run() external { - uint256 feesAmount = 100000000; // 100 USDC + uint256 feesAmount = 2000000; // 2 USDC vm.createSelectFork(vm.envString("ARBITRUM_SEPOLIA_RPC")); uint256 privateKey = vm.envUint("PRIVATE_KEY"); From b47c8fb102e4e386fab3c0398c468df70f0ad3a2 Mon Sep 17 00:00:00 2001 From: Akash Date: Fri, 6 Jun 2025 20:42:05 +0530 Subject: [PATCH 6/7] feat: added details for trace --- hardhat-scripts/misc-scripts/createLabels.ts | 6 +- trace.sh | 60 ++++++++++++++++++-- 2 files changed, 58 insertions(+), 8 deletions(-) diff --git a/hardhat-scripts/misc-scripts/createLabels.ts b/hardhat-scripts/misc-scripts/createLabels.ts index 49966ad1..29097ee7 100644 --- a/hardhat-scripts/misc-scripts/createLabels.ts +++ b/hardhat-scripts/misc-scripts/createLabels.ts @@ -8,7 +8,6 @@ function generateFoundryLabels(chainSlug?: string) { // Read deployed addresses const deployedAddresses = getAddresses(mode); - console.log(`chainSlug: ${chainSlug}`); // Read existing foundry.toml const foundryPath = path.join(__dirname, "../../foundry.toml"); let foundryContent = fs.existsSync(foundryPath) @@ -20,7 +19,6 @@ function generateFoundryLabels(chainSlug?: string) { // Generate new labels section let labelsSection = "[labels]\n"; - const chainIds = [EVMX_CHAIN_ID]; if (chainSlug) { const additionalChainId = parseInt(chainSlug, 10); @@ -28,7 +26,7 @@ function generateFoundryLabels(chainSlug?: string) { console.error(`❌ Invalid chain ID: ${chainSlug}`); process.exit(1); } - chainIds.push(additionalChainId); + if (additionalChainId !== EVMX_CHAIN_ID) chainIds.push(additionalChainId); } for (const chainId of chainIds) { @@ -36,7 +34,7 @@ function generateFoundryLabels(chainSlug?: string) { if (!chainAddresses) { console.error(`❌ No addresses found for chain ${chainId}`); - process.exit(1); + continue; } // Add all addresses to the labels section diff --git a/trace.sh b/trace.sh index 96ef63e2..3e185bc6 100644 --- a/trace.sh +++ b/trace.sh @@ -1,10 +1,62 @@ +#!/bin/bash +source .env + +# Usage function +show_usage() { + echo "Usage: yarn trace " + echo "Example: yarn trace 42161 0x129f0f8dc131d59b88aa05d1bb136665480eb9e98ab11796f1f60fc7d4179b8d \$ARBITRUM_RPC" +} + +# Check if we have 3 arguments +if [ "$#" -ne 3 ]; then + echo "Error: 3 arguments required" + show_usage + exit 0 +fi + +# Validate required arguments +if [ -z "$1" ]; then + echo "Error: chainSlug argument is required" + show_usage + exit 0 +fi + +if [ -z "$2" ]; then + echo "Error: txHash argument is required" + show_usage + exit 0 +fi + +# Validate chainSlug is a number +if ! [[ "$1" =~ ^[0-9]+$ ]]; then + echo "Error: chainSlug must be a number" + show_usage + exit 0 +fi + +# Validate txHash format (0x followed by 64 hex chars) +if ! [[ "$2" =~ ^0x[a-fA-F0-9]{64}$ ]]; then + echo "Error: Invalid transaction hash format" + show_usage + exit 0 +fi + +# Validate RPC URL +RPC_URL=${3:-$ETH_RPC_URL} +if [ -z "$RPC_URL" ]; then + echo "Error: No RPC URL provided and ETH_RPC_URL not set in .env" + show_usage + exit 0 +fi + echo "chainSlug: $1" echo "txHash: $2" -echo "rpcUrl: $3" -npx ts-node hardhat-scripts/misc-scripts/createLabels.ts $1 -cast run --la $2 --rpc-url $3 +echo "rpcUrl: $RPC_URL" + +npx ts-node hardhat-scripts/misc-scripts/createLabels.ts $1 +cast run --la $2 --rpc-url $RPC_URL # usage : # yarn trace # Example : -# yarn trace 10 0x129f0f8dc131d59b88aa05d1bb136665480eb9e98ab11796f1f60fc7d4179b8d $ARBITRUM_RPC \ No newline at end of file +# yarn trace 42161 0x129f0f8dc131d59b88aa05d1bb136665480eb9e98ab11796f1f60fc7d4179b8d $ARBITRUM_RPC \ No newline at end of file From db621cb778cfec520ba547c2ec08ddb2d772db27 Mon Sep 17 00:00:00 2001 From: Akash Date: Fri, 6 Jun 2025 20:42:21 +0530 Subject: [PATCH 7/7] feat: added support for local --- hardhat-scripts/constants/feeConstants.ts | 5 +++++ hardhat-scripts/deploy/1.deploy.ts | 2 +- hardhat-scripts/deploy/7.upload.ts | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hardhat-scripts/constants/feeConstants.ts b/hardhat-scripts/constants/feeConstants.ts index 0c610e3e..78710f38 100644 --- a/hardhat-scripts/constants/feeConstants.ts +++ b/hardhat-scripts/constants/feeConstants.ts @@ -2,6 +2,10 @@ import { DeploymentMode } from "../../src"; import { TokenMap } from "./types"; const tokens: TokenMap = { + [DeploymentMode.LOCAL]: { + 421614: ["0x5e732b6f5DC56dDAe4dBDbf844348F87C3B0b957"], + 11155420: ["0xb669f76f781dC75E06183DcdB7fd8bcD8Ef700E6"], + }, [DeploymentMode.DEV]: { 421614: ["0x2321BF7AdFaf49b1338F1Cd474859dBc0D8dfA96"], 11155420: ["0x15dbE4B96306Cc9Eba15D834d6c1a895cF4e1697"], @@ -14,6 +18,7 @@ const tokens: TokenMap = { }; const feePools: { [key: string]: string } = { + [DeploymentMode.LOCAL]: "0x9De353dD1131aB4e502590D3a1832652FA316268", [DeploymentMode.DEV]: "0xc20Be67ef742202dc93A78aa741E7C3715eA1DFd", [DeploymentMode.STAGE]: "0xe2054B575664dfDBD7a7FbAf2B12420ae88DE0FF", }; diff --git a/hardhat-scripts/deploy/1.deploy.ts b/hardhat-scripts/deploy/1.deploy.ts index 60581ec7..f5e19534 100644 --- a/hardhat-scripts/deploy/1.deploy.ts +++ b/hardhat-scripts/deploy/1.deploy.ts @@ -106,7 +106,7 @@ const deployEVMxContracts = async () => { deployUtils.addresses[contractName] = proxyFactory.address; const feePool = getFeePool(mode); - if (feePool.length == 0) { + if (feePool?.length == 0) { const feesPool = await getOrDeploy( Contracts.FeesPool, Contracts.FeesPool, diff --git a/hardhat-scripts/deploy/7.upload.ts b/hardhat-scripts/deploy/7.upload.ts index 4eaccb8f..f5f83811 100644 --- a/hardhat-scripts/deploy/7.upload.ts +++ b/hardhat-scripts/deploy/7.upload.ts @@ -24,7 +24,7 @@ const getBucketName = () => { const getFileName = () => { switch (mode) { case DeploymentMode.LOCAL: - return "pocConfig.json"; + return process.env.CONFIG_FILE_NAME || "pocConfig.json"; case DeploymentMode.DEV: return "devConfig.json"; case DeploymentMode.STAGE: