Skip to content
This repository has been archived by the owner on Feb 14, 2021. It is now read-only.

gasleft extern added #14

Merged
merged 1 commit into from
Aug 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ mod external {

pub fn gaslimit(dest: *mut u8);

pub fn gasleft() -> i64;

pub fn sender(dest: *mut u8);

pub fn address(dest: *mut u8);
Expand Down Expand Up @@ -253,6 +255,11 @@ pub fn gas_limit() -> U256 {
unsafe { fetch_u256(|x| external::gaslimit(x) ) }
}

/// Get amount of gas left.
pub fn gas_left() -> u64 {
unsafe { external::gasleft() as u64 }
}

/// Get caller address
///
/// This is the address of the account that is directly responsible for this execution.
Expand Down