i_ack
After the i_receive
function is executed, an acknowledgment is generated by Router's destination chain Gateway contract, indicating whether the call was successful. The i_ack function must be implemented in your contract with the following structure:
pub fn i_ack(
ctx: Context<IAck>,
request_identifier: u128,
exec_flag: bool,
) -> Result<Vec<u8>>
Parameters:
request_identifier
: This is the same nonce received when calling thei_send
function on the source chain's Gateway contract. It helps map the acknowledgment to the corresponding request.src_chain_id
: A boolean value indicating the execution status of the request on the destination chain.
Account Context
#[derive(Accounts)]
pub struct IAck<'info> {
//CHECK: dapp can have different storage structure, dapp have to validate account
#[account(mut)]
pub dapp_account: UncheckedAccount<'info>,
#[account()]
pub packet_account: AccountLoader<'info, PacketAccount>,
#[account()]
pub gateway_authority: Signer<'info>,
pub system_program: Program<'info, System>,
}
Account Info:
packet_account
: Contains the exec data which is the data in bytes that provides the abi-encoded return value from thei_receive
call on the destination chain. Based on the application's requirement, this data can be decoded and processed on the source chain.gateway_authority
: The authorized signer by the Gateway contract to ensure the request is valid.
caution
Currently, i_ack
does not support dynamically passing additional accounts beyond those explicitly listed in the IAck context.