UA Custom Configuration
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.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
. Set: Inbound Proof Library
1 let config = ethers.utils.defaultAbiCoder.encode(
2 ["uint16"],
3 [inboundProofLibraryVersion]
4 )
5 await lzEndpoint.setConfig(
6 0,
7 dstChainId,
8 CONFIG_TYPE_INBOUND_PROOF_LIBRARY_VERSION,
9 config
10 )
Set: Inbound Block Confirmations
1 let config = ethers.utils.defaultAbiCoder.encode(
2 ["uint16"],
3 [42]
4 )
5 await lzEndpoint.setConfig(
6 0,
7 dstChainId,
8 CONFIG_TYPE_INBOUND_BLOCK_CONFIRMATIONS,
9 config
10 )
Set: Relayer
1 let config = ethers.utils.solidityPack(
2 ["address"],
3 [relayerAddr]
4 )
5 await lzEndpoint.setConfig(
6 0,
7 dstChainId,
8 CONFIG_TYPE_RELAYER,
9 config
10 )
Set: Outbound Proof Type/LibraryVersion
1 let config = ethers.utils.defaultAbiCoder.encode(
2 ["uint16"],
3 [outboundProofType]
4 )
5 await lzEndpoint.setConfig(
6 0,
7 dstChainId,
8 CONFIG_TYPE_OUTBOUND_PROOF_TYPE,
9 config
10 )
Set: Outbound Block Confirmations
1 let config = ethers.utils.defaultAbiCoder.encode(
2 ["uint16"],
3 [17] // outbound block confirmations
4 )
5 await lzEndpoint.setConfig(
6 0,
7 dstChainId,
8 CONFIG_TYPE_OUTBOUND_BLOCK_CONFIRMATIONS,
9 config
10 )
Set: Oracle
1 let config = ethers.utils.defaultAbiCoder.encode(
2 ["address"],
3 [oracleAddr]
4 )
5 await lzEndpoint.setConfig(
6 0,
7 dstChainId,
8 CONFIG_TYPE_ORACLE,
9 config
10 )
Config Types
CONFIG_TYPE_INBOUND_PROOF_LIBRARY_VERSION | 1 |
CONFIG_TYPE_INBOUND_BLOCK_CONFIRMATIONS | 2 |
CONFIG_TYPE_RELAYER | 3 |
CONFIG_TYPE_OUTBOUND_PROOF_TYPE | 4 |
CONFIG_TYPE_OUTBOUND_BLOCK_CONFIRMATIONS | 5 |
CONFIG_TYPE_ORACLE | 6 |
Last modified 3mo ago