ReceiveUln302
0xe1844c5d63a9543023008d332bd3d2e6f1fe1043
Verification
Verified
v0.8.22+commit.4fc1097e
Type
Contract
11,010 bytes
ABI entries
35
11 read · 6 write
License
none
Contract information
- Address
- 0xe1844c5d63a9543023008d332bd3d2e6f1fe1043
- Chain
- Robinhood Chain (4663)
- Compiler
- v0.8.22+commit.4fc1097e
- Optimization
- Enabled
- Creator
- 0x9F403140Bc…1Bbd4eF327
- Creation tx
- 0xda77903593…c52235c2d2
Token
Not a token
This contract does not expose ERC-20 metadata.
Read contract (11)
assertHeader(bytes, uint32)
getAppUlnConfig(address, uint32) → tuple
getConfig(uint32, address, uint32) → bytes
getUlnConfig(address, uint32) → tuple
hashLookup(bytes32, bytes32, address) → bool, uint64
isSupportedEid(uint32) → bool
messageLibType() → uint8
owner() → address
supportsInterface(bytes4) → bool
verifiable(tuple, bytes32, bytes32) → bool
version() → uint64, uint8, uint8
Events (4)
DefaultUlnConfigsSetOwnershipTransferredPayloadVerifiedUlnConfigSet
ABI
[
{
"inputs": [
{
"internalType": "address",
"name": "_endpoint",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "LZ_MessageLib_OnlyEndpoint",
"type": "error"
},
{
"inputs": [],
"name": "LZ_ULN_AtLeastOneDVN",
"type": "error"
},
{
"inputs": [
{
"internalType": "uint32",
"name": "configType",
"type": "uint32"
}
],
"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": [
{
"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": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"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": "bytes",
"name": "_packetHeader",
"type": "bytes"
},
{
"internalType": "uint32",
"name": "_localEid",
"type": "uint32"
}
],
"name": "assertHeader",
"outputs": [],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes",
"name": "_packetHeader",
"type": "bytes"
},
{
"internalType": "bytes32",
"name": "_payloadHash",
"type": "bytes32"
}
],
"name": "commitVerification",
"outputs": [],
"stateMutability": "nonpayable",
"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": "uint32",
"name": "_eid",
"type": "uint32"
},
{
"internalType": "address",
"name": "_oapp",
"type": "address"
},
{
"internalType": "uint32",
"name": "_configType",
"type": "uint32"
}
],
"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": "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": [
{
"internalType": "uint32",
"name": "_eid",
"type": "uint32"
}
],
"name": "isSupportedEid",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "messageLibType",
"outputs": [
{
"internalType": "enum MessageLibType",
"name": "",
"type": "uint8"
}
],
"stateMutability": "pure",
"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": "address",
"name": "_oapp",
"type": "address"
},
{
"components": [
{
"internalType": "uint32",
"name": "eid",
"type": "uint32"
},
{
"internalType": "uint32",
"name": "configType",
"type": "uint32"
},
{
"internalType": "bytes",
"name": "config",
"type": "bytes"
}
],
"internalType": "struct SetConfigParam[]",
"name": "_params",
"type": "tuple[]"
}
],
"name": "setConfig",
"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": "bytes4",
"name": "_interfaceId",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"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 { PacketV1Codec } from "@layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/PacketV1Codec.sol";
import { SetConfigParam } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessageLibManager.sol";
import { ILayerZeroEndpointV2, Origin } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol";
import { IReceiveUlnE2 } from "../interfaces/IReceiveUlnE2.sol";
import { ReceiveUlnBase } from "../ReceiveUlnBase.sol";
import { ReceiveLibBaseE2 } from "../../ReceiveLibBaseE2.sol";
import { UlnConfig } from "../UlnBase.sol";
/// @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 ReceiveLibBaseE2
contract ReceiveUln302 is IReceiveUlnE2, ReceiveUlnBase, ReceiveLibBaseE2 {
using PacketV1Codec for bytes;
/// @dev CONFIG_TYPE_ULN=2 here to align with SendUln302/ReceiveUln302/ReceiveUln301
uint32 internal constant CONFIG_TYPE_ULN = 2;
error LZ_ULN_InvalidConfigType(uint32 configType);
constructor(address _endpoint) ReceiveLibBaseE2(_endpoint) {}
function supportsInterface(bytes4 _interfaceId) public view override returns (bool) {
return _interfaceId == type(IReceiveUlnE2).interfaceId || super.supportsInterface(_interfaceId);
}
// ============================ OnlyEndpoint ===================================
// only the ULN config on the receive side
function setConfig(address _oapp, SetConfigParam[] calldata _params) external override onlyEndpoint {
for (uint256 i = 0; i < _params.length; i++) {
SetConfigParam calldata param = _params[i];
_assertSupportedEid(param.eid);
if (param.configType == CONFIG_TYPE_ULN) {
_setUlnConfig(param.eid, _oapp, abi.decode(param.config, (UlnConfig)));
} else {
revert LZ_ULN_InvalidConfigType(param.configType);
}
}
}
// ============================ External ===================================
/// @dev dont need to check endpoint verifiable here to save gas, as it will reverts if not verifiable.
function commitVerification(bytes calldata _packetHeader, bytes32 _payloadHash) external {
_assertHeader(_packetHeader, localEid);
// cache these values to save gas
address receiver = _packetHeader.receiverB20();
uint32 srcEid = _packetHeader.srcEid();
UlnConfig memory config = getUlnConfig(receiver, srcEid);
_verifyAndReclaimStorage(config, keccak256(_packetHeader), _payloadHash);
Origin memory origin = Origin(srcEid, _packetHeader.sender(), _packetHeader.nonce());
// endpoint will revert if nonce <= lazyInboundNonce
ILayerZeroEndpointV2(endpoint).verify(origin, receiver, _payloadHash);
}
/// @dev for dvn to verify the payload
function verify(bytes calldata _packetHeader, bytes32 _payloadHash, uint64 _confirmations) external {
_verify(_packetHeader, _payloadHash, _confirmations);
}
// ============================ View ===================================
function getConfig(uint32 _eid, address _oapp, uint32 _configType) external view override returns (bytes memory) {
if (_configType == CONFIG_TYPE_ULN) {
return abi.encode(getUlnConfig(_oapp, _eid));
} else {
revert LZ_ULN_InvalidConfigType(_configType);
}
}
function isSupportedEid(uint32 _eid) external view override returns (bool) {
return _isSupportedEid(_eid);
}
function version() external pure override returns (uint64 major, uint8 minor, uint8 endpointVersion) {
return (3, 0, 2);
}
}
Chain explorer3754msChain node82ms