Function gstd::exec::reply_deposit

source ·
pub fn reply_deposit(message_id: MessageId, amount: u64) -> Result<()>
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.


use gcore::{exec, msg};

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");

extern "C" fn handle_reply() {
    // I will be executed for pre-defined (deposited) 100_000 of gas!