[OLD] How to Use Blockdaemon Oracle (v1)

Learn know to use Blockdaemon Oracle.

User applications can modify cross-chain behavior by configuring certain values. These configuration values are established at the LayerZero endpoint of each chain. The user application's smart contract must initiate the transactions that alter these configuration values.

1. Implementing a Custom Configuration

A User Application (UA) can use non-default protocol settings. To implement it, please refer to the following function as specified in the LayerZero documentation.

function setConfig(
    uint16 _version,
    uint16 _chainId,
    uint _configType,
    bytes calldata _config
)

The parameters for the setConfigfunctions are as follows:

Config TypesDescription
_versionUltra Light Client version (0 refers to the default version).
_dstChainIdThe destination chain ID can be found in the Supported Chain IDs.

🚧 Important note: LayerZero uses different identifiers than those described in EIP-155.
_configTypeCONFIG_TYPE_ORACLE - 6.

See more in Config Types.
_config:The ABI encoded Oracle address.

See more in Blockdaemon Oracle Addresses.

👍

Info:

If your user application extends LzApp.sol or NonBlockingLzApp.sol, it already implements the ILayerZeroUserApplicationConfig.sol interface, which includes the function setConfig.

1.1. Example

ConfigDescription
Blockdaemon Oracle AddressesThe address to use for the configuration. The available addresses can be found here.

Users must call the setConfig function for each pair of chains.

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

2. Using UA-Utils Tooling

To repeat this configuration on each source chain for every destination chain, UA-Utils Tooling is used to simplify the process of modifying configurations across multiple blockchains.


📘

Learn more:

For more information, please refer to the LayerZero documentations below: