Skip to main content

reply_deposit

Function reply_deposit 

Source
pub fn reply_deposit(message_id: MessageId, amount: u64) -> Result<(), Error>
Expand description

Provide gas deposit from current message to handle reply message on given message id.

This message id should be sent within the execution. Once destination actor or system sends reply on it, the gas limit ignores, if the program gave deposit - the only it will be used for execution of handle_reply.

ยงExamples

use gcore::{exec, msg};

#[unsafe(no_mangle)]
extern "C" fn handle() {
    let message_id =
        msg::send(msg::source(), b"Outgoing message", 0).expect("Failed to send message");

    exec::reply_deposit(message_id, 100_000).expect("Failed to deposit reply");
}

#[unsafe(no_mangle)]
extern "C" fn handle_reply() {
    // I will be executed for pre-defined (deposited) 100_000 of gas!
}