From e4211630445b0825fb10bce6d6853cd43774ba90 Mon Sep 17 00:00:00 2001 From: Ameesha Agrawal Date: Wed, 26 Feb 2025 14:29:29 +0400 Subject: [PATCH 1/5] feat: merge deploy and app gateway base --- contracts/base/AppDeployerBase.sol | 112 -------- contracts/base/AppGatewayBase.sol | 102 +++++++- contracts/interfaces/IAppDeployer.sol | 24 -- contracts/interfaces/IAppGateway.sol | 20 +- contracts/mock/MockSocket.sol | 181 ------------- contracts/mock/MockWatcherPrecompile.sol | 245 ------------------ .../protocol/payload-delivery/FeesManager.sol | 2 +- test/mock/MockSocket.sol | 6 +- test/mock/MockWatcherPrecompile.sol | 12 +- 9 files changed, 128 insertions(+), 576 deletions(-) delete mode 100644 contracts/base/AppDeployerBase.sol delete mode 100644 contracts/interfaces/IAppDeployer.sol delete mode 100644 contracts/mock/MockSocket.sol delete mode 100644 contracts/mock/MockWatcherPrecompile.sol diff --git a/contracts/base/AppDeployerBase.sol b/contracts/base/AppDeployerBase.sol deleted file mode 100644 index b6eff74f..00000000 --- a/contracts/base/AppDeployerBase.sol +++ /dev/null @@ -1,112 +0,0 @@ -// SPDX-License-Identifier: Unlicense -pragma solidity ^0.8.21; - -import {DeployParams, Fees, CallType, PayloadBatch} from "../protocol/utils/common/Structs.sol"; -import "./AppGatewayBase.sol"; -import {IForwarder} from "../interfaces/IForwarder.sol"; -import {IPromise} from "../interfaces/IPromise.sol"; -import {IAppDeployer} from "../interfaces/IAppDeployer.sol"; -import {IDeliveryHelper} from "../interfaces/IDeliveryHelper.sol"; - -/// @title AppDeployerBase -/// @notice Abstract contract for deploying applications -abstract contract AppDeployerBase is AppGatewayBase, IAppDeployer { - mapping(bytes32 => mapping(uint32 => address)) public override forwarderAddresses; - mapping(bytes32 => bytes) public creationCodeWithArgs; - - constructor( - address addressResolver_, - address auctionManager_, - bytes32 sbType_ - ) AppGatewayBase(addressResolver_, auctionManager_) { - sbType = sbType_; - } - - /// @notice Deploys a contract - /// @param contractId_ The contract ID - /// @param chainSlug_ The chain slug - function _deploy(bytes32 contractId_, uint32 chainSlug_, IsPlug isPlug_) internal { - _deploy(contractId_, chainSlug_, isPlug_, new bytes(0)); - } - - /// @notice Deploys a contract - /// @param contractId_ The contract ID - /// @param chainSlug_ The chain slug - function _deploy( - bytes32 contractId_, - uint32 chainSlug_, - IsPlug isPlug_, - bytes memory initCallData_ - ) internal { - address asyncPromise = addressResolver__.deployAsyncPromiseContract(address(this)); - isValidPromise[asyncPromise] = true; - IPromise(asyncPromise).then(this.setAddress.selector, abi.encode(chainSlug_, contractId_)); - - onCompleteData = abi.encode(chainSlug_); - IDeliveryHelper(deliveryHelper()).queue( - isPlug_, - isParallelCall, - chainSlug_, - address(0), - asyncPromise, - 0, - CallType.DEPLOY, - creationCodeWithArgs[contractId_], - initCallData_ - ); - } - - /// @notice Sets the address for a deployed contract - /// @param data_ The data - /// @param returnData_ The return data - function setAddress(bytes memory data_, bytes memory returnData_) external onlyPromises { - (uint32 chainSlug, bytes32 contractId) = abi.decode(data_, (uint32, bytes32)); - - address forwarderContractAddress = addressResolver__.getOrDeployForwarderContract( - address(this), - abi.decode(returnData_, (address)), - chainSlug - ); - - forwarderAddresses[contractId][chainSlug] = forwarderContractAddress; - } - - /// @notice Gets the on-chain address - /// @param contractId_ The contract ID - /// @param chainSlug_ The chain slug - /// @return onChainAddress The on-chain address - function getOnChainAddress( - bytes32 contractId_, - uint32 chainSlug_ - ) public view returns (address onChainAddress) { - if (forwarderAddresses[contractId_][chainSlug_] == address(0)) { - return address(0); - } - - onChainAddress = IForwarder(forwarderAddresses[contractId_][chainSlug_]) - .getOnChainAddress(); - } - - /// @notice Callback in pd promise to be called after all contracts are deployed - /// @param payloadBatch_ The payload batch - /// @dev only payload delivery can call this - /// @dev callback in pd promise to be called after all contracts are deployed - function onBatchComplete( - bytes32, - PayloadBatch memory payloadBatch_ - ) external override onlyDeliveryHelper { - uint32 chainSlug = abi.decode(payloadBatch_.onCompleteData, (uint32)); - initialize(chainSlug); - } - - /// @notice Gets the socket address - /// @param chainSlug_ The chain slug - /// @return socketAddress_ The socket address - function getSocketAddress(uint32 chainSlug_) public view returns (address) { - return watcherPrecompile__().sockets(chainSlug_); - } - - /// @notice Initializes the contract - /// @param chainSlug_ The chain slug - function initialize(uint32 chainSlug_) public virtual {} -} diff --git a/contracts/base/AppGatewayBase.sol b/contracts/base/AppGatewayBase.sol index f0aa6d2a..559e8c29 100644 --- a/contracts/base/AppGatewayBase.sol +++ b/contracts/base/AppGatewayBase.sol @@ -2,10 +2,11 @@ pragma solidity ^0.8.3; import "../protocol/utils/AddressResolverUtil.sol"; -import "../interfaces/IDeliveryHelper.sol"; import "../interfaces/IAppGateway.sol"; +import "../interfaces/IForwarder.sol"; +import "../interfaces/IDeliveryHelper.sol"; import "../interfaces/IPromise.sol"; -import {Fees, Read, Parallel} from "../protocol/utils/common/Structs.sol"; + import {FeesPlugin} from "../protocol/utils/FeesPlugin.sol"; import {InvalidPromise, FeesNotSet} from "../protocol/utils/common/Errors.sol"; @@ -23,6 +24,8 @@ abstract contract AppGatewayBase is AddressResolverUtil, IAppGateway, FeesPlugin bool public isAsyncModifierSet; mapping(address => bool) public isValidPromise; + mapping(bytes32 => mapping(uint32 => address)) public override forwarderAddresses; + mapping(bytes32 => bytes) public creationCodeWithArgs; /// @notice Modifier to treat functions async modifier async() { @@ -47,9 +50,10 @@ abstract contract AppGatewayBase is AddressResolverUtil, IAppGateway, FeesPlugin /// @notice Constructor for AppGatewayBase /// @param addressResolver_ The address resolver address - constructor(address addressResolver_, address auctionManager_) { + constructor(address addressResolver_, address auctionManager_, bytes32 sbType_) { _setAddressResolver(addressResolver_); auctionManager = auctionManager_; + sbType = sbType_; } /// @notice Creates a contract ID @@ -79,6 +83,94 @@ abstract contract AppGatewayBase is AddressResolverUtil, IAppGateway, FeesPlugin } } + /// @notice Gets the socket address + /// @param chainSlug_ The chain slug + /// @return socketAddress_ The socket address + function getSocketAddress(uint32 chainSlug_) public view returns (address) { + return watcherPrecompile__().sockets(chainSlug_); + } + + //////////////////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////// DEPLOY HELPERS /////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////// + + /// @notice Deploys a contract + /// @param contractId_ The contract ID + /// @param chainSlug_ The chain slug + function _deploy(bytes32 contractId_, uint32 chainSlug_, IsPlug isPlug_) internal { + _deploy(contractId_, chainSlug_, isPlug_, new bytes(0)); + } + + /// @notice Deploys a contract + /// @param contractId_ The contract ID + /// @param chainSlug_ The chain slug + function _deploy( + bytes32 contractId_, + uint32 chainSlug_, + IsPlug isPlug_, + bytes memory initCallData_ + ) internal { + address asyncPromise = addressResolver__.deployAsyncPromiseContract(address(this)); + isValidPromise[asyncPromise] = true; + IPromise(asyncPromise).then(this.setAddress.selector, abi.encode(chainSlug_, contractId_)); + + onCompleteData = abi.encode(chainSlug_); + IDeliveryHelper(deliveryHelper()).queue( + isPlug_, + isParallelCall, + chainSlug_, + address(0), + asyncPromise, + 0, + CallType.DEPLOY, + creationCodeWithArgs[contractId_], + initCallData_ + ); + } + + /// @notice Sets the address for a deployed contract + /// @param data_ The data + /// @param returnData_ The return data + function setAddress(bytes memory data_, bytes memory returnData_) external onlyPromises { + (uint32 chainSlug, bytes32 contractId) = abi.decode(data_, (uint32, bytes32)); + + address forwarderContractAddress = addressResolver__.getOrDeployForwarderContract( + address(this), + abi.decode(returnData_, (address)), + chainSlug + ); + + forwarderAddresses[contractId][chainSlug] = forwarderContractAddress; + } + + /// @notice Gets the on-chain address + /// @param contractId_ The contract ID + /// @param chainSlug_ The chain slug + /// @return onChainAddress The on-chain address + function getOnChainAddress( + bytes32 contractId_, + uint32 chainSlug_ + ) public view returns (address onChainAddress) { + if (forwarderAddresses[contractId_][chainSlug_] == address(0)) { + return address(0); + } + + onChainAddress = IForwarder(forwarderAddresses[contractId_][chainSlug_]) + .getOnChainAddress(); + } + + /// @notice Callback in pd promise to be called after all contracts are deployed + /// @param payloadBatch_ The payload batch + /// @dev only payload delivery can call this + /// @dev callback in pd promise to be called after all contracts are deployed + function onBatchComplete( + bytes32, + PayloadBatch memory payloadBatch_ + ) external override onlyDeliveryHelper { + uint32 chainSlug = abi.decode(payloadBatch_.onCompleteData, (uint32)); + initialize(chainSlug); + } + //////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////// TX OVERRIDE HELPERS /////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////// @@ -191,6 +283,10 @@ abstract contract AppGatewayBase is AddressResolverUtil, IAppGateway, FeesPlugin bytes32 params_ ) external virtual onlyWatcherPrecompile {} + /// @notice Initializes the contract + /// @param chainSlug_ The chain slug + function initialize(uint32 chainSlug_) public virtual {} + /// @notice hook to handle the revert in callbacks or onchain executions /// @dev can be overridden by the app gateway to add custom logic /// @param asyncId_ The async ID diff --git a/contracts/interfaces/IAppDeployer.sol b/contracts/interfaces/IAppDeployer.sol deleted file mode 100644 index 14b6e8f4..00000000 --- a/contracts/interfaces/IAppDeployer.sol +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.21; - -/// @title IAppDeployer -/// @notice Interface for the app deployer -interface IAppDeployer { - /// @notice initialize the contracts on chain - function initialize(uint32 chainSlug_) external; - - /// @notice deploy contracts to chain - function deployContracts(uint32 chainSlug_) external; - - /// @notice get the on-chain address of a contract - function getOnChainAddress( - bytes32 contractId_, - uint32 chainSlug_ - ) external view returns (address onChainAddress); - - /// @notice get the forwarder address of a contract - function forwarderAddresses( - bytes32 contractId_, - uint32 chainSlug_ - ) external view returns (address forwarderAddress); -} diff --git a/contracts/interfaces/IAppGateway.sol b/contracts/interfaces/IAppGateway.sol index 50d0123f..38e68fee 100644 --- a/contracts/interfaces/IAppGateway.sol +++ b/contracts/interfaces/IAppGateway.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Unlicense pragma solidity ^0.8.21; -import {PayloadBatch, Read, Parallel} from "../protocol/utils/common/Structs.sol"; +import {Fees, Read, Parallel, DeployParams, CallType, PayloadBatch} from "../protocol/utils/common/Structs.sol"; interface IAppGateway { function isReadCall() external view returns (Read); @@ -22,4 +22,22 @@ interface IAppGateway { ) external; function handleRevert(bytes32 asyncId_, bytes32 payloadId_) external; + + /// @notice initialize the contracts on chain + function initialize(uint32 chainSlug_) external; + + /// @notice deploy contracts to chain + function deployContracts(uint32 chainSlug_) external; + + /// @notice get the on-chain address of a contract + function getOnChainAddress( + bytes32 contractId_, + uint32 chainSlug_ + ) external view returns (address onChainAddress); + + /// @notice get the forwarder address of a contract + function forwarderAddresses( + bytes32 contractId_, + uint32 chainSlug_ + ) external view returns (address forwarderAddress); } diff --git a/contracts/mock/MockSocket.sol b/contracts/mock/MockSocket.sol deleted file mode 100644 index d6a4c96e..00000000 --- a/contracts/mock/MockSocket.sol +++ /dev/null @@ -1,181 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.21; - -import {PlugDisconnected, InvalidAppGateway} from "../protocol/utils/common/Errors.sol"; -import "../interfaces/ISwitchboard.sol"; -import "../interfaces/ISocket.sol"; - -/** - * @title SocketDst - * @dev SocketDst is an abstract contract that inherits from SocketUtils and - * provides functionality for payload execution, verification. - * It manages the mapping of payload execution status - * timestamps - * It also includes functions for payload execution and verification - */ -contract MockSocket is ISocket { - struct PlugConfig { - // address of the sibling plug on the remote chain - address appGateway; - // switchboard instance for the plug connection - ISwitchboard switchboard__; - } - - // plug => (appGateway, switchboard__) - mapping(address => PlugConfig) internal _plugConfigs; - - function getPlugConfig( - address plugAddress_ - ) external view returns (address appGateway, address switchboard__) { - PlugConfig memory _plugConfig = _plugConfigs[plugAddress_]; - return (_plugConfig.appGateway, address(_plugConfig.switchboard__)); - } - - function connect(address appGateway_, address switchboard_) external override {} - - function registerSwitchboard() external override {} - - //////////////////////////////////////////////////////// - ////////////////////// ERRORS ////////////////////////// - //////////////////////////////////////////////////////// - /** - * @dev Error emitted when proof is invalid - */ - - /** - * @dev Error emitted when a payload has already been executed - */ - error PayloadAlreadyExecuted(); - /** - * @dev Error emitted when the executor is not valid - */ - /** - * @dev Error emitted when verification fails - */ - error VerificationFailed(); - /** - * @dev Error emitted when source slugs deduced from packet id and msg id don't match - */ - /** - * @dev Error emitted when less gas limit is provided for execution than expected - */ - error LowGasLimit(); - error InvalidSlug(); - - //////////////////////////////////////////////////////////// - ////////////////////// State Vars ////////////////////////// - //////////////////////////////////////////////////////////// - uint64 public callCounter; - uint32 public chainSlug; - - enum ExecutionStatus { - NotExecuted, - Executed, - Reverted - } - - /** - * @dev keeps track of whether a payload has been executed or not using payload id - */ - mapping(bytes32 => ExecutionStatus) public payloadExecuted; - - constructor(uint32 chainSlug_, address, address, address, string memory) { - chainSlug = chainSlug_; - } - - //////////////////////////////////////////////////////// - ////////////////////// OPERATIONS ////////////////////////// - //////////////////////////////////////////////////////// - - /** - * @notice To send message to a connected remote chain. Should only be called by a plug. - * @param payload bytes to be delivered to the Plug on the siblingChainSlug_ - * @param params a 32 bytes param to add details for execution, for eg: fees to be paid for execution - */ - function callAppGateway( - bytes calldata payload, - bytes32 params - ) external returns (bytes32 callId) { - PlugConfig memory plugConfig = _plugConfigs[msg.sender]; - // creates a unique ID for the message - callId = _encodeCallId(plugConfig.appGateway); - emit AppGatewayCallRequested( - callId, - chainSlug, - msg.sender, - plugConfig.appGateway, - params, - payload - ); - } - - /** - * @notice Executes a payload that has been delivered by transmitters and authenticated by switchboards - */ - function execute( - address, - ExecuteParams memory params_, - bytes memory - ) external payable returns (bytes memory) { - // execute payload - return - _execute(params_.target, params_.payloadId, params_.executionGasLimit, params_.payload); - } - - //////////////////////////////////////////////////////// - ////////////////// INTERNAL FUNCS ////////////////////// - //////////////////////////////////////////////////////// - - function _verify( - bytes32 digest_, - bytes32 payloadId_, - ISwitchboard switchboard__ - ) internal view { - // NOTE: is the the first un-trusted call in the system, another one is Plug.call - if (!switchboard__.allowPacket(digest_, payloadId_)) revert VerificationFailed(); - } - - /** - * This function assumes localPlug_ will have code while executing. As the payload - * execution failure is not blocking the system, it is not necessary to check if - * code exists in the given address. - */ - function _execute( - address, - bytes32 payloadId_, - uint256, - bytes memory - ) internal returns (bytes memory) { - bytes memory returnData = hex"00010203"; - emit ExecutionSuccess(payloadId_, returnData); - return returnData; - } - - /** - * @dev Decodes the switchboard address from a given payload id. - * @param id_ The ID of the msg to decode the switchboard from. - * @return switchboard_ The address of switchboard decoded from the payload ID. - */ - function _decodeSwitchboard(bytes32 id_) internal pure returns (address switchboard_) { - switchboard_ = address(uint160(uint256(id_) >> 64)); - } - - /** - * @dev Decodes the chain ID from a given packet/payload ID. - * @param id_ The ID of the packet/msg to decode the chain slug from. - * @return chainSlug_ The chain slug decoded from the packet/payload ID. - */ - function _decodeChainSlug(bytes32 id_) internal pure returns (uint32 chainSlug_) { - chainSlug_ = uint32(uint256(id_) >> 224); - } - - // Packs the local plug, local chain slug, remote chain slug and nonce - // callCount++ will take care of call id overflow as well - // callId(256) = localChainSlug(32) | appGateway_(160) | nonce(64) - function _encodeCallId(address appGateway_) internal returns (bytes32) { - return - bytes32( - (uint256(chainSlug) << 224) | (uint256(uint160(appGateway_)) << 64) | callCounter++ - ); - } -} diff --git a/contracts/mock/MockWatcherPrecompile.sol b/contracts/mock/MockWatcherPrecompile.sol deleted file mode 100644 index 93f9b3c5..00000000 --- a/contracts/mock/MockWatcherPrecompile.sol +++ /dev/null @@ -1,245 +0,0 @@ -// SPDX-License-Identifier: Unlicense -pragma solidity ^0.8.21; - -import "../interfaces/IAppGateway.sol"; -import "../interfaces/IWatcherPrecompile.sol"; -import "../interfaces/IPromise.sol"; - -import {PayloadDigestParams, AsyncRequest, FinalizeParams, TimeoutRequest, CallFromChainParams, PlugConfig, ResolvedPromises, AppGatewayConfig} from "../protocol/utils/common/Structs.sol"; -import {QUERY, FINALIZE, SCHEDULE} from "../protocol/utils/common/Constants.sol"; -import {TimeoutDelayTooLarge, TimeoutAlreadyResolved, InvalidInboxCaller, ResolvingTimeoutTooEarly, CallFailed, AppGatewayAlreadyCalled} from "../protocol/utils/common/Errors.sol"; -import "solady/utils/ERC1967Factory.sol"; - -/// @title WatcherPrecompile -/// @notice Contract that handles payload verification, execution and app configurations -contract MockWatcherPrecompile { - uint256 public maxTimeoutDelayInSeconds = 24 * 60 * 60; // 24 hours - /// @notice Counter for tracking query requests - uint256 public queryCounter; - /// @notice Counter for tracking payload execution requests - uint256 public payloadCounter; - /// @notice Counter for tracking timeout requests - uint256 public timeoutCounter; - /// @notice Mapping to store async requests - /// @dev payloadId => AsyncRequest struct - mapping(bytes32 => AsyncRequest) public asyncRequests; - /// @notice Mapping to store timeout requests - /// @dev timeoutId => TimeoutRequest struct - mapping(bytes32 => TimeoutRequest) public timeoutRequests; - - mapping(uint32 => mapping(address => PlugConfig)) internal _plugConfigs; - - /// @notice Error thrown when an invalid chain slug is provided - error InvalidChainSlug(); - error InvalidTransmitter(); - - event CalledAppGateway( - bytes32 callId, - uint32 chainSlug, - address plug, - address appGateway, - bytes32 params, - bytes payload - ); - - /// @notice Emitted when a new query is requested - /// @param chainSlug The identifier of the destination chain - /// @param targetAddress The address of the target contract - /// @param payloadId The unique identifier for the query - /// @param payload The query data - event QueryRequested(uint32 chainSlug, address targetAddress, bytes32 payloadId, bytes payload); - - /// @notice Emitted when a finalize request is made - /// @param payloadId The unique identifier for the request - /// @param asyncRequest The async request details - event FinalizeRequested(bytes32 indexed payloadId, AsyncRequest asyncRequest); - - /// @notice Emitted when a request is finalized - /// @param payloadId The unique identifier for the request - /// @param asyncRequest The async request details - /// @param proof The proof from the watcher - event Finalized(bytes32 indexed payloadId, AsyncRequest asyncRequest, bytes proof); - - /// @notice Emitted when a promise is resolved - /// @param payloadId The unique identifier for the resolved promise - event PromiseResolved(bytes32 indexed payloadId); - - event TimeoutRequested( - bytes32 timeoutId, - address target, - bytes payload, - uint256 executeAt // Epoch time when the task should execute - ); - - /// @notice Emitted when a timeout is resolved - /// @param timeoutId The unique identifier for the timeout - /// @param target The target address for the timeout - /// @param payload The payload data - /// @param executedAt The epoch time when the task was executed - event TimeoutResolved(bytes32 timeoutId, address target, bytes payload, uint256 executedAt); - - /// @notice Contract constructor - /// @param _owner Address of the contract owner - constructor(address _owner, address addressResolver_) {} - - // ================== Timeout functions ================== - - /// @notice Sets a timeout for a payload execution on app gateway - /// @param payload_ The payload data - /// @param delayInSeconds_ The delay in seconds - function setTimeout(bytes calldata payload_, uint256 delayInSeconds_) external { - uint256 executeAt = block.timestamp + delayInSeconds_; - bytes32 timeoutId = _encodeTimeoutId(timeoutCounter++); - timeoutRequests[timeoutId] = TimeoutRequest( - timeoutId, - msg.sender, - delayInSeconds_, - executeAt, - 0, - false, - payload_ - ); - emit TimeoutRequested(timeoutId, msg.sender, payload_, executeAt); - } - - /// @notice Ends the timeouts and calls the target address with the callback payload - /// @param timeoutId The unique identifier for the timeout - /// @dev Only callable by the contract owner - function resolveTimeout(bytes32 timeoutId) external { - TimeoutRequest storage timeoutRequest = timeoutRequests[timeoutId]; - - (bool success, ) = address(timeoutRequest.target).call(timeoutRequest.payload); - if (!success) revert CallFailed(); - emit TimeoutResolved( - timeoutId, - timeoutRequest.target, - timeoutRequest.payload, - block.timestamp - ); - } - - // ================== Finalize functions ================== - - /// @notice Finalizes a payload request, requests the watcher to release the proofs to execute on chain - /// @param params_ The finalization parameters - /// @return payloadId The unique identifier for the finalized request - /// @return digest The digest of the payload parameters - function finalize( - FinalizeParams memory params_ - ) external returns (bytes32 payloadId, bytes32 digest) { - digest = keccak256(abi.encode(block.timestamp)); - // Generate a unique payload ID by combining chain, target, and counter - payloadId = encodePayloadId( - params_.payloadDetails.chainSlug, - params_.payloadDetails.target, - payloadCounter++ - ); - address[] memory next = new address[](1); - emit FinalizeRequested( - payloadId, - AsyncRequest( - msg.sender, - address(0), - address(0), - params_.payloadDetails.target, - address(0), - 0, - block.timestamp + 1000, - params_.asyncId, - bytes32(0), - bytes(""), - next - ) - ); - } - - // ================== Query functions ================== - /// @notice Creates a new query request - /// @param chainSlug The identifier of the destination chain - /// @param targetAddress The address of the target contract - /// @param payload The query payload data - /// @return payloadId The unique identifier for the query - function query( - uint32 chainSlug, - address targetAddress, - address[] memory, - bytes memory payload - ) public returns (bytes32 payloadId) { - payloadId = bytes32(queryCounter++); - emit QueryRequested(chainSlug, targetAddress, payloadId, payload); - } - - /// @notice Marks a request as finalized with a proof - /// @param payloadId_ The unique identifier of the request - /// @param proof_ The watcher's proof - /// @dev Only callable by the contract owner - function finalized(bytes32 payloadId_, bytes calldata proof_) external { - emit Finalized(payloadId_, asyncRequests[payloadId_], proof_); - } - - /// @notice Resolves multiple promises with their return data - /// @param resolvedPromises_ Array of resolved promises and their return data - /// @dev Only callable by the contract owner - function resolvePromises(ResolvedPromises[] calldata resolvedPromises_) external { - for (uint256 i = 0; i < resolvedPromises_.length; i++) { - emit PromiseResolved(resolvedPromises_[i].payloadId); - } - } - - // ================== On-Chain Inbox ================== - - function callAppGateways(CallFromChainParams[] calldata params_) external { - for (uint256 i = 0; i < params_.length; i++) { - emit CalledAppGateway( - params_[i].callId, - params_[i].chainSlug, - params_[i].plug, - params_[i].appGateway, - params_[i].params, - params_[i].payload - ); - } - } - - /// @notice Encodes a unique payload ID from chain slug, plug address, and counter - /// @param chainSlug_ The identifier of the chain - /// @param plug_ The plug address - /// @param counter_ The current counter value - /// @return The encoded payload ID as bytes32 - /// @dev Reverts if chainSlug is 0 - function encodePayloadId( - uint32 chainSlug_, - address plug_, - uint256 counter_ - ) internal view returns (bytes32) { - if (chainSlug_ == 0) revert InvalidChainSlug(); - (, address switchboard) = getPlugConfigs(chainSlug_, plug_); - // Encode payload ID by bit-shifting and combining: - // chainSlug (32 bits) | switchboard address (160 bits) | counter (64 bits) - - return - bytes32( - (uint256(chainSlug_) << 224) | (uint256(uint160(switchboard)) << 64) | counter_ - ); - } - - function _encodeTimeoutId(uint256 timeoutCounter_) internal view returns (bytes32) { - // watcher address (160 bits) | counter (64 bits) - return bytes32((uint256(uint160(address(this))) << 64) | timeoutCounter_); - } - - /// @notice Retrieves the configuration for a specific plug on a network - /// @param chainSlug_ The identifier of the network - /// @param plug_ The address of the plug - /// @return The app gateway address and switchboard address for the plug - /// @dev Returns zero addresses if configuration doesn't exist - function getPlugConfigs( - uint32 chainSlug_, - address plug_ - ) public view returns (address, address) { - return ( - _plugConfigs[chainSlug_][plug_].appGateway, - _plugConfigs[chainSlug_][plug_].switchboard - ); - } -} diff --git a/contracts/protocol/payload-delivery/FeesManager.sol b/contracts/protocol/payload-delivery/FeesManager.sol index 007e2e09..e90014e5 100644 --- a/contracts/protocol/payload-delivery/FeesManager.sol +++ b/contracts/protocol/payload-delivery/FeesManager.sol @@ -45,7 +45,7 @@ abstract contract FeesManagerStorage is IFeesManager { uint256[50] _gap_after; // slots 104-153 reserved for addr resolver util - } +} /// @title FeesManager /// @notice Contract for managing fees diff --git a/test/mock/MockSocket.sol b/test/mock/MockSocket.sol index d6a4c96e..98c87f09 100644 --- a/test/mock/MockSocket.sol +++ b/test/mock/MockSocket.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {PlugDisconnected, InvalidAppGateway} from "../protocol/utils/common/Errors.sol"; -import "../interfaces/ISwitchboard.sol"; -import "../interfaces/ISocket.sol"; +import {PlugDisconnected, InvalidAppGateway} from "../../contracts/protocol/utils/common/Errors.sol"; +import "../../contracts/interfaces/ISwitchboard.sol"; +import "../../contracts/interfaces/ISocket.sol"; /** * @title SocketDst diff --git a/test/mock/MockWatcherPrecompile.sol b/test/mock/MockWatcherPrecompile.sol index 93f9b3c5..d1886b89 100644 --- a/test/mock/MockWatcherPrecompile.sol +++ b/test/mock/MockWatcherPrecompile.sol @@ -1,13 +1,13 @@ // SPDX-License-Identifier: Unlicense pragma solidity ^0.8.21; -import "../interfaces/IAppGateway.sol"; -import "../interfaces/IWatcherPrecompile.sol"; -import "../interfaces/IPromise.sol"; +import "../../contracts/interfaces/IAppGateway.sol"; +import "../../contracts/interfaces/IWatcherPrecompile.sol"; +import "../../contracts/interfaces/IPromise.sol"; -import {PayloadDigestParams, AsyncRequest, FinalizeParams, TimeoutRequest, CallFromChainParams, PlugConfig, ResolvedPromises, AppGatewayConfig} from "../protocol/utils/common/Structs.sol"; -import {QUERY, FINALIZE, SCHEDULE} from "../protocol/utils/common/Constants.sol"; -import {TimeoutDelayTooLarge, TimeoutAlreadyResolved, InvalidInboxCaller, ResolvingTimeoutTooEarly, CallFailed, AppGatewayAlreadyCalled} from "../protocol/utils/common/Errors.sol"; +import {PayloadDigestParams, AsyncRequest, FinalizeParams, TimeoutRequest, CallFromChainParams, PlugConfig, ResolvedPromises, AppGatewayConfig} from "../../contracts/protocol/utils/common/Structs.sol"; +import {QUERY, FINALIZE, SCHEDULE} from "../../contracts/protocol/utils/common/Constants.sol"; +import {TimeoutDelayTooLarge, TimeoutAlreadyResolved, InvalidInboxCaller, ResolvingTimeoutTooEarly, CallFailed, AppGatewayAlreadyCalled} from "../../contracts/protocol/utils/common/Errors.sol"; import "solady/utils/ERC1967Factory.sol"; /// @title WatcherPrecompile From 8d93d3313c414b91c1cf403da6065554af9f57d9 Mon Sep 17 00:00:00 2001 From: Ameesha Agrawal Date: Wed, 26 Feb 2025 17:05:31 +0400 Subject: [PATCH 2/5] fix: apps and scripts --- .env.sample | 1 - contracts/apps/counter-inbox/CounterInbox.sol | 11 --- .../counter-inbox/CounterInboxAppGateway.sol | 29 ------- contracts/apps/counter/Counter.sol | 4 + contracts/apps/counter/CounterAppGateway.sol | 79 ++++++++++++++++++- contracts/apps/counter/CounterDeployer.sol | 33 -------- contracts/apps/cron/CronAppGateway.sol | 30 ------- .../ParallelCounterAppGateway.sol | 45 ----------- .../ParallelCounterDeployer.sol | 43 ---------- .../SuperTokenLockableAppGateway.sol | 61 ++++++++++++-- .../SuperTokenLockableDeployer.sol | 68 ---------------- .../apps/super-token/SuperTokenAppGateway.sol | 43 ++++++++-- .../apps/super-token/SuperTokenDeployer.sol | 50 ------------ contracts/base/AppGatewayBase.sol | 34 ++++---- contracts/interfaces/IAddressResolver.sol | 2 +- .../interfaces/IMultiChainAppDeployer.sol | 4 +- contracts/protocol/AddressResolver.sol | 8 +- .../counter-inbox/CheckGatewayCounter.s.sol | 10 +-- .../DeployCounterAndGateway.s.sol | 49 ------------ script/counter-inbox/Increment.s.sol | 6 +- script/counter/IncrementCountersFromApp.s.sol | 14 ++-- script/counter/ReadOnchainCounters.s.sol | 14 ++-- script/counter/deployEVMxCounterApp.s.sol | 8 +- script/counter/deployOnchainCounters.s.sol | 14 ++-- script/cron/DeployGateway.s.sol | 37 --------- script/cron/SetTimeout.s.sol | 4 +- script/mock/DeployEVMx.s.sol | 4 +- script/mock/DeploySocket.s.sol | 5 +- script/mock/FinalizeAndExecution.s.sol | 5 +- script/mock/Inbox.s.sol | 4 +- script/mock/Query.s.sol | 2 +- script/mock/Timeout.s.sol | 2 +- script/parallel-counter/checkCounters.s.sol | 54 ++++++------- script/parallel-counter/deployOnEVMx.s.sol | 46 ----------- script/parallel-counter/deployOnchain.s.sol | 9 +-- .../parallel-counter/incrementCounters.s.sol | 23 +++--- script/super-token-lockable/Bridge.s.sol | 32 ++++---- .../DeployContracts.s.sol | 9 +-- .../super-token-lockable/DeployGateway.s.sol | 22 ++---- script/super-token/DeployContracts.s.sol | 3 +- script/super-token/DeployGateway.s.sol | 26 ++---- test/DeliveryHelper.t.sol | 28 +++---- test/apps/ParallelCounter.t.sol | 6 +- testScript.sh | 8 +- 44 files changed, 329 insertions(+), 660 deletions(-) delete mode 100644 contracts/apps/counter-inbox/CounterInbox.sol delete mode 100644 contracts/apps/counter-inbox/CounterInboxAppGateway.sol delete mode 100644 contracts/apps/counter/CounterDeployer.sol delete mode 100644 contracts/apps/cron/CronAppGateway.sol delete mode 100644 contracts/apps/parallel-counter/ParallelCounterAppGateway.sol delete mode 100644 contracts/apps/parallel-counter/ParallelCounterDeployer.sol delete mode 100644 contracts/apps/super-token-lockable/SuperTokenLockableDeployer.sol delete mode 100644 contracts/apps/super-token/SuperTokenDeployer.sol delete mode 100644 script/counter-inbox/DeployCounterAndGateway.s.sol delete mode 100644 script/cron/DeployGateway.s.sol delete mode 100644 script/parallel-counter/deployOnEVMx.s.sol diff --git a/.env.sample b/.env.sample index de7767c6..607b51c5 100644 --- a/.env.sample +++ b/.env.sample @@ -17,7 +17,6 @@ FEES_MANAGER="0x80bEc58A00993dc874Ab2fAe56621af24eF06bA5" PRIVATE_KEY="0x" # Set app related values after deployment on EVMx -DEPLOYER="0x" APP_GATEWAY="0x" # FOR INFRASTRUCTURE DEPLOYMENT ONLY diff --git a/contracts/apps/counter-inbox/CounterInbox.sol b/contracts/apps/counter-inbox/CounterInbox.sol deleted file mode 100644 index df86efb7..00000000 --- a/contracts/apps/counter-inbox/CounterInbox.sol +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; - -import "solady/auth/Ownable.sol"; -import "../../base/PlugBase.sol"; - -contract CounterInbox is Ownable, PlugBase { - function increaseOnGateway(uint256 value_) external returns (bytes32) { - return _callAppGateway(abi.encode(value_), bytes32(0)); - } -} diff --git a/contracts/apps/counter-inbox/CounterInboxAppGateway.sol b/contracts/apps/counter-inbox/CounterInboxAppGateway.sol deleted file mode 100644 index 23c6a03c..00000000 --- a/contracts/apps/counter-inbox/CounterInboxAppGateway.sol +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; - -import "../../base/AppGatewayBase.sol"; - -contract CounterInboxAppGateway is AppGatewayBase { - uint256 public counter; - - constructor( - address addressResolver_, - address auctionManager_, - address counterInbox_, - uint32 chainSlug_, - Fees memory fees_ - ) AppGatewayBase(addressResolver_, auctionManager_) { - watcherPrecompile__().setIsValidPlug(chainSlug_, address(counterInbox_), true); - _setOverrides(fees_); - } - - function callFromChain( - uint32, - address, - bytes calldata payload_, - bytes32 - ) external override onlyWatcherPrecompile { - uint256 value = abi.decode(payload_, (uint256)); - counter += value; - } -} diff --git a/contracts/apps/counter/Counter.sol b/contracts/apps/counter/Counter.sol index 44054091..f2502c33 100644 --- a/contracts/apps/counter/Counter.sol +++ b/contracts/apps/counter/Counter.sol @@ -14,4 +14,8 @@ contract Counter is Ownable, PlugBase { function getCounter() external view returns (uint256) { return counter; } + + function increaseOnGateway(uint256 value_) external returns (bytes32) { + return _callAppGateway(abi.encode(value_), bytes32(0)); + } } diff --git a/contracts/apps/counter/CounterAppGateway.sol b/contracts/apps/counter/CounterAppGateway.sol index dc6943cb..0d36d319 100644 --- a/contracts/apps/counter/CounterAppGateway.sol +++ b/contracts/apps/counter/CounterAppGateway.sol @@ -7,18 +7,51 @@ import "./ICounter.sol"; import "../../interfaces/IForwarder.sol"; import "../../interfaces/IPromise.sol"; -contract CounterAppGateway is AppGatewayBase { +contract CounterAppGateway is AppGatewayBase, Ownable { + bytes32 public counter = _createContractId("counter"); + bytes32 public counter1 = _createContractId("counter1"); + + uint256 public counterVal; + uint256 arbCounter; uint256 optCounter; + event TimeoutResolved(uint256 creationTimestamp, uint256 executionTimestamp); constructor( address addressResolver_, - address deployerContract_, address auctionManager_, + bytes32 sbType_, Fees memory fees_ - ) AppGatewayBase(addressResolver_, auctionManager_) { - addressResolver__.setContractsToGateways(deployerContract_); + ) AppGatewayBase(addressResolver_, auctionManager_, sbType_) { + creationCodeWithArgs[counter] = abi.encodePacked(type(Counter).creationCode); + creationCodeWithArgs[counter1] = abi.encodePacked(type(Counter).creationCode); _setOverrides(fees_); + _initializeOwner(msg.sender); + } + + // deploy contracts + function deployContracts(uint32 chainSlug_) external async { + _deploy(counter, chainSlug_, IsPlug.YES); + } + + function deployParallelContracts(uint32 chainSlug_) external async { + _setOverrides(Parallel.ON); + _deploy(counter, chainSlug_, IsPlug.YES); + _deploy(counter1, chainSlug_, IsPlug.YES); + _setOverrides(Parallel.OFF); + } + + function deployMultiChainContracts(uint32[] memory chainSlugs_) external async { + _setOverrides(Parallel.ON); + for (uint32 i = 0; i < chainSlugs_.length; i++) { + _deploy(counter, chainSlugs_[i], IsPlug.YES); + _deploy(counter1, chainSlugs_[i], IsPlug.YES); + } + _setOverrides(Parallel.OFF); + } + + function initialize(uint32) public pure override { + return; } function incrementCounters(address[] memory instances_) public async { @@ -29,6 +62,14 @@ contract CounterAppGateway is AppGatewayBase { } } + // for testing purposes + function incrementCountersWithoutAsync(address[] memory instances_) public { + // the increase function is called on given list of instances + for (uint256 i = 0; i < instances_.length; i++) { + Counter(instances_[i]).increase(); + } + } + function readCounters(address[] memory instances_) public async { // the increase function is called on given list of instances _setOverrides(Read.ON, Parallel.ON); @@ -51,6 +92,36 @@ contract CounterAppGateway is AppGatewayBase { } } + // INBOX + function setIsValidPlug(uint32 chainSlug_, address plug_) public { + watcherPrecompile__().setIsValidPlug(chainSlug_, plug_, true); + } + + function callFromChain( + uint32, + address, + bytes calldata payload_, + bytes32 + ) external override onlyWatcherPrecompile { + uint256 value = abi.decode(payload_, (uint256)); + counterVal += value; + } + + // TIMEOUT + function setTimeout(uint256 delayInSeconds_) public { + bytes memory payload = abi.encodeWithSelector( + this.resolveTimeout.selector, + block.timestamp + ); + watcherPrecompile__().setTimeout(address(this), payload, delayInSeconds_); + } + + function resolveTimeout(uint256 creationTimestamp_) external onlyWatcherPrecompile { + emit TimeoutResolved(creationTimestamp_, block.timestamp); + } + + // UTILS + function setFees(Fees memory fees_) public { fees = fees_; } diff --git a/contracts/apps/counter/CounterDeployer.sol b/contracts/apps/counter/CounterDeployer.sol deleted file mode 100644 index 8ae8c2f3..00000000 --- a/contracts/apps/counter/CounterDeployer.sol +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; - -import "./Counter.sol"; -import "../../base/AppDeployerBase.sol"; -import "solady/auth/Ownable.sol"; - -contract CounterDeployer is AppDeployerBase, Ownable { - bytes32 public counter = _createContractId("counter"); - - constructor( - address addressResolver_, - address auctionManager_, - bytes32 sbType_, - Fees memory fees_ - ) AppDeployerBase(addressResolver_, auctionManager_, sbType_) { - creationCodeWithArgs[counter] = abi.encodePacked(type(Counter).creationCode); - _setOverrides(fees_); - _initializeOwner(msg.sender); - } - - function deployContracts(uint32 chainSlug_) external async { - _deploy(counter, chainSlug_, IsPlug.YES); - } - - function initialize(uint32) public pure override { - return; - } - - function setFees(Fees memory fees_) public { - fees = fees_; - } -} diff --git a/contracts/apps/cron/CronAppGateway.sol b/contracts/apps/cron/CronAppGateway.sol deleted file mode 100644 index 9b50abf5..00000000 --- a/contracts/apps/cron/CronAppGateway.sol +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; - -import "../../base/AppGatewayBase.sol"; - -contract CronAppGateway is AppGatewayBase { - event TimeoutResolved(uint256 creationTimestamp, uint256 executionTimestamp); - - constructor( - address addressResolver_, - address deployerContract_, - address auctionManager_, - Fees memory fees_ - ) AppGatewayBase(addressResolver_, auctionManager_) { - addressResolver__.setContractsToGateways(deployerContract_); - _setOverrides(fees_); - } - - function setTimeout(uint256 delayInSeconds_) public { - bytes memory payload = abi.encodeWithSelector( - this.resolveTimeout.selector, - block.timestamp - ); - watcherPrecompile__().setTimeout(address(this), payload, delayInSeconds_); - } - - function resolveTimeout(uint256 creationTimestamp_) external onlyWatcherPrecompile { - emit TimeoutResolved(creationTimestamp_, block.timestamp); - } -} diff --git a/contracts/apps/parallel-counter/ParallelCounterAppGateway.sol b/contracts/apps/parallel-counter/ParallelCounterAppGateway.sol deleted file mode 100644 index 32abf96b..00000000 --- a/contracts/apps/parallel-counter/ParallelCounterAppGateway.sol +++ /dev/null @@ -1,45 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; - -import "../../base/AppGatewayBase.sol"; -import "../counter/Counter.sol"; - -contract ParallelCounterAppGateway is AppGatewayBase { - constructor( - address addressResolver_, - address deployerContract_, - address auctionManager_, - Fees memory fees_ - ) AppGatewayBase(addressResolver_, auctionManager_) { - addressResolver__.setContractsToGateways(deployerContract_); - _setOverrides(Read.OFF, Parallel.OFF, 1000000, fees_); - } - - function incrementCounters(address[] memory instances_) public async { - // the increase function is called on given list of instances - // this - for (uint256 i = 0; i < instances_.length; i++) { - Counter(instances_[i]).increase(); - } - } - - function incrementCountersWithoutAsync(address[] memory instances_) public { - // the increase function is called on given list of instances - for (uint256 i = 0; i < instances_.length; i++) { - Counter(instances_[i]).increase(); - } - } - - function setFees(Fees memory fees_) public { - fees = fees_; - } - - function withdrawFeeTokens( - uint32 chainSlug_, - address token_, - uint256 amount_, - address receiver_ - ) external { - _withdrawFeeTokens(chainSlug_, token_, amount_, receiver_); - } -} diff --git a/contracts/apps/parallel-counter/ParallelCounterDeployer.sol b/contracts/apps/parallel-counter/ParallelCounterDeployer.sol deleted file mode 100644 index 7c4e27c5..00000000 --- a/contracts/apps/parallel-counter/ParallelCounterDeployer.sol +++ /dev/null @@ -1,43 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; - -import "solady/auth/Ownable.sol"; -import "../counter/Counter.sol"; -import "../../base/AppDeployerBase.sol"; - -contract ParallelCounterDeployer is AppDeployerBase, Ownable { - bytes32 public counter1 = _createContractId("counter1"); - bytes32 public counter2 = _createContractId("counter2"); - - constructor( - address addressResolver_, - address auctionManager_, - bytes32 sbType_, - Fees memory fees_ - ) AppDeployerBase(addressResolver_, auctionManager_, sbType_) { - creationCodeWithArgs[counter1] = abi.encodePacked(type(Counter).creationCode); - creationCodeWithArgs[counter2] = abi.encodePacked(type(Counter).creationCode); - _setOverrides(Read.OFF, Parallel.ON, 1000000, fees_); - _initializeOwner(msg.sender); - } - - function deployContracts(uint32 chainSlug_) external async { - _deploy(counter1, chainSlug_, IsPlug.YES); - _deploy(counter2, chainSlug_, IsPlug.YES); - } - - function deployMultiChainContracts(uint32[] memory chainSlugs_) external async { - for (uint32 i = 0; i < chainSlugs_.length; i++) { - _deploy(counter1, chainSlugs_[i], IsPlug.YES); - _deploy(counter2, chainSlugs_[i], IsPlug.YES); - } - } - - function initialize(uint32) public pure override { - return; - } - - function setFees(Fees memory fees_) public { - fees = fees_; - } -} diff --git a/contracts/apps/super-token-lockable/SuperTokenLockableAppGateway.sol b/contracts/apps/super-token-lockable/SuperTokenLockableAppGateway.sol index 92a96e06..56336bef 100644 --- a/contracts/apps/super-token-lockable/SuperTokenLockableAppGateway.sol +++ b/contracts/apps/super-token-lockable/SuperTokenLockableAppGateway.sol @@ -1,12 +1,15 @@ // SPDX-License-Identifier: Unlicense pragma solidity ^0.8.21; -import "../../base/AppGatewayBase.sol"; -import {ISuperToken} from "../../interfaces/ISuperToken.sol"; import "solady/auth/Ownable.sol"; +import {ISuperToken} from "../../interfaces/ISuperToken.sol"; +import "../../base/AppGatewayBase.sol"; +import "./SuperTokenLockable.sol"; +import "./LimitHook.sol"; contract SuperTokenLockableAppGateway is AppGatewayBase, Ownable { - uint256 public idCounter; + bytes32 public superTokenLockable = _createContractId("superTokenLockable"); + bytes32 public limitHook = _createContractId("limitHook"); event Bridged(bytes32 asyncId); @@ -18,17 +21,61 @@ contract SuperTokenLockableAppGateway is AppGatewayBase, Ownable { uint256 deadline; } + struct ConstructorParams { + uint256 _burnLimit; + uint256 _mintLimit; + string name_; + string symbol_; + uint8 decimals_; + address initialSupplyHolder_; + uint256 initialSupply_; + } + constructor( address addressResolver_, - address deployerContract_, address auctionManager_, - Fees memory fees_ - ) AppGatewayBase(addressResolver_, auctionManager_) { - addressResolver__.setContractsToGateways(deployerContract_); + bytes32 sbType_, + Fees memory fees_, + ConstructorParams memory params + ) AppGatewayBase(addressResolver_, auctionManager_, sbType_) { + creationCodeWithArgs[superTokenLockable] = abi.encodePacked( + type(SuperTokenLockable).creationCode, + abi.encode( + params.name_, + params.symbol_, + params.decimals_, + params.initialSupplyHolder_, + params.initialSupply_ + ) + ); + + creationCodeWithArgs[limitHook] = abi.encodePacked( + type(LimitHook).creationCode, + abi.encode(params._burnLimit, params._mintLimit) + ); + _setOverrides(fees_); _initializeOwner(msg.sender); } + function deployContracts(uint32 chainSlug_) external async { + bytes memory initData = abi.encodeWithSelector( + SuperTokenLockable.setOwner.selector, + owner() + ); + _deploy(superTokenLockable, chainSlug_, IsPlug.YES, initData); + _deploy(limitHook, chainSlug_, IsPlug.YES, initData); + } + + // don't need to call this directly, will be called automatically after all contracts are deployed. + // check AppGatewayBase.onBatchComplete + function initialize(uint32 chainSlug_) public override async { + address limitHookContract = getOnChainAddress(limitHook, chainSlug_); + SuperTokenLockable(forwarderAddresses[superTokenLockable][chainSlug_]).setLimitHook( + limitHookContract + ); + } + function checkBalance(bytes memory data_, bytes memory returnData_) external onlyPromises { (UserOrder memory order, bytes32 asyncId) = abi.decode(data_, (UserOrder, bytes32)); diff --git a/contracts/apps/super-token-lockable/SuperTokenLockableDeployer.sol b/contracts/apps/super-token-lockable/SuperTokenLockableDeployer.sol deleted file mode 100644 index 1648d49b..00000000 --- a/contracts/apps/super-token-lockable/SuperTokenLockableDeployer.sol +++ /dev/null @@ -1,68 +0,0 @@ -// SPDX-License-Identifier: Unlicense -pragma solidity ^0.8.21; - -import "./SuperTokenLockable.sol"; -import "./LimitHook.sol"; -import "../../base/AppDeployerBase.sol"; -import "solady/auth/Ownable.sol"; - -contract SuperTokenLockableDeployer is AppDeployerBase, Ownable { - bytes32 public superTokenLockable = _createContractId("superTokenLockable"); - bytes32 public limitHook = _createContractId("limitHook"); - - struct ConstructorParams { - uint256 _burnLimit; - uint256 _mintLimit; - string name_; - string symbol_; - uint8 decimals_; - address initialSupplyHolder_; - uint256 initialSupply_; - } - - constructor( - address addressResolver_, - address owner_, - address auctionManager_, - bytes32 sbType_, - ConstructorParams memory params, - Fees memory fees_ - ) AppDeployerBase(addressResolver_, auctionManager_, sbType_) { - creationCodeWithArgs[superTokenLockable] = abi.encodePacked( - type(SuperTokenLockable).creationCode, - abi.encode( - params.name_, - params.symbol_, - params.decimals_, - params.initialSupplyHolder_, - params.initialSupply_ - ) - ); - - creationCodeWithArgs[limitHook] = abi.encodePacked( - type(LimitHook).creationCode, - abi.encode(params._burnLimit, params._mintLimit) - ); - - _setOverrides(fees_); - _initializeOwner(owner_); - } - - function deployContracts(uint32 chainSlug_) external async { - bytes memory initData = abi.encodeWithSelector( - SuperTokenLockable.setOwner.selector, - owner() - ); - _deploy(superTokenLockable, chainSlug_, IsPlug.YES, initData); - _deploy(limitHook, chainSlug_, IsPlug.YES, initData); - } - - // don't need to call this directly, will be called automatically after all contracts are deployed. - // check AppDeployerBase.allPayloadsExecuted and AppGateway.queueAndDeploy - function initialize(uint32 chainSlug_) public override async { - address limitHookContract = getOnChainAddress(limitHook, chainSlug_); - SuperTokenLockable(forwarderAddresses[superTokenLockable][chainSlug_]).setLimitHook( - limitHookContract - ); - } -} diff --git a/contracts/apps/super-token/SuperTokenAppGateway.sol b/contracts/apps/super-token/SuperTokenAppGateway.sol index 2527ab7e..308759b3 100644 --- a/contracts/apps/super-token/SuperTokenAppGateway.sol +++ b/contracts/apps/super-token/SuperTokenAppGateway.sol @@ -1,13 +1,24 @@ // SPDX-License-Identifier: Unlicense pragma solidity ^0.8.21; +import "solady/auth/Ownable.sol"; import "../../base/AppGatewayBase.sol"; import "../../interfaces/ISuperToken.sol"; -import "solady/auth/Ownable.sol"; +import "./SuperToken.sol"; contract SuperTokenAppGateway is AppGatewayBase, Ownable { + bytes32 public superToken = _createContractId("superToken"); + event Transferred(bytes32 asyncId); + struct ConstructorParams { + string name_; + string symbol_; + uint8 decimals_; + address initialSupplyHolder_; + uint256 initialSupply_; + } + struct TransferOrder { address srcToken; address dstToken; @@ -18,12 +29,21 @@ contract SuperTokenAppGateway is AppGatewayBase, Ownable { constructor( address addressResolver_, - address deployerContract_, + address auctionManager_, + bytes32 sbType_, Fees memory fees_, - address auctionManager_ - ) AppGatewayBase(addressResolver_, auctionManager_) { - // called to connect the deployer contract with this app - addressResolver__.setContractsToGateways(deployerContract_); + ConstructorParams memory params_ + ) AppGatewayBase(addressResolver_, auctionManager_, sbType_) { + creationCodeWithArgs[superToken] = abi.encodePacked( + type(SuperToken).creationCode, + abi.encode( + params_.name_, + params_.symbol_, + params_.decimals_, + params_.initialSupplyHolder_, + params_.initialSupply_ + ) + ); // sets the fees data like max fees, chain and token for all transfers // they can be updated for each transfer as well @@ -31,6 +51,17 @@ contract SuperTokenAppGateway is AppGatewayBase, Ownable { _initializeOwner(msg.sender); } + function deployContracts(uint32 chainSlug_) external async { + bytes memory initData = abi.encodeWithSelector(SuperToken.setOwner.selector, owner()); + _deploy(superToken, chainSlug_, IsPlug.YES, initData); + } + + // no need to call this directly, will be called automatically after all contracts are deployed. + // check AppGatewayBase._deploy and AppGatewayBase.onBatchComplete + function initialize(uint32) public pure override { + return; + } + function transfer(bytes memory order_) external async { TransferOrder memory order = abi.decode(order_, (TransferOrder)); ISuperToken(order.srcToken).burn(order.user, order.srcAmount); diff --git a/contracts/apps/super-token/SuperTokenDeployer.sol b/contracts/apps/super-token/SuperTokenDeployer.sol deleted file mode 100644 index 53e06964..00000000 --- a/contracts/apps/super-token/SuperTokenDeployer.sol +++ /dev/null @@ -1,50 +0,0 @@ -// SPDX-License-Identifier: Unlicense -pragma solidity ^0.8.21; - -import "./SuperToken.sol"; -import "../../base/AppDeployerBase.sol"; -import "solady/auth/Ownable.sol"; - -contract SuperTokenDeployer is AppDeployerBase, Ownable { - bytes32 public superToken = _createContractId("superToken"); - struct ConstructorParams { - string name_; - string symbol_; - uint8 decimals_; - address initialSupplyHolder_; - uint256 initialSupply_; - } - - constructor( - address addressResolver_, - address owner_, - address auctionManager_, - bytes32 sbType_, - ConstructorParams memory params_, - Fees memory fees_ - ) AppDeployerBase(addressResolver_, auctionManager_, sbType_) { - _initializeOwner(owner_); - creationCodeWithArgs[superToken] = abi.encodePacked( - type(SuperToken).creationCode, - abi.encode( - params_.name_, - params_.symbol_, - params_.decimals_, - params_.initialSupplyHolder_, - params_.initialSupply_ - ) - ); - _setOverrides(fees_); - } - - function deployContracts(uint32 chainSlug_) external async { - bytes memory initData = abi.encodeWithSelector(SuperToken.setOwner.selector, owner()); - _deploy(superToken, chainSlug_, IsPlug.YES, initData); - } - - // no need to call this directly, will be called automatically after all contracts are deployed. - // check AppDeployerBase._deploy and AppDeployerBase.onBatchComplete - function initialize(uint32) public pure override { - return; - } -} diff --git a/contracts/base/AppGatewayBase.sol b/contracts/base/AppGatewayBase.sol index 559e8c29..c8472cbd 100644 --- a/contracts/base/AppGatewayBase.sol +++ b/contracts/base/AppGatewayBase.sol @@ -114,7 +114,7 @@ abstract contract AppGatewayBase is AddressResolverUtil, IAppGateway, FeesPlugin isValidPromise[asyncPromise] = true; IPromise(asyncPromise).then(this.setAddress.selector, abi.encode(chainSlug_, contractId_)); - onCompleteData = abi.encode(chainSlug_); + onCompleteData = abi.encode(chainSlug_, true); IDeliveryHelper(deliveryHelper()).queue( isPlug_, isParallelCall, @@ -126,6 +126,8 @@ abstract contract AppGatewayBase is AddressResolverUtil, IAppGateway, FeesPlugin creationCodeWithArgs[contractId_], initCallData_ ); + + onCompleteData = abi.encode(chainSlug_, false); } /// @notice Sets the address for a deployed contract @@ -155,20 +157,7 @@ abstract contract AppGatewayBase is AddressResolverUtil, IAppGateway, FeesPlugin return address(0); } - onChainAddress = IForwarder(forwarderAddresses[contractId_][chainSlug_]) - .getOnChainAddress(); - } - - /// @notice Callback in pd promise to be called after all contracts are deployed - /// @param payloadBatch_ The payload batch - /// @dev only payload delivery can call this - /// @dev callback in pd promise to be called after all contracts are deployed - function onBatchComplete( - bytes32, - PayloadBatch memory payloadBatch_ - ) external override onlyDeliveryHelper { - uint32 chainSlug = abi.decode(payloadBatch_.onCompleteData, (uint32)); - initialize(chainSlug); + onChainAddress = IForwarder(forwarderAddresses[contractId_][chainSlug_]).getOnChainAddress(); } //////////////////////////////////////////////////////////////////////////////////////////////// @@ -269,12 +258,21 @@ abstract contract AppGatewayBase is AddressResolverUtil, IAppGateway, FeesPlugin //////////////////////////////////////////////////////////////////////////////////////////////// /// @notice Callback in pd promise to be called after all contracts are deployed - /// @param asyncId_ The async ID /// @param payloadBatch_ The payload batch + /// @dev only payload delivery can call this + /// @dev callback in pd promise to be called after all contracts are deployed function onBatchComplete( - bytes32 asyncId_, + bytes32, PayloadBatch memory payloadBatch_ - ) external virtual onlyDeliveryHelper {} + ) external override onlyDeliveryHelper { + (uint32 chainSlug, bool isDeploy) = abi.decode( + payloadBatch_.onCompleteData, + (uint32, bool) + ); + if (isDeploy) { + initialize(chainSlug); + } + } function callFromChain( uint32 chainSlug_, diff --git a/contracts/interfaces/IAddressResolver.sol b/contracts/interfaces/IAddressResolver.sol index 8d062286..be19aae4 100644 --- a/contracts/interfaces/IAddressResolver.sol +++ b/contracts/interfaces/IAddressResolver.sol @@ -66,7 +66,7 @@ interface IAddressResolver { /// @param chainSlug_ The identifier of the destination chain /// @return The address of the newly deployed forwarder contract function getOrDeployForwarderContract( - address appDeployer_, + address appGateway_, address chainContractAddress_, uint32 chainSlug_ ) external returns (address); diff --git a/contracts/interfaces/IMultiChainAppDeployer.sol b/contracts/interfaces/IMultiChainAppDeployer.sol index e36020c1..37bd04ad 100644 --- a/contracts/interfaces/IMultiChainAppDeployer.sol +++ b/contracts/interfaces/IMultiChainAppDeployer.sol @@ -1,11 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.21; -import "./IAppDeployer.sol"; - /// @title IMultiChainAppDeployer /// @notice Interface for the multi-chain app deployer -interface IMultiChainAppDeployer is IAppDeployer { +interface IMultiChainAppDeployer { /// @notice deploy contracts to multiple chains function deployMultiChainContracts(uint32[] memory chainSlugs_) external; } diff --git a/contracts/protocol/AddressResolver.sol b/contracts/protocol/AddressResolver.sol index fe87dbe9..65775d7e 100644 --- a/contracts/protocol/AddressResolver.sol +++ b/contracts/protocol/AddressResolver.sol @@ -88,7 +88,7 @@ contract AddressResolver is AddressResolverStorage, Initializable, Ownable { /// @param chainSlug_ The chain slug /// @return newForwarder The address of the deployed Forwarder proxy contract function getOrDeployForwarderContract( - address appDeployer_, + address appGateway_, address chainContractAddress_, uint32 chainSlug_ ) public returns (address newForwarder) { @@ -105,7 +105,7 @@ contract AddressResolver is AddressResolverStorage, Initializable, Ownable { ); newForwarder = _deployProxy(salt, address(forwarderBeacon), initData); - _setConfig(appDeployer_, newForwarder); + _setConfig(appGateway_, newForwarder); emit ForwarderDeployed(newForwarder, salt); } @@ -222,8 +222,8 @@ contract AddressResolver is AddressResolverStorage, Initializable, Ownable { LibClone.predictDeterministicAddressERC1967BeaconProxy(beacon_, salt_, address(this)); } - function _setConfig(address appDeployer_, address newForwarder_) internal { - address gateway = contractsToGateways[appDeployer_]; + function _setConfig(address appGateway_, address newForwarder_) internal { + address gateway = contractsToGateways[appGateway_]; gatewaysToContracts[gateway] = newForwarder_; contractsToGateways[newForwarder_] = gateway; } diff --git a/script/counter-inbox/CheckGatewayCounter.s.sol b/script/counter-inbox/CheckGatewayCounter.s.sol index c9855b7d..563b61d7 100644 --- a/script/counter-inbox/CheckGatewayCounter.s.sol +++ b/script/counter-inbox/CheckGatewayCounter.s.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {CounterInboxAppGateway} from "../../contracts/apps/counter-inbox/CounterInboxAppGateway.sol"; +import {CounterAppGateway} from "../../contracts/apps/counter/CounterAppGateway.sol"; contract CheckGatewayCounter is Script { function run() external { @@ -11,11 +11,11 @@ contract CheckGatewayCounter is Script { vm.createSelectFork(rpc); address gatewayAddress = vm.envAddress("APP_GATEWAY"); - CounterInboxAppGateway gateway = CounterInboxAppGateway(gatewayAddress); + CounterAppGateway gateway = CounterAppGateway(gatewayAddress); - // Log the value of the counter variable on CounterInboxAppGateway - uint256 counterValue = gateway.counter(); - console.log("Counter value on CounterInboxAppGateway:"); + // 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/DeployCounterAndGateway.s.sol b/script/counter-inbox/DeployCounterAndGateway.s.sol deleted file mode 100644 index 09341af4..00000000 --- a/script/counter-inbox/DeployCounterAndGateway.s.sol +++ /dev/null @@ -1,49 +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 {CounterInbox} from "../../contracts/apps/counter-inbox/CounterInbox.sol"; -import {CounterInboxAppGateway} from "../../contracts/apps/counter-inbox/CounterInboxAppGateway.sol"; -import {Fees} from "../../contracts/protocol/utils/common/Structs.sol"; -import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol"; - -contract DeployCounterAndGateway is Script { - function run() external { - address addressResolver = vm.envAddress("ADDRESS_RESOLVER"); - address auctionManager = vm.envAddress("AUCTION_MANAGER"); - - string memory arbRpc = vm.envString("ARBITRUM_SEPOLIA_RPC"); - vm.createSelectFork(arbRpc); - uint256 arbDeployerPrivateKey = vm.envUint("SPONSOR_KEY"); - vm.startBroadcast(arbDeployerPrivateKey); - - CounterInbox inbox = new CounterInbox(); - console.log("CounterInbox:", address(inbox)); - - vm.stopBroadcast(); - - string memory offChainRpc = vm.envString("EVMX_RPC"); - vm.createSelectFork(offChainRpc); - uint256 offChainDeployerPrivateKey = vm.envUint("PRIVATE_KEY"); - vm.startBroadcast(offChainDeployerPrivateKey); - - Fees memory fees = Fees({ - feePoolChain: 421614, - feePoolToken: ETH_ADDRESS, - amount: 0.001 ether - }); - - CounterInboxAppGateway gateway = new CounterInboxAppGateway( - addressResolver, - auctionManager, - address(inbox), - 421614, - fees - ); - - console.log("CounterInboxAppGateway:", address(gateway)); - - vm.stopBroadcast(); - } -} diff --git a/script/counter-inbox/Increment.s.sol b/script/counter-inbox/Increment.s.sol index 95477943..44fb7897 100644 --- a/script/counter-inbox/Increment.s.sol +++ b/script/counter-inbox/Increment.s.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {CounterInbox} from "../../contracts/apps/counter-inbox/CounterInbox.sol"; -import {CounterInboxAppGateway} from "../../contracts/apps/counter-inbox/CounterInboxAppGateway.sol"; +import {CounterAppGateway} from "../../contracts/apps/counter/CounterAppGateway.sol"; +import {Counter} from "../../contracts/apps/counter/Counter.sol"; import {Fees} from "../../contracts/protocol/utils/common/Structs.sol"; import {ETH_ADDRESS, FAST} from "../../contracts/protocol/utils/common/Constants.sol"; @@ -17,7 +17,7 @@ contract Increment is Script { vm.startBroadcast(arbDeployerPrivateKey); address counterInbox = vm.envAddress("COUNTER_INBOX"); - CounterInbox inbox = CounterInbox(counterInbox); + Counter inbox = Counter(counterInbox); inbox.increaseOnGateway(100); vm.stopBroadcast(); diff --git a/script/counter/IncrementCountersFromApp.s.sol b/script/counter/IncrementCountersFromApp.s.sol index 379cd9ef..10a0f727 100644 --- a/script/counter/IncrementCountersFromApp.s.sol +++ b/script/counter/IncrementCountersFromApp.s.sol @@ -3,7 +3,6 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {CounterDeployer} from "../../contracts/apps//counter/CounterDeployer.sol"; import {CounterAppGateway} from "../../contracts/apps//counter/CounterAppGateway.sol"; contract IncrementCounters is Script { @@ -13,19 +12,18 @@ contract IncrementCounters is Script { vm.createSelectFork(socketRPC); - CounterDeployer deployer = CounterDeployer(vm.envAddress("DEPLOYER")); CounterAppGateway gateway = CounterAppGateway(vm.envAddress("APP_GATEWAY")); - address counterForwarderArbitrumSepolia = deployer.forwarderAddresses( - deployer.counter(), + address counterForwarderArbitrumSepolia = gateway.forwarderAddresses( + gateway.counter(), 421614 ); - address counterForwarderOptimismSepolia = deployer.forwarderAddresses( - deployer.counter(), + address counterForwarderOptimismSepolia = gateway.forwarderAddresses( + gateway.counter(), 11155420 ); - address counterForwarderBaseSepolia = deployer.forwarderAddresses( - deployer.counter(), + address counterForwarderBaseSepolia = gateway.forwarderAddresses( + gateway.counter(), 84532 ); //address counterForwarderSepolia = deployer.forwarderAddresses( diff --git a/script/counter/ReadOnchainCounters.s.sol b/script/counter/ReadOnchainCounters.s.sol index 56a91796..3770e927 100644 --- a/script/counter/ReadOnchainCounters.s.sol +++ b/script/counter/ReadOnchainCounters.s.sol @@ -3,23 +3,23 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {CounterDeployer} from "../../contracts/apps/counter/CounterDeployer.sol"; import {Counter} from "../../contracts/apps//counter/Counter.sol"; +import {CounterAppGateway} from "../../contracts/apps//counter/CounterAppGateway.sol"; contract CheckCounters is Script { function run() external { - CounterDeployer deployer = CounterDeployer(vm.envAddress("DEPLOYER")); + CounterAppGateway gateway = CounterAppGateway(vm.envAddress("APP_GATEWAY")); vm.createSelectFork(vm.envString("EVMX_RPC")); - address counterInstanceArbitrumSepolia = deployer.getOnChainAddress( - deployer.counter(), + address counterInstanceArbitrumSepolia = gateway.getOnChainAddress( + gateway.counter(), 421614 ); - address counterInstanceOptimismSepolia = deployer.getOnChainAddress( - deployer.counter(), + address counterInstanceOptimismSepolia = gateway.getOnChainAddress( + gateway.counter(), 11155420 ); - address counterInstanceBaseSepolia = deployer.getOnChainAddress(deployer.counter(), 84532); + address counterInstanceBaseSepolia = gateway.getOnChainAddress(gateway.counter(), 84532); //address counterInstanceSepolia = deployer.getOnChainAddress( // deployer.counter(), // 11155111 diff --git a/script/counter/deployEVMxCounterApp.s.sol b/script/counter/deployEVMxCounterApp.s.sol index 97d4f68d..12868719 100644 --- a/script/counter/deployEVMxCounterApp.s.sol +++ b/script/counter/deployEVMxCounterApp.s.sol @@ -4,7 +4,6 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; import {CounterAppGateway} from "../../contracts/apps//counter/CounterAppGateway.sol"; -import {CounterDeployer} from "../../contracts/apps//counter/CounterDeployer.sol"; import {Fees} from "../../contracts/protocol/utils/common/Structs.sol"; import {ETH_ADDRESS, FAST} from "../../contracts/protocol/utils/common/Constants.sol"; @@ -25,19 +24,16 @@ contract CounterDeploy is Script { amount: 0.001 ether }); - CounterDeployer deployer = new CounterDeployer(addressResolver, auctionManager, FAST, fees); - CounterAppGateway gateway = new CounterAppGateway( addressResolver, - address(deployer), auctionManager, + FAST, fees ); console.log("Contracts deployed:"); - console.log("CounterDeployer:", address(deployer)); console.log("CounterAppGateway:", address(gateway)); console.log("counterId:"); - console.logBytes32(deployer.counter()); + console.logBytes32(gateway.counter()); } } diff --git a/script/counter/deployOnchainCounters.s.sol b/script/counter/deployOnchainCounters.s.sol index 2c67a1fe..123c6958 100644 --- a/script/counter/deployOnchainCounters.s.sol +++ b/script/counter/deployOnchainCounters.s.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {CounterDeployer} from "../../contracts/apps//counter/CounterDeployer.sol"; import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol"; +import {CounterAppGateway} from "../../contracts/apps/counter/CounterAppGateway.sol"; contract CounterDeployOnchain is Script { function run() external { @@ -15,17 +15,17 @@ contract CounterDeployOnchain is Script { uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); vm.startBroadcast(deployerPrivateKey); - CounterDeployer deployer = CounterDeployer(vm.envAddress("DEPLOYER")); + CounterAppGateway appGateway = CounterAppGateway(vm.envAddress("APP_GATEWAY")); - console.log("Counter Deployer:", address(deployer)); + console.log("Counter Gateway:", address(appGateway)); console.log("Deploying contracts on Arbitrum Sepolia..."); - deployer.deployContracts(421614); + appGateway.deployContracts(421614); // console.log("Deploying contracts on Optimism Sepolia..."); - // deployer.deployContracts(11155420); + // appGateway.deployContracts(11155420); // console.log("Deploying contracts on Base Sepolia..."); - // deployer.deployContracts(84532); + // appGateway.deployContracts(84532); // console.log("Deploying contracts on Ethereum Sepolia..."); - // deployer.deployContracts(11155111); + // appGateway.deployContracts(11155111); } } diff --git a/script/cron/DeployGateway.s.sol b/script/cron/DeployGateway.s.sol deleted file mode 100644 index 32bd6eb1..00000000 --- a/script/cron/DeployGateway.s.sol +++ /dev/null @@ -1,37 +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 {CronAppGateway} from "../../contracts/apps/cron/CronAppGateway.sol"; -import {Fees} from "../../contracts/protocol/utils/common/Structs.sol"; -import {ETH_ADDRESS} 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"); - - string memory rpc = vm.envString("EVMX_RPC"); - vm.createSelectFork(rpc); - - uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); - vm.startBroadcast(deployerPrivateKey); - - // Setting fee payment on Arbitrum Sepolia - Fees memory fees = Fees({ - feePoolChain: 421614, - feePoolToken: ETH_ADDRESS, - amount: 0.01 ether - }); - CronAppGateway gateway = new CronAppGateway( - addressResolver, - address(uint160(uint256(keccak256(abi.encodePacked(block.timestamp))))), - auctionManager, - fees - ); - - console.log("Contracts deployed:"); - console.log("CronAppGateway:", address(gateway)); - } -} diff --git a/script/cron/SetTimeout.s.sol b/script/cron/SetTimeout.s.sol index 29ed632a..9a8c575a 100644 --- a/script/cron/SetTimeout.s.sol +++ b/script/cron/SetTimeout.s.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {CronAppGateway} from "../../contracts/apps/cron/CronAppGateway.sol"; +import {CounterAppGateway} from "../../contracts/apps/counter/CounterAppGateway.sol"; contract SetTimeoutScript is Script { function run() external { @@ -12,7 +12,7 @@ contract SetTimeoutScript is Script { vm.createSelectFork(socketRPC); address gatewayAddress = vm.envAddress("APP_GATEWAY"); console.log("Gateway address:", gatewayAddress); - CronAppGateway gateway = CronAppGateway(gatewayAddress); + CounterAppGateway gateway = CounterAppGateway(gatewayAddress); vm.startBroadcast(deployerPrivateKey); gateway.setTimeout(0); // vm.stopBroadcast(); diff --git a/script/mock/DeployEVMx.s.sol b/script/mock/DeployEVMx.s.sol index 12570d06..4ed43b5b 100644 --- a/script/mock/DeployEVMx.s.sol +++ b/script/mock/DeployEVMx.s.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {MockWatcherPrecompile} from "../../contracts/mock/MockWatcherPrecompile.sol"; -import {MockSocket} from "../../contracts/mock/MockSocket.sol"; +import {MockWatcherPrecompile} from "../../test/mock/MockWatcherPrecompile.sol"; +import {MockSocket} from "../../test/mock/MockSocket.sol"; contract DeployEVMx is Script { function run() external { diff --git a/script/mock/DeploySocket.s.sol b/script/mock/DeploySocket.s.sol index d69bad3a..56291966 100644 --- a/script/mock/DeploySocket.s.sol +++ b/script/mock/DeploySocket.s.sol @@ -3,8 +3,9 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {MockWatcherPrecompile} from "../../contracts/mock/MockWatcherPrecompile.sol"; -import {MockSocket} from "../../contracts/mock/MockSocket.sol"; +import {MockWatcherPrecompile} from "../../test/mock/MockWatcherPrecompile.sol"; +import {MockSocket} from "../../test/mock/MockSocket.sol"; + contract DeploySocket is Script { function run() external { string memory rpc = vm.envString("ARBITRUM_SEPOLIA_RPC"); diff --git a/script/mock/FinalizeAndExecution.s.sol b/script/mock/FinalizeAndExecution.s.sol index 628bd4aa..4ba2d49a 100644 --- a/script/mock/FinalizeAndExecution.s.sol +++ b/script/mock/FinalizeAndExecution.s.sol @@ -3,9 +3,10 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {MockWatcherPrecompile} from "../../contracts/mock/MockWatcherPrecompile.sol"; -import "../../contracts/mock/MockSocket.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"); diff --git a/script/mock/Inbox.s.sol b/script/mock/Inbox.s.sol index 178825ad..792a635d 100644 --- a/script/mock/Inbox.s.sol +++ b/script/mock/Inbox.s.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {MockWatcherPrecompile} from "../../contracts/mock/MockWatcherPrecompile.sol"; -import {MockSocket} from "../../contracts/mock/MockSocket.sol"; +import {MockWatcherPrecompile} from "../../test/mock/MockWatcherPrecompile.sol"; +import {MockSocket} from "../../test/mock/MockSocket.sol"; contract InboxTest is Script { function run() external { diff --git a/script/mock/Query.s.sol b/script/mock/Query.s.sol index 1909509c..6f5dde86 100644 --- a/script/mock/Query.s.sol +++ b/script/mock/Query.s.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {MockWatcherPrecompile} from "../../contracts/mock/MockWatcherPrecompile.sol"; +import {MockWatcherPrecompile} from "../../test/mock/MockWatcherPrecompile.sol"; contract QueryTest is Script { function run() external { diff --git a/script/mock/Timeout.s.sol b/script/mock/Timeout.s.sol index 68ae3a10..52313212 100644 --- a/script/mock/Timeout.s.sol +++ b/script/mock/Timeout.s.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {MockWatcherPrecompile} from "../../contracts/mock/MockWatcherPrecompile.sol"; +import {MockWatcherPrecompile} from "../../test/mock/MockWatcherPrecompile.sol"; contract TimeoutTest is Script { function run() external { diff --git a/script/parallel-counter/checkCounters.s.sol b/script/parallel-counter/checkCounters.s.sol index 55b7e29d..23c0ad53 100644 --- a/script/parallel-counter/checkCounters.s.sol +++ b/script/parallel-counter/checkCounters.s.sol @@ -3,65 +3,63 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {ParallelCounterDeployer} from "../../contracts/apps/parallel-counter/ParallelCounterDeployer.sol"; +import {CounterAppGateway} from "../../contracts/apps/counter/CounterAppGateway.sol"; import {Counter} from "../../contracts/apps/counter/Counter.sol"; contract CheckCounters is Script { function run() external { - ParallelCounterDeployer deployer = ParallelCounterDeployer(vm.envAddress("DEPLOYER")); + CounterAppGateway gateway = CounterAppGateway(vm.envAddress("APP_GATEWAY")); vm.createSelectFork(vm.envString("EVMX_RPC")); - address counter1InstanceArbitrumSepolia = deployer.getOnChainAddress( - deployer.counter1(), + address counterInstanceArbitrumSepolia = gateway.getOnChainAddress( + gateway.counter(), 421614 ); - address counter2InstanceArbitrumSepolia = deployer.getOnChainAddress( - deployer.counter2(), + address counter1InstanceArbitrumSepolia = gateway.getOnChainAddress( + gateway.counter1(), 421614 ); - address counter1InstanceOptimismSepolia = deployer.getOnChainAddress( - deployer.counter1(), + address counterInstanceOptimismSepolia = gateway.getOnChainAddress( + gateway.counter(), 11155420 ); - address counter2InstanceOptimismSepolia = deployer.getOnChainAddress( - deployer.counter2(), + address counter1InstanceOptimismSepolia = gateway.getOnChainAddress( + gateway.counter1(), 11155420 ); - if (counter1InstanceArbitrumSepolia != address(0)) { + if (counterInstanceArbitrumSepolia != address(0)) { vm.createSelectFork(vm.envString("ARBITRUM_SEPOLIA_RPC")); - console.log("Counter 1 instance on Arbitrum Sepolia:", counter1InstanceArbitrumSepolia); - uint256 counterValueArbitrumSepolia = Counter(counter1InstanceArbitrumSepolia) - .counter(); + 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 (counter2InstanceArbitrumSepolia != address(0)) { + if (counter1InstanceArbitrumSepolia != address(0)) { vm.createSelectFork(vm.envString("ARBITRUM_SEPOLIA_RPC")); - console.log("Counter 2 instance on Arbitrum Sepolia:", counter2InstanceArbitrumSepolia); - uint256 counterValueArbitrumSepolia = Counter(counter2InstanceArbitrumSepolia) + 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 (counter1InstanceOptimismSepolia != address(0)) { + if (counterInstanceOptimismSepolia != address(0)) { vm.createSelectFork(vm.envString("OPTIMISM_SEPOLIA_RPC")); - console.log("Counter 1 instance on Optimism Sepolia:", counter1InstanceOptimismSepolia); - uint256 counterValueOptimismSepolia = Counter(counter1InstanceOptimismSepolia) - .counter(); + 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 (counter2InstanceOptimismSepolia != address(0)) { + if (counter1InstanceOptimismSepolia != address(0)) { vm.createSelectFork(vm.envString("OPTIMISM_SEPOLIA_RPC")); - console.log("Counter 2 instance on Optimism Sepolia:", counter2InstanceOptimismSepolia); - uint256 counterValueOptimismSepolia = Counter(counter2InstanceOptimismSepolia) + console.log("Counter 2 instance on Optimism Sepolia:", counter1InstanceOptimismSepolia); + uint256 counterValueOptimismSepolia = Counter(counter1InstanceOptimismSepolia) .counter(); console.log("Counter2 value on Optimism Sepolia: ", counterValueOptimismSepolia); } else { @@ -69,10 +67,10 @@ contract CheckCounters is Script { } vm.createSelectFork(vm.envString("EVMX_RPC")); - address forwarderArb1 = deployer.forwarderAddresses(deployer.counter1(), 421614); - address forwarderArb2 = deployer.forwarderAddresses(deployer.counter2(), 421614); - address forwarderOpt1 = deployer.forwarderAddresses(deployer.counter1(), 11155420); - address forwarderOpt2 = deployer.forwarderAddresses(deployer.counter2(), 11155420); + 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); diff --git a/script/parallel-counter/deployOnEVMx.s.sol b/script/parallel-counter/deployOnEVMx.s.sol deleted file mode 100644 index 9cbe0350..00000000 --- a/script/parallel-counter/deployOnEVMx.s.sol +++ /dev/null @@ -1,46 +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 {ParallelCounterAppGateway} from "../../contracts/apps/parallel-counter/ParallelCounterAppGateway.sol"; -import {ParallelCounterDeployer} from "../../contracts/apps/parallel-counter/ParallelCounterDeployer.sol"; -import {Fees} from "../../contracts/protocol/utils/common/Structs.sol"; -import {ETH_ADDRESS, FAST} from "../../contracts/protocol/utils/common/Constants.sol"; - -contract CounterDeploy is Script { - function run() external { - address addressResolver = vm.envAddress("ADDRESS_RESOLVER"); - address auctionManager = vm.envAddress("AUCTION_MANAGER"); - string memory rpc = vm.envString("EVMX_RPC"); - vm.createSelectFork(rpc); - - uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); - vm.startBroadcast(deployerPrivateKey); - - // Setting fee payment on Arbitrum Sepolia - Fees memory fees = Fees({ - feePoolChain: 421614, - feePoolToken: ETH_ADDRESS, - amount: 0.01 ether - }); - - ParallelCounterDeployer deployer = new ParallelCounterDeployer( - addressResolver, - auctionManager, - FAST, - fees - ); - - ParallelCounterAppGateway gateway = new ParallelCounterAppGateway( - addressResolver, - address(deployer), - auctionManager, - fees - ); - - console.log("Contracts deployed:"); - console.log("ParallelCounterDeployer:", address(deployer)); - console.log("ParallelCounterAppGateway:", address(gateway)); - } -} diff --git a/script/parallel-counter/deployOnchain.s.sol b/script/parallel-counter/deployOnchain.s.sol index ba05c9c9..6bf9811c 100644 --- a/script/parallel-counter/deployOnchain.s.sol +++ b/script/parallel-counter/deployOnchain.s.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {ParallelCounterDeployer} from "../../contracts/apps/parallel-counter/ParallelCounterDeployer.sol"; +import {CounterAppGateway} from "../../contracts/apps/counter/CounterAppGateway.sol"; import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol"; contract CounterDeployOnchain is Script { @@ -15,15 +15,14 @@ contract CounterDeployOnchain is Script { uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); vm.startBroadcast(deployerPrivateKey); - ParallelCounterDeployer deployer = ParallelCounterDeployer(vm.envAddress("DEPLOYER")); - - console.log("Counter Deployer:", address(deployer)); + 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; - deployer.deployMultiChainContracts(chainSlugs); + gateway.deployMultiChainContracts(chainSlugs); } } diff --git a/script/parallel-counter/incrementCounters.s.sol b/script/parallel-counter/incrementCounters.s.sol index 5c4fc7e5..c7651085 100644 --- a/script/parallel-counter/incrementCounters.s.sol +++ b/script/parallel-counter/incrementCounters.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 {CounterDeployer} from "../../contracts/apps//counter/CounterDeployer.sol"; -import {CounterAppGateway} from "../../contracts/apps//counter/CounterAppGateway.sol"; +import {CounterAppGateway} from "../../contracts/apps/counter/CounterAppGateway.sol"; contract IncrementCounters is Script { function run() external { @@ -12,23 +11,19 @@ contract IncrementCounters is Script { vm.createSelectFork(socketRPC); - CounterDeployer deployer = CounterDeployer(vm.envAddress("COUNTER_DEPLOYER")); - CounterAppGateway gateway = CounterAppGateway(vm.envAddress("COUNTER_APP_GATEWAY")); + CounterAppGateway gateway = CounterAppGateway(vm.envAddress("APP_GATEWAY")); - address counterForwarderArbitrumSepolia = deployer.forwarderAddresses( - deployer.counter(), + address counterForwarderArbitrumSepolia = gateway.forwarderAddresses( + gateway.counter(), 421614 ); - address counterForwarderOptimismSepolia = deployer.forwarderAddresses( - deployer.counter(), + address counterForwarderOptimismSepolia = gateway.forwarderAddresses( + gateway.counter(), 11155420 ); - address counterForwarderBaseSepolia = deployer.forwarderAddresses( - deployer.counter(), - 84532 - ); - //address counterForwarderSepolia = deployer.forwarderAddresses( - // deployer.counter(), + address counterForwarderBaseSepolia = gateway.forwarderAddresses(gateway.counter(), 84532); + //address counterForwarderSepolia = gateway.forwarderAddresses( + // gateway.counter(), // 11155111 //); diff --git a/script/super-token-lockable/Bridge.s.sol b/script/super-token-lockable/Bridge.s.sol index 9fa30d5b..abb6875f 100644 --- a/script/super-token-lockable/Bridge.s.sol +++ b/script/super-token-lockable/Bridge.s.sol @@ -5,42 +5,40 @@ import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; import {SuperTokenLockableAppGateway} from "../../contracts/apps/super-token-lockable/SuperTokenLockableAppGateway.sol"; -import {SuperTokenLockableDeployer} from "../../contracts/apps/super-token-lockable/SuperTokenLockableDeployer.sol"; contract Bridge is Script { function run() external { - address owner = vm.envAddress("SUPERTOKEN_OWNER"); - address deployer = vm.envAddress("SUPERTOKEN_DEPLOYER"); - address gateway = vm.envAddress("SUPERTOKEN_APP_GATEWAY"); + address owner = vm.envAddress("OWNER"); + address gateway = vm.envAddress("APP_GATEWAY"); SuperTokenLockableAppGateway gatewayContract = SuperTokenLockableAppGateway(gateway); - SuperTokenLockableDeployer deployerContract = SuperTokenLockableDeployer(deployer); + string memory rpc = vm.envString("EVMX_RPC"); vm.createSelectFork(rpc); uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); vm.startBroadcast(deployerPrivateKey); - address arbTokenForwarder = deployerContract.forwarderAddresses( - deployerContract.superTokenLockable(), + address arbTokenForwarder = gatewayContract.forwarderAddresses( + gatewayContract.superTokenLockable(), 421614 ); - address arbHookForwarder = deployerContract.forwarderAddresses( - deployerContract.limitHook(), + address arbHookForwarder = gatewayContract.forwarderAddresses( + gatewayContract.limitHook(), 421614 ); - address optTokenForwarder = deployerContract.forwarderAddresses( - deployerContract.superTokenLockable(), + address optTokenForwarder = gatewayContract.forwarderAddresses( + gatewayContract.superTokenLockable(), 11155420 ); - address optHookForwarder = deployerContract.forwarderAddresses( - deployerContract.limitHook(), + address optHookForwarder = gatewayContract.forwarderAddresses( + gatewayContract.limitHook(), 11155420 ); - address arbOnChainToken = deployerContract.getOnChainAddress( - deployerContract.superTokenLockable(), + address arbOnChainToken = gatewayContract.getOnChainAddress( + gatewayContract.superTokenLockable(), 421614 ); - address optOnChainToken = deployerContract.getOnChainAddress( - deployerContract.superTokenLockable(), + address optOnChainToken = gatewayContract.getOnChainAddress( + gatewayContract.superTokenLockable(), 11155420 ); console.log("arbTokenForwarder"); diff --git a/script/super-token-lockable/DeployContracts.s.sol b/script/super-token-lockable/DeployContracts.s.sol index f4439e8e..b1729a85 100644 --- a/script/super-token-lockable/DeployContracts.s.sol +++ b/script/super-token-lockable/DeployContracts.s.sol @@ -4,21 +4,20 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; import {SuperTokenLockableAppGateway} from "../../contracts/apps/super-token-lockable/SuperTokenLockableAppGateway.sol"; -import {SuperTokenLockableDeployer} from "../../contracts/apps/super-token-lockable/SuperTokenLockableDeployer.sol"; import {SuperTokenLockable} from "../../contracts/apps/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 { - SuperTokenLockableDeployer deployer = SuperTokenLockableDeployer( - vm.envAddress("SUPERTOKEN_DEPLOYER") + 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); - deployer.deployContracts(84532); - deployer.deployContracts(11155111); + gateway.deployContracts(84532); + gateway.deployContracts(11155111); } } diff --git a/script/super-token-lockable/DeployGateway.s.sol b/script/super-token-lockable/DeployGateway.s.sol index e9ef679a..dee05645 100644 --- a/script/super-token-lockable/DeployGateway.s.sol +++ b/script/super-token-lockable/DeployGateway.s.sol @@ -4,7 +4,6 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; import {SuperTokenLockableAppGateway} from "../../contracts/apps/super-token-lockable/SuperTokenLockableAppGateway.sol"; -import {SuperTokenLockableDeployer} from "../../contracts/apps/super-token-lockable/SuperTokenLockableDeployer.sol"; import {SuperTokenLockable} from "../../contracts/apps/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"; @@ -25,12 +24,12 @@ contract DeployGateway is Script { amount: 0.001 ether }); - SuperTokenLockableDeployer deployer = new SuperTokenLockableDeployer( + SuperTokenLockableAppGateway gateway = new SuperTokenLockableAppGateway( addressResolver, - owner, address(auctionManager), FAST, - SuperTokenLockableDeployer.ConstructorParams({ + fees, + SuperTokenLockableAppGateway.ConstructorParams({ _burnLimit: 1000000000 ether, _mintLimit: 1000000000 ether, name_: "SUPER TOKEN", @@ -38,23 +37,14 @@ contract DeployGateway is Script { decimals_: 18, initialSupplyHolder_: owner, initialSupply_: 1000000000 ether - }), - fees - ); - - SuperTokenLockableAppGateway gateway = new SuperTokenLockableAppGateway( - addressResolver, - address(deployer), - address(auctionManager), - fees + }) ); - bytes32 superToken = deployer.superTokenLockable(); - bytes32 limitHook = deployer.limitHook(); + bytes32 superToken = gateway.superTokenLockable(); + bytes32 limitHook = gateway.limitHook(); console.log("Contracts deployed:"); console.log("SuperTokenLockableAppGateway:", address(gateway)); - console.log("SuperTokenLockableDeployer:", address(deployer)); console.log("SuperTokenLockableId:"); console.logBytes32(superToken); console.log("LimitHookId:"); diff --git a/script/super-token/DeployContracts.s.sol b/script/super-token/DeployContracts.s.sol index 08cc9989..37546559 100644 --- a/script/super-token/DeployContracts.s.sol +++ b/script/super-token/DeployContracts.s.sol @@ -4,7 +4,6 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; import {SuperTokenAppGateway} from "../../contracts/apps/super-token/SuperTokenAppGateway.sol"; -import {SuperTokenDeployer} from "../../contracts/apps/super-token/SuperTokenDeployer.sol"; import {SuperToken} from "../../contracts/apps/super-token/SuperToken.sol"; import {Fees} from "../../contracts/protocol/utils/common/Structs.sol"; import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol"; @@ -12,7 +11,7 @@ import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol"; contract DeployContracts is Script { function run() external { vm.startBroadcast(); - SuperTokenDeployer deployer = SuperTokenDeployer( + SuperTokenAppGateway deployer = SuperTokenAppGateway( 0x02520426a04D2943d817A60ABa37ab25bA10e630 ); deployer.deployContracts(84532); diff --git a/script/super-token/DeployGateway.s.sol b/script/super-token/DeployGateway.s.sol index 3d81543b..e4091a1d 100644 --- a/script/super-token/DeployGateway.s.sol +++ b/script/super-token/DeployGateway.s.sol @@ -4,7 +4,6 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; import {SuperTokenAppGateway} from "../../contracts/apps/super-token/SuperTokenAppGateway.sol"; -import {SuperTokenDeployer} from "../../contracts/apps/super-token/SuperTokenDeployer.sol"; import {SuperToken} from "../../contracts/apps/super-token/SuperToken.sol"; import {Fees} from "../../contracts/protocol/utils/common/Structs.sol"; import {ETH_ADDRESS, FAST} from "../../contracts/protocol/utils/common/Constants.sol"; @@ -23,33 +22,24 @@ contract DeployGateway is Script { amount: 0.001 ether }); - SuperTokenDeployer deployer = new SuperTokenDeployer( + SuperTokenAppGateway gateway = new SuperTokenAppGateway( addressResolver, - owner, address(auctionManager), FAST, - SuperTokenDeployer.ConstructorParams({ - name_: "SUPER TOKEN", + fees, + SuperTokenAppGateway.ConstructorParams({ + name_: "SuperToken", symbol_: "SUPER", decimals_: 18, initialSupplyHolder_: owner, - initialSupply_: 1000000000 ether - }), - fees - ); - - SuperTokenAppGateway gateway = new SuperTokenAppGateway( - addressResolver, - address(deployer), - fees, - address(auctionManager) + initialSupply_: 1000000000000000000000000 + }) ); - bytes32 superToken = deployer.superToken(); + bytes32 superToken = gateway.superToken(); console.log("Contracts deployed:"); - console.log("SuperTokenApp:", address(gateway)); - console.log("SuperTokenDeployer:", address(deployer)); + console.log("SuperTokenAppGateway:", address(gateway)); console.log("SuperTokenId:"); console.logBytes32(superToken); } diff --git a/test/DeliveryHelper.t.sol b/test/DeliveryHelper.t.sol index 2d6f923c..10f31140 100644 --- a/test/DeliveryHelper.t.sol +++ b/test/DeliveryHelper.t.sol @@ -6,8 +6,7 @@ import "../contracts/protocol/payload-delivery/FeesManager.sol"; import "../contracts/protocol/payload-delivery/AuctionManager.sol"; import "../contracts/protocol/Forwarder.sol"; -import "../contracts/interfaces/IAppDeployer.sol"; -import "../contracts/interfaces/IMultiChainAppDeployer.sol"; +import "../contracts/interfaces/IAppGateway.sol"; import "./SetupTest.t.sol"; @@ -292,8 +291,7 @@ contract DeliveryHelperTest is SetupTest { bytes32[] memory contractIds, uint32 chainSlug_, uint256 totalPayloads, - IAppDeployer appDeployer_, - address appGateway_ + IAppGateway appGateway_ ) internal returns (bytes32 asyncId) { SocketContracts memory socketConfig = getSocketConfig(chainSlug_); @@ -304,16 +302,15 @@ contract DeliveryHelperTest is SetupTest { totalPayloads ); - appDeployer_.deployContracts(chainSlug_); + appGateway_.deployContracts(chainSlug_); bidAndExecute(payloadIds, asyncId); - setupGatewayAndPlugs(chainSlug_, appDeployer_, appGateway_, contractIds); + setupGatewayAndPlugs(chainSlug_, appGateway_, appGateway_, contractIds); } function _deployParallel( bytes32[] memory contractIds, uint32[] memory chainSlugs_, - IMultiChainAppDeployer appDeployer_, - address appGateway_ + IAppGateway appGateway_ ) internal returns (bytes32 asyncId) { asyncId = getNextAsyncId(); bytes32[] memory payloadIds = new bytes32[](contractIds.length * chainSlugs_.length); @@ -329,24 +326,23 @@ contract DeliveryHelperTest is SetupTest { // for fees payloadIdCounter += chainSlugs_.length * contractIds.length + 1; - appDeployer_.deployMultiChainContracts(chainSlugs_); + appGateway_.deployMultiChainContracts(chainSlugs_); bidAndExecute(payloadIds, asyncId); for (uint i = 0; i < chainSlugs_.length; i++) { - setupGatewayAndPlugs(chainSlugs_[i], appDeployer_, appGateway_, contractIds); + setupGatewayAndPlugs(chainSlugs_[i], appGateway_, appGateway_, contractIds); } } function setupGatewayAndPlugs( uint32 chainSlug_, - IAppDeployer appDeployer_, - address appGateway_, + IAppGateway appGateway_, bytes32[] memory contractIds ) internal { AppGatewayConfig[] memory gateways = new AppGatewayConfig[](contractIds.length); SocketContracts memory socketConfig = getSocketConfig(chainSlug_); for (uint i = 0; i < contractIds.length; i++) { - address plug = appDeployer_.getOnChainAddress(contractIds[i], chainSlug_); + address plug = appGateway_.getOnChainAddress(contractIds[i], chainSlug_); gateways[i] = AppGatewayConfig({ plug: plug, @@ -671,10 +667,10 @@ contract DeliveryHelperTest is SetupTest { function getOnChainAndForwarderAddresses( uint32 chainSlug_, bytes32 contractId_, - IAppDeployer deployer_ + IAppGateway appGateway_ ) internal view returns (address, address) { - address app = deployer_.getOnChainAddress(contractId_, chainSlug_); - address forwarder = deployer_.forwarderAddresses(contractId_, chainSlug_); + address app = appGateway_.getOnChainAddress(contractId_, chainSlug_); + address forwarder = appGateway_.forwarderAddresses(contractId_, chainSlug_); return (app, forwarder); } } diff --git a/test/apps/ParallelCounter.t.sol b/test/apps/ParallelCounter.t.sol index 963aa1e1..c6e2e1ea 100644 --- a/test/apps/ParallelCounter.t.sol +++ b/test/apps/ParallelCounter.t.sol @@ -5,6 +5,9 @@ import {ParallelCounterAppGateway} from "../../contracts/apps/parallel-counter/P import {ParallelCounterDeployer} from "../../contracts/apps/parallel-counter/ParallelCounterDeployer.sol"; import "../DeliveryHelper.t.sol"; + + + contract ParallelCounterTest is DeliveryHelperTest { uint256 feesAmount = 0.01 ether; @@ -42,8 +45,7 @@ contract ParallelCounterTest is DeliveryHelperTest { asyncId = _deployParallel( contractIds, chainSlugs, - IMultiChainAppDeployer(address(parallelCounterDeployer)), - address(parallelCounterGateway) + IAppGateway(address(parallelCounterGateway)) ); } diff --git a/testScript.sh b/testScript.sh index 818eb715..f211c951 100644 --- a/testScript.sh +++ b/testScript.sh @@ -3,7 +3,7 @@ ## Parallel Counter source .env && forge script script/parallel-counter/deployOnEVMx.s.sol --broadcast --skip-simulation ## set limits for the app gateway using API -source .env && cast send $DEPLOYER "deployMultiChainContracts(uint32[])" '[421614, 11155420]' --private-key $PRIVATE_KEY +source .env && cast send $APP_GATEWAY "deployMultiChainContracts(uint32[])" '[421614, 11155420]' --private-key $PRIVATE_KEY source .env && forge script script/parallel-counter/checkCounters.s.sol --broadcast --skip-simulation @@ -11,7 +11,7 @@ source .env && forge script script/parallel-counter/checkCounters.s.sol --broadc source .env && forge script script/counter/deployEVMxCounterApp.s.sol --broadcast --skip-simulation --legacy --gas-price 0 source .env && forge script script/counter/DeployCounterOnchain.s.sol --broadcast --skip-simulation ## set limits for the app gateway using API -source .env && cast send $DEPLOYER "deployContracts(uint32)" 421614 --private-key $PRIVATE_KEY --legacy --gas-price 0 +source .env && cast send $APP_GATEWAY "deployContracts(uint32)" 421614 --private-key $PRIVATE_KEY --legacy --gas-price 0 source .env && cast send $APP_GATEWAY "incrementCounters(address[])" '[0x9Bd3efbd1dA4f58Bd4A11421102FE4B08fAb0121]' --private-key $PRIVATE_KEY --legacy --gas-price 0 forge script script/counter/incrementCounters.s.sol --broadcast --skip-simulation forge script script/counter/checkCounters.s.sol --broadcast --skip-simulation @@ -23,8 +23,8 @@ source .env && cast send $APP_GATEWAY "setTimeout(uint256)" 0 --private-key $PRI ## Super Token Lockable forge script script/super-token-lockable/DeployGateway.s.sol --broadcast --skip-simulation -source .env && cast send $DEPLOYER "deployContracts(uint32)" 421614 --private-key $PRIVATE_KEY -source .env && cast send $DEPLOYER "deployContracts(uint32)" 11155420 --private-key $PRIVATE_KEY +source .env && cast send $APP_GATEWAY "deployContracts(uint32)" 421614 --private-key $PRIVATE_KEY +source .env && cast send $APP_GATEWAY "deployContracts(uint32)" 11155420 --private-key $PRIVATE_KEY forge script script/super-token-lockable/Bridge.s.sol --broadcast --skip-simulation source .env && cast send $APP_GATEWAY $data --private-key $PRIVATE_KEY From bd1895b16dc476713c72decf8297405b91b9f313 Mon Sep 17 00:00:00 2001 From: Ameesha Agrawal Date: Wed, 26 Feb 2025 19:26:36 +0400 Subject: [PATCH 3/5] fix: tests --- .../SuperTokenLockableAppGateway.sol | 3 +- .../apps/super-token/SuperTokenAppGateway.sol | 3 +- contracts/base/AppGatewayBase.sol | 8 +- contracts/interfaces/IAddressResolver.sol | 5 -- contracts/protocol/AddressResolver.sol | 6 +- script/counter/IncrementCountersFromApp.s.sol | 5 +- .../super-token-lockable/DeployGateway.s.sol | 1 + script/super-token/DeployGateway.s.sol | 1 + test/DeliveryHelper.t.sol | 30 +------ test/FeesTest.t.sol | 21 +---- test/Inbox.t.sol | 21 +++-- test/apps/Counter.t.sol | 33 +++----- test/apps/ParallelCounter.t.sol | 60 +++++++------- test/apps/SuperToken.t.sol | 52 +++--------- test/apps/SuperTokenLockable.t.sol | 80 ++++++------------- 15 files changed, 107 insertions(+), 222 deletions(-) diff --git a/contracts/apps/super-token-lockable/SuperTokenLockableAppGateway.sol b/contracts/apps/super-token-lockable/SuperTokenLockableAppGateway.sol index 56336bef..ef003ac0 100644 --- a/contracts/apps/super-token-lockable/SuperTokenLockableAppGateway.sol +++ b/contracts/apps/super-token-lockable/SuperTokenLockableAppGateway.sol @@ -34,6 +34,7 @@ contract SuperTokenLockableAppGateway is AppGatewayBase, Ownable { constructor( address addressResolver_, address auctionManager_, + address owner_, bytes32 sbType_, Fees memory fees_, ConstructorParams memory params @@ -55,7 +56,7 @@ contract SuperTokenLockableAppGateway is AppGatewayBase, Ownable { ); _setOverrides(fees_); - _initializeOwner(msg.sender); + _initializeOwner(owner_); } function deployContracts(uint32 chainSlug_) external async { diff --git a/contracts/apps/super-token/SuperTokenAppGateway.sol b/contracts/apps/super-token/SuperTokenAppGateway.sol index 308759b3..77f4cf9e 100644 --- a/contracts/apps/super-token/SuperTokenAppGateway.sol +++ b/contracts/apps/super-token/SuperTokenAppGateway.sol @@ -30,6 +30,7 @@ contract SuperTokenAppGateway is AppGatewayBase, Ownable { constructor( address addressResolver_, address auctionManager_, + address owner_, bytes32 sbType_, Fees memory fees_, ConstructorParams memory params_ @@ -48,7 +49,7 @@ contract SuperTokenAppGateway is AppGatewayBase, Ownable { // sets the fees data like max fees, chain and token for all transfers // they can be updated for each transfer as well _setOverrides(fees_); - _initializeOwner(msg.sender); + _initializeOwner(owner_); } function deployContracts(uint32 chainSlug_) external async { diff --git a/contracts/base/AppGatewayBase.sol b/contracts/base/AppGatewayBase.sol index c8472cbd..f019ff3a 100644 --- a/contracts/base/AppGatewayBase.sol +++ b/contracts/base/AppGatewayBase.sol @@ -37,6 +37,7 @@ abstract contract AppGatewayBase is AddressResolverUtil, IAppGateway, FeesPlugin isAsyncModifierSet = false; deliveryHelper().batch(fees, auctionManager, onCompleteData, sbType); _markValidPromises(); + onCompleteData = bytes(""); } /// @notice Modifier to ensure only valid promises can call the function @@ -126,8 +127,6 @@ abstract contract AppGatewayBase is AddressResolverUtil, IAppGateway, FeesPlugin creationCodeWithArgs[contractId_], initCallData_ ); - - onCompleteData = abi.encode(chainSlug_, false); } /// @notice Sets the address for a deployed contract @@ -157,7 +156,8 @@ abstract contract AppGatewayBase is AddressResolverUtil, IAppGateway, FeesPlugin return address(0); } - onChainAddress = IForwarder(forwarderAddresses[contractId_][chainSlug_]).getOnChainAddress(); + onChainAddress = IForwarder(forwarderAddresses[contractId_][chainSlug_]) + .getOnChainAddress(); } //////////////////////////////////////////////////////////////////////////////////////////////// @@ -265,6 +265,8 @@ abstract contract AppGatewayBase is AddressResolverUtil, IAppGateway, FeesPlugin bytes32, PayloadBatch memory payloadBatch_ ) external override onlyDeliveryHelper { + if (payloadBatch_.onCompleteData.length == 0) return; + (uint32 chainSlug, bool isDeploy) = abi.decode( payloadBatch_.onCompleteData, (uint32, bool) diff --git a/contracts/interfaces/IAddressResolver.sol b/contracts/interfaces/IAddressResolver.sol index be19aae4..89f5483a 100644 --- a/contracts/interfaces/IAddressResolver.sol +++ b/contracts/interfaces/IAddressResolver.sol @@ -32,11 +32,6 @@ interface IAddressResolver { /// @return The gateway address associated with the contract function contractsToGateways(address contractAddress_) external view returns (address); - /// @notice Maps gateway addresses to their corresponding contract addresses - /// @param gatewayAddress_ The address of the gateway to lookup - /// @return The contract address associated with the gateway - function gatewaysToContracts(address gatewayAddress_) external view returns (address); - /// @notice Gets the list of all deployed async promise contracts /// @return Array of async promise contract addresses function getPromises() external view returns (address[] memory); diff --git a/contracts/protocol/AddressResolver.sol b/contracts/protocol/AddressResolver.sol index 65775d7e..12581543 100644 --- a/contracts/protocol/AddressResolver.sol +++ b/contracts/protocol/AddressResolver.sol @@ -46,10 +46,7 @@ abstract contract AddressResolverStorage is IAddressResolver { // slot 60 mapping(address => address) public override contractsToGateways; - // slot 61 - mapping(address => address) public override gatewaysToContracts; - - // slots [62-111] reserved for gap + // slots [61-110] reserved for gap uint256[50] _gap_after; } @@ -224,7 +221,6 @@ contract AddressResolver is AddressResolverStorage, Initializable, Ownable { function _setConfig(address appGateway_, address newForwarder_) internal { address gateway = contractsToGateways[appGateway_]; - gatewaysToContracts[gateway] = newForwarder_; contractsToGateways[newForwarder_] = gateway; } diff --git a/script/counter/IncrementCountersFromApp.s.sol b/script/counter/IncrementCountersFromApp.s.sol index 10a0f727..704cd065 100644 --- a/script/counter/IncrementCountersFromApp.s.sol +++ b/script/counter/IncrementCountersFromApp.s.sol @@ -22,10 +22,7 @@ contract IncrementCounters is Script { gateway.counter(), 11155420 ); - address counterForwarderBaseSepolia = gateway.forwarderAddresses( - gateway.counter(), - 84532 - ); + address counterForwarderBaseSepolia = gateway.forwarderAddresses(gateway.counter(), 84532); //address counterForwarderSepolia = deployer.forwarderAddresses( // deployer.counter(), // 11155111 diff --git a/script/super-token-lockable/DeployGateway.s.sol b/script/super-token-lockable/DeployGateway.s.sol index dee05645..86ba6018 100644 --- a/script/super-token-lockable/DeployGateway.s.sol +++ b/script/super-token-lockable/DeployGateway.s.sol @@ -27,6 +27,7 @@ contract DeployGateway is Script { SuperTokenLockableAppGateway gateway = new SuperTokenLockableAppGateway( addressResolver, address(auctionManager), + owner, FAST, fees, SuperTokenLockableAppGateway.ConstructorParams({ diff --git a/script/super-token/DeployGateway.s.sol b/script/super-token/DeployGateway.s.sol index e4091a1d..165f0bcd 100644 --- a/script/super-token/DeployGateway.s.sol +++ b/script/super-token/DeployGateway.s.sol @@ -25,6 +25,7 @@ contract DeployGateway is Script { SuperTokenAppGateway gateway = new SuperTokenAppGateway( addressResolver, address(auctionManager), + owner, FAST, fees, SuperTokenAppGateway.ConstructorParams({ diff --git a/test/DeliveryHelper.t.sol b/test/DeliveryHelper.t.sol index 10f31140..96c7046a 100644 --- a/test/DeliveryHelper.t.sol +++ b/test/DeliveryHelper.t.sol @@ -304,33 +304,7 @@ contract DeliveryHelperTest is SetupTest { appGateway_.deployContracts(chainSlug_); bidAndExecute(payloadIds, asyncId); - setupGatewayAndPlugs(chainSlug_, appGateway_, appGateway_, contractIds); - } - - function _deployParallel( - bytes32[] memory contractIds, - uint32[] memory chainSlugs_, - IAppGateway appGateway_ - ) internal returns (bytes32 asyncId) { - asyncId = getNextAsyncId(); - bytes32[] memory payloadIds = new bytes32[](contractIds.length * chainSlugs_.length); - for (uint32 i = 0; i < chainSlugs_.length; i++) { - for (uint j = 0; j < contractIds.length; j++) { - payloadIds[i * contractIds.length + j] = getWritePayloadId( - chainSlugs_[i], - address(getSocketConfig(chainSlugs_[i]).switchboard), - i * contractIds.length + j + payloadIdCounter - ); - } - } - // for fees - payloadIdCounter += chainSlugs_.length * contractIds.length + 1; - - appGateway_.deployMultiChainContracts(chainSlugs_); - bidAndExecute(payloadIds, asyncId); - for (uint i = 0; i < chainSlugs_.length; i++) { - setupGatewayAndPlugs(chainSlugs_[i], appGateway_, appGateway_, contractIds); - } + setupGatewayAndPlugs(chainSlug_, appGateway_, contractIds); } function setupGatewayAndPlugs( @@ -347,7 +321,7 @@ contract DeliveryHelperTest is SetupTest { gateways[i] = AppGatewayConfig({ plug: plug, chainSlug: chainSlug_, - appGateway: appGateway_, + appGateway: address(appGateway_), switchboard: address(socketConfig.switchboard) }); } diff --git a/test/FeesTest.t.sol b/test/FeesTest.t.sol index 060f4af2..8a70922e 100644 --- a/test/FeesTest.t.sol +++ b/test/FeesTest.t.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8.3; import "./DeliveryHelper.t.sol"; -import {CounterDeployer} from "../contracts/apps/counter/CounterDeployer.sol"; import {Counter} from "../contracts/apps/counter/Counter.sol"; import {CounterAppGateway} from "../contracts/apps/counter/CounterAppGateway.sol"; @@ -16,36 +15,22 @@ contract FeesTest is DeliveryHelperTest { bytes32 asyncId; CounterAppGateway counterGateway; - CounterDeployer counterDeployer; function setUp() public { setUpDeliveryHelper(); feesConfig = getSocketConfig(feesChainSlug); - counterDeployer = new CounterDeployer( - address(addressResolver), - address(auctionManager), - FAST, - createFees(feesAmount) - ); - counterGateway = new CounterAppGateway( address(addressResolver), - address(counterDeployer), address(auctionManager), + FAST, createFees(feesAmount) ); depositFees(address(counterGateway), createFees(depositAmount)); bytes32[] memory contractIds = new bytes32[](1); - contractIds[0] = counterDeployer.counter(); - asyncId = _deploy( - contractIds, - feesChainSlug, - 1, - IAppDeployer(counterDeployer), - address(counterGateway) - ); + contractIds[0] = counterGateway.counter(); + asyncId = _deploy(contractIds, feesChainSlug, 1, IAppGateway(counterGateway)); } function testDistributeFee() public { diff --git a/test/Inbox.t.sol b/test/Inbox.t.sol index 29711ef8..e067972f 100644 --- a/test/Inbox.t.sol +++ b/test/Inbox.t.sol @@ -1,30 +1,30 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {CounterInboxAppGateway} from "../contracts/apps/counter-inbox/CounterInboxAppGateway.sol"; -import {CounterInbox} from "../contracts/apps/counter-inbox/CounterInbox.sol"; +import {CounterAppGateway} from "../contracts/apps/counter/CounterAppGateway.sol"; +import {Counter} from "../contracts/apps/counter/Counter.sol"; import "./DeliveryHelper.t.sol"; contract InboxTest is DeliveryHelperTest { uint256 constant feesAmount = 0.01 ether; - CounterInboxAppGateway public gateway; - CounterInbox public inbox; + CounterAppGateway public gateway; + Counter public inbox; function setUp() public { // Setup core test infrastructure setUpDeliveryHelper(); // Deploy the inbox contract - inbox = new CounterInbox(); + inbox = new Counter(); // Deploy the gateway with fees - gateway = new CounterInboxAppGateway( + gateway = new CounterAppGateway( address(addressResolver), address(auctionManager), - address(inbox), - arbChainSlug, + FAST, createFees(feesAmount) ); + gateway.setIsValidPlug(arbChainSlug, address(inbox)); // Connect the inbox to the gateway and socket inbox.initSocket( @@ -55,13 +55,12 @@ contract InboxTest is DeliveryHelperTest { function testInboxIncrement() public { // Initial counter value should be 0 - assertEq(gateway.counter(), 0, "Initial gateway counter should be 0"); + assertEq(gateway.counterVal(), 0, "Initial gateway counter should be 0"); // Simulate a message from another chain through the watcher uint256 incrementValue = 5; bytes32 callId = inbox.increaseOnGateway(incrementValue); - CallFromChainParams[] memory params = new CallFromChainParams[](1); params[0] = CallFromChainParams({ callId: callId, @@ -77,6 +76,6 @@ contract InboxTest is DeliveryHelperTest { ); watcherPrecompile.callAppGateways(params, signatureNonce++, watcherSignature); // Check counter was incremented - assertEq(gateway.counter(), incrementValue, "Gateway counter should be incremented"); + assertEq(gateway.counterVal(), incrementValue, "Gateway counter should be incremented"); } } diff --git a/test/apps/Counter.t.sol b/test/apps/Counter.t.sol index 9c892710..ac74c870 100644 --- a/test/apps/Counter.t.sol +++ b/test/apps/Counter.t.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8.21; import {CounterAppGateway} from "../../contracts/apps/counter/CounterAppGateway.sol"; -import {CounterDeployer} from "../../contracts/apps/counter/CounterDeployer.sol"; import {Counter} from "../../contracts/apps/counter/Counter.sol"; import "../DeliveryHelper.t.sol"; @@ -13,38 +12,24 @@ contract CounterTest is DeliveryHelperTest { bytes32[] contractIds = new bytes32[](1); CounterAppGateway counterGateway; - CounterDeployer counterDeployer; function deploySetup() internal { setUpDeliveryHelper(); - counterDeployer = new CounterDeployer( - address(addressResolver), - address(auctionManager), - FAST, - createFees(feesAmount) - ); - counterGateway = new CounterAppGateway( address(addressResolver), - address(counterDeployer), address(auctionManager), + FAST, createFees(feesAmount) ); depositFees(address(counterGateway), createFees(1 ether)); - counterId = counterDeployer.counter(); + counterId = counterGateway.counter(); contractIds[0] = counterId; } function deployCounterApp(uint32 chainSlug) internal returns (bytes32 asyncId) { - asyncId = _deploy( - contractIds, - chainSlug, - 1, - IAppDeployer(counterDeployer), - address(counterGateway) - ); + asyncId = _deploy(contractIds, chainSlug, 1, IAppGateway(counterGateway)); } function testCounterDeployment() external { @@ -54,7 +39,7 @@ contract CounterTest is DeliveryHelperTest { (address onChain, address forwarder) = getOnChainAndForwarderAddresses( arbChainSlug, counterId, - counterDeployer + counterGateway ); assertEq( @@ -76,7 +61,7 @@ contract CounterTest is DeliveryHelperTest { (address arbCounter, address arbCounterForwarder) = getOnChainAndForwarderAddresses( arbChainSlug, counterId, - counterDeployer + counterGateway ); uint256 arbCounterBefore = Counter(arbCounter).counter(); @@ -97,12 +82,12 @@ contract CounterTest is DeliveryHelperTest { (address arbCounter, address arbCounterForwarder) = getOnChainAndForwarderAddresses( arbChainSlug, counterId, - counterDeployer + counterGateway ); (address optCounter, address optCounterForwarder) = getOnChainAndForwarderAddresses( optChainSlug, counterId, - counterDeployer + counterGateway ); uint256 arbCounterBefore = Counter(arbCounter).counter(); @@ -128,12 +113,12 @@ contract CounterTest is DeliveryHelperTest { (address arbCounter, address arbCounterForwarder) = getOnChainAndForwarderAddresses( arbChainSlug, counterId, - counterDeployer + counterGateway ); (address optCounter, address optCounterForwarder) = getOnChainAndForwarderAddresses( optChainSlug, counterId, - counterDeployer + counterGateway ); address[] memory instances = new address[](2); diff --git a/test/apps/ParallelCounter.t.sol b/test/apps/ParallelCounter.t.sol index c6e2e1ea..d6c049c7 100644 --- a/test/apps/ParallelCounter.t.sol +++ b/test/apps/ParallelCounter.t.sol @@ -1,13 +1,9 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.21; -import {ParallelCounterAppGateway} from "../../contracts/apps/parallel-counter/ParallelCounterAppGateway.sol"; -import {ParallelCounterDeployer} from "../../contracts/apps/parallel-counter/ParallelCounterDeployer.sol"; +import {CounterAppGateway} from "../../contracts/apps/counter/CounterAppGateway.sol"; import "../DeliveryHelper.t.sol"; - - - contract ParallelCounterTest is DeliveryHelperTest { uint256 feesAmount = 0.01 ether; @@ -15,38 +11,48 @@ contract ParallelCounterTest is DeliveryHelperTest { bytes32 counterId2; bytes32[] contractIds = new bytes32[](2); - ParallelCounterAppGateway parallelCounterGateway; - ParallelCounterDeployer parallelCounterDeployer; + CounterAppGateway parallelCounterGateway; function deploySetup() internal { setUpDeliveryHelper(); - parallelCounterDeployer = new ParallelCounterDeployer( + parallelCounterGateway = new CounterAppGateway( address(addressResolver), address(auctionManager), FAST, createFees(feesAmount) ); - - parallelCounterGateway = new ParallelCounterAppGateway( - address(addressResolver), - address(parallelCounterDeployer), - address(auctionManager), - createFees(feesAmount) - ); depositFees(address(parallelCounterGateway), createFees(1 ether)); - counterId1 = parallelCounterDeployer.counter1(); - counterId2 = parallelCounterDeployer.counter2(); + counterId1 = parallelCounterGateway.counter1(); + counterId2 = parallelCounterGateway.counter(); contractIds[0] = counterId1; contractIds[1] = counterId2; } + function _deployParallel(uint32[] memory chainSlugs_) internal returns (bytes32 asyncId) { + asyncId = getNextAsyncId(); + bytes32[] memory payloadIds = new bytes32[](contractIds.length * chainSlugs_.length); + for (uint32 i = 0; i < chainSlugs_.length; i++) { + for (uint j = 0; j < contractIds.length; j++) { + payloadIds[i * contractIds.length + j] = getWritePayloadId( + chainSlugs_[i], + address(getSocketConfig(chainSlugs_[i]).switchboard), + i * contractIds.length + j + payloadIdCounter + ); + } + } + // for fees + payloadIdCounter += chainSlugs_.length * contractIds.length + 1; + + parallelCounterGateway.deployMultiChainContracts(chainSlugs_); + bidAndExecute(payloadIds, asyncId); + for (uint i = 0; i < chainSlugs_.length; i++) { + setupGatewayAndPlugs(chainSlugs_[i], parallelCounterGateway, contractIds); + } + } + function deployCounterApps(uint32[] memory chainSlugs) internal returns (bytes32 asyncId) { - asyncId = _deployParallel( - contractIds, - chainSlugs, - IAppGateway(address(parallelCounterGateway)) - ); + asyncId = _deployParallel(chainSlugs); } function testParallelCounterDeployment() external { @@ -59,23 +65,23 @@ contract ParallelCounterTest is DeliveryHelperTest { (address onChainArb1, address forwarderArb1) = getOnChainAndForwarderAddresses( arbChainSlug, counterId1, - parallelCounterDeployer + parallelCounterGateway ); (address onChainArb2, address forwarderArb2) = getOnChainAndForwarderAddresses( arbChainSlug, counterId2, - parallelCounterDeployer + parallelCounterGateway ); (address onChainOpt1, address forwarderOpt1) = getOnChainAndForwarderAddresses( optChainSlug, counterId1, - parallelCounterDeployer + parallelCounterGateway ); (address onChainOpt2, address forwarderOpt2) = getOnChainAndForwarderAddresses( optChainSlug, counterId2, - parallelCounterDeployer + parallelCounterGateway ); assertEq( @@ -129,7 +135,7 @@ contract ParallelCounterTest is DeliveryHelperTest { (, address arbCounterForwarder) = getOnChainAndForwarderAddresses( arbChainSlug, counterId1, - parallelCounterDeployer + parallelCounterGateway ); address[] memory instances = new address[](1); diff --git a/test/apps/SuperToken.t.sol b/test/apps/SuperToken.t.sol index 7ce322e2..379799ef 100644 --- a/test/apps/SuperToken.t.sol +++ b/test/apps/SuperToken.t.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {SuperTokenDeployer} from "../../contracts/apps/super-token/SuperTokenDeployer.sol"; import {SuperTokenAppGateway} from "../../contracts/apps/super-token/SuperTokenAppGateway.sol"; import {SuperToken} from "../../contracts/apps/super-token/SuperToken.sol"; import "../DeliveryHelper.t.sol"; @@ -28,7 +27,6 @@ contract SuperTokenTest is DeliveryHelperTest { */ struct AppContracts { SuperTokenAppGateway superTokenApp; - SuperTokenDeployer superTokenDeployer; bytes32 superToken; } @@ -64,25 +62,19 @@ contract SuperTokenTest is DeliveryHelperTest { * - Sets up fee structure and auction manager integration */ function deploySuperTokenApp() internal { - SuperTokenDeployer superTokenDeployer = new SuperTokenDeployer( + SuperTokenAppGateway superTokenApp = new SuperTokenAppGateway( address(addressResolver), - owner, address(auctionManager), + owner, FAST, - SuperTokenDeployer.ConstructorParams({ + createFees(maxFees), + SuperTokenAppGateway.ConstructorParams({ name_: "SUPER TOKEN", symbol_: "SUPER", decimals_: 18, initialSupplyHolder_: owner, initialSupply_: 1000000000 ether - }), - createFees(maxFees) - ); - SuperTokenAppGateway superTokenApp = new SuperTokenAppGateway( - address(addressResolver), - address(superTokenDeployer), - createFees(maxFees), - address(auctionManager) + }) ); // Enable app gateways to do all operations in the Watcher: Read, Write and Schedule on EVMx // Watcher sets the limits for apps in this SOCKET protocol version @@ -90,8 +82,7 @@ contract SuperTokenTest is DeliveryHelperTest { appContracts = AppContracts({ superTokenApp: superTokenApp, - superTokenDeployer: superTokenDeployer, - superToken: superTokenDeployer.superToken() + superToken: superTokenApp.superToken() }); } @@ -103,18 +94,12 @@ contract SuperTokenTest is DeliveryHelperTest { * - Correct setup of forwarder contracts for multi-chain communication */ function testContractDeployment() public { - _deploy( - contractIds, - arbChainSlug, - 1, - appContracts.superTokenDeployer, - address(appContracts.superTokenApp) - ); + _deploy(contractIds, arbChainSlug, 1, IAppGateway(appContracts.superTokenApp)); (address onChain, address forwarder) = getOnChainAndForwarderAddresses( arbChainSlug, appContracts.superToken, - appContracts.superTokenDeployer + IAppGateway(appContracts.superTokenApp) ); assertEq( @@ -140,21 +125,8 @@ contract SuperTokenTest is DeliveryHelperTest { * @dev Deploys necessary contracts on both Arbitrum and Optimism chains */ function beforeTransfer() internal { - _deploy( - contractIds, - arbChainSlug, - 1, - appContracts.superTokenDeployer, - address(appContracts.superTokenApp) - ); - - _deploy( - contractIds, - optChainSlug, - 1, - appContracts.superTokenDeployer, - address(appContracts.superTokenApp) - ); + _deploy(contractIds, arbChainSlug, 1, IAppGateway(appContracts.superTokenApp)); + _deploy(contractIds, optChainSlug, 1, IAppGateway(appContracts.superTokenApp)); } /** @@ -171,13 +143,13 @@ contract SuperTokenTest is DeliveryHelperTest { (address onChainArb, address forwarderArb) = getOnChainAndForwarderAddresses( arbChainSlug, appContracts.superToken, - appContracts.superTokenDeployer + IAppGateway(appContracts.superTokenApp) ); (address onChainOpt, address forwarderOpt) = getOnChainAndForwarderAddresses( optChainSlug, appContracts.superToken, - appContracts.superTokenDeployer + IAppGateway(appContracts.superTokenApp) ); uint256 arbBalanceBefore = SuperToken(onChainArb).balanceOf(owner); diff --git a/test/apps/SuperTokenLockable.t.sol b/test/apps/SuperTokenLockable.t.sol index 1994fe79..5159d62a 100644 --- a/test/apps/SuperTokenLockable.t.sol +++ b/test/apps/SuperTokenLockable.t.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {SuperTokenLockableDeployer} from "../../contracts/apps/super-token-lockable/SuperTokenLockableDeployer.sol"; import {SuperTokenLockableAppGateway} from "../../contracts/apps/super-token-lockable/SuperTokenLockableAppGateway.sol"; import {SuperTokenLockable} from "../../contracts/apps/super-token-lockable/SuperTokenLockable.sol"; import {LimitHook} from "../../contracts/apps/super-token-lockable/LimitHook.sol"; @@ -12,7 +11,6 @@ import "../DeliveryHelper.t.sol"; contract SuperTokenLockableTest is DeliveryHelperTest { struct AppContracts { SuperTokenLockableAppGateway superTokenLockableApp; - SuperTokenLockableDeployer superTokenLockableDeployer; bytes32 superTokenLockable; bytes32 limitHook; } @@ -34,12 +32,13 @@ contract SuperTokenLockableTest is DeliveryHelperTest { } function deploySuperTokenApp() internal { - SuperTokenLockableDeployer superTokenLockableDeployer = new SuperTokenLockableDeployer( + SuperTokenLockableAppGateway superTokenLockableApp = new SuperTokenLockableAppGateway( address(addressResolver), - owner, address(auctionManager), + owner, FAST, - SuperTokenLockableDeployer.ConstructorParams({ + createFees(maxFees), + SuperTokenLockableAppGateway.ConstructorParams({ _burnLimit: 10000000000000000000000, _mintLimit: 10000000000000000000000, name_: "SUPER TOKEN", @@ -47,22 +46,14 @@ contract SuperTokenLockableTest is DeliveryHelperTest { decimals_: 18, initialSupplyHolder_: owner, initialSupply_: 1000000000 ether - }), - createFees(maxFees) - ); - SuperTokenLockableAppGateway superTokenLockableApp = new SuperTokenLockableAppGateway( - address(addressResolver), - address(superTokenLockableDeployer), - address(auctionManager), - createFees(maxFees) + }) ); depositFees(address(superTokenLockableApp), createFees(1 ether)); appContracts = AppContracts({ superTokenLockableApp: superTokenLockableApp, - superTokenLockableDeployer: superTokenLockableDeployer, - superTokenLockable: superTokenLockableDeployer.superTokenLockable(), - limitHook: superTokenLockableDeployer.limitHook() + superTokenLockable: superTokenLockableApp.superTokenLockable(), + limitHook: superTokenLockableApp.limitHook() }); } @@ -72,15 +63,13 @@ contract SuperTokenLockableTest is DeliveryHelperTest { PayloadDetails[] memory payloadDetails = new PayloadDetails[](2); payloadDetails[0] = createDeployPayloadDetail( chainSlug_, - address(appContracts.superTokenLockableDeployer), - appContracts.superTokenLockableDeployer.creationCodeWithArgs( - appContracts.superTokenLockable - ) + address(appContracts.superTokenLockableApp), + appContracts.superTokenLockableApp.creationCodeWithArgs(appContracts.superTokenLockable) ); payloadDetails[1] = createDeployPayloadDetail( chainSlug_, - address(appContracts.superTokenLockableDeployer), - appContracts.superTokenLockableDeployer.creationCodeWithArgs(appContracts.limitHook) + address(appContracts.superTokenLockableApp), + appContracts.superTokenLockableApp.creationCodeWithArgs(appContracts.limitHook) ); return payloadDetails; @@ -89,11 +78,11 @@ contract SuperTokenLockableTest is DeliveryHelperTest { function createConfigurePayloadDetailsArray( uint32 chainSlug_ ) internal returns (PayloadDetails[] memory) { - address superTokenForwarder = appContracts.superTokenLockableDeployer.forwarderAddresses( + address superTokenForwarder = appContracts.superTokenLockableApp.forwarderAddresses( appContracts.superTokenLockable, chainSlug_ ); - address limitHookForwarder = appContracts.superTokenLockableDeployer.forwarderAddresses( + address limitHookForwarder = appContracts.superTokenLockableApp.forwarderAddresses( appContracts.limitHook, chainSlug_ ); @@ -105,7 +94,7 @@ contract SuperTokenLockableTest is DeliveryHelperTest { payloadDetails[0] = createExecutePayloadDetail( chainSlug_, deployedToken, - address(appContracts.superTokenLockableDeployer), + address(appContracts.superTokenLockableApp), superTokenForwarder, abi.encodeWithSignature("setLimitHook(address)", deployedLimitHook) ); @@ -144,20 +133,19 @@ contract SuperTokenLockableTest is DeliveryHelperTest { contractIds, arbChainSlug, 2, - appContracts.superTokenLockableDeployer, - address(appContracts.superTokenLockableApp) + IAppGateway(appContracts.superTokenLockableApp) ); (address onChainSuperToken, address forwarderSuperToken) = getOnChainAndForwarderAddresses( arbChainSlug, appContracts.superTokenLockable, - appContracts.superTokenLockableDeployer + IAppGateway(appContracts.superTokenLockableApp) ); (address onChainLimitHook, address forwarderLimitHook) = getOnChainAndForwarderAddresses( arbChainSlug, appContracts.limitHook, - appContracts.superTokenLockableDeployer + IAppGateway(appContracts.superTokenLockableApp) ); assertEq( @@ -208,30 +196,24 @@ contract SuperTokenLockableTest is DeliveryHelperTest { checkPayloadBatchAndDetails( payloadDetails, asyncId, - address(appContracts.superTokenLockableDeployer) + address(appContracts.superTokenLockableApp) ); } function testConfigure() public { - _deploy( - contractIds, - arbChainSlug, - 2, - appContracts.superTokenLockableDeployer, - address(appContracts.superTokenLockableApp) - ); + _deploy(contractIds, arbChainSlug, 2, IAppGateway(appContracts.superTokenLockableApp)); bytes32 asyncId = _executeWriteBatchSingleChain(arbChainSlug, 1); (address onChainSuperToken, ) = getOnChainAndForwarderAddresses( arbChainSlug, appContracts.superTokenLockable, - appContracts.superTokenLockableDeployer + IAppGateway(appContracts.superTokenLockableApp) ); (address onChainLimitHook, ) = getOnChainAndForwarderAddresses( arbChainSlug, appContracts.limitHook, - appContracts.superTokenLockableDeployer + IAppGateway(appContracts.superTokenLockableApp) ); assertEq( address(SuperTokenLockable(onChainSuperToken).limitHook__()), @@ -248,23 +230,11 @@ contract SuperTokenLockableTest is DeliveryHelperTest { } function _deployBridge() internal { - _deploy( - contractIds, - arbChainSlug, - 2, - appContracts.superTokenLockableDeployer, - address(appContracts.superTokenLockableApp) - ); + _deploy(contractIds, arbChainSlug, 2, IAppGateway(appContracts.superTokenLockableApp)); _executeWriteBatchSingleChain(arbChainSlug, 1); - _deploy( - contractIds, - optChainSlug, - 2, - appContracts.superTokenLockableDeployer, - address(appContracts.superTokenLockableApp) - ); + _deploy(contractIds, optChainSlug, 2, IAppGateway(appContracts.superTokenLockableApp)); _executeWriteBatchSingleChain(optChainSlug, 1); } @@ -273,11 +243,11 @@ contract SuperTokenLockableTest is DeliveryHelperTest { _deployBridge(); userOrder = SuperTokenLockableAppGateway.UserOrder({ - srcToken: appContracts.superTokenLockableDeployer.forwarderAddresses( + srcToken: appContracts.superTokenLockableApp.forwarderAddresses( appContracts.superTokenLockable, arbChainSlug ), - dstToken: appContracts.superTokenLockableDeployer.forwarderAddresses( + dstToken: appContracts.superTokenLockableApp.forwarderAddresses( appContracts.superTokenLockable, optChainSlug ), From cc49d1ee6746bb83c1c473797aaae025c89b6669 Mon Sep 17 00:00:00 2001 From: Ameesha Agrawal Date: Wed, 26 Feb 2025 19:33:46 +0400 Subject: [PATCH 4/5] fix: move apps to tests --- script/counter-inbox/CheckGatewayCounter.s.sol | 2 +- script/counter-inbox/Increment.s.sol | 4 ++-- script/counter/IncrementCountersFromApp.s.sol | 2 +- script/counter/ReadOnchainCounters.s.sol | 4 ++-- script/counter/WithdrawFeesArbitrumFeesPlug.s.sol | 2 +- script/counter/deployEVMxCounterApp.s.sol | 2 +- script/counter/deployOnchainCounters.s.sol | 2 +- script/cron/SetTimeout.s.sol | 2 +- script/parallel-counter/checkCounters.s.sol | 4 ++-- script/parallel-counter/deployOnchain.s.sol | 2 +- script/parallel-counter/incrementCounters.s.sol | 2 +- script/super-token-lockable/Bridge.s.sol | 2 +- script/super-token-lockable/DeployContracts.s.sol | 4 ++-- script/super-token-lockable/DeployGateway.s.sol | 4 ++-- script/super-token/Bridge.s.sol | 2 +- script/super-token/DeployContracts.s.sol | 4 ++-- script/super-token/DeployGateway.s.sol | 4 ++-- test/FeesTest.t.sol | 4 ++-- test/Inbox.t.sol | 4 ++-- test/apps/Counter.t.sol | 4 ++-- test/apps/ParallelCounter.t.sol | 2 +- test/apps/SuperToken.t.sol | 4 ++-- test/apps/SuperTokenLockable.t.sol | 6 +++--- .../apps => test/apps/app-gateways}/counter/Counter.sol | 2 +- .../apps/app-gateways}/counter/CounterAppGateway.sol | 6 +++--- .../apps => test/apps/app-gateways}/counter/ICounter.sol | 0 .../apps/app-gateways}/super-token-lockable/LimitHook.sol | 2 +- .../super-token-lockable/SuperTokenLockable.sol | 2 +- .../super-token-lockable/SuperTokenLockableAppGateway.sol | 4 ++-- .../apps/app-gateways}/super-token/SuperToken.sol | 2 +- .../apps/app-gateways}/super-token/SuperTokenAppGateway.sol | 4 ++-- 31 files changed, 47 insertions(+), 47 deletions(-) rename {contracts/apps => test/apps/app-gateways}/counter/Counter.sol (90%) rename {contracts/apps => test/apps/app-gateways}/counter/CounterAppGateway.sol (96%) rename {contracts/apps => test/apps/app-gateways}/counter/ICounter.sol (100%) rename {contracts/apps => test/apps/app-gateways}/super-token-lockable/LimitHook.sol (96%) rename {contracts/apps => test/apps/app-gateways}/super-token-lockable/SuperTokenLockable.sol (97%) rename {contracts/apps => test/apps/app-gateways}/super-token-lockable/SuperTokenLockableAppGateway.sol (96%) rename {contracts/apps => test/apps/app-gateways}/super-token/SuperToken.sol (95%) rename {contracts/apps => test/apps/app-gateways}/super-token/SuperTokenAppGateway.sol (95%) diff --git a/script/counter-inbox/CheckGatewayCounter.s.sol b/script/counter-inbox/CheckGatewayCounter.s.sol index 563b61d7..ffd80b88 100644 --- a/script/counter-inbox/CheckGatewayCounter.s.sol +++ b/script/counter-inbox/CheckGatewayCounter.s.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {CounterAppGateway} from "../../contracts/apps/counter/CounterAppGateway.sol"; +import {CounterAppGateway} from "../../test/apps/app-gateways/counter/CounterAppGateway.sol"; contract CheckGatewayCounter is Script { function run() external { diff --git a/script/counter-inbox/Increment.s.sol b/script/counter-inbox/Increment.s.sol index 44fb7897..3937d716 100644 --- a/script/counter-inbox/Increment.s.sol +++ b/script/counter-inbox/Increment.s.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {CounterAppGateway} from "../../contracts/apps/counter/CounterAppGateway.sol"; -import {Counter} from "../../contracts/apps/counter/Counter.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"; diff --git a/script/counter/IncrementCountersFromApp.s.sol b/script/counter/IncrementCountersFromApp.s.sol index 704cd065..b63f6c83 100644 --- a/script/counter/IncrementCountersFromApp.s.sol +++ b/script/counter/IncrementCountersFromApp.s.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {CounterAppGateway} from "../../contracts/apps//counter/CounterAppGateway.sol"; +import {CounterAppGateway} from "../../test/apps/app-gateways/counter/CounterAppGateway.sol"; contract IncrementCounters is Script { function run() external { diff --git a/script/counter/ReadOnchainCounters.s.sol b/script/counter/ReadOnchainCounters.s.sol index 3770e927..850f7e9c 100644 --- a/script/counter/ReadOnchainCounters.s.sol +++ b/script/counter/ReadOnchainCounters.s.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {Counter} from "../../contracts/apps//counter/Counter.sol"; -import {CounterAppGateway} from "../../contracts/apps//counter/CounterAppGateway.sol"; +import {Counter} from "../../test/apps/app-gateways/counter/Counter.sol"; +import {CounterAppGateway} from "../../test/apps/app-gateways/counter/CounterAppGateway.sol"; contract CheckCounters is Script { function run() external { diff --git a/script/counter/WithdrawFeesArbitrumFeesPlug.s.sol b/script/counter/WithdrawFeesArbitrumFeesPlug.s.sol index a7dbc9f1..fbebfe6e 100644 --- a/script/counter/WithdrawFeesArbitrumFeesPlug.s.sol +++ b/script/counter/WithdrawFeesArbitrumFeesPlug.s.sol @@ -5,7 +5,7 @@ import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; import {FeesManager} from "../../contracts/protocol/payload-delivery/FeesManager.sol"; import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol"; -import {CounterAppGateway} from "../../contracts/apps/counter/CounterAppGateway.sol"; +import {CounterAppGateway} from "../../test/apps/app-gateways/counter/CounterAppGateway.sol"; contract WithdrawFees is Script { function run() external { diff --git a/script/counter/deployEVMxCounterApp.s.sol b/script/counter/deployEVMxCounterApp.s.sol index 12868719..922baacd 100644 --- a/script/counter/deployEVMxCounterApp.s.sol +++ b/script/counter/deployEVMxCounterApp.s.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {CounterAppGateway} from "../../contracts/apps//counter/CounterAppGateway.sol"; +import {CounterAppGateway} from "../../test/apps/app-gateways/counter/CounterAppGateway.sol"; import {Fees} from "../../contracts/protocol/utils/common/Structs.sol"; import {ETH_ADDRESS, FAST} from "../../contracts/protocol/utils/common/Constants.sol"; diff --git a/script/counter/deployOnchainCounters.s.sol b/script/counter/deployOnchainCounters.s.sol index 123c6958..fd75c155 100644 --- a/script/counter/deployOnchainCounters.s.sol +++ b/script/counter/deployOnchainCounters.s.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol"; -import {CounterAppGateway} from "../../contracts/apps/counter/CounterAppGateway.sol"; +import {CounterAppGateway} from "../../test/apps/app-gateways/counter/CounterAppGateway.sol"; contract CounterDeployOnchain is Script { function run() external { diff --git a/script/cron/SetTimeout.s.sol b/script/cron/SetTimeout.s.sol index 9a8c575a..b58a0925 100644 --- a/script/cron/SetTimeout.s.sol +++ b/script/cron/SetTimeout.s.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {CounterAppGateway} from "../../contracts/apps/counter/CounterAppGateway.sol"; +import {CounterAppGateway} from "../../test/apps/app-gateways/counter/CounterAppGateway.sol"; contract SetTimeoutScript is Script { function run() external { diff --git a/script/parallel-counter/checkCounters.s.sol b/script/parallel-counter/checkCounters.s.sol index 23c0ad53..fa04b108 100644 --- a/script/parallel-counter/checkCounters.s.sol +++ b/script/parallel-counter/checkCounters.s.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {CounterAppGateway} from "../../contracts/apps/counter/CounterAppGateway.sol"; -import {Counter} from "../../contracts/apps/counter/Counter.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 { diff --git a/script/parallel-counter/deployOnchain.s.sol b/script/parallel-counter/deployOnchain.s.sol index 6bf9811c..d52528ec 100644 --- a/script/parallel-counter/deployOnchain.s.sol +++ b/script/parallel-counter/deployOnchain.s.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {CounterAppGateway} from "../../contracts/apps/counter/CounterAppGateway.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 { diff --git a/script/parallel-counter/incrementCounters.s.sol b/script/parallel-counter/incrementCounters.s.sol index c7651085..ab03e084 100644 --- a/script/parallel-counter/incrementCounters.s.sol +++ b/script/parallel-counter/incrementCounters.s.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {CounterAppGateway} from "../../contracts/apps/counter/CounterAppGateway.sol"; +import {CounterAppGateway} from "../../test/apps/app-gateways/counter/CounterAppGateway.sol"; contract IncrementCounters is Script { function run() external { diff --git a/script/super-token-lockable/Bridge.s.sol b/script/super-token-lockable/Bridge.s.sol index abb6875f..34fc36bf 100644 --- a/script/super-token-lockable/Bridge.s.sol +++ b/script/super-token-lockable/Bridge.s.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {SuperTokenLockableAppGateway} from "../../contracts/apps/super-token-lockable/SuperTokenLockableAppGateway.sol"; +import {SuperTokenLockableAppGateway} from "../../test/apps/app-gateways/super-token-lockable/SuperTokenLockableAppGateway.sol"; contract Bridge is Script { function run() external { diff --git a/script/super-token-lockable/DeployContracts.s.sol b/script/super-token-lockable/DeployContracts.s.sol index b1729a85..df001e0f 100644 --- a/script/super-token-lockable/DeployContracts.s.sol +++ b/script/super-token-lockable/DeployContracts.s.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {SuperTokenLockableAppGateway} from "../../contracts/apps/super-token-lockable/SuperTokenLockableAppGateway.sol"; -import {SuperTokenLockable} from "../../contracts/apps/super-token-lockable/SuperTokenLockable.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"; diff --git a/script/super-token-lockable/DeployGateway.s.sol b/script/super-token-lockable/DeployGateway.s.sol index 86ba6018..8a2be2a8 100644 --- a/script/super-token-lockable/DeployGateway.s.sol +++ b/script/super-token-lockable/DeployGateway.s.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {SuperTokenLockableAppGateway} from "../../contracts/apps/super-token-lockable/SuperTokenLockableAppGateway.sol"; -import {SuperTokenLockable} from "../../contracts/apps/super-token-lockable/SuperTokenLockable.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"; diff --git a/script/super-token/Bridge.s.sol b/script/super-token/Bridge.s.sol index 2f83e781..a5e8aed9 100644 --- a/script/super-token/Bridge.s.sol +++ b/script/super-token/Bridge.s.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; -import {SuperTokenAppGateway} from "../../contracts/apps/super-token/SuperTokenAppGateway.sol"; +import {SuperTokenAppGateway} from "../../test/apps/app-gateways/super-token/SuperTokenAppGateway.sol"; contract Bridge is Script { struct UserOrder { diff --git a/script/super-token/DeployContracts.s.sol b/script/super-token/DeployContracts.s.sol index 37546559..d007bcc3 100644 --- a/script/super-token/DeployContracts.s.sol +++ b/script/super-token/DeployContracts.s.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {SuperTokenAppGateway} from "../../contracts/apps/super-token/SuperTokenAppGateway.sol"; -import {SuperToken} from "../../contracts/apps/super-token/SuperToken.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"; diff --git a/script/super-token/DeployGateway.s.sol b/script/super-token/DeployGateway.s.sol index 165f0bcd..61df966a 100644 --- a/script/super-token/DeployGateway.s.sol +++ b/script/super-token/DeployGateway.s.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.0; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {SuperTokenAppGateway} from "../../contracts/apps/super-token/SuperTokenAppGateway.sol"; -import {SuperToken} from "../../contracts/apps/super-token/SuperToken.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"; diff --git a/test/FeesTest.t.sol b/test/FeesTest.t.sol index 8a70922e..c04b7a85 100644 --- a/test/FeesTest.t.sol +++ b/test/FeesTest.t.sol @@ -2,8 +2,8 @@ pragma solidity ^0.8.3; import "./DeliveryHelper.t.sol"; -import {Counter} from "../contracts/apps/counter/Counter.sol"; -import {CounterAppGateway} from "../contracts/apps/counter/CounterAppGateway.sol"; +import {Counter} from "./apps/app-gateways/counter/Counter.sol"; +import {CounterAppGateway} from "./apps/app-gateways/counter/CounterAppGateway.sol"; contract FeesTest is DeliveryHelperTest { uint256 constant depositAmount = 1 ether; diff --git a/test/Inbox.t.sol b/test/Inbox.t.sol index e067972f..7a555c77 100644 --- a/test/Inbox.t.sol +++ b/test/Inbox.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {CounterAppGateway} from "../contracts/apps/counter/CounterAppGateway.sol"; -import {Counter} from "../contracts/apps/counter/Counter.sol"; +import {CounterAppGateway} from "./apps/app-gateways/counter/CounterAppGateway.sol"; +import {Counter} from "./apps/app-gateways/counter/Counter.sol"; import "./DeliveryHelper.t.sol"; contract InboxTest is DeliveryHelperTest { diff --git a/test/apps/Counter.t.sol b/test/apps/Counter.t.sol index ac74c870..2200e655 100644 --- a/test/apps/Counter.t.sol +++ b/test/apps/Counter.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.21; -import {CounterAppGateway} from "../../contracts/apps/counter/CounterAppGateway.sol"; -import {Counter} from "../../contracts/apps/counter/Counter.sol"; +import {CounterAppGateway} from "./app-gateways/counter/CounterAppGateway.sol"; +import {Counter} from "./app-gateways/counter/Counter.sol"; import "../DeliveryHelper.t.sol"; contract CounterTest is DeliveryHelperTest { diff --git a/test/apps/ParallelCounter.t.sol b/test/apps/ParallelCounter.t.sol index d6c049c7..beec26e5 100644 --- a/test/apps/ParallelCounter.t.sol +++ b/test/apps/ParallelCounter.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.21; -import {CounterAppGateway} from "../../contracts/apps/counter/CounterAppGateway.sol"; +import {CounterAppGateway} from "./app-gateways/counter/CounterAppGateway.sol"; import "../DeliveryHelper.t.sol"; contract ParallelCounterTest is DeliveryHelperTest { diff --git a/test/apps/SuperToken.t.sol b/test/apps/SuperToken.t.sol index 379799ef..c3c98bdb 100644 --- a/test/apps/SuperToken.t.sol +++ b/test/apps/SuperToken.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {SuperTokenAppGateway} from "../../contracts/apps/super-token/SuperTokenAppGateway.sol"; -import {SuperToken} from "../../contracts/apps/super-token/SuperToken.sol"; +import {SuperTokenAppGateway} from "./app-gateways/super-token/SuperTokenAppGateway.sol"; +import {SuperToken} from "./app-gateways/super-token/SuperToken.sol"; import "../DeliveryHelper.t.sol"; import {QUERY, FINALIZE, SCHEDULE} from "../../contracts/protocol/utils/common/Constants.sol"; diff --git a/test/apps/SuperTokenLockable.t.sol b/test/apps/SuperTokenLockable.t.sol index 5159d62a..3bff72d9 100644 --- a/test/apps/SuperTokenLockable.t.sol +++ b/test/apps/SuperTokenLockable.t.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {SuperTokenLockableAppGateway} from "../../contracts/apps/super-token-lockable/SuperTokenLockableAppGateway.sol"; -import {SuperTokenLockable} from "../../contracts/apps/super-token-lockable/SuperTokenLockable.sol"; -import {LimitHook} from "../../contracts/apps/super-token-lockable/LimitHook.sol"; +import {SuperTokenLockableAppGateway} from "./app-gateways/super-token-lockable/SuperTokenLockableAppGateway.sol"; +import {SuperTokenLockable} from "./app-gateways/super-token-lockable/SuperTokenLockable.sol"; +import {LimitHook} from "./app-gateways/super-token-lockable/LimitHook.sol"; import {QUERY, FINALIZE, SCHEDULE} from "../../contracts/protocol/utils/common/Constants.sol"; import "../DeliveryHelper.t.sol"; diff --git a/contracts/apps/counter/Counter.sol b/test/apps/app-gateways/counter/Counter.sol similarity index 90% rename from contracts/apps/counter/Counter.sol rename to test/apps/app-gateways/counter/Counter.sol index f2502c33..b4d585ef 100644 --- a/contracts/apps/counter/Counter.sol +++ b/test/apps/app-gateways/counter/Counter.sol @@ -2,7 +2,7 @@ pragma solidity >=0.7.0 <0.9.0; import "solady/auth/Ownable.sol"; -import "../../base/PlugBase.sol"; +import "../../../../contracts/base/PlugBase.sol"; contract Counter is Ownable, PlugBase { uint256 public counter; diff --git a/contracts/apps/counter/CounterAppGateway.sol b/test/apps/app-gateways/counter/CounterAppGateway.sol similarity index 96% rename from contracts/apps/counter/CounterAppGateway.sol rename to test/apps/app-gateways/counter/CounterAppGateway.sol index 0d36d319..1b73aa47 100644 --- a/contracts/apps/counter/CounterAppGateway.sol +++ b/test/apps/app-gateways/counter/CounterAppGateway.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; -import "../../base/AppGatewayBase.sol"; +import "../../../../contracts/base/AppGatewayBase.sol"; +import "../../../../contracts/interfaces/IForwarder.sol"; +import "../../../../contracts/interfaces/IPromise.sol"; import "./Counter.sol"; import "./ICounter.sol"; -import "../../interfaces/IForwarder.sol"; -import "../../interfaces/IPromise.sol"; contract CounterAppGateway is AppGatewayBase, Ownable { bytes32 public counter = _createContractId("counter"); diff --git a/contracts/apps/counter/ICounter.sol b/test/apps/app-gateways/counter/ICounter.sol similarity index 100% rename from contracts/apps/counter/ICounter.sol rename to test/apps/app-gateways/counter/ICounter.sol diff --git a/contracts/apps/super-token-lockable/LimitHook.sol b/test/apps/app-gateways/super-token-lockable/LimitHook.sol similarity index 96% rename from contracts/apps/super-token-lockable/LimitHook.sol rename to test/apps/app-gateways/super-token-lockable/LimitHook.sol index 76527f5b..d2ac0939 100644 --- a/contracts/apps/super-token-lockable/LimitHook.sol +++ b/test/apps/app-gateways/super-token-lockable/LimitHook.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.0; import {Ownable} from "solady/auth/Ownable.sol"; -import "../../base/PlugBase.sol"; +import "../../../../contracts/base/PlugBase.sol"; contract LimitHook is Ownable, PlugBase { // Define any state variables or functions for the LimitHook contract here diff --git a/contracts/apps/super-token-lockable/SuperTokenLockable.sol b/test/apps/app-gateways/super-token-lockable/SuperTokenLockable.sol similarity index 97% rename from contracts/apps/super-token-lockable/SuperTokenLockable.sol rename to test/apps/app-gateways/super-token-lockable/SuperTokenLockable.sol index 92eb64f1..5aec4aec 100644 --- a/contracts/apps/super-token-lockable/SuperTokenLockable.sol +++ b/test/apps/app-gateways/super-token-lockable/SuperTokenLockable.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.21; import "solmate/tokens/ERC20.sol"; import {Ownable} from "solady/auth/Ownable.sol"; import {LimitHook} from "./LimitHook.sol"; -import "../../base/PlugBase.sol"; +import "../../../../contracts/base/PlugBase.sol"; /** * @title SuperToken diff --git a/contracts/apps/super-token-lockable/SuperTokenLockableAppGateway.sol b/test/apps/app-gateways/super-token-lockable/SuperTokenLockableAppGateway.sol similarity index 96% rename from contracts/apps/super-token-lockable/SuperTokenLockableAppGateway.sol rename to test/apps/app-gateways/super-token-lockable/SuperTokenLockableAppGateway.sol index ef003ac0..a1b3c125 100644 --- a/contracts/apps/super-token-lockable/SuperTokenLockableAppGateway.sol +++ b/test/apps/app-gateways/super-token-lockable/SuperTokenLockableAppGateway.sol @@ -2,8 +2,8 @@ pragma solidity ^0.8.21; import "solady/auth/Ownable.sol"; -import {ISuperToken} from "../../interfaces/ISuperToken.sol"; -import "../../base/AppGatewayBase.sol"; +import {ISuperToken} from "../../../../contracts/interfaces/ISuperToken.sol"; +import "../../../../contracts/base/AppGatewayBase.sol"; import "./SuperTokenLockable.sol"; import "./LimitHook.sol"; diff --git a/contracts/apps/super-token/SuperToken.sol b/test/apps/app-gateways/super-token/SuperToken.sol similarity index 95% rename from contracts/apps/super-token/SuperToken.sol rename to test/apps/app-gateways/super-token/SuperToken.sol index 17b0ba85..4d7dfe05 100644 --- a/contracts/apps/super-token/SuperToken.sol +++ b/test/apps/app-gateways/super-token/SuperToken.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.21; import "solmate/tokens/ERC20.sol"; import {Ownable} from "solady/auth/Ownable.sol"; -import "../../base/PlugBase.sol"; +import "../../../../contracts/base/PlugBase.sol"; /** * @title SuperToken diff --git a/contracts/apps/super-token/SuperTokenAppGateway.sol b/test/apps/app-gateways/super-token/SuperTokenAppGateway.sol similarity index 95% rename from contracts/apps/super-token/SuperTokenAppGateway.sol rename to test/apps/app-gateways/super-token/SuperTokenAppGateway.sol index 77f4cf9e..a73b8e39 100644 --- a/contracts/apps/super-token/SuperTokenAppGateway.sol +++ b/test/apps/app-gateways/super-token/SuperTokenAppGateway.sol @@ -2,8 +2,8 @@ pragma solidity ^0.8.21; import "solady/auth/Ownable.sol"; -import "../../base/AppGatewayBase.sol"; -import "../../interfaces/ISuperToken.sol"; +import "../../../../contracts/base/AppGatewayBase.sol"; +import "../../../../contracts/interfaces/ISuperToken.sol"; import "./SuperToken.sol"; contract SuperTokenAppGateway is AppGatewayBase, Ownable { From 1fb422c54b74af6f22a5f6ca9eeb65b6cb0e9918 Mon Sep 17 00:00:00 2001 From: Ameesha Agrawal Date: Thu, 27 Feb 2025 14:52:06 +0400 Subject: [PATCH 5/5] fix: remove interface --- contracts/interfaces/IMultiChainAppDeployer.sol | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 contracts/interfaces/IMultiChainAppDeployer.sol diff --git a/contracts/interfaces/IMultiChainAppDeployer.sol b/contracts/interfaces/IMultiChainAppDeployer.sol deleted file mode 100644 index 37bd04ad..00000000 --- a/contracts/interfaces/IMultiChainAppDeployer.sol +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.21; - -/// @title IMultiChainAppDeployer -/// @notice Interface for the multi-chain app deployer -interface IMultiChainAppDeployer { - /// @notice deploy contracts to multiple chains - function deployMultiChainContracts(uint32[] memory chainSlugs_) external; -}