Program: Example OApp
The Solana example OApp implements a basic OApp, which is able to perform cross-chain calls that pass a string between a Solana program and other allowlisted remote contracts using LayerZero.
The life cycle of the example OApp is simple. After the OApp program is deployed, it must be initialized and registered with LayerZero by using the InitStore
instruction. The instruction also assigns the admin of the OApp.
The admin must then invoke SetPeerConfig
to allowlist contracts on remote chains that are allowed to send messages to the OApp.
After this, messages can be sent by using QuoteSend
to get an estimate of the required fees for a given message and destination and Send
to actually send the message.
Messages received from other contracts are processed by the LzReceive
instruction handler, which verifies that the incoming message is legitimate with the LayerZero contracts and then acts on the incoming message.