Instruction: InitStore
This instruction initializes the example OApp. It initializes an account holding the configuration of the program and registers the OApp with the application with the LayerZero endpoint.
The instruction can only be invoked once for any given instance of the program.
Input parameters
admin
: This is the address of the admin for this program.endpoint
: This is the address of the LayerZero endpoint.
Accounts
The instruction receives the following accounts explicitly:
payer
: Account that pays account-creation fees.Signer: Yes.
Mutable: Yes.
store
: Newly initializedStore
account.Init: Yes.
PDA: Yes, with fixed seed
STORE_SEED
.
lz_receive_types_accounts
: Newly initializedLzReceiveTypesAccounts
account.Init: Yes.
PDA: Yes, with seeds
LZ_RECEIVE_TYPES_SEED
andstore.key()
.
It also forwards the remaining accounts to the CPI that registers the OApp with the LayerZero endpoint.
CPI
The instruction performs one CPI call to the LayerZero endpoint to invoke the RegisterOApp
instruction.
This call is needed to initialize an OAppRegistry
account, which stores the address of the delegate↗ for the OApp.
The delegate can configure critical parameters of the OApp, including the security thresholds.