ReceiveUln301
0x15e51701f245f6d5bd0fee87bcaf55b0841451b3
Verification
Verified
v0.8.22+commit.4fc1097e
Type
Contract
12,985 bytes
ABI entries
48
12 read · 8 write
License
none
Contract information
- Address
- 0x15e51701f245f6d5bd0fee87bcaf55b0841451b3
- Chain
- Robinhood Chain (4663)
- Compiler
- v0.8.22+commit.4fc1097e
- Optimization
- Enabled
- Creator
- 0x9F403140Bc…1Bbd4eF327
- Creation tx
- 0x2e80718e17…9565f2df0f
Token
Not a token
This contract does not expose ERC-20 metadata.
Read contract (12)
addressSizes(uint32) → uint256
assertHeader(bytes, uint32)
defaultExecutors(uint32) → address
executors(address, uint32) → address
getAppUlnConfig(address, uint32) → tuple
getConfig(uint16, address, uint256) → bytes
getExecutor(address, uint32) → address
getUlnConfig(address, uint32) → tuple
hashLookup(bytes32, bytes32, address) → bool, uint64
owner() → address
verifiable(tuple, bytes32, bytes32) → bool
version() → uint64, uint8, uint8
Events (9)
AddressSizeSetDefaultExecutorsSetDefaultUlnConfigsSetExecutorSetInvalidDstOwnershipTransferredPacketDeliveredPayloadVerifiedUlnConfigSet
ABI
[
{
"inputs": [
{
"internalType": "address",
"name": "_endpoint",
"type": "address"
},
{
"internalType": "uint32",
"name": "_localEid",
"type": "uint32"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "AddressCast_InvalidSizeForAddress",
"type": "error"
},
{
"inputs": [],
"name": "AddressSizeConfig_AddressSizeAlreadySet",
"type": "error"
},
{
"inputs": [],
"name": "AddressSizeConfig_InvalidAddressSize",
"type": "error"
},
{
"inputs": [],
"name": "LZ_MessageLib_InvalidExecutor",
"type": "error"
},
{
"inputs": [],
"name": "LZ_MessageLib_OnlyEndpoint",
"type": "error"
},
{
"inputs": [],
"name": "LZ_MessageLib_OnlyExecutor",
"type": "error"
},
{
"inputs": [],
"name": "LZ_ULN_AtLeastOneDVN",
"type": "error"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "configType",
"type": "uint256"
}
],
"name": "LZ_ULN_InvalidConfigType",
"type": "error"
},
{
"inputs": [],
"name": "LZ_ULN_InvalidConfirmations",
"type": "error"
},
{
"inputs": [],
"name": "LZ_ULN_InvalidEid",
"type": "error"
},
{
"inputs": [],
"name": "LZ_ULN_InvalidOptionalDVNCount",
"type": "error"
},
{
"inputs": [],
"name": "LZ_ULN_InvalidOptionalDVNThreshold",
"type": "error"
},
{
"inputs": [],
"name": "LZ_ULN_InvalidPacketHeader",
"type": "error"
},
{
"inputs": [],
"name": "LZ_ULN_InvalidPacketVersion",
"type": "error"
},
{
"inputs": [],
"name": "LZ_ULN_InvalidRequiredDVNCount",
"type": "error"
},
{
"inputs": [],
"name": "LZ_ULN_Unsorted",
"type": "error"
},
{
"inputs": [
{
"internalType": "uint32",
"name": "eid",
"type": "uint32"
}
],
"name": "LZ_ULN_UnsupportedEid",
"type": "error"
},
{
"inputs": [],
"name": "LZ_ULN_Verifying",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint16",
"name": "eid",
"type": "uint16"
},
{
"indexed": false,
"internalType": "uint256",
"name": "size",
"type": "uint256"
}
],
"name": "AddressSizeSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"components": [
{
"internalType": "uint32",
"name": "eid",
"type": "uint32"
},
{
"internalType": "address",
"name": "executor",
"type": "address"
}
],
"indexed": false,
"internalType": "struct SetDefaultExecutorParam[]",
"name": "params",
"type": "tuple[]"
}
],
"name": "DefaultExecutorsSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"components": [
{
"internalType": "uint32",
"name": "eid",
"type": "uint32"
},
{
"components": [
{
"internalType": "uint64",
"name": "confirmations",
"type": "uint64"
},
{
"internalType": "uint8",
"name": "requiredDVNCount",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "optionalDVNCount",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "optionalDVNThreshold",
"type": "uint8"
},
{
"internalType": "address[]",
"name": "requiredDVNs",
"type": "address[]"
},
{
"internalType": "address[]",
"name": "optionalDVNs",
"type": "address[]"
}
],
"internalType": "struct UlnConfig",
"name": "config",
"type": "tuple"
}
],
"indexed": false,
"internalType": "struct SetDefaultUlnConfigParam[]",
"name": "params",
"type": "tuple[]"
}
],
"name": "DefaultUlnConfigsSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "oapp",
"type": "address"
},
{
"indexed": false,
"internalType": "uint32",
"name": "eid",
"type": "uint32"
},
{
"indexed": false,
"internalType": "address",
"name": "executor",
"type": "address"
}
],
"name": "ExecutorSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint16",
"name": "srcChainId",
"type": "uint16"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "srcAddress",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "dstAddress",
"type": "address"
},
{
"indexed": false,
"internalType": "uint64",
"name": "nonce",
"type": "uint64"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "payloadHash",
"type": "bytes32"
}
],
"name": "InvalidDst",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"components": [
{
"internalType": "uint32",
"name": "srcEid",
"type": "uint32"
},
{
"internalType": "bytes32",
"name": "sender",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "nonce",
"type": "uint64"
}
],
"indexed": false,
"internalType": "struct Origin",
"name": "origin",
"type": "tuple"
},
{
"indexed": false,
"internalType": "address",
"name": "receiver",
"type": "address"
}
],
"name": "PacketDelivered",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "dvn",
"type": "address"
},
{
"indexed": false,
"internalType": "bytes",
"name": "header",
"type": "bytes"
},
{
"indexed": false,
"internalType": "uint256",
"name": "confirmations",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "proofHash",
"type": "bytes32"
}
],
"name": "PayloadVerified",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "oapp",
"type": "address"
},
{
"indexed": false,
"internalType": "uint32",
"name": "eid",
"type": "uint32"
},
{
"components": [
{
"internalType": "uint64",
"name": "confirmations",
"type": "uint64"
},
{
"internalType": "uint8",
"name": "requiredDVNCount",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "optionalDVNCount",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "optionalDVNThreshold",
"type": "uint8"
},
{
"internalType": "address[]",
"name": "requiredDVNs",
"type": "address[]"
},
{
"internalType": "address[]",
"name": "optionalDVNs",
"type": "address[]"
}
],
"indexed": false,
"internalType": "struct UlnConfig",
"name": "config",
"type": "tuple"
}
],
"name": "UlnConfigSet",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint32",
"name": "dstEid",
"type": "uint32"
}
],
"name": "addressSizes",
"outputs": [
{
"internalType": "uint256",
"name": "size",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes",
"name": "_packetHeader",
"type": "bytes"
},
{
"internalType": "uint32",
"name": "_localEid",
"type": "uint32"
}
],
"name": "assertHeader",
"outputs": [],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes",
"name": "_packet",
"type": "bytes"
},
{
"internalType": "uint256",
"name": "_gasLimit",
"type": "uint256"
}
],
"name": "commitVerification",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint32",
"name": "eid",
"type": "uint32"
}
],
"name": "defaultExecutors",
"outputs": [
{
"internalType": "address",
"name": "executor",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "oapp",
"type": "address"
},
{
"internalType": "uint32",
"name": "eid",
"type": "uint32"
}
],
"name": "executors",
"outputs": [
{
"internalType": "address",
"name": "executor",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_oapp",
"type": "address"
},
{
"internalType": "uint32",
"name": "_remoteEid",
"type": "uint32"
}
],
"name": "getAppUlnConfig",
"outputs": [
{
"components": [
{
"internalType": "uint64",
"name": "confirmations",
"type": "uint64"
},
{
"internalType": "uint8",
"name": "requiredDVNCount",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "optionalDVNCount",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "optionalDVNThreshold",
"type": "uint8"
},
{
"internalType": "address[]",
"name": "requiredDVNs",
"type": "address[]"
},
{
"internalType": "address[]",
"name": "optionalDVNs",
"type": "address[]"
}
],
"internalType": "struct UlnConfig",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint16",
"name": "_eid",
"type": "uint16"
},
{
"internalType": "address",
"name": "_oapp",
"type": "address"
},
{
"internalType": "uint256",
"name": "_configType",
"type": "uint256"
}
],
"name": "getConfig",
"outputs": [
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_oapp",
"type": "address"
},
{
"internalType": "uint32",
"name": "_remoteEid",
"type": "uint32"
}
],
"name": "getExecutor",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_oapp",
"type": "address"
},
{
"internalType": "uint32",
"name": "_remoteEid",
"type": "uint32"
}
],
"name": "getUlnConfig",
"outputs": [
{
"components": [
{
"internalType": "uint64",
"name": "confirmations",
"type": "uint64"
},
{
"internalType": "uint8",
"name": "requiredDVNCount",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "optionalDVNCount",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "optionalDVNThreshold",
"type": "uint8"
},
{
"internalType": "address[]",
"name": "requiredDVNs",
"type": "address[]"
},
{
"internalType": "address[]",
"name": "optionalDVNs",
"type": "address[]"
}
],
"internalType": "struct UlnConfig",
"name": "rtnConfig",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "headerHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "payloadHash",
"type": "bytes32"
},
{
"internalType": "address",
"name": "dvn",
"type": "address"
}
],
"name": "hashLookup",
"outputs": [
{
"internalType": "bool",
"name": "submitted",
"type": "bool"
},
{
"internalType": "uint64",
"name": "confirmations",
"type": "uint64"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint16",
"name": "_eid",
"type": "uint16"
},
{
"internalType": "uint256",
"name": "_size",
"type": "uint256"
}
],
"name": "setAddressSize",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint16",
"name": "_eid",
"type": "uint16"
},
{
"internalType": "address",
"name": "_oapp",
"type": "address"
},
{
"internalType": "uint256",
"name": "_configType",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "_config",
"type": "bytes"
}
],
"name": "setConfig",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "uint32",
"name": "eid",
"type": "uint32"
},
{
"internalType": "address",
"name": "executor",
"type": "address"
}
],
"internalType": "struct SetDefaultExecutorParam[]",
"name": "_params",
"type": "tuple[]"
}
],
"name": "setDefaultExecutors",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "uint32",
"name": "eid",
"type": "uint32"
},
{
"components": [
{
"internalType": "uint64",
"name": "confirmations",
"type": "uint64"
},
{
"internalType": "uint8",
"name": "requiredDVNCount",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "optionalDVNCount",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "optionalDVNThreshold",
"type": "uint8"
},
{
"internalType": "address[]",
"name": "requiredDVNs",
"type": "address[]"
},
{
"internalType": "address[]",
"name": "optionalDVNs",
"type": "address[]"
}
],
"internalType": "struct UlnConfig",
"name": "config",
"type": "tuple"
}
],
"internalType": "struct SetDefaultUlnConfigParam[]",
"name": "_params",
"type": "tuple[]"
}
],
"name": "setDefaultUlnConfigs",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "uint64",
"name": "confirmations",
"type": "uint64"
},
{
"internalType": "uint8",
"name": "requiredDVNCount",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "optionalDVNCount",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "optionalDVNThreshold",
"type": "uint8"
},
{
"internalType": "address[]",
"name": "requiredDVNs",
"type": "address[]"
},
{
"internalType": "address[]",
"name": "optionalDVNs",
"type": "address[]"
}
],
"internalType": "struct UlnConfig",
"name": "_config",
"type": "tuple"
},
{
"internalType": "bytes32",
"name": "_headerHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "_payloadHash",
"type": "bytes32"
}
],
"name": "verifiable",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes",
"name": "_packetHeader",
"type": "bytes"
},
{
"internalType": "bytes32",
"name": "_payloadHash",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "_confirmations",
"type": "uint64"
}
],
"name": "verify",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "version",
"outputs": [
{
"internalType": "uint64",
"name": "major",
"type": "uint64"
},
{
"internalType": "uint8",
"name": "minor",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "endpointVersion",
"type": "uint8"
}
],
"stateMutability": "pure",
"type": "function"
}
]Source code
// SPDX-License-Identifier: LZBL-1.2
pragma solidity ^0.8.20;
import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
import { PacketV1Codec } from "@layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/PacketV1Codec.sol";
import { IUltraLightNode301 } from "./interfaces/IUltraLightNode301.sol";
import { ReceiveLibBaseE1 } from "./ReceiveLibBaseE1.sol";
import { ReceiveUlnBase } from "../ReceiveUlnBase.sol";
import { UlnConfig } from "../UlnBase.sol";
/// @dev ULN301 will be deployed on EndpointV1 and is for backward compatibility with ULN302 on EndpointV2. 301 can talk to both 301 and 302
/// @dev This is a gluing contract. It simply parses the requests and forward to the super.impl() accordingly.
/// @dev In this case, it combines the logic of ReceiveUlnBase and ReceiveLibBaseE1
contract ReceiveUln301 is IUltraLightNode301, ReceiveUlnBase, ReceiveLibBaseE1 {
using PacketV1Codec for bytes;
using SafeCast for uint32; // for chain ID uint32 to uint16 conversion
uint256 internal constant CONFIG_TYPE_EXECUTOR = 1;
uint256 internal constant CONFIG_TYPE_ULN = 2;
error LZ_ULN_InvalidConfigType(uint256 configType);
constructor(address _endpoint, uint32 _localEid) ReceiveLibBaseE1(_endpoint, _localEid) {}
// ============================ OnlyEndpoint ===================================
function setConfig(
uint16 _eid,
address _oapp,
uint256 _configType,
bytes calldata _config
) external override onlyEndpoint {
_assertSupportedEid(_eid);
if (_configType == CONFIG_TYPE_EXECUTOR) {
_setExecutor(_eid, _oapp, abi.decode(_config, (address)));
} else if (_configType == CONFIG_TYPE_ULN) {
_setUlnConfig(_eid, _oapp, abi.decode(_config, (UlnConfig)));
} else {
revert LZ_ULN_InvalidConfigType(_configType);
}
}
// ============================ External ===================================
/// @dev in 301, this is equivalent to execution as in Endpoint V2
/// @dev dont need to check endpoint verifiable here to save gas, as it will reverts if not verifiable.
function commitVerification(bytes calldata _packet, uint256 _gasLimit) external {
bytes calldata header = _packet.header();
_assertHeader(header, localEid);
// cache these values to save gas
address receiver = _packet.receiverB20();
uint16 srcEid = _packet.srcEid().toUint16();
UlnConfig memory config = getUlnConfig(receiver, srcEid);
_verifyAndReclaimStorage(config, keccak256(header), _packet.payloadHash());
// endpoint will revert if nonce != ++inboundNonce
_execute(srcEid, _packet.sender(), receiver, _packet.nonce(), _packet.message(), _gasLimit);
}
function verify(bytes calldata _packetHeader, bytes32 _payloadHash, uint64 _confirmations) external {
_verify(_packetHeader, _payloadHash, _confirmations);
}
// ============================ View ===================================
function getConfig(uint16 _eid, address _oapp, uint256 _configType) external view override returns (bytes memory) {
if (_configType == CONFIG_TYPE_EXECUTOR) {
return abi.encode(getExecutor(_oapp, _eid));
} else if (_configType == CONFIG_TYPE_ULN) {
return abi.encode(getUlnConfig(_oapp, _eid));
} else {
revert LZ_ULN_InvalidConfigType(_configType);
}
}
function version() external pure returns (uint64 major, uint8 minor, uint8 endpointVersion) {
return (3, 0, 1);
}
}
Chain explorer3790msChain node85ms