Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- BlockedMessageLib
- Optimization enabled
- true
- Compiler version
- v0.8.22+commit.4fc1097e
- Optimization runs
- 20000
- EVM Version
- paris
- Verified at
- 2025-03-28T00:20:59.284984Z
contracts/messagelib/BlockedMessageLib.sol
// SPDX-License-Identifier: LZBL-1.2
pragma solidity ^0.8.20;
import { ERC165 } from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import { IMessageLib, MessageLibType } from "../interfaces/IMessageLib.sol";
import { Errors } from "../libs/Errors.sol";
contract BlockedMessageLib is ERC165 {
function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
return interfaceId == type(IMessageLib).interfaceId || super.supportsInterface(interfaceId);
}
function version() external pure returns (uint64 major, uint8 minor, uint8 endpointVersion) {
return (type(uint64).max, type(uint8).max, 2);
}
function messageLibType() external pure returns (MessageLibType) {
return MessageLibType.SendAndReceive;
}
function isSupportedEid(uint32) external pure returns (bool) {
return true;
}
fallback() external {
revert Errors.LZ_NotImplemented();
}
}
@openzeppelin/contracts/utils/introspection/ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
@openzeppelin/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
contracts/interfaces/IMessageLib.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import { SetConfigParam } from "./IMessageLibManager.sol";
enum MessageLibType {
Send,
Receive,
SendAndReceive
}
interface IMessageLib is IERC165 {
function setConfig(address _oapp, SetConfigParam[] calldata _config) external;
function getConfig(uint32 _eid, address _oapp, uint32 _configType) external view returns (bytes memory config);
function isSupportedEid(uint32 _eid) external view returns (bool);
// message libs of same major version are compatible
function version() external view returns (uint64 major, uint8 minor, uint8 endpointVersion);
function messageLibType() external view returns (MessageLibType);
}
contracts/interfaces/IMessageLibManager.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
struct SetConfigParam {
uint32 eid;
uint32 configType;
bytes config;
}
interface IMessageLibManager {
struct Timeout {
address lib;
uint256 expiry;
}
event LibraryRegistered(address newLib);
event DefaultSendLibrarySet(uint32 eid, address newLib);
event DefaultReceiveLibrarySet(uint32 eid, address newLib);
event DefaultReceiveLibraryTimeoutSet(uint32 eid, address oldLib, uint256 expiry);
event SendLibrarySet(address sender, uint32 eid, address newLib);
event ReceiveLibrarySet(address receiver, uint32 eid, address newLib);
event ReceiveLibraryTimeoutSet(address receiver, uint32 eid, address oldLib, uint256 timeout);
function registerLibrary(address _lib) external;
function isRegisteredLibrary(address _lib) external view returns (bool);
function getRegisteredLibraries() external view returns (address[] memory);
function setDefaultSendLibrary(uint32 _eid, address _newLib) external;
function defaultSendLibrary(uint32 _eid) external view returns (address);
function setDefaultReceiveLibrary(uint32 _eid, address _newLib, uint256 _gracePeriod) external;
function defaultReceiveLibrary(uint32 _eid) external view returns (address);
function setDefaultReceiveLibraryTimeout(uint32 _eid, address _lib, uint256 _expiry) external;
function defaultReceiveLibraryTimeout(uint32 _eid) external view returns (address lib, uint256 expiry);
function isSupportedEid(uint32 _eid) external view returns (bool);
function isValidReceiveLibrary(address _receiver, uint32 _eid, address _lib) external view returns (bool);
/// ------------------- OApp interfaces -------------------
function setSendLibrary(address _oapp, uint32 _eid, address _newLib) external;
function getSendLibrary(address _sender, uint32 _eid) external view returns (address lib);
function isDefaultSendLibrary(address _sender, uint32 _eid) external view returns (bool);
function setReceiveLibrary(address _oapp, uint32 _eid, address _newLib, uint256 _gracePeriod) external;
function getReceiveLibrary(address _receiver, uint32 _eid) external view returns (address lib, bool isDefault);
function setReceiveLibraryTimeout(address _oapp, uint32 _eid, address _lib, uint256 _expiry) external;
function receiveLibraryTimeout(address _receiver, uint32 _eid) external view returns (address lib, uint256 expiry);
function setConfig(address _oapp, address _lib, SetConfigParam[] calldata _params) external;
function getConfig(
address _oapp,
address _lib,
uint32 _eid,
uint32 _configType
) external view returns (bytes memory config);
}
contracts/libs/Errors.sol
// SPDX-License-Identifier: LZBL-1.2
pragma solidity ^0.8.20;
library Errors {
error LZ_LzTokenUnavailable();
error LZ_InvalidReceiveLibrary();
error LZ_InvalidNonce(uint64 nonce);
error LZ_InvalidArgument();
error LZ_InvalidExpiry();
error LZ_InvalidAmount(uint256 required, uint256 supplied);
error LZ_OnlyRegisteredOrDefaultLib();
error LZ_OnlyRegisteredLib();
error LZ_OnlyNonDefaultLib();
error LZ_Unauthorized();
error LZ_DefaultSendLibUnavailable();
error LZ_DefaultReceiveLibUnavailable();
error LZ_PathNotInitializable();
error LZ_PathNotVerifiable();
error LZ_OnlySendLib();
error LZ_OnlyReceiveLib();
error LZ_UnsupportedEid();
error LZ_UnsupportedInterface();
error LZ_AlreadyRegistered();
error LZ_SameValue();
error LZ_InvalidPayloadHash();
error LZ_PayloadHashNotFound(bytes32 expected, bytes32 actual);
error LZ_ComposeNotFound(bytes32 expected, bytes32 actual);
error LZ_ComposeExists();
error LZ_SendReentrancy();
error LZ_NotImplemented();
error LZ_InsufficientFee(
uint256 requiredNative,
uint256 suppliedNative,
uint256 requiredLzToken,
uint256 suppliedLzToken
);
error LZ_ZeroLzTokenFee();
}
Compiler Settings
{"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":20000,"enabled":true},"libraries":{},"evmVersion":"paris"}
Contract ABI
[{"type":"error","name":"LZ_NotImplemented","inputs":[]},{"type":"fallback","stateMutability":"nonpayable"},{"type":"function","stateMutability":"pure","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isSupportedEid","inputs":[{"type":"uint32","name":"","internalType":"uint32"}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"uint8","name":"","internalType":"enum MessageLibType"}],"name":"messageLibType","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"uint64","name":"major","internalType":"uint64"},{"type":"uint8","name":"minor","internalType":"uint8"},{"type":"uint8","name":"endpointVersion","internalType":"uint8"}],"name":"version","inputs":[]}]
Contract Creation Code
0x608060405234801561001057600080fd5b5061026f806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806301ffc9a71461007e5780631881d94d146100a657806354fd4d50146100b55780636750cd4c146100dc575b6040517f2657b6c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61009161008c366004610189565b6100f0565b60405190151581526020015b60405180910390f35b600260405161009d91906101d2565b6040805167ffffffffffffffff815260ff602082015260029181019190915260600161009d565b6100916100ea366004610213565b50600190565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f97f0258400000000000000000000000000000000000000000000000000000000148061018357507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60006020828403121561019b57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146101cb57600080fd5b9392505050565b602081016003831061020d577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b60006020828403121561022557600080fd5b813563ffffffff811681146101cb57600080fdfea2646970667358221220468116af6289d47cca395a20001eab24a8adf35da1e528b23e346fe87a8bc04064736f6c63430008160033
Deployed ByteCode
0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806301ffc9a71461007e5780631881d94d146100a657806354fd4d50146100b55780636750cd4c146100dc575b6040517f2657b6c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61009161008c366004610189565b6100f0565b60405190151581526020015b60405180910390f35b600260405161009d91906101d2565b6040805167ffffffffffffffff815260ff602082015260029181019190915260600161009d565b6100916100ea366004610213565b50600190565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f97f0258400000000000000000000000000000000000000000000000000000000148061018357507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60006020828403121561019b57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146101cb57600080fd5b9392505050565b602081016003831061020d577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b60006020828403121561022557600080fd5b813563ffffffff811681146101cb57600080fdfea2646970667358221220468116af6289d47cca395a20001eab24a8adf35da1e528b23e346fe87a8bc04064736f6c63430008160033