Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
NetworkMiddlewareService
Compiler Version
v0.8.25+commit.b61c2a91
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.25; import {INetworkMiddlewareService} from "../../interfaces/service/INetworkMiddlewareService.sol"; import {IRegistry} from "../../interfaces/common/IRegistry.sol"; contract NetworkMiddlewareService is INetworkMiddlewareService { /** * @inheritdoc INetworkMiddlewareService */ address public immutable NETWORK_REGISTRY; /** * @inheritdoc INetworkMiddlewareService */ mapping(address network => address value) public middleware; constructor( address networkRegistry ) { NETWORK_REGISTRY = networkRegistry; } /** * @inheritdoc INetworkMiddlewareService */ function setMiddleware( address middleware_ ) external { if (!IRegistry(NETWORK_REGISTRY).isEntity(msg.sender)) { revert NotNetwork(); } if (middleware[msg.sender] == middleware_) { revert AlreadySet(); } middleware[msg.sender] = middleware_; emit SetMiddleware(msg.sender, middleware_); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface INetworkMiddlewareService { error AlreadySet(); error NotNetwork(); /** * @notice Emitted when a middleware is set for a network. * @param network address of the network * @param middleware new middleware of the network */ event SetMiddleware(address indexed network, address middleware); /** * @notice Get the network registry's address. * @return address of the network registry */ function NETWORK_REGISTRY() external view returns (address); /** * @notice Get a given network's middleware. * @param network address of the network * @return middleware of the network */ function middleware( address network ) external view returns (address); /** * @notice Set a new middleware for a calling network. * @param middleware new middleware of the network */ function setMiddleware( address middleware ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IRegistry { error EntityNotExist(); /** * @notice Emitted when an entity is added. * @param entity address of the added entity */ event AddEntity(address indexed entity); /** * @notice Get if a given address is an entity. * @param account address to check * @return if the given address is an entity */ function isEntity( address account ) external view returns (bool); /** * @notice Get a total number of entities. * @return total number of entities added */ function totalEntities() external view returns (uint256); /** * @notice Get an entity given its index. * @param index index of the entity to get * @return address of the entity */ function entity( uint256 index ) external view returns (address); }
{ "remappings": [ "forge-std/=lib/forge-std/src/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": true, "libraries": {} }
[{"inputs":[{"internalType":"address","name":"networkRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadySet","type":"error"},{"inputs":[],"name":"NotNetwork","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"network","type":"address"},{"indexed":false,"internalType":"address","name":"middleware","type":"address"}],"name":"SetMiddleware","type":"event"},{"inputs":[],"name":"NETWORK_REGISTRY","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"network","type":"address"}],"name":"middleware","outputs":[{"internalType":"address","name":"value","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"middleware_","type":"address"}],"name":"setMiddleware","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a034606c57601f6102ef38819003918201601f19168301916001600160401b03831184841017607157808492602094604052833981010312606c57516001600160a01b0381168103606c5760805260405161026790816100888239608051818181605901526101120152f35b600080fd5b634e487b7160e01b600052604160045260246000fdfe608060408181526004918236101561001657600080fd5b600092833560e01c918263b7d8e1a9146100d057508163bb5ed0321461008c575063c0cd7c3e1461004657600080fd5b34610088578160031936011261008857517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b5080fd5b9050346100cc5760203660031901126100cc576001600160a01b039035818116908190036100c857838391602095528085522054169051908152f35b8380fd5b8280fd5b849184346100c8576020918260031936011261022d576001600160a01b0381358181169590869003610205576302910f8b60e31b8152338382015284816024817f000000000000000000000000000000000000000000000000000000000000000086165afa9081156102235787916101bf575b50156101b057338652858452828620541684146101a257503380855284835281852080546001600160a01b031916851790559051928352917ff64e2a8734392e221de13f5e56deb22d308e292cad394052affa97dbaf41ec989190a280f35b905163a741a04560e01b8152fd5b5090516323d53b9760e21b8152fd5b9050843d861161021c575b601f8101601f1916820167ffffffffffffffff8111838210176102095786918391875281010312610205575180151581036102055787610143565b8680fd5b634e487b7160e01b895260418552602489fd5b503d6101ca565b84513d89823e3d90fd5b8480fdfea264697066735822122008389c986676a26096965653d28442dd5e8ca96a65747ec2220f274a829e84f964736f6c634300081900330000000000000000000000006fee87ff83799eb1eb5314b10296c4920c39803f
Deployed Bytecode
0x608060408181526004918236101561001657600080fd5b600092833560e01c918263b7d8e1a9146100d057508163bb5ed0321461008c575063c0cd7c3e1461004657600080fd5b34610088578160031936011261008857517f0000000000000000000000006fee87ff83799eb1eb5314b10296c4920c39803f6001600160a01b03168152602090f35b5080fd5b9050346100cc5760203660031901126100cc576001600160a01b039035818116908190036100c857838391602095528085522054169051908152f35b8380fd5b8280fd5b849184346100c8576020918260031936011261022d576001600160a01b0381358181169590869003610205576302910f8b60e31b8152338382015284816024817f0000000000000000000000006fee87ff83799eb1eb5314b10296c4920c39803f86165afa9081156102235787916101bf575b50156101b057338652858452828620541684146101a257503380855284835281852080546001600160a01b031916851790559051928352917ff64e2a8734392e221de13f5e56deb22d308e292cad394052affa97dbaf41ec989190a280f35b905163a741a04560e01b8152fd5b5090516323d53b9760e21b8152fd5b9050843d861161021c575b601f8101601f1916820167ffffffffffffffff8111838210176102095786918391875281010312610205575180151581036102055787610143565b8680fd5b634e487b7160e01b895260418552602489fd5b503d6101ca565b84513d89823e3d90fd5b8480fdfea264697066735822122008389c986676a26096965653d28442dd5e8ca96a65747ec2220f274a829e84f964736f6c63430008190033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000006fee87ff83799eb1eb5314b10296c4920c39803f
-----Decoded View---------------
Arg [0] : networkRegistry (address): 0x6fEe87ff83799EB1eB5314B10296C4920C39803f
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000006fee87ff83799eb1eb5314b10296c4920c39803f
Loading...
Loading
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.