Function gcore::msg::reply_commit_from_reservation
source · pub fn reply_commit_from_reservation(
id: ReservationId,
value: u128,
) -> Result<MessageId>
Expand description
Same as reply_commit
, but it spends gas from a reservation instead of
borrowing it from the gas limit provided with the incoming message.
§Examples
use gcore::{exec, msg};
#[no_mangle]
extern "C" fn handle() {
msg::reply_push(b"Hello,").expect("Unable to push");
msg::reply_push(b" world!").expect("Unable to push");
let reservation_id = exec::reserve_gas(5_000_000, 100).expect("Unable to reserves");
msg::reply_commit_from_reservation(reservation_id, 42).expect("Unable to commit");
}
§See also
reply_push
function allows forming a reply message in parts.