relevant tag icon
LayerZero Ultra Light Node
copy icon
LayerZero
• version 1.0.0
Communication
Protocol
Crosschain
Node
Audited

LayerZero Ultra Light Node

Audited

ULN is a messaging protocol, firstly introduced in the LayerZero white paper, that allows lightweight cross-chain messaging with configurable trustlessness on the specification of Oracle and Relayer, the two roles that are relaying block information and transaction proof across chains.

*Visit desktop site to download or deploy

Version

1.0.0

Creator

LayerZero

Recent Use

🍞 0x77CA saved
🥐 0xEC12 downloaded

Last Publish

11/25/2022
Any contract you deploy is yours.
Fully owned and controlled by your wallet.
Documentation
Source Code
validateTransactionProof(uint16,address,bytes32) :
This function is used to validate a transaction proof from a source chain to a destination chain. It first checks that the relayer is valid, then checks that there are enough block confirmations for the transaction. It then uses an inbound proof library to validate the proof, and checks that the ULN address is valid. Finally, it calls the receivePayload function to complete the transaction. (autogenerated documentation)
send(address,uint64,uint16,address,address) :
This function is used to send a packet of data from one chain to another. It takes in the address of the user, a nonce, the chain ID, the destination address, the payload, a refund address, a ZRO payment address, and adapter parameters. It then calculates the total native fee required for the transaction, which includes the oracle fee and the relayer fee. It then emits a Packet event with the encoded payload, and notifies the oracle. It then checks if the amount of native sent is enough to cover the fees, and if there is any remaining amount, it refunds it to the refund address. (autogenerated documentation)
updateHash(uint16,bytes32,bytes32) :
This function updates the hash lookup data stored in the contract. It takes in four parameters: a source chain ID, a lookup hash, a number of confirmations, and data. It first checks that the number of confirmations is higher than the current number of confirmations stored in the contract. If it is, it updates the confirmations and data stored in the contract for the given lookup hash. Finally, it emits an event to signal that the hash has been received. (autogenerated documentation)
getAppConfig(uint16,address) :
This function retrieves the application configuration for a given user application address and chain ID. It first checks if the configuration is stored in the appConfig mapping, and if not, it retrieves the default configuration from the defaultAppConfig mapping. If any of the configuration values are not set, it sets them to the default values. Finally, it returns the configuration. (autogenerated documentation)
setConfig(uint16,address) :
This function allows the endpoint to set various configurations for a given user account (ua) on a given chain. It takes in the chain ID, user account address, configuration type, and configuration data as parameters. Depending on the configuration type, it will decode the configuration data and set the appropriate configuration for the user account. It also emits an AppConfigUpdated event with the user account address, configuration type, and configuration data. (autogenerated documentation)
getConfig(uint16,address) :
This function is used to retrieve the configuration settings for a given user application address and chain ID. It takes in the chain ID, user application address, and a configuration type as parameters. It then checks the appConfig mapping to see if there is a configuration set for the given user application address and chain ID. If there is, it returns the configuration for the given configuration type. If there is not, it returns the default configuration for the given configuration type. (autogenerated documentation)
estimateFees(uint16,address,bool) :
This function estimates the fees associated with a transaction on the Layer Zero protocol. It takes in the chain ID, the address of the user agent, the payload of the transaction, a boolean indicating whether the payment is in ZRO, and adapter parameters as inputs. It then retrieves the application configuration for the user agent, calculates the relayer fee and the oracle fee, and then calculates the protocol fee based on the treasury contract. Finally, it adds the relayer fee and the oracle fee to the native fee, and returns the native fee and the ZRO fee. (autogenerated documentation)
withdrawZRO(address) :
This function allows the treasury contract to withdraw a specified amount of ZRO tokens from the LayerZero treasury. It requires that the msg.sender is the treasury contract, and subtracts the amount from the treasuryZROFees variable. It then uses the safeTransfer function to securely transfer the specified amount of ZRO tokens to the specified address. Finally, it emits an event to log the withdrawal. (autogenerated documentation)
withdrawNative(uint8,address,address) :
This function allows the sender to withdraw native funds from the LayerZero contract. It takes in four parameters: a type, an owner, a recipient, and an amount. Depending on the type, the function will subtract the amount from either the treasuryNativeFees, oracleQuotedFees, or relayerQuotedFees. It then calls the recipient address with the amount, and emits a WithdrawNative event. (autogenerated documentation)
setLayerZeroToken(address) :
This function allows the owner of the contract to set the address of the LayerZeroToken contract. It requires that the address provided is not the zero address, and then sets the layerZeroToken variable to the IERC20 interface of the provided address. Finally, it emits an event to signal that the LayerZeroToken address has been set. (autogenerated documentation)
setTreasury(address) :
This function allows the owner of the LayerZero contract to set the address of the treasury contract. It requires that the address of the treasury contract is not the zero address, and then sets the treasuryContract variable to the address of the treasury contract. It then emits an event to signal that the treasury has been set. (autogenerated documentation)
addInboundProofLibraryForChain(uint16,address) :
This function allows the owner of the contract to add a library address to the inboundProofLibrary mapping for a given chain ID. The function requires that the library address is not the zero address, and that the maxInboundProofLibrary for the given chain ID is less than 65535. If these conditions are met, the maxInboundProofLibrary for the given chain ID is incremented, and the library address is added to the inboundProofLibrary mapping for the given chain ID. An event is then emitted to indicate that the library address has been added. (autogenerated documentation)
enableSupportedOutboundProof(uint16,uint16) :
This function enables a specific type of outbound proof for a given chain ID. It is only accessible to the contract owner, and emits an event when it is called. The function takes two parameters, a chain ID and a proof type, and sets the corresponding value in the supportedOutboundProof mapping to true. This allows the contract to recognize and process outbound proofs of the specified type for the given chain ID. (autogenerated documentation)
setDefaultConfigForChainId(uint16,uint16,uint64,address,uint16,uint16,address) :
This function allows the owner of the LayerZero contract to set the default configuration for a given chain ID. It requires the owner to provide the inbound proof library version, inbound block confirmations, relayer address, outbound proof type, outbound block confirmations, and oracle address. If all of the provided parameters are valid, the default configuration for the given chain ID is set and an event is emitted. (autogenerated documentation)
setDefaultAdapterParamsForChainId(uint16,uint16) :
This function allows the owner of the contract to set the default adapter parameters for a given chain ID and proof type. It takes in three parameters: a chain ID, a proof type, and adapter parameters. It then stores the adapter parameters in a mapping, and emits an event to indicate that the parameters have been set. (autogenerated documentation)
setRemoteUln(uint16,bytes32) :
This function allows the owner of the contract to set the Universal Location Number (ULN) for a remote chain. The function takes two parameters, a uint16 _remoteChainId and a bytes32 _remoteUln. It first checks to make sure that the ULN for the remote chain has not already been set, and then sets the ULN for the remote chain to the given bytes32 _remoteUln. Finally, it emits an event to signal that the ULN has been set. (autogenerated documentation)
setChainAddressSize(uint16) :
This function sets the address size for a given chain ID. It is only accessible to the contract owner and requires that the address size for the given chain ID has not already been set. Once the address size is set, an event is emitted to notify the users of the change. (autogenerated documentation)
getBlockHeaderData(address,uint16,bytes32) :
This function retrieves block header data from a given oracle, remote chain ID, and lookup hash. It works by accessing the hashLookup mapping, which stores the block header data associated with the given oracle, remote chain ID, and lookup hash. The function returns the blockData associated with the given parameters. (autogenerated documentation)
oracleQuotedAmount(address) :
This function returns the amount of fees that have been quoted by a given oracle address. It works by accessing the oracleQuotedFees mapping, which stores the fees associated with each oracle address. The function takes in an oracle address as an argument and returns the corresponding fee stored in the mapping. (autogenerated documentation)
relayerQuotedAmount(address) :
This function returns the amount of fees that a relayer has quoted for a particular transaction. It works by accessing the relayerQuotedFees mapping, which stores the amount of fees that each relayer has quoted for a particular transaction. The function takes in the address of the relayer as an argument and returns the amount of fees that the relayer has quoted for the transaction. (autogenerated documentation)

Get Cookin'
share iconShare

copy iconDownload Source
copy iconnpx cookbookdev i layer-zero-ultra-light-node
copy icon

Recent Use

🍞 0x77CA saved
🥐 0xEC12 downloaded

Last Publish

11/25/2022

Version

1.0.0

Creator

LayerZero

Cookbook is free.
Any contract you deploy is yours.
Your contract is owned and controlled by you.