diff --git a/Errors.md b/Errors.md index 2100d8eb..fe4496c6 100644 --- a/Errors.md +++ b/Errors.md @@ -1,207 +1,206 @@ # Custom Error Codes - ## apps/super-token-lockable/LimitHook.sol -| Error | Signature | -|-------|-----------| +| Error | Signature | +| --------------------- | ------------ | | `BurnLimitExceeded()` | `0x85e72fd4` | | `MintLimitExceeded()` | `0xb643bfa6` | ## apps/super-token-lockable/SuperTokenLockable.sol -| Error | Signature | -|-------|-----------| -| `InsufficientBalance()` | `0xf4d678b8` | +| Error | Signature | +| ---------------------------- | ------------ | +| `InsufficientBalance()` | `0xf4d678b8` | | `InsufficientLockedTokens()` | `0x4f6d2a3e` | ## base/PlugBase.sol -| Error | Signature | -|-------|-----------| +| Error | Signature | +| ---------------------------- | ------------ | | `SocketAlreadyInitialized()` | `0xc9500b00` | ## mock/MockSocket.sol -| Error | Signature | -|-------|-----------| +| Error | Signature | +| -------------------------- | ------------ | | `PayloadAlreadyExecuted()` | `0xe17bd578` | -| `VerificationFailed()` | `0x439cc0cd` | -| `LowGasLimit()` | `0xd38edae0` | -| `InvalidSlug()` | `0x290a8315` | +| `VerificationFailed()` | `0x439cc0cd` | +| `LowGasLimit()` | `0xd38edae0` | +| `InvalidSlug()` | `0x290a8315` | ## mock/MockWatcherPrecompile.sol -| Error | Signature | -|-------|-----------| -| `InvalidChainSlug()` | `0xbff6b106` | +| Error | Signature | +| ---------------------- | ------------ | +| `InvalidChainSlug()` | `0xbff6b106` | | `InvalidTransmitter()` | `0x58a70a0a` | ## protocol/AddressResolver.sol -| Error | Signature | -|-------|-----------| +| Error | Signature | +| ---------------------------- | ------------ | | `InvalidAppGateway(address)` | `0x0e66940d` | ## protocol/AsyncPromise.sol -| Error | Signature | -|-------|-----------| -| `PromiseAlreadyResolved()` | `0x56b63537` | +| Error | Signature | +| ------------------------------- | ------------ | +| `PromiseAlreadyResolved()` | `0x56b63537` | | `OnlyForwarderOrLocalInvoker()` | `0xa9fb0b28` | -| `PromiseAlreadySetUp()` | `0x927c53d5` | -| `PromiseRevertFailed()` | `0x0175b9de` | +| `PromiseAlreadySetUp()` | `0x927c53d5` | +| `PromiseRevertFailed()` | `0x0175b9de` | ## protocol/payload-delivery/ContractFactoryPlug.sol -| Error | Signature | -|-------|-----------| -| `DeploymentFailed()` | `0x30116425` | -| `ExecutionFailed()` | `0xacfdb444` | +| Error | Signature | +| ------------------------- | ------------ | +| `DeploymentFailed()` | `0x30116425` | +| `ExecutionFailed()` | `0xacfdb444` | | `information(bool,bytes)` | `0x1a5c6d63` | ## protocol/payload-delivery/FeesPlug.sol -| Error | Signature | -|-------|-----------| -| `FeesAlreadyPaid()` | `0xd3b1ad69` | +| Error | Signature | +| ----------------------------------- | ------------ | +| `FeesAlreadyPaid()` | `0xd3b1ad69` | | `InsufficientTokenBalance(address)` | `0x642faafa` | -| `InvalidDepositAmount()` | `0xfe9ba5cd` | -| `TokenNotWhitelisted(address)` | `0xea3bff2e` | +| `InvalidDepositAmount()` | `0xfe9ba5cd` | +| `TokenNotWhitelisted(address)` | `0xea3bff2e` | ## protocol/payload-delivery/app-gateway/AuctionManager.sol -| Error | Signature | -|-------|-----------| -| `AuctionClosed()` | `0x36b6b46d` | +| Error | Signature | +| ------------------------- | ------------ | +| `AuctionClosed()` | `0x36b6b46d` | | `AuctionAlreadyStarted()` | `0x628e3883` | -| `BidExceedsMaxFees()` | `0x4c923f3c` | -| `InvalidTransmitter()` | `0x58a70a0a` | +| `BidExceedsMaxFees()` | `0x4c923f3c` | +| `InvalidTransmitter()` | `0x58a70a0a` | | `LowerBidAlreadyExists()` | `0xaaa1f709` | ## protocol/payload-delivery/app-gateway/BatchAsync.sol -| Error | Signature | -|-------|-----------| +| Error | Signature | +| ----------------------- | ------------ | | `AllPayloadsExecuted()` | `0x6bc43bfe` | -| `NotFromForwarder()` | `0xe83aa6bd` | -| `CallFailed(bytes32)` | `0xe22e3683` | -| `PayloadTooLarge()` | `0x492f620d` | -| `OnlyAppGateway()` | `0xfec944ea` | -| `WinningBidExists()` | `0xe8733654` | -| `InsufficientFees()` | `0x8d53e553` | +| `NotFromForwarder()` | `0xe83aa6bd` | +| `CallFailed(bytes32)` | `0xe22e3683` | +| `PayloadTooLarge()` | `0x492f620d` | +| `OnlyAppGateway()` | `0xfec944ea` | +| `WinningBidExists()` | `0xe8733654` | +| `InsufficientFees()` | `0x8d53e553` | ## protocol/payload-delivery/app-gateway/FeesManager.sol -| Error | Signature | -|-------|-----------| +| Error | Signature | +| ----------------------------- | ------------ | | `InsufficientFeesAvailable()` | `0x51488f54` | -| `NoFeesForTransmitter()` | `0x248bac55` | -| `NoFeesBlocked()` | `0x116d68f9` | -| `InvalidWatcherSignature()` | `0x5029f14f` | -| `NonceUsed()` | `0x1f6d5aef` | +| `NoFeesForTransmitter()` | `0x248bac55` | +| `NoFeesBlocked()` | `0x116d68f9` | +| `InvalidWatcherSignature()` | `0x5029f14f` | +| `NonceUsed()` | `0x1f6d5aef` | ## protocol/socket/Socket.sol -| Error | Signature | -|-------|-----------| +| Error | Signature | +| ----------------------------------------- | ------------ | | `PayloadAlreadyExecuted(ExecutionStatus)` | `0xf4c54edd` | -| `VerificationFailed()` | `0x439cc0cd` | -| `LowGasLimit()` | `0xd38edae0` | -| `InvalidSlug()` | `0x290a8315` | -| `DeadlinePassed()` | `0x70f65caa` | +| `VerificationFailed()` | `0x439cc0cd` | +| `LowGasLimit()` | `0xd38edae0` | +| `InvalidSlug()` | `0x290a8315` | +| `DeadlinePassed()` | `0x70f65caa` | ## protocol/socket/SocketConfig.sol -| Error | Signature | -|-------|-----------| -| `SwitchboardExists()` | `0x2dff8555` | -| `InvalidConnection()` | `0x63228f29` | -| `InvalidSwitchboard()` | `0xf63c9e4d` | +| Error | Signature | +| ------------------------------- | ------------ | +| `SwitchboardExists()` | `0x2dff8555` | +| `InvalidConnection()` | `0x63228f29` | +| `InvalidSwitchboard()` | `0xf63c9e4d` | | `SwitchboardExistsOrDisabled()` | `0x1c7d2487` | ## protocol/socket/SocketUtils.sol -| Error | Signature | -|-------|-----------| +| Error | Signature | +| ---------------------- | ------------ | | `InvalidTransmitter()` | `0x58a70a0a` | ## protocol/socket/switchboard/FastSwitchboard.sol -| Error | Signature | -|-------|-----------| +| Error | Signature | +| ------------------- | ------------ | | `AlreadyAttested()` | `0x35d90805` | | `WatcherNotFound()` | `0xa278e4ad` | ## protocol/socket/switchboard/SwitchboardBase.sol -| Error | Signature | -|-------|-----------| +| Error | Signature | +| ---------------- | ------------ | | `InvalidNonce()` | `0x756688fe` | ## protocol/utils/AccessControl.sol -| Error | Signature | -|-------|-----------| +| Error | Signature | +| ------------------- | ------------ | | `NoPermit(bytes32)` | `0x962f6333` | ## protocol/utils/AddressResolverUtil.sol -| Error | Signature | -|-------|-----------| -| `OnlyPayloadDelivery()` | `0x7ccc3a43` | +| Error | Signature | +| ------------------------- | ------------ | +| `OnlyPayloadDelivery()` | `0x7ccc3a43` | | `OnlyWatcherPrecompile()` | `0x663a892a` | ## protocol/utils/common/Errors.sol -| Error | Signature | -|-------|-----------| -| `NotAuthorized()` | `0xea8e4eb5` | -| `NotBridge()` | `0x7fea9dc5` | -| `NotSocket()` | `0xc59f8f7c` | -| `ConnectorUnavailable()` | `0xb1efb84a` | -| `InvalidTokenContract()` | `0x29bdfb34` | -| `ZeroAddressReceiver()` | `0x96bbcf1e` | -| `ZeroAddress()` | `0xd92e233d` | -| `ZeroAmount()` | `0x1f2a2005` | -| `InsufficientFunds()` | `0x356680b7` | -| `InvalidSigner()` | `0x815e1d64` | -| `InvalidFunction()` | `0xdb2079c3` | -| `TimeoutDelayTooLarge()` | `0xc10bfe64` | -| `TimeoutAlreadyResolved()` | `0x7dc8be06` | +| Error | Signature | +| ---------------------------- | ------------ | +| `NotAuthorized()` | `0xea8e4eb5` | +| `NotBridge()` | `0x7fea9dc5` | +| `NotSocket()` | `0xc59f8f7c` | +| `ConnectorUnavailable()` | `0xb1efb84a` | +| `InvalidTokenContract()` | `0x29bdfb34` | +| `ZeroAddressReceiver()` | `0x96bbcf1e` | +| `ZeroAddress()` | `0xd92e233d` | +| `ZeroAmount()` | `0x1f2a2005` | +| `InsufficientFunds()` | `0x356680b7` | +| `InvalidSigner()` | `0x815e1d64` | +| `InvalidFunction()` | `0xdb2079c3` | +| `TimeoutDelayTooLarge()` | `0xc10bfe64` | +| `TimeoutAlreadyResolved()` | `0x7dc8be06` | | `ResolvingTimeoutTooEarly()` | `0x28fd4c50` | -| `LimitReached()` | `0x3dd19101` | -| `FeesAlreadyPaid()` | `0xd3b1ad69` | -| `NotAuctionManager()` | `0x87944c26` | -| `CallFailed()` | `0x3204506f` | -| `PlugDisconnected()` | `0xe741bafb` | -| `InvalidAppGateway()` | `0x82ded261` | -| `AppGatewayAlreadyCalled()` | `0xb224683f` | -| `InvalidInboxCaller()` | `0x4f1aa61e` | -| `PromisesNotResolved()` | `0xb91dbe7d` | -| `InvalidPromise()` | `0x45f2d176` | -| `InvalidIndex()` | `0x63df8171` | -| `InvalidTransmitter()` | `0x58a70a0a` | -| `FeesNotSet()` | `0x2a831034` | -| `InvalidTokenAddress()` | `0x1eb00b06` | -| `InvalidWatcherSignature()` | `0x5029f14f` | -| `NonceUsed()` | `0x1f6d5aef` | +| `LimitReached()` | `0x3dd19101` | +| `FeesAlreadyPaid()` | `0xd3b1ad69` | +| `NotAuctionManager()` | `0x87944c26` | +| `CallFailed()` | `0x3204506f` | +| `PlugDisconnected()` | `0xe741bafb` | +| `InvalidAppGateway()` | `0x82ded261` | +| `AppGatewayAlreadyCalled()` | `0xb224683f` | +| `InvalidInboxCaller()` | `0x4f1aa61e` | +| `PromisesNotResolved()` | `0xb91dbe7d` | +| `InvalidPromise()` | `0x45f2d176` | +| `InvalidIndex()` | `0x63df8171` | +| `InvalidTransmitter()` | `0x58a70a0a` | +| `FeesNotSet()` | `0x2a831034` | +| `InvalidTokenAddress()` | `0x1eb00b06` | +| `InvalidWatcherSignature()` | `0x5029f14f` | +| `NonceUsed()` | `0x1f6d5aef` | ## protocol/watcherPrecompile/WatcherPrecompile.sol -| Error | Signature | -|-------|-----------| -| `InvalidChainSlug()` | `0xbff6b106` | -| `InvalidConnection()` | `0x63228f29` | -| `InvalidTransmitter()` | `0x58a70a0a` | +| Error | Signature | +| ------------------------- | ------------ | +| `InvalidChainSlug()` | `0xbff6b106` | +| `InvalidConnection()` | `0x63228f29` | +| `InvalidTransmitter()` | `0x58a70a0a` | | `InvalidTimeoutRequest()` | `0x600ca372` | -| `InvalidPayloadId()` | `0xfa0b8c86` | -| `InvalidCaller()` | `0x48f5c3ed` | +| `InvalidPayloadId()` | `0xfa0b8c86` | +| `InvalidCaller()` | `0x48f5c3ed` | ## protocol/watcherPrecompile/WatcherPrecompileLimits.sol -| Error | Signature | -|-------|-----------| -| `ActionNotSupported(address,bytes32)` | `0xa219158f` | -| `NotDeliveryHelper()` | `0x29029c67` | +| Error | Signature | +| ------------------------------------------------ | ------------ | +| `ActionNotSupported(address,bytes32)` | `0xa219158f` | +| `NotDeliveryHelper()` | `0x29029c67` | | `LimitExceeded(address,bytes32,uint256,uint256)` | `0x80bb2621` | diff --git a/contracts/interfaces/IERC20.sol b/contracts/interfaces/IERC20.sol deleted file mode 100644 index 8810365c..00000000 --- a/contracts/interfaces/IERC20.sol +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.8.0; - -/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. -interface IERC20 { - /*////////////////////////////////////////////////////////////// - EVENTS - //////////////////////////////////////////////////////////////*/ - - event Transfer(address indexed from, address indexed to, uint256 amount); - - event Approval(address indexed owner, address indexed spender, uint256 amount); - - /*////////////////////////////////////////////////////////////// - ERC20 STORAGE - //////////////////////////////////////////////////////////////*/ - - function totalSupply() external view returns (uint256); - - function balanceOf(address account_) external view returns (uint256); - - function allowance(address owner_, address spender_) external view returns (uint256); - - /*////////////////////////////////////////////////////////////// - ERC20 LOGIC - //////////////////////////////////////////////////////////////*/ - - function approve(address spender_, uint256 amount_) external returns (bool); - - function transfer(address to_, uint256 amount_) external returns (bool); - - function transferFrom(address from_, address to_, uint256 amount_) external returns (bool); -} diff --git a/deployments/dev_addresses_composer.json b/deployments/dev_addresses_composer.json deleted file mode 100644 index 8e2f78f9..00000000 --- a/deployments/dev_addresses_composer.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "421614": { - "ContractFactoryPlug": "0x38cAf1D477F806Fae8aed84ecD68E00eF6c2cB0c", - "FastSwitchboard": "0xB16475054Dc6D8bfbd80daE964bbE416a4B7a791", - "FeesPlug": "0x228AA70a66498FC75524371cDAfB31958Ca5F12D", - "Socket": "0x963eC83119862cD518826DA9177B348cFdfebaA4", - "SocketBatcher": "0x2db8cb4f841aa944869ECD5002e8153642A30971", - "startBlock": 125604419 - }, - "7625382": { - "AddressResolver": "0x5d16F235471531521ec23e1c75F26F55b15f51F1", - "AddressResolverImpl": "0x3d981a431c38B9b781178279AecFb91509BDa645", - "AuctionManager": "0x7DC27a33f99252FaF2388416620E3178597cfBdC", - "AuctionManagerImpl": "0x48228f8ebdCA92B7F7fdC9C545372123f5Bcc4C4", - "DeliveryHelper": "0xC415FA4baE9183a2439FA0a06dd558bb4FCc0051", - "DeliveryHelperImpl": "0xc67BEa5A43cb0D908866F3577D1f967f901Dbc75", - "ERC1967Factory": "0xC36e58c0c505435179417a318333e4a7C1867247", - "FeesManager": "0x7B03A532aCea55bc06aB39b844797dD5d82Af012", - "FeesManagerImpl": "0xaF369f1fc1523dc8086c2ACDD7e7A73aA8732FE6", - "startBlock": 5534, - "WatcherPrecompile": "0x71B25Fc5f47E786574aFca919Ca61611168d94D0", - "WatcherPrecompileImpl": "0xCF9728Dc37da5c5B08780F818B6fB65c64d6a402" - }, - "11155420": { - "ContractFactoryPlug": "0x43942f05D5b44DC6Ca19b316dF54BE87FcF9D583", - "FastSwitchboard": "0xA448B8CD7325AA38d4E533cE209471B7ce01901F", - "FeesPlug": "0x17b3c7c5552fA4e730888558A8912cFD7A8b042e", - "Socket": "0xaF57894A5244711a7bEBE582E9e121980f1aa95e", - "SocketBatcher": "0x977e2f721f8958b2F776d2dc693D04A1256ed426", - "startBlock": 24127420 - } -} diff --git a/deployments/dev_verification.json b/deployments/dev_verification.json index e9eca4a3..93eca439 100644 --- a/deployments/dev_verification.json +++ b/deployments/dev_verification.json @@ -41,11 +41,7 @@ "0x6c40Fb39B03e32EC4D23e31DdE6D10283F2C7b4F", "Socket", "contracts/protocol/socket/Socket.sol", - [ - 84532, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] + [84532, "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", "EVMX"] ] ], "421614": [ @@ -217,11 +213,7 @@ "0x79Ac996De9333956f4980397ED5Bd91f77f10b01", "Socket", "contracts/protocol/socket/Socket.sol", - [ - 11155420, - "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", - "EVMX" - ] + [11155420, "0x3339Cf48f1F9cf31b6F8c2664d144c7444eBBB18", "EVMX"] ] ] } diff --git a/deployments/local_addresses.json b/deployments/local_addresses.json deleted file mode 100644 index 7f90cbb0..00000000 --- a/deployments/local_addresses.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "7625382": {} -} diff --git a/deployments/prod_addresses.json b/deployments/prod_addresses.json deleted file mode 100644 index 9e26dfee..00000000 --- a/deployments/prod_addresses.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/deployments/prod_verification.json b/deployments/prod_verification.json deleted file mode 100644 index 9e26dfee..00000000 --- a/deployments/prod_verification.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/hardhat-scripts/constants/roles.ts b/hardhat-scripts/constants/roles.ts index 97188a39..5faeb8c1 100644 --- a/hardhat-scripts/constants/roles.ts +++ b/hardhat-scripts/constants/roles.ts @@ -1,5 +1,3 @@ - - export enum ROLES { RESCUE_ROLE = "RESCUE_ROLE", WITHDRAW_ROLE = "WITHDRAW_ROLE", diff --git a/hardhat-scripts/constants/types.ts b/hardhat-scripts/constants/types.ts index 2f014a9b..97603b2c 100644 --- a/hardhat-scripts/constants/types.ts +++ b/hardhat-scripts/constants/types.ts @@ -1,5 +1,8 @@ -import { ChainAddressesObj, ChainSlug } from "@socket.tech/socket-protocol-common"; +import { + ChainAddressesObj, + ChainSlug, +} from "@socket.tech/socket-protocol-common"; export type DeploymentAddresses = { - [chainSlug in ChainSlug]?: ChainAddressesObj; -}; \ No newline at end of file + [chainSlug in ChainSlug]?: ChainAddressesObj; +}; diff --git a/hardhat-scripts/deploy/1.deploy.ts b/hardhat-scripts/deploy/1.deploy.ts index 3b2eaf77..edef7ede 100644 --- a/hardhat-scripts/deploy/1.deploy.ts +++ b/hardhat-scripts/deploy/1.deploy.ts @@ -1,7 +1,7 @@ import { ChainSlug, DeploymentMode, - ChainAddressesObj + ChainAddressesObj, } from "@socket.tech/socket-protocol-common"; import { config } from "dotenv"; import { Contract, Signer, Wallet, providers } from "ethers"; @@ -13,7 +13,11 @@ import { mode, logConfig, } from "../config/config"; -import { CORE_CONTRACTS, DeploymentAddresses, EVMxCoreContracts } from "../constants"; +import { + CORE_CONTRACTS, + DeploymentAddresses, + EVMxCoreContracts, +} from "../constants"; import { getImplementationAddress } from "../migration/migrate-proxies"; import { DeployParams, @@ -160,9 +164,10 @@ const deployEVMxContracts = async () => { deployUtils.signer ); - deployUtils.addresses.startBlock = (deployUtils.addresses.startBlock - ? deployUtils.addresses.startBlock - : await deployUtils.signer.provider?.getBlockNumber()) || 0; + deployUtils.addresses.startBlock = + (deployUtils.addresses.startBlock + ? deployUtils.addresses.startBlock + : await deployUtils.signer.provider?.getBlockNumber()) || 0; await storeAddresses(deployUtils.addresses, chain as ChainSlug, mode); } catch (error) { @@ -256,9 +261,10 @@ const deploySocketContracts = async () => { ); deployUtils.addresses[contractName] = contractFactoryPlug.address; - deployUtils.addresses.startBlock = (deployUtils.addresses.startBlock - ? deployUtils.addresses.startBlock - : await deployUtils.signer.provider?.getBlockNumber()) || 0; + deployUtils.addresses.startBlock = + (deployUtils.addresses.startBlock + ? deployUtils.addresses.startBlock + : await deployUtils.signer.provider?.getBlockNumber()) || 0; await storeAddresses(deployUtils.addresses, chain, mode); } catch (error) { diff --git a/hardhat-scripts/deploy/2.roles.ts b/hardhat-scripts/deploy/2.roles.ts index cf96de35..1e3c25f5 100644 --- a/hardhat-scripts/deploy/2.roles.ts +++ b/hardhat-scripts/deploy/2.roles.ts @@ -4,8 +4,18 @@ dotenvConfig(); import { Wallet } from "ethers"; import { ethers } from "hardhat"; import { chains, EVMX_CHAIN_ID, mode, watcher } from "../config"; -import { CORE_CONTRACTS, DeploymentAddresses, EVMxCoreContracts } from "../constants"; -import { getAddresses, getInstance, getProviderFromChainSlug, getRoleHash, overrides } from "../utils"; +import { + CORE_CONTRACTS, + DeploymentAddresses, + EVMxCoreContracts, +} from "../constants"; +import { + getAddresses, + getInstance, + getProviderFromChainSlug, + getRoleHash, + overrides, +} from "../utils"; import { relayerAddressList } from "../constants/relayers"; import { ChainAddressesObj } from "@socket.tech/socket-protocol-common"; import { ROLES } from "../constants/roles"; diff --git a/hardhat-scripts/deploy/3.upgradeManagers.ts b/hardhat-scripts/deploy/3.upgradeManagers.ts index 62344c57..eaf3592f 100644 --- a/hardhat-scripts/deploy/3.upgradeManagers.ts +++ b/hardhat-scripts/deploy/3.upgradeManagers.ts @@ -10,7 +10,11 @@ dotenvConfig(); import { Wallet } from "ethers"; import { ethers } from "hardhat"; import { chains, EVMX_CHAIN_ID, mode } from "../config"; -import { CORE_CONTRACTS, DeploymentAddresses, EVMxCoreContracts } from "../constants"; +import { + CORE_CONTRACTS, + DeploymentAddresses, + EVMxCoreContracts, +} from "../constants"; import { getAddresses, getInstance, diff --git a/hardhat-scripts/deploy/4.connect.ts b/hardhat-scripts/deploy/4.connect.ts index f5f78b89..0de5a503 100644 --- a/hardhat-scripts/deploy/4.connect.ts +++ b/hardhat-scripts/deploy/4.connect.ts @@ -1,10 +1,17 @@ -import { - ChainAddressesObj, -} from "@socket.tech/socket-protocol-common"; +import { ChainAddressesObj } from "@socket.tech/socket-protocol-common"; import { Contract, ethers, providers, Wallet } from "ethers"; import { chains, EVMX_CHAIN_ID, mode } from "../config"; -import { CORE_CONTRACTS, DeploymentAddresses, EVMxCoreContracts } from "../constants"; -import { getAddresses, getInstance, getProviderFromChainSlug, overrides } from "../utils"; +import { + CORE_CONTRACTS, + DeploymentAddresses, + EVMxCoreContracts, +} from "../constants"; +import { + getAddresses, + getInstance, + getProviderFromChainSlug, + overrides, +} from "../utils"; import { signWatcherMessage } from "../utils/sign"; const plugs = [CORE_CONTRACTS.ContractFactoryPlug, CORE_CONTRACTS.FeesPlug]; export type AppGatewayConfig = { @@ -195,12 +202,12 @@ export const updateConfigEVMx = async () => { if (appConfigs.length > 0) { console.log({ appConfigs }); const encodedMessage = ethers.utils.defaultAbiCoder.encode( - ['bytes4', 'tuple(address plug,address appGateway,address switchboard,uint32 chainSlug)[]'], [ - watcher.interface.getSighash('setAppGateways'), - appConfigs, + "bytes4", + "tuple(address plug,address appGateway,address switchboard,uint32 chainSlug)[]", ], - ); + [watcher.interface.getSighash("setAppGateways"), appConfigs] + ); const { nonce, signature } = await signWatcherMessage(encodedMessage); const tx = await watcher.setAppGateways(appConfigs, nonce, signature, { ...overrides(EVMX_CHAIN_ID), diff --git a/hardhat-scripts/deploy/5.upload.ts b/hardhat-scripts/deploy/5.upload.ts index dbe22860..cd34b7d6 100644 --- a/hardhat-scripts/deploy/5.upload.ts +++ b/hardhat-scripts/deploy/5.upload.ts @@ -1,5 +1,10 @@ import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3"; -import { ChainAddressesObj, EVMxAddressesObj, ChainSlug, DeploymentMode } from "@socket.tech/socket-protocol-common"; +import { + ChainAddressesObj, + EVMxAddressesObj, + ChainSlug, + DeploymentMode, +} from "@socket.tech/socket-protocol-common"; import { config as dotenvConfig } from "dotenv"; import fs from "fs"; import path from "path"; @@ -26,14 +31,13 @@ const getFileName = () => { return "devConfig.json"; case DeploymentMode.STAGE: return "stageConfig.json"; - case DeploymentMode.PROD: + case DeploymentMode.PROD: return "prodConfig.json"; default: throw new Error(`Invalid deployment mode: ${mode}`); } }; - const getAddressesPath = () => { switch (mode) { case DeploymentMode.DEV: @@ -104,10 +108,7 @@ export let config: S3Config = { ], }; // Read the addresses.json file -const addressesPath = path.join( - __dirname, - getAddressesPath() -); +const addressesPath = path.join(__dirname, getAddressesPath()); const addresses = JSON.parse(fs.readFileSync(addressesPath, "utf8")); // Update config with addresses diff --git a/hardhat-scripts/utils/address.ts b/hardhat-scripts/utils/address.ts index af8c5edd..d74f1313 100644 --- a/hardhat-scripts/utils/address.ts +++ b/hardhat-scripts/utils/address.ts @@ -1,5 +1,3 @@ - - import dev_addresses from "../../deployments/dev_addresses.json"; import stage_addresses from "../../deployments/stage_addresses.json"; import prod_addresses from "../../deployments/prod_addresses.json"; diff --git a/hardhat-scripts/utils/deployUtils.ts b/hardhat-scripts/utils/deployUtils.ts index 36d1241c..a3accdf2 100644 --- a/hardhat-scripts/utils/deployUtils.ts +++ b/hardhat-scripts/utils/deployUtils.ts @@ -8,7 +8,7 @@ import fs from "fs"; import { ChainAddressesObj, ChainSlug, - DeploymentMode + DeploymentMode, } from "@socket.tech/socket-protocol-common"; import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; import { overrides } from "../utils"; diff --git a/hardhat-scripts/utils/networks.ts b/hardhat-scripts/utils/networks.ts index 56d69fd8..b2f55ebe 100644 --- a/hardhat-scripts/utils/networks.ts +++ b/hardhat-scripts/utils/networks.ts @@ -22,7 +22,7 @@ function createReverseEnumMap(enumObj: any) { } export const rpcKeys = (chainSlug: ChainSlug) => { - if (chainSlug == EVMX_CHAIN_ID as ChainSlug) { + if (chainSlug == (EVMX_CHAIN_ID as ChainSlug)) { return "EVMX_RPC"; } let chainName = chainSlugToHardhatChainName[chainSlug].toString(); diff --git a/hardhat-scripts/utils/sign.ts b/hardhat-scripts/utils/sign.ts index 6c038e8b..2bd67a08 100644 --- a/hardhat-scripts/utils/sign.ts +++ b/hardhat-scripts/utils/sign.ts @@ -4,21 +4,16 @@ import { EVMxCoreContracts } from "../constants"; import { getAddresses } from "./address"; export const signWatcherMessage = async (encodedMessage: string) => { - const signatureNonce = Date.now(); - const signer = new Wallet(process.env.WATCHER_PRIVATE_KEY!); - const watcherPrecompileAddress = getAddresses(mode)[EVMX_CHAIN_ID][EVMxCoreContracts.WatcherPrecompile]; - const digest = ethers.utils.keccak256( - ethers.utils.defaultAbiCoder.encode( - ['address', 'uint32', 'uint256', 'bytes'], - [ - watcherPrecompileAddress, - EVMX_CHAIN_ID, - signatureNonce, - encodedMessage, - ], - ), - ); - const signature = await signer.signMessage(ethers.utils.arrayify(digest)); - return { nonce: signatureNonce, signature }; - }; - \ No newline at end of file + const signatureNonce = Date.now(); + const signer = new Wallet(process.env.WATCHER_PRIVATE_KEY!); + const watcherPrecompileAddress = + getAddresses(mode)[EVMX_CHAIN_ID][EVMxCoreContracts.WatcherPrecompile]; + const digest = ethers.utils.keccak256( + ethers.utils.defaultAbiCoder.encode( + ["address", "uint32", "uint256", "bytes"], + [watcherPrecompileAddress, EVMX_CHAIN_ID, signatureNonce, encodedMessage] + ) + ); + const signature = await signer.signMessage(ethers.utils.arrayify(digest)); + return { nonce: signatureNonce, signature }; +}; diff --git a/hardhat-scripts/verify/verify.ts b/hardhat-scripts/verify/verify.ts index 20ccc6b5..4afabe63 100644 --- a/hardhat-scripts/verify/verify.ts +++ b/hardhat-scripts/verify/verify.ts @@ -64,11 +64,7 @@ export const main = async () => { } } - await storeUnVerifiedParams( - unverifiedChainParams, - chain, - mode - ); + await storeUnVerifiedParams(unverifiedChainParams, chain, mode); } } catch (error) { console.log("Error in verifying contracts", error); diff --git a/script/mock/DeployEVMx.s.sol b/script/admin/mock/DeployEVMx.s.sol similarity index 80% rename from script/mock/DeployEVMx.s.sol rename to script/admin/mock/DeployEVMx.s.sol index 4ed43b5b..e3f71807 100644 --- a/script/mock/DeployEVMx.s.sol +++ b/script/admin/mock/DeployEVMx.s.sol @@ -3,8 +3,7 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {MockWatcherPrecompile} from "../../test/mock/MockWatcherPrecompile.sol"; -import {MockSocket} from "../../test/mock/MockSocket.sol"; +import {MockWatcherPrecompile} from "../../../test/mock/MockWatcherPrecompile.sol"; contract DeployEVMx is Script { function run() external { diff --git a/script/mock/DeploySocket.s.sol b/script/admin/mock/DeploySocket.s.sol similarity index 80% rename from script/mock/DeploySocket.s.sol rename to script/admin/mock/DeploySocket.s.sol index 56291966..603d8eea 100644 --- a/script/mock/DeploySocket.s.sol +++ b/script/admin/mock/DeploySocket.s.sol @@ -3,8 +3,7 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {MockWatcherPrecompile} from "../../test/mock/MockWatcherPrecompile.sol"; -import {MockSocket} from "../../test/mock/MockSocket.sol"; +import {MockSocket} from "../../../test/mock/MockSocket.sol"; contract DeploySocket is Script { function run() external { diff --git a/script/counter-inbox/CheckGatewayCounter.s.sol b/script/counter-inbox/CheckGatewayCounter.s.sol deleted file mode 100644 index ffd80b88..00000000 --- a/script/counter-inbox/CheckGatewayCounter.s.sol +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import {Script} from "forge-std/Script.sol"; -import {console} from "forge-std/console.sol"; -import {CounterAppGateway} from "../../test/apps/app-gateways/counter/CounterAppGateway.sol"; - -contract CheckGatewayCounter is Script { - function run() external { - string memory rpc = vm.envString("EVMX_RPC"); - vm.createSelectFork(rpc); - - address gatewayAddress = vm.envAddress("APP_GATEWAY"); - CounterAppGateway gateway = CounterAppGateway(gatewayAddress); - - // Log the value of the counter variable on CounterAppGateway - uint256 counterValue = gateway.counterVal(); - console.log("Counter value on CounterAppGateway:"); - console.log(counterValue); - } -} diff --git a/script/counter-inbox/Increment.s.sol b/script/counter-inbox/Increment.s.sol deleted file mode 100644 index 3937d716..00000000 --- a/script/counter-inbox/Increment.s.sol +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import {Script} from "forge-std/Script.sol"; -import {console} from "forge-std/console.sol"; -import {CounterAppGateway} from "../../test/apps/app-gateways/counter/CounterAppGateway.sol"; -import {Counter} from "../../test/apps/app-gateways/counter/Counter.sol"; -import {Fees} from "../../contracts/protocol/utils/common/Structs.sol"; -import {ETH_ADDRESS, FAST} from "../../contracts/protocol/utils/common/Constants.sol"; - -contract Increment is Script { - function run() external { - string memory arbRpc = vm.envString("ARBITRUM_SEPOLIA_RPC"); - - vm.createSelectFork(arbRpc); - uint256 arbDeployerPrivateKey = vm.envUint("SPONSOR_KEY"); - vm.startBroadcast(arbDeployerPrivateKey); - address counterInbox = vm.envAddress("COUNTER_INBOX"); - - Counter inbox = Counter(counterInbox); - inbox.increaseOnGateway(100); - - vm.stopBroadcast(); - } -} diff --git a/script/counter/IncrementCountersFromApp.s.sol b/script/counter/IncrementCountersFromApp.s.sol index b63f6c83..60a90fd2 100644 --- a/script/counter/IncrementCountersFromApp.s.sol +++ b/script/counter/IncrementCountersFromApp.s.sol @@ -23,17 +23,12 @@ contract IncrementCounters is Script { 11155420 ); address counterForwarderBaseSepolia = gateway.forwarderAddresses(gateway.counter(), 84532); - //address counterForwarderSepolia = deployer.forwarderAddresses( - // deployer.counter(), - // 11155111 - //); // Count non-zero addresses uint256 nonZeroCount = 0; if (counterForwarderArbitrumSepolia != address(0)) nonZeroCount++; if (counterForwarderOptimismSepolia != address(0)) nonZeroCount++; if (counterForwarderBaseSepolia != address(0)) nonZeroCount++; - //if (counterForwarderSepolia != address(0)) nonZeroCount++; address[] memory instances = new address[](nonZeroCount); uint256 index = 0; @@ -55,12 +50,6 @@ contract IncrementCounters is Script { } else { console.log("Base Sepolia forwarder not yet deployed"); } - //if (counterForwarderSepolia != address(0)) { - // instances[index] = counterForwarderSepolia; - // index++; - //} else { - // console.log("Ethereum Sepolia forwarder not yet deployed"); - //} vm.startBroadcast(deployerPrivateKey); gateway.incrementCounters(instances); diff --git a/script/counter/ReadOnchainCounters.s.sol b/script/counter/ReadOnchainCounters.s.sol index 850f7e9c..534acd66 100644 --- a/script/counter/ReadOnchainCounters.s.sol +++ b/script/counter/ReadOnchainCounters.s.sol @@ -20,10 +20,6 @@ contract CheckCounters is Script { 11155420 ); address counterInstanceBaseSepolia = gateway.getOnChainAddress(gateway.counter(), 84532); - //address counterInstanceSepolia = deployer.getOnChainAddress( - // deployer.counter(), - // 11155111 - //); if (counterInstanceArbitrumSepolia != address(0)) { vm.createSelectFork(vm.envString("ARBITRUM_SEPOLIA_RPC")); @@ -48,18 +44,5 @@ contract CheckCounters is Script { } else { console.log("Counter not yet deployed on Base Sepolia"); } - - //if (counterInstanceSepolia != address(0)) { - // vm.createSelectFork(vm.envString("SEPOLIA_RPC")); - // uint256 counterValueOptimismSepolia = Counter( - // counterInstanceOptimismSepolia - // ).counter(); - // console.log( - // "Counter value on Ethereum Sepolia: ", - // counterValueOptimismSepolia - // ); - //} else { - // console.log("Counter not yet deployed on Ethereum Sepolia"); - //} } } diff --git a/script/counter/deployOnchainCounters.s.sol b/script/counter/deployOnchainCounters.s.sol index fd75c155..65b00d4c 100644 --- a/script/counter/deployOnchainCounters.s.sol +++ b/script/counter/deployOnchainCounters.s.sol @@ -21,11 +21,5 @@ contract CounterDeployOnchain is Script { console.log("Deploying contracts on Arbitrum Sepolia..."); appGateway.deployContracts(421614); - // console.log("Deploying contracts on Optimism Sepolia..."); - // appGateway.deployContracts(11155420); - // console.log("Deploying contracts on Base Sepolia..."); - // appGateway.deployContracts(84532); - // console.log("Deploying contracts on Ethereum Sepolia..."); - // appGateway.deployContracts(11155111); } } diff --git a/script/cron/SetTimeout.s.sol b/script/cron/SetTimeout.s.sol deleted file mode 100644 index b58a0925..00000000 --- a/script/cron/SetTimeout.s.sol +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import {Script} from "forge-std/Script.sol"; -import {console} from "forge-std/console.sol"; -import {CounterAppGateway} from "../../test/apps/app-gateways/counter/CounterAppGateway.sol"; - -contract SetTimeoutScript is Script { - function run() external { - string memory socketRPC = vm.envString("EVMX_RPC"); - uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); - vm.createSelectFork(socketRPC); - address gatewayAddress = vm.envAddress("APP_GATEWAY"); - console.log("Gateway address:", gatewayAddress); - CounterAppGateway gateway = CounterAppGateway(gatewayAddress); - vm.startBroadcast(deployerPrivateKey); - gateway.setTimeout(0); - // vm.stopBroadcast(); - } -} diff --git a/script/AppGatewayFeeBalance.s.sol b/script/helpers/AppGatewayFeeBalance.s.sol similarity index 78% rename from script/AppGatewayFeeBalance.s.sol rename to script/helpers/AppGatewayFeeBalance.s.sol index cb773904..6637a83b 100644 --- a/script/AppGatewayFeeBalance.s.sol +++ b/script/helpers/AppGatewayFeeBalance.s.sol @@ -3,9 +3,9 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {FeesManager} from "../contracts/protocol/payload-delivery/FeesManager.sol"; -import {Fees} from "../contracts/protocol/utils/common/Structs.sol"; -import {ETH_ADDRESS} from "../contracts/protocol/utils/common/Constants.sol"; +import {FeesManager} from "../../contracts/protocol/payload-delivery/FeesManager.sol"; +import {Fees} from "../../contracts/protocol/utils/common/Structs.sol"; +import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol"; contract CheckDepositedFees is Script { function run() external { diff --git a/script/admin/CheckAppEVMxLimits.s.sol b/script/helpers/CheckAppEVMxLimits.s.sol similarity index 100% rename from script/admin/CheckAppEVMxLimits.s.sol rename to script/helpers/CheckAppEVMxLimits.s.sol diff --git a/script/PayFeesInArbitrumETH.s.sol b/script/helpers/PayFeesInArbitrumETH.s.sol similarity index 78% rename from script/PayFeesInArbitrumETH.s.sol rename to script/helpers/PayFeesInArbitrumETH.s.sol index ff3ff1be..50da4fc1 100644 --- a/script/PayFeesInArbitrumETH.s.sol +++ b/script/helpers/PayFeesInArbitrumETH.s.sol @@ -3,9 +3,9 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {FeesPlug} from "../contracts/protocol/payload-delivery/FeesPlug.sol"; -import {Fees} from "../contracts/protocol/utils/common/Structs.sol"; -import {ETH_ADDRESS} from "../contracts/protocol/utils/common/Constants.sol"; +import {FeesPlug} from "../../contracts/protocol/payload-delivery/FeesPlug.sol"; +import {Fees} from "../../contracts/protocol/utils/common/Structs.sol"; +import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol"; contract DepositFees is Script { function run() external { diff --git a/script/counter/WithdrawFeesArbitrumFeesPlug.s.sol b/script/helpers/WithdrawFeesArbitrumFeesPlug.s.sol similarity index 92% rename from script/counter/WithdrawFeesArbitrumFeesPlug.s.sol rename to script/helpers/WithdrawFeesArbitrumFeesPlug.s.sol index fbebfe6e..fc954d26 100644 --- a/script/counter/WithdrawFeesArbitrumFeesPlug.s.sol +++ b/script/helpers/WithdrawFeesArbitrumFeesPlug.s.sol @@ -7,14 +7,16 @@ import {FeesManager} from "../../contracts/protocol/payload-delivery/FeesManager import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol"; import {CounterAppGateway} from "../../test/apps/app-gateways/counter/CounterAppGateway.sol"; +// @notice This script is used to withdraw fees from EVMX to Arbitrum Sepolia +// @dev Make sure your app has withdrawFeeTokens() function implemented. You can check its implementation in CounterAppGateway.sol contract WithdrawFees is Script { function run() external { // EVMX Check available fees vm.createSelectFork(vm.envString("EVMX_RPC")); FeesManager feesManager = FeesManager(payable(vm.envAddress("FEES_MANAGER"))); address appGatewayAddress = vm.envAddress("APP_GATEWAY"); - CounterAppGateway appGateway = CounterAppGateway(appGatewayAddress); + CounterAppGateway appGateway = CounterAppGateway(appGatewayAddress); uint256 availableFees = feesManager.getAvailableFees( 421614, appGatewayAddress, diff --git a/script/mock/FinalizeAndExecution.s.sol b/script/mock/FinalizeAndExecution.s.sol deleted file mode 100644 index 4ba2d49a..00000000 --- a/script/mock/FinalizeAndExecution.s.sol +++ /dev/null @@ -1,60 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import {Script} from "forge-std/Script.sol"; -import {console} from "forge-std/console.sol"; -import {MockWatcherPrecompile} from "../../test/mock/MockWatcherPrecompile.sol"; -import "../../test/mock/MockSocket.sol"; -import {CallType, FinalizeParams, PayloadDetails, Parallel} from "../../contracts/protocol/utils/common/Structs.sol"; - -contract InboxTest is Script { - function run() external { - string memory arbRpc = vm.envString("ARBITRUM_SEPOLIA_RPC"); - string memory offChainRpc = vm.envString("EVMX_RPC"); - uint256 offChainDeployerPrivateKey = vm.envUint("PRIVATE_KEY"); - uint256 arbDeployerPrivateKey = vm.envUint("SOCKET_SIGNER_KEY"); - - vm.createSelectFork(offChainRpc); - vm.startBroadcast(offChainDeployerPrivateKey); - address watcher = vm.envAddress("WATCHER_PRECOMPILE"); - MockWatcherPrecompile watcherInstance = MockWatcherPrecompile(watcher); - PayloadDetails memory payloadDetails = PayloadDetails({ - chainSlug: 421614, - appGateway: address(0), // usdc contract - target: 0x6402c4c08C1F752Ac8c91beEAF226018ec1a27f2, // usdc contract - payload: abi.encodeWithSignature( - "transfer(address,uint256)", - address(0), - 1000000000000000000 - ), - callType: CallType.WRITE, - executionGasLimit: 1000000, - value: 0, - next: new address[](0), - isParallel: Parallel.OFF - }); - FinalizeParams memory finalizeParams = FinalizeParams({ - payloadDetails: payloadDetails, - asyncId: bytes32(0), - transmitter: address(0) - }); - (bytes32 payloadId, ) = watcherInstance.finalize(finalizeParams); - - vm.stopBroadcast(); - - vm.createSelectFork(arbRpc); - vm.startBroadcast(arbDeployerPrivateKey); - address socket = vm.envAddress("SOCKET"); - MockSocket socketInstance = MockSocket(socket); - - ISocket.ExecuteParams memory executeParams = ISocket.ExecuteParams({ - payloadId: payloadId, - target: address(0), - executionGasLimit: 10000000, - deadline: 10000000, - payload: bytes("") - }); - socketInstance.execute(address(0), executeParams, bytes("")); - vm.stopBroadcast(); - } -} diff --git a/script/mock/Inbox.s.sol b/script/mock/Inbox.s.sol deleted file mode 100644 index 792a635d..00000000 --- a/script/mock/Inbox.s.sol +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import {Script} from "forge-std/Script.sol"; -import {console} from "forge-std/console.sol"; -import {MockWatcherPrecompile} from "../../test/mock/MockWatcherPrecompile.sol"; -import {MockSocket} from "../../test/mock/MockSocket.sol"; - -contract InboxTest is Script { - function run() external { - string memory rpc = vm.envString("ARBITRUM_SEPOLIA_RPC"); - vm.createSelectFork(rpc); - uint256 deployerPrivateKey = vm.envUint("SOCKET_SIGNER_KEY"); - vm.startBroadcast(deployerPrivateKey); - address socket = vm.envAddress("SOCKET"); - MockSocket socketInstance = MockSocket(socket); - bytes memory payload = hex"00010203"; - bytes32 params = bytes32(0); - socketInstance.callAppGateway(payload, params); - } -} diff --git a/script/mock/Query.s.sol b/script/mock/Query.s.sol deleted file mode 100644 index 6f5dde86..00000000 --- a/script/mock/Query.s.sol +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import {Script} from "forge-std/Script.sol"; -import {console} from "forge-std/console.sol"; -import {MockWatcherPrecompile} from "../../test/mock/MockWatcherPrecompile.sol"; - -contract QueryTest is Script { - function run() external { - string memory rpc = vm.envString("EVMX_RPC"); - vm.createSelectFork(rpc); - uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); - vm.startBroadcast(deployerPrivateKey); - address watcher = vm.envAddress("WATCHER_PRECOMPILE"); - MockWatcherPrecompile watcherInstance = MockWatcherPrecompile(watcher); - - address[] memory asyncPromises = new address[](1); - asyncPromises[0] = address(0); - bytes memory payload = abi.encodeWithSignature("balanceOf(address)", address(0)); - watcherInstance.query( - 421614, - 0x6402c4c08C1F752Ac8c91beEAF226018ec1a27f2, // usdc contract - asyncPromises, - payload - ); - } -} diff --git a/script/mock/Timeout.s.sol b/script/mock/Timeout.s.sol deleted file mode 100644 index 52313212..00000000 --- a/script/mock/Timeout.s.sol +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import {Script} from "forge-std/Script.sol"; -import {console} from "forge-std/console.sol"; -import {MockWatcherPrecompile} from "../../test/mock/MockWatcherPrecompile.sol"; - -contract TimeoutTest is Script { - function run() external { - string memory rpc = vm.envString("EVMX_RPC"); - vm.createSelectFork(rpc); - uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); - vm.startBroadcast(deployerPrivateKey); - address watcher = vm.envAddress("WATCHER_PRECOMPILE"); - MockWatcherPrecompile watcherInstance = MockWatcherPrecompile(watcher); - watcherInstance.setTimeout("", 10); - } -} diff --git a/script/parallel-counter/checkCounters.s.sol b/script/parallel-counter/checkCounters.s.sol deleted file mode 100644 index fa04b108..00000000 --- a/script/parallel-counter/checkCounters.s.sol +++ /dev/null @@ -1,80 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import {Script} from "forge-std/Script.sol"; -import {console} from "forge-std/console.sol"; -import {CounterAppGateway} from "../../test/apps/app-gateways/counter/CounterAppGateway.sol"; -import {Counter} from "../../test/apps/app-gateways/counter/Counter.sol"; - -contract CheckCounters is Script { - function run() external { - CounterAppGateway gateway = CounterAppGateway(vm.envAddress("APP_GATEWAY")); - - vm.createSelectFork(vm.envString("EVMX_RPC")); - address counterInstanceArbitrumSepolia = gateway.getOnChainAddress( - gateway.counter(), - 421614 - ); - address counter1InstanceArbitrumSepolia = gateway.getOnChainAddress( - gateway.counter1(), - 421614 - ); - address counterInstanceOptimismSepolia = gateway.getOnChainAddress( - gateway.counter(), - 11155420 - ); - address counter1InstanceOptimismSepolia = gateway.getOnChainAddress( - gateway.counter1(), - 11155420 - ); - - if (counterInstanceArbitrumSepolia != address(0)) { - vm.createSelectFork(vm.envString("ARBITRUM_SEPOLIA_RPC")); - console.log("Counter 1 instance on Arbitrum Sepolia:", counterInstanceArbitrumSepolia); - uint256 counterValueArbitrumSepolia = Counter(counterInstanceArbitrumSepolia).counter(); - console.log("Counter1 value on Arbitrum Sepolia: ", counterValueArbitrumSepolia); - } else { - console.log("Counter1 not yet deployed on Arbitrum Sepolia"); - } - - if (counter1InstanceArbitrumSepolia != address(0)) { - vm.createSelectFork(vm.envString("ARBITRUM_SEPOLIA_RPC")); - console.log("Counter 2 instance on Arbitrum Sepolia:", counter1InstanceArbitrumSepolia); - uint256 counterValueArbitrumSepolia = Counter(counter1InstanceArbitrumSepolia) - .counter(); - console.log("Counter2 value on Arbitrum Sepolia: ", counterValueArbitrumSepolia); - } else { - console.log("Counter2 not yet deployed on Arbitrum Sepolia"); - } - - if (counterInstanceOptimismSepolia != address(0)) { - vm.createSelectFork(vm.envString("OPTIMISM_SEPOLIA_RPC")); - console.log("Counter 1 instance on Optimism Sepolia:", counterInstanceOptimismSepolia); - uint256 counterValueOptimismSepolia = Counter(counterInstanceOptimismSepolia).counter(); - console.log("Counter1 value on Optimism Sepolia: ", counterValueOptimismSepolia); - } else { - console.log("Counter1 not yet deployed on Optimism Sepolia"); - } - - if (counter1InstanceOptimismSepolia != address(0)) { - vm.createSelectFork(vm.envString("OPTIMISM_SEPOLIA_RPC")); - console.log("Counter 2 instance on Optimism Sepolia:", counter1InstanceOptimismSepolia); - uint256 counterValueOptimismSepolia = Counter(counter1InstanceOptimismSepolia) - .counter(); - console.log("Counter2 value on Optimism Sepolia: ", counterValueOptimismSepolia); - } else { - console.log("Counter2 not yet deployed on Optimism Sepolia"); - } - - vm.createSelectFork(vm.envString("EVMX_RPC")); - address forwarderArb1 = gateway.forwarderAddresses(gateway.counter(), 421614); - address forwarderArb2 = gateway.forwarderAddresses(gateway.counter1(), 421614); - address forwarderOpt1 = gateway.forwarderAddresses(gateway.counter(), 11155420); - address forwarderOpt2 = gateway.forwarderAddresses(gateway.counter1(), 11155420); - - console.log("Forwarder 1 on Arbitrum Sepolia:", forwarderArb1); - console.log("Forwarder 2 on Arbitrum Sepolia:", forwarderArb2); - console.log("Forwarder 1 on Optimism Sepolia:", forwarderOpt1); - console.log("Forwarder 2 on Optimism Sepolia:", forwarderOpt2); - } -} diff --git a/script/parallel-counter/deployOnchain.s.sol b/script/parallel-counter/deployOnchain.s.sol deleted file mode 100644 index d52528ec..00000000 --- a/script/parallel-counter/deployOnchain.s.sol +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import {Script} from "forge-std/Script.sol"; -import {console} from "forge-std/console.sol"; -import {CounterAppGateway} from "../../test/apps/app-gateways/counter/CounterAppGateway.sol"; -import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol"; - -contract CounterDeployOnchain is Script { - function run() external { - string memory rpc = vm.envString("EVMX_RPC"); - console.log(rpc); - vm.createSelectFork(rpc); - - uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); - vm.startBroadcast(deployerPrivateKey); - - CounterAppGateway gateway = CounterAppGateway(vm.envAddress("APP_GATEWAY")); - - console.log("Counter Gateway:", address(gateway)); - console.log("Deploying contracts on Arbitrum Sepolia..."); - - uint32[] memory chainSlugs = new uint32[](2); - chainSlugs[0] = 421614; - chainSlugs[1] = 11155420; - gateway.deployMultiChainContracts(chainSlugs); - } -} diff --git a/script/parallel-counter/incrementCounters.s.sol b/script/parallel-counter/incrementCounters.s.sol deleted file mode 100644 index ab03e084..00000000 --- a/script/parallel-counter/incrementCounters.s.sol +++ /dev/null @@ -1,75 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import {Script} from "forge-std/Script.sol"; -import {console} from "forge-std/console.sol"; -import {CounterAppGateway} from "../../test/apps/app-gateways/counter/CounterAppGateway.sol"; - -contract IncrementCounters is Script { - function run() external { - string memory socketRPC = vm.envString("EVMX_RPC"); - - vm.createSelectFork(socketRPC); - - CounterAppGateway gateway = CounterAppGateway(vm.envAddress("APP_GATEWAY")); - - address counterForwarderArbitrumSepolia = gateway.forwarderAddresses( - gateway.counter(), - 421614 - ); - address counterForwarderOptimismSepolia = gateway.forwarderAddresses( - gateway.counter(), - 11155420 - ); - address counterForwarderBaseSepolia = gateway.forwarderAddresses(gateway.counter(), 84532); - //address counterForwarderSepolia = gateway.forwarderAddresses( - // gateway.counter(), - // 11155111 - //); - - // Count non-zero addresses - uint256 nonZeroCount = 0; - if (counterForwarderArbitrumSepolia != address(0)) nonZeroCount++; - if (counterForwarderOptimismSepolia != address(0)) nonZeroCount++; - if (counterForwarderBaseSepolia != address(0)) nonZeroCount++; - //if (counterForwarderSepolia != address(0)) nonZeroCount++; - - address[] memory instances = new address[](nonZeroCount); - uint256 index = 0; - if (counterForwarderArbitrumSepolia != address(0)) { - instances[index] = counterForwarderArbitrumSepolia; - index++; - } else { - console.log("Arbitrum Sepolia forwarder not yet deployed"); - } - if (counterForwarderOptimismSepolia != address(0)) { - instances[index] = counterForwarderOptimismSepolia; - index++; - } else { - console.log("Optimism Sepolia forwarder not yet deployed"); - } - if (counterForwarderBaseSepolia != address(0)) { - instances[index] = counterForwarderBaseSepolia; - index++; - } else { - console.log("Base Sepolia forwarder not yet deployed"); - } - //if (counterForwarderSepolia != address(0)) { - // instances[index] = counterForwarderSepolia; - // index++; - //} else { - // console.log("Ethereum Sepolia forwarder not yet deployed"); - //} - - // vm.startBroadcast(deployerPrivateKey); - bytes memory data = abi.encodeWithSelector( - CounterAppGateway.incrementCounters.selector, - instances - ); - console.log("to"); - console.log(address(gateway)); - console.log("data"); - console.logBytes(data); - // gateway.incrementCounters(instances); - } -} diff --git a/script/super-token-lockable/Bridge.s.sol b/script/super-token-lockable/Bridge.s.sol deleted file mode 100644 index 34fc36bf..00000000 --- a/script/super-token-lockable/Bridge.s.sol +++ /dev/null @@ -1,85 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import {Script} from "forge-std/Script.sol"; -import {console} from "forge-std/console.sol"; - -import {SuperTokenLockableAppGateway} from "../../test/apps/app-gateways/super-token-lockable/SuperTokenLockableAppGateway.sol"; - -contract Bridge is Script { - function run() external { - address owner = vm.envAddress("OWNER"); - address gateway = vm.envAddress("APP_GATEWAY"); - SuperTokenLockableAppGateway gatewayContract = SuperTokenLockableAppGateway(gateway); - - string memory rpc = vm.envString("EVMX_RPC"); - vm.createSelectFork(rpc); - uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); - vm.startBroadcast(deployerPrivateKey); - - address arbTokenForwarder = gatewayContract.forwarderAddresses( - gatewayContract.superTokenLockable(), - 421614 - ); - address arbHookForwarder = gatewayContract.forwarderAddresses( - gatewayContract.limitHook(), - 421614 - ); - address optTokenForwarder = gatewayContract.forwarderAddresses( - gatewayContract.superTokenLockable(), - 11155420 - ); - address optHookForwarder = gatewayContract.forwarderAddresses( - gatewayContract.limitHook(), - 11155420 - ); - address arbOnChainToken = gatewayContract.getOnChainAddress( - gatewayContract.superTokenLockable(), - 421614 - ); - address optOnChainToken = gatewayContract.getOnChainAddress( - gatewayContract.superTokenLockable(), - 11155420 - ); - console.log("arbTokenForwarder"); - console.logAddress(arbTokenForwarder); - console.log("arbHookForwarder"); - console.logAddress(arbHookForwarder); - console.log("arbOnChainToken"); - console.logAddress(arbOnChainToken); - console.log("optTokenForwarder"); - console.logAddress(optTokenForwarder); - console.log("optHookForwarder"); - console.logAddress(optHookForwarder); - console.log("optOnChainToken"); - console.logAddress(optOnChainToken); - if ( - arbTokenForwarder == address(0) || - optTokenForwarder == address(0) || - arbHookForwarder == address(0) || - optHookForwarder == address(0) - ) { - revert("Forwarder not found"); - } - SuperTokenLockableAppGateway.UserOrder memory order = SuperTokenLockableAppGateway - .UserOrder({ - srcToken: arbTokenForwarder, - dstToken: optTokenForwarder, - user: owner, - srcAmount: 1000, - deadline: block.timestamp + 1 days - }); - console.log(order.srcToken); - console.log(order.dstToken); - console.log(order.user); - console.log(order.srcAmount); - console.log(order.deadline); - - // bytes memory payload = abi.encodeWithSelector( - // bytes4(keccak256("bridge(UserOrder)")), - // order - // ); - // console.logBytes(payload); - gatewayContract.bridge(abi.encode(order)); - } -} diff --git a/script/super-token-lockable/DeployContracts.s.sol b/script/super-token-lockable/DeployContracts.s.sol deleted file mode 100644 index df001e0f..00000000 --- a/script/super-token-lockable/DeployContracts.s.sol +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import {Script} from "forge-std/Script.sol"; -import {console} from "forge-std/console.sol"; -import {SuperTokenLockableAppGateway} from "../../test/apps/app-gateways/super-token-lockable/SuperTokenLockableAppGateway.sol"; -import {SuperTokenLockable} from "../../test/apps/app-gateways/super-token-lockable/SuperTokenLockable.sol"; -import {Fees} from "../../contracts/protocol/utils/common/Structs.sol"; -import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol"; - -contract DeployContracts is Script { - function run() external { - SuperTokenLockableAppGateway gateway = SuperTokenLockableAppGateway( - vm.envAddress("APP_GATEWAY") - ); - string memory rpc = vm.envString("EVMX_RPC"); - vm.createSelectFork(rpc); - uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); - vm.startBroadcast(deployerPrivateKey); - gateway.deployContracts(84532); - gateway.deployContracts(11155111); - } -} diff --git a/script/super-token-lockable/DeployGateway.s.sol b/script/super-token-lockable/DeployGateway.s.sol deleted file mode 100644 index 8a2be2a8..00000000 --- a/script/super-token-lockable/DeployGateway.s.sol +++ /dev/null @@ -1,54 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import {Script} from "forge-std/Script.sol"; -import {console} from "forge-std/console.sol"; -import {SuperTokenLockableAppGateway} from "../../test/apps/app-gateways/super-token-lockable/SuperTokenLockableAppGateway.sol"; -import {SuperTokenLockable} from "../../test/apps/app-gateways/super-token-lockable/SuperTokenLockable.sol"; -import {Fees} from "../../contracts/protocol/utils/common/Structs.sol"; -import {ETH_ADDRESS, FAST} from "../../contracts/protocol/utils/common/Constants.sol"; - -contract DeployGateway is Script { - function run() external { - address addressResolver = vm.envAddress("ADDRESS_RESOLVER"); - address auctionManager = vm.envAddress("AUCTION_MANAGER"); - address owner = vm.envAddress("SUPERTOKEN_OWNER"); - string memory rpc = vm.envString("EVMX_RPC"); - vm.createSelectFork(rpc); - uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); - vm.startBroadcast(deployerPrivateKey); - - Fees memory fees = Fees({ - feePoolChain: 421614, - feePoolToken: ETH_ADDRESS, - amount: 0.001 ether - }); - - SuperTokenLockableAppGateway gateway = new SuperTokenLockableAppGateway( - addressResolver, - address(auctionManager), - owner, - FAST, - fees, - SuperTokenLockableAppGateway.ConstructorParams({ - _burnLimit: 1000000000 ether, - _mintLimit: 1000000000 ether, - name_: "SUPER TOKEN", - symbol_: "SUPER", - decimals_: 18, - initialSupplyHolder_: owner, - initialSupply_: 1000000000 ether - }) - ); - - bytes32 superToken = gateway.superTokenLockable(); - bytes32 limitHook = gateway.limitHook(); - - console.log("Contracts deployed:"); - console.log("SuperTokenLockableAppGateway:", address(gateway)); - console.log("SuperTokenLockableId:"); - console.logBytes32(superToken); - console.log("LimitHookId:"); - console.logBytes32(limitHook); - } -} diff --git a/script/super-token/Bridge.s.sol b/script/super-token/Bridge.s.sol deleted file mode 100644 index a5e8aed9..00000000 --- a/script/super-token/Bridge.s.sol +++ /dev/null @@ -1,32 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import {Script} from "forge-std/Script.sol"; -import {SuperTokenAppGateway} from "../../test/apps/app-gateways/super-token/SuperTokenAppGateway.sol"; - -contract Bridge is Script { - struct UserOrder { - address srcToken; - address dstToken; - address user; - uint256 srcAmount; - uint256 deadline; - } - - function run() external { - vm.startBroadcast(); - - UserOrder memory order = UserOrder({ - srcToken: 0x047Db07E30809f87CABA2E552585F9A727a074ED, - dstToken: 0x4545C7bc6347945e7bfda082a2A0033cE4C7CEae, - user: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266, - srcAmount: 1000, - deadline: block.timestamp + 1 days - }); - - SuperTokenAppGateway gateway = SuperTokenAppGateway( - 0xb1F4CbFCE786aA8B553796Fb06c04Dd461967A16 - ); - gateway.transfer(abi.encode(order)); - } -} diff --git a/script/super-token/DeployContracts.s.sol b/script/super-token/DeployContracts.s.sol deleted file mode 100644 index d007bcc3..00000000 --- a/script/super-token/DeployContracts.s.sol +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import {Script} from "forge-std/Script.sol"; -import {console} from "forge-std/console.sol"; -import {SuperTokenAppGateway} from "../../test/apps/app-gateways/super-token/SuperTokenAppGateway.sol"; -import {SuperToken} from "../../test/apps/app-gateways/super-token/SuperToken.sol"; -import {Fees} from "../../contracts/protocol/utils/common/Structs.sol"; -import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol"; - -contract DeployContracts is Script { - function run() external { - vm.startBroadcast(); - SuperTokenAppGateway deployer = SuperTokenAppGateway( - 0x02520426a04D2943d817A60ABa37ab25bA10e630 - ); - deployer.deployContracts(84532); - deployer.deployContracts(11155111); - } -} diff --git a/script/super-token/DeployGateway.s.sol b/script/super-token/DeployGateway.s.sol deleted file mode 100644 index 61df966a..00000000 --- a/script/super-token/DeployGateway.s.sol +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import {Script} from "forge-std/Script.sol"; -import {console} from "forge-std/console.sol"; -import {SuperTokenAppGateway} from "../../test/apps/app-gateways/super-token/SuperTokenAppGateway.sol"; -import {SuperToken} from "../../test/apps/app-gateways/super-token/SuperToken.sol"; -import {Fees} from "../../contracts/protocol/utils/common/Structs.sol"; -import {ETH_ADDRESS, FAST} from "../../contracts/protocol/utils/common/Constants.sol"; - -contract DeployGateway is Script { - function run() external { - vm.startBroadcast(); - - address addressResolver = vm.envAddress("ADDRESS_RESOLVER"); - address auctionManager = vm.envAddress("AUCTION_MANAGER"); - address owner = vm.envAddress("OWNER"); - - Fees memory fees = Fees({ - feePoolChain: 421614, - feePoolToken: ETH_ADDRESS, - amount: 0.001 ether - }); - - SuperTokenAppGateway gateway = new SuperTokenAppGateway( - addressResolver, - address(auctionManager), - owner, - FAST, - fees, - SuperTokenAppGateway.ConstructorParams({ - name_: "SuperToken", - symbol_: "SUPER", - decimals_: 18, - initialSupplyHolder_: owner, - initialSupply_: 1000000000000000000000000 - }) - ); - - bytes32 superToken = gateway.superToken(); - - console.log("Contracts deployed:"); - console.log("SuperTokenAppGateway:", address(gateway)); - console.log("SuperTokenId:"); - console.logBytes32(superToken); - } -} diff --git a/script/transactionStatus.js b/script/transactionStatus.js deleted file mode 100644 index ca27bb7c..00000000 --- a/script/transactionStatus.js +++ /dev/null @@ -1,138 +0,0 @@ -const fs = require('fs'); -const path = require('path'); - -// Read script name from command-line arguments -const scriptName = process.argv[2]; // The argument passed to the script -if (!scriptName) { - console.error('Usage: node checkTransactions.js '); - console.error('Example: node checkTransactions.js deployOnchain'); - process.exit(1); -} - -// Construct the JSON file path dynamically -const jsonFilePath = path.join('broadcast', `${scriptName}.s.sol`, '7625382', 'run-latest.json'); - -// Validate that the file exists -if (!fs.existsSync(jsonFilePath)) { - console.error(`Error: File not found at path '${jsonFilePath}'.`); - process.exit(1); -} - -// Load JSON file -const jsonData = JSON.parse(fs.readFileSync(jsonFilePath, 'utf-8')); - -// Extract transaction hashes -const transactions = jsonData.transactions.map((tx) => tx.hash); -console.log(`Found ${transactions.length} transactions to process.`); - -const apiUrl = 'https://apiv2.dev.socket.tech/getDetailsByTxHash?txHash='; -let intervalId; - -// Track statuses for each hash -let statusTracker = transactions.map((hash) => ({ - hash, - status: 'PENDING', - printed: false, - printedPayloads: new Set(), -})); -let allDonePrinted = false; // Prevent multiple prints of the final message - -// Function to perform API requests -const fetchTransactionStatus = async (hash) => { - try { - const response = await fetch(`${apiUrl}${hash}`); - if (!response.ok) throw new Error(`HTTP Error: ${response.status}`); - const data = await response.json(); - return data; - } catch (error) { - console.error(`Error fetching status for hash ${hash}: ${error.message}`); - return null; // Handle errors gracefully - } -}; - -const processMultiplePayloads = (payloads, tx) => { - if (payloads.length > 1) { - payloads.forEach((payload) => { - // Create a unique key for the payload to track printed status - const payloadKey = `${payload.executeDetails.executeTxHash}-${payload.callBackDetails.callbackStatus}`; - - if ( - payload.callBackDetails.callbackStatus === 'PROMISE_RESOLVED' && - payload.executeDetails.executeTxHash && - !tx.printedPayloads.has(payloadKey) - ) { - console.log( - `Hash: ${payload.executeDetails.executeTxHash}, Status: ${payload.callBackDetails.callbackStatus}, ChainId: ${payload.chainSlug}`, - ); - - tx.printedPayloads.add(payloadKey); - } - }); - } -}; - -// Function to check transaction status -const checkTransactionStatus = async () => { - let allCompleted = true; - for (let i = 0; i < statusTracker.length; i++) { - const tx = statusTracker[i]; - - // Skip already printed transactions - if (tx.status === 'COMPLETED' && tx.printed) continue; - - const data = await fetchTransactionStatus(tx.hash); - - if (data && data.status === 'SUCCESS') { - if (data.response.length === 0) { - if (tx.printed === false) { - console.log(`Hash: ${tx.hash}, There are no logs for this transaction hash.`); - tx.status = 'NO_LOGS'; - tx.printed = true; - continue; - } else { - continue; - } - } - - const transactionResponse = data.response[0]; // First response object - const status = transactionResponse.status || 'UNKNOWN'; - const payloads = transactionResponse.payloads || []; - - // Update tracker - tx.status = status; - if (status === 'COMPLETED' && !tx.printed) { - processMultiplePayloads(payloads, tx); - - const deployerDetails = payloads[0].deployerDetails || {}; - - if (Object.keys(deployerDetails).length !== 0) { - console.log(`Hash: ${tx.hash}, Status: ${status}, ChainId: ${payloads[0].chainSlug}`); - console.log(`OnChainAddress: ${deployerDetails.onChainAddress}`); - console.log(`ForwarderAddress: ${deployerDetails.forwarderAddress}`); - } else { - console.log(`Hash: ${tx.hash}, Status: ${status}, ChainId: 7625382`); - } - - tx.printed = true; - } else if (status === 'IN_PROGRESS') { - processMultiplePayloads(payloads, tx); - } - } else { - console.error(`Invalid or empty response for hash: ${tx.hash}`); - } - - // Check if any are still pending - if (tx.status !== 'COMPLETED' && tx.status !== 'NO_LOGS') allCompleted = false; - } - - // Stop script and print final message if all transactions are COMPLETED - if (allCompleted && !allDonePrinted) { - console.log('All transactions are COMPLETED. Stopping script.'); - allDonePrinted = true; // Prevent duplicate final messages - clearInterval(intervalId); - } -}; - -// Start periodic polling every second -console.log('Starting to monitor transaction statuses...'); -intervalId = setInterval(checkTransactionStatus, 2000); diff --git a/test/Migration.t.sol b/test/Migration.t.sol index e073092b..17ffb944 100644 --- a/test/Migration.t.sol +++ b/test/Migration.t.sol @@ -6,7 +6,7 @@ import "../contracts/protocol/AddressResolver.sol"; import "../contracts/protocol/watcherPrecompile/WatcherPrecompile.sol"; import "../contracts/protocol/Forwarder.sol"; import "../contracts/protocol/AsyncPromise.sol"; -import "./MockWatcherPrecompileImpl.sol"; +import "./mock/MockWatcherPrecompileImpl.sol"; contract MigrationTest is SetupTest { // ERC1967Factory emits this event with both proxy and implementation addresses diff --git a/test/apps/app-gateways/super-token-lockable/SuperTokenLockableAppGateway.sol b/test/apps/app-gateways/super-token-lockable/SuperTokenLockableAppGateway.sol index a1b3c125..cb9fb514 100644 --- a/test/apps/app-gateways/super-token-lockable/SuperTokenLockableAppGateway.sol +++ b/test/apps/app-gateways/super-token-lockable/SuperTokenLockableAppGateway.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.21; import "solady/auth/Ownable.sol"; -import {ISuperToken} from "../../../../contracts/interfaces/ISuperToken.sol"; +import {ISuperToken} from "../super-token/ISuperToken.sol"; import "../../../../contracts/base/AppGatewayBase.sol"; import "./SuperTokenLockable.sol"; import "./LimitHook.sol"; diff --git a/contracts/interfaces/ISuperToken.sol b/test/apps/app-gateways/super-token/ISuperToken.sol similarity index 100% rename from contracts/interfaces/ISuperToken.sol rename to test/apps/app-gateways/super-token/ISuperToken.sol diff --git a/test/apps/app-gateways/super-token/SuperTokenAppGateway.sol b/test/apps/app-gateways/super-token/SuperTokenAppGateway.sol index a73b8e39..1b73ac90 100644 --- a/test/apps/app-gateways/super-token/SuperTokenAppGateway.sol +++ b/test/apps/app-gateways/super-token/SuperTokenAppGateway.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.21; import "solady/auth/Ownable.sol"; import "../../../../contracts/base/AppGatewayBase.sol"; -import "../../../../contracts/interfaces/ISuperToken.sol"; +import "./ISuperToken.sol"; import "./SuperToken.sol"; contract SuperTokenAppGateway is AppGatewayBase, Ownable { diff --git a/test/MockWatcherPrecompileImpl.sol b/test/mock/MockWatcherPrecompileImpl.sol similarity index 89% rename from test/MockWatcherPrecompileImpl.sol rename to test/mock/MockWatcherPrecompileImpl.sol index 5e92693a..0298e103 100644 --- a/test/MockWatcherPrecompileImpl.sol +++ b/test/mock/MockWatcherPrecompileImpl.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import "../contracts/protocol/watcherPrecompile/WatcherPrecompile.sol"; +import "../../contracts/protocol/watcherPrecompile/WatcherPrecompile.sol"; contract MockWatcherPrecompileImpl is WatcherPrecompile { // Mock function to test reinitialization with version 2