Skip to main content
Version: Endpoint V1 Docs

UA Custom Configuration Overview

User Application contracts may set their own configuration for block confirmation, send version, relayer, oracle, etc.

When a UA wishes to configure their own block confirmations both the outboundBlockConfirmations of the source and the inboundBlockConfirmations of the destination must be configured and match.

How to Configure

A User Application (UA) can use non-default protocol settings, and to do so it must implement the interface ILayerZeroUserApplicationConfig. The UA may then manually update its ApplicationConfig . See examples below as well as the CONFIG_TYPES.

This function would be implemented in your UA. This is included in LZapp.sol if you inherit from it.

function setConfig(
uint16 _version,
uint16 _chainId,
uint _configType,
bytes calldata _config
) external override onlyOwner {
lzEndpoint.setConfig(_version, _chainId, _configType, _config);
}

Config Types

TypeValue
CONFIG_TYPE_INBOUND_PROOF_LIBRARY_VERSION1
CONFIG_TYPE_INBOUND_BLOCK_CONFIRMATIONS2
CONFIG_TYPE_RELAYER3
CONFIG_TYPE_OUTBOUND_PROOF_TYPE4
CONFIG_TYPE_OUTBOUND_BLOCK_CONFIRMATIONS5
CONFIG_TYPE_ORACLE6
info

The config should be abi encoded.

ethers.utils.defaultAbiCoder.encode([configValueType], [newValue]);

Set: Inbound Proof Library

ConfigDefinition
1MPT
2Feather Proof
let config = ethers.utils.defaultAbiCoder.encode(['uint16'], [inboundProofLibraryVersion]);
await UA.setConfig(0, dstChainId, CONFIG_TYPE_INBOUND_PROOF_LIBRARY_VERSION, config);
info

CONFIG_TYPE_INBOUND_PROOF_LIBRARY_VERSION is 1 in this casse

Set: Inbound Block Confirmations

ConfigDefinition
42How many block confirmations is needed for inbound block confirmations
let config = ethers.utils.defaultAbiCoder.encode(['uint16'], [42]);
await UA.setConfig(0, dstChainId, CONFIG_TYPE_INBOUND_BLOCK_CONFIRMATIONS, config);

Set: Relayer

ConfigDefinition
relayerAddrWhich relayer you want to use
let config = ethers.utils.solidityPack(['address'], [relayerAddr]);
await UA.setConfig(0, dstChainId, CONFIG_TYPE_RELAYER, config);

Set: Outbound Proof Type/LibraryVersion

ConfigDefinition
1MPT
2Feather Proof
let config = ethers.utils.defaultAbiCoder.encode(['uint16'], [outboundProofType]);
await UA.setConfig(0, dstChainId, CONFIG_TYPE_OUTBOUND_PROOF_TYPE, config);

Set: Outbound Block Confirmations

ConfigDefinition
42How many block confirmations is needed for outbound block confirmations
let config = ethers.utils.defaultAbiCoder.encode(
['uint16'],
[17], // outbound block confirmations
);
await UA.setConfig(0, dstChainId, CONFIG_TYPE_OUTBOUND_BLOCK_CONFIRMATIONS, config);

Set: Oracle

ConfigDefinition
Oracle AddressWhich oracle to use

The available oracles can be found here. (Select the oracle type you prefer)

Oracle settings are configured per channel pathway, meaning UAs who want to lock Oracle configs will need to call setConfig per chain pairing.

let config = ethers.utils.defaultAbiCoder.encode(['address'], [oracleAddr]);
await UA.setConfig(0, dstChainId, CONFIG_TYPE_ORACLE, config);