Overview
S Balance
0 S
S Value
-More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 25 internal transactions (View All)
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
3330567 | 46 mins ago | 0.00322881 S | ||||
3330567 | 46 mins ago | 0.00322881 S | ||||
3288401 | 7 hrs ago | 0.19618393 S | ||||
3288401 | 7 hrs ago | 0.19618393 S | ||||
3274904 | 10 hrs ago | 0.13370021 S | ||||
3274904 | 10 hrs ago | 0.13370021 S | ||||
3274896 | 10 hrs ago | 0.2250061 S | ||||
3274896 | 10 hrs ago | 0.2250061 S | ||||
3266991 | 11 hrs ago | 0.03345682 S | ||||
3266991 | 11 hrs ago | 0.03345682 S | ||||
3258664 | 12 hrs ago | 0.00357656 S | ||||
3258664 | 12 hrs ago | 0.00357656 S | ||||
3249712 | 13 hrs ago | 0.00482722 S | ||||
3249712 | 13 hrs ago | 0.00482722 S | ||||
3249708 | 13 hrs ago | 0.05655399 S | ||||
3249708 | 13 hrs ago | 0.05655399 S | ||||
3241543 | 14 hrs ago | 0.01206772 S | ||||
3241543 | 14 hrs ago | 0.01206772 S | ||||
3241526 | 14 hrs ago | 0.00901462 S | ||||
3241526 | 14 hrs ago | 0.00901462 S | ||||
3225586 | 17 hrs ago | 0.00377762 S | ||||
3225586 | 17 hrs ago | 0.00377762 S | ||||
3219184 | 18 hrs ago | 0.00501224 S | ||||
3219184 | 18 hrs ago | 0.00501224 S | ||||
3202712 | 21 hrs ago | 0.05619278 S |
Loading...
Loading
Contract Name:
SwitchboardPlug
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.17; import {ISocket} from "../interfaces/ISocket.sol"; import {ISwitchboardRouter} from "../interfaces/ISwitchboardRouter.sol"; import {ISwitchboardPlug} from "../interfaces/ISwitchboardPlug.sol"; import {IPlug} from "../interfaces/IPlug.sol"; import {NotSocket, NotSwitchboardRouter, ConnectionAlreadyInitialised} from "../common/Errors.sol"; contract SwitchboardPlug is IPlug, ISwitchboardPlug { /*////////////////////////////////////////////////////////////////////////// PUBLIC STORAGE //////////////////////////////////////////////////////////////////////////*/ /// Socket - Settlement layer ISocket public immutable SOCKET; /// SwitchboardRouter ISwitchboardRouter public immutable SWITCHBOARD_ROUTER; /// SwitchboardId assigned to this SwitchboardPlug uint32 public immutable SWITCHBOARD_ID; /// @notice address of switchboard which will validate the incoming messages to the current chain address public immutable INBOUND_SWITCHBOARD; /// @notice address of switchboard which will process outgoing messages to the siblingChain address public immutable OUTBOUND_SWITCHBOARD; /// @notice maps siblingChainSlug to bool to indicate if that chain is already configured mapping(uint32 siblingChainSlug => bool configured) public isConfigured; constructor( address _socket, address _switchboardRouter, address _inboundSwitchboard, address _outboundSwitchboard, uint32 _switchboardId ) { SOCKET = ISocket(_socket); SWITCHBOARD_ROUTER = ISwitchboardRouter(_switchboardRouter); INBOUND_SWITCHBOARD = _inboundSwitchboard; OUTBOUND_SWITCHBOARD = _outboundSwitchboard; SWITCHBOARD_ID = _switchboardId; } /*////////////////////////////////////////////////////////////////////////// EXTERNAL FUNCTIONS //////////////////////////////////////////////////////////////////////////*/ /// @notice Calls Socket to initialise connection with sibling switchboardPlug to send/receive messages /// @param siblingChainSlug chainSlug of the sibling chain /// @param siblingPlug address of the sibling Plug function connect(uint32 siblingChainSlug, address siblingPlug) external { // checks if the caller is Switchboard Router _checkIfSwitchboardRouter(); // checks if siblingPlug is already configured for specified siblingChain // @note if misconfigured and needed to reset again, this check reverts and we need to redeploy the SwitchboardPlug again // @todo do we need this condition? 🔴 // if (isConfigured[siblingChainSlug]) revert ConnectionAlreadyInitialised(); // calls Socket to initialise connection SOCKET.connect(siblingChainSlug, siblingPlug, INBOUND_SWITCHBOARD, OUTBOUND_SWITCHBOARD); // stores connection status isConfigured[siblingChainSlug] = true; } /// @notice Called by SwitchboardRouter to send outgoing settlement messages /// @param siblingChainSlug chainSlug of the sibling chain the message is to be sent to /// @param msgGasLimit gasLimit required to execute the message on the sibling chain /// @param payload payload to be executed on the sibling chain function outbound(uint32 siblingChainSlug, uint256 msgGasLimit, bytes calldata payload) external payable { // checks if the caller is Switchboard Router _checkIfSwitchboardRouter(); // sends message to Socket /// @dev bytes32(0) indicates fast finality transmission SOCKET.outbound{value: msg.value}(siblingChainSlug, msgGasLimit, bytes32(0), bytes32(0), payload); } /// @notice Called by Socket to receive incoming messages on the destination chain /// @param siblingChainSlug chainSlug of the chain the message originated from /// @param payload payload sent from the originating chain function inbound(uint32 siblingChainSlug, bytes calldata payload) external payable { // checks if the caller is Socket _checkIfSocket(); // Calls SwitchboardRouter with the incoming message SWITCHBOARD_ROUTER.receiveAndDeliverMsg(SWITCHBOARD_ID, siblingChainSlug, payload); } /*////////////////////////////////////////////////////////////////////////// INTERNAL FUNCTIONS //////////////////////////////////////////////////////////////////////////*/ /// @notice checks if caller is Switchboard Router function _checkIfSwitchboardRouter() internal view { if (msg.sender != address(SWITCHBOARD_ROUTER)) revert NotSwitchboardRouter(); } /// @notice checks if caller is Socket function _checkIfSocket() internal view { if (msg.sender != address(SOCKET)) revert NotSocket(); } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.17; // TODO - separate our errors depending on which actor they are part of error NotBungeeGateway(); error NotSiblingBungeeGateway(); error NotSocket(); error NotSwitchboardRouter(); error NotSwitchboardPlug(); error SwitchboardPlugZero(); error ConnectionAlreadyInitialised(); error IncorrectSwitchboard(); error InvalidMsg(); error CallerNotCCTPMessageTransmitter();
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; /** * @title IPlug * @notice Interface for a plug contract that executes the message received from a source chain. */ interface IPlug { /** * @dev this should be only executable by socket * @notice executes the message received from source chain * @notice It is expected to have original sender checks in the destination plugs using payload * @param srcChainSlug_ chain slug of source * @param payload_ the data which is needed by plug at inbound call on remote */ function inbound(uint32 srcChainSlug_, bytes calldata payload_) external payable; }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.17; interface ISocketConfig { function getPlugConfig( address plugAddress_, uint32 siblingChainSlug_ ) external view returns ( address siblingPlug, address inboundSwitchboard__, address outboundSwitchboard__, address capacitor__, address decapacitor__ ); } /** * @title ISocket * @notice An interface for a cross-chain communication contract * @dev This interface provides methods for transmitting and executing messages between chains, * connecting a plug to a remote chain and setting up switchboards for the message transmission * This interface also emits events for important operations such as message transmission, execution status, * and plug connection */ interface ISocket is ISocketConfig { /** * @notice registers a message * @dev Packs the message and includes it in a packet with capacitor * @param remoteChainSlug_ the remote chain slug * @param minMsgGasLimit_ the gas limit needed to execute the payload on remote * @param payload_ the data which is needed by plug at inbound call on remote */ function outbound( uint32 remoteChainSlug_, uint256 minMsgGasLimit_, bytes32 executionParams_, bytes32 transmissionParams_, bytes calldata payload_ ) external payable returns (bytes32 msgId); /** * @notice sets the config specific to the plug * @param siblingChainSlug_ the sibling chain slug * @param siblingPlug_ address of plug present at sibling chain to call inbound * @param inboundSwitchboard_ the address of switchboard to use for receiving messages * @param outboundSwitchboard_ the address of switchboard to use for sending messages */ function connect( uint32 siblingChainSlug_, address siblingPlug_, address inboundSwitchboard_, address outboundSwitchboard_ ) external; event PlugConnected( address plug, uint32 siblingChainSlug, address siblingPlug, address inboundSwitchboard, address outboundSwitchboard, address capacitor, address decapacitor ); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.17; import {IPlug} from "./IPlug.sol"; interface ISwitchboardPlug is IPlug { function SWITCHBOARD_ID() external view returns (uint32); function connect(uint32 siblingChainSlug, address siblingPlug) external; function outbound(uint32 siblingChainSlug, uint256 msgGasLimit, bytes calldata payload) external payable; }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.17; interface ISwitchboardRouter { function sendOutboundMsg( uint32 originChainId, uint32 switchboardId, uint8 msgId, uint256 destGasLimit, bytes calldata payload ) external payable; function receiveAndDeliverMsg(uint32 switchboardId, uint32 siblingChainId, bytes calldata payload) external; }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_socket","type":"address"},{"internalType":"address","name":"_switchboardRouter","type":"address"},{"internalType":"address","name":"_inboundSwitchboard","type":"address"},{"internalType":"address","name":"_outboundSwitchboard","type":"address"},{"internalType":"uint32","name":"_switchboardId","type":"uint32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"NotSocket","type":"error"},{"inputs":[],"name":"NotSwitchboardRouter","type":"error"},{"inputs":[],"name":"INBOUND_SWITCHBOARD","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OUTBOUND_SWITCHBOARD","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SOCKET","outputs":[{"internalType":"contract ISocket","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SWITCHBOARD_ID","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SWITCHBOARD_ROUTER","outputs":[{"internalType":"contract ISwitchboardRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"siblingChainSlug","type":"uint32"},{"internalType":"address","name":"siblingPlug","type":"address"}],"name":"connect","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"siblingChainSlug","type":"uint32"},{"internalType":"bytes","name":"payload","type":"bytes"}],"name":"inbound","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint32","name":"siblingChainSlug","type":"uint32"}],"name":"isConfigured","outputs":[{"internalType":"bool","name":"configured","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"siblingChainSlug","type":"uint32"},{"internalType":"uint256","name":"msgGasLimit","type":"uint256"},{"internalType":"bytes","name":"payload","type":"bytes"}],"name":"outbound","outputs":[],"stateMutability":"payable","type":"function"}]
Contract Creation Code
61012060405234801561001157600080fd5b506040516109023803806109028339810160408190526100309161007b565b6001600160a01b0394851660805292841660a05290831660e0529091166101005263ffffffff1660c0526100ed565b80516001600160a01b038116811461007657600080fd5b919050565b600080600080600060a0868803121561009357600080fd5b61009c8661005f565b94506100aa6020870161005f565b93506100b86040870161005f565b92506100c66060870161005f565b9150608086015163ffffffff811681146100df57600080fd5b809150509295509295909350565b60805160a05160c05160e0516101005161079a6101686000396000818160b2015261034f015260008181610227015261032701526000818161017701526104430152600081816101030152818161041601526104b30152600081816101f3015281816102680152818161037701526104fe015261079a6000f3fe6080604052600436106100865760003560e01c8063883dbe0211610059578063883dbe02146101655780638ec4a6e7146101ae578063c41f1f6c146101ce578063d2954f9a146101e1578063d41471ac1461021557600080fd5b80630293f6971461008b5780630a5415e6146100a05780630e4bfd6e146100f15780635ecd1ca614610125575b600080fd5b61009e61009936600461059e565b610249565b005b3480156100ac57600080fd5b506100d47f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100fd57600080fd5b506100d47f000000000000000000000000000000000000000000000000000000000000000081565b34801561013157600080fd5b506101556101403660046105f8565b60006020819052908152604090205460ff1681565b60405190151581526020016100e8565b34801561017157600080fd5b506101997f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016100e8565b3480156101ba57600080fd5b5061009e6101c936600461061a565b6102f4565b61009e6101dc36600461065d565b6103f7565b3480156101ed57600080fd5b506100d47f000000000000000000000000000000000000000000000000000000000000000081565b34801561022157600080fd5b506100d47f000000000000000000000000000000000000000000000000000000000000000081565b6102516104a8565b604051633386774f60e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690633386774f9034906102aa908890889060009081908a908a906004016106d9565b60206040518083038185885af11580156102c8573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906102ed9190610717565b5050505050565b6102fc6104a8565b6040516307637ccf60e31b815263ffffffff831660048201526001600160a01b0382811660248301527f0000000000000000000000000000000000000000000000000000000000000000811660448301527f0000000000000000000000000000000000000000000000000000000000000000811660648301527f00000000000000000000000000000000000000000000000000000000000000001690633b1be67890608401600060405180830381600087803b1580156103bb57600080fd5b505af11580156103cf573d6000803e3d6000fd5b50505063ffffffff9092166000908152602081905260409020805460ff191660011790555050565b6103ff6104f3565b604051634078888360e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690634078888390610471907f000000000000000000000000000000000000000000000000000000000000000090879087908790600401610730565b600060405180830381600087803b15801561048b57600080fd5b505af115801561049f573d6000803e3d6000fd5b50505050505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104f1576040516365dc0c7760e11b815260040160405180910390fd5b565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104f157604051633167e3df60e21b815260040160405180910390fd5b803563ffffffff8116811461055057600080fd5b919050565b60008083601f84011261056757600080fd5b50813567ffffffffffffffff81111561057f57600080fd5b60208301915083602082850101111561059757600080fd5b9250929050565b600080600080606085870312156105b457600080fd5b6105bd8561053c565b935060208501359250604085013567ffffffffffffffff8111156105e057600080fd5b6105ec87828801610555565b95989497509550505050565b60006020828403121561060a57600080fd5b6106138261053c565b9392505050565b6000806040838503121561062d57600080fd5b6106368361053c565b915060208301356001600160a01b038116811461065257600080fd5b809150509250929050565b60008060006040848603121561067257600080fd5b61067b8461053c565b9250602084013567ffffffffffffffff81111561069757600080fd5b6106a386828701610555565b9497909650939450505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b63ffffffff8716815285602082015284604082015283606082015260a06080820152600061070b60a0830184866106b0565b98975050505050505050565b60006020828403121561072957600080fd5b5051919050565b600063ffffffff80871683528086166020840152506060604083015261075a6060830184866106b0565b969550505050505056fea2646970667358221220c410a095e0d923b96a901a5b7fca1dd56ccb31f49e5053ad1d72347d8f7ba20964736f6c63430008130033000000000000000000000000be7241e9d11ec2d1ac86ce217c4a37b7ad1701ce000000000000000000000000fd6b5c873faf51a9a9968eeaf31ec2c9c93dc2a6000000000000000000000000b4ef469c9d8317851270346070da0ece24616e6b000000000000000000000000b4ef469c9d8317851270346070da0ece24616e6b0000000000000000000000000000000000000000000000000000000000000001
Deployed Bytecode
0x6080604052600436106100865760003560e01c8063883dbe0211610059578063883dbe02146101655780638ec4a6e7146101ae578063c41f1f6c146101ce578063d2954f9a146101e1578063d41471ac1461021557600080fd5b80630293f6971461008b5780630a5415e6146100a05780630e4bfd6e146100f15780635ecd1ca614610125575b600080fd5b61009e61009936600461059e565b610249565b005b3480156100ac57600080fd5b506100d47f000000000000000000000000b4ef469c9d8317851270346070da0ece24616e6b81565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100fd57600080fd5b506100d47f000000000000000000000000fd6b5c873faf51a9a9968eeaf31ec2c9c93dc2a681565b34801561013157600080fd5b506101556101403660046105f8565b60006020819052908152604090205460ff1681565b60405190151581526020016100e8565b34801561017157600080fd5b506101997f000000000000000000000000000000000000000000000000000000000000000181565b60405163ffffffff90911681526020016100e8565b3480156101ba57600080fd5b5061009e6101c936600461061a565b6102f4565b61009e6101dc36600461065d565b6103f7565b3480156101ed57600080fd5b506100d47f000000000000000000000000be7241e9d11ec2d1ac86ce217c4a37b7ad1701ce81565b34801561022157600080fd5b506100d47f000000000000000000000000b4ef469c9d8317851270346070da0ece24616e6b81565b6102516104a8565b604051633386774f60e01b81526001600160a01b037f000000000000000000000000be7241e9d11ec2d1ac86ce217c4a37b7ad1701ce1690633386774f9034906102aa908890889060009081908a908a906004016106d9565b60206040518083038185885af11580156102c8573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906102ed9190610717565b5050505050565b6102fc6104a8565b6040516307637ccf60e31b815263ffffffff831660048201526001600160a01b0382811660248301527f000000000000000000000000b4ef469c9d8317851270346070da0ece24616e6b811660448301527f000000000000000000000000b4ef469c9d8317851270346070da0ece24616e6b811660648301527f000000000000000000000000be7241e9d11ec2d1ac86ce217c4a37b7ad1701ce1690633b1be67890608401600060405180830381600087803b1580156103bb57600080fd5b505af11580156103cf573d6000803e3d6000fd5b50505063ffffffff9092166000908152602081905260409020805460ff191660011790555050565b6103ff6104f3565b604051634078888360e01b81526001600160a01b037f000000000000000000000000fd6b5c873faf51a9a9968eeaf31ec2c9c93dc2a61690634078888390610471907f000000000000000000000000000000000000000000000000000000000000000190879087908790600401610730565b600060405180830381600087803b15801561048b57600080fd5b505af115801561049f573d6000803e3d6000fd5b50505050505050565b336001600160a01b037f000000000000000000000000fd6b5c873faf51a9a9968eeaf31ec2c9c93dc2a616146104f1576040516365dc0c7760e11b815260040160405180910390fd5b565b336001600160a01b037f000000000000000000000000be7241e9d11ec2d1ac86ce217c4a37b7ad1701ce16146104f157604051633167e3df60e21b815260040160405180910390fd5b803563ffffffff8116811461055057600080fd5b919050565b60008083601f84011261056757600080fd5b50813567ffffffffffffffff81111561057f57600080fd5b60208301915083602082850101111561059757600080fd5b9250929050565b600080600080606085870312156105b457600080fd5b6105bd8561053c565b935060208501359250604085013567ffffffffffffffff8111156105e057600080fd5b6105ec87828801610555565b95989497509550505050565b60006020828403121561060a57600080fd5b6106138261053c565b9392505050565b6000806040838503121561062d57600080fd5b6106368361053c565b915060208301356001600160a01b038116811461065257600080fd5b809150509250929050565b60008060006040848603121561067257600080fd5b61067b8461053c565b9250602084013567ffffffffffffffff81111561069757600080fd5b6106a386828701610555565b9497909650939450505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b63ffffffff8716815285602082015284604082015283606082015260a06080820152600061070b60a0830184866106b0565b98975050505050505050565b60006020828403121561072957600080fd5b5051919050565b600063ffffffff80871683528086166020840152506060604083015261075a6060830184866106b0565b969550505050505056fea2646970667358221220c410a095e0d923b96a901a5b7fca1dd56ccb31f49e5053ad1d72347d8f7ba20964736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000be7241e9d11ec2d1ac86ce217c4a37b7ad1701ce000000000000000000000000fd6b5c873faf51a9a9968eeaf31ec2c9c93dc2a6000000000000000000000000b4ef469c9d8317851270346070da0ece24616e6b000000000000000000000000b4ef469c9d8317851270346070da0ece24616e6b0000000000000000000000000000000000000000000000000000000000000001
-----Decoded View---------------
Arg [0] : _socket (address): 0xbe7241e9D11EC2D1Ac86CE217c4A37b7aD1701cE
Arg [1] : _switchboardRouter (address): 0xFD6b5c873fAf51a9a9968eeaF31EC2C9C93DC2A6
Arg [2] : _inboundSwitchboard (address): 0xb4Ef469c9d8317851270346070dA0ecE24616E6b
Arg [3] : _outboundSwitchboard (address): 0xb4Ef469c9d8317851270346070dA0ecE24616E6b
Arg [4] : _switchboardId (uint32): 1
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000be7241e9d11ec2d1ac86ce217c4a37b7ad1701ce
Arg [1] : 000000000000000000000000fd6b5c873faf51a9a9968eeaf31ec2c9c93dc2a6
Arg [2] : 000000000000000000000000b4ef469c9d8317851270346070da0ece24616e6b
Arg [3] : 000000000000000000000000b4ef469c9d8317851270346070da0ece24616e6b
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000001
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
FTM | 100.00% | $0.710622 | 4.2498 | $3.02 |
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.