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

Commit

Permalink
gasleft extern added
Browse files Browse the repository at this point in the history
  • Loading branch information
lexfrl committed Aug 15, 2018
1 parent be7f8f3 commit 168b5be
Showing 1 changed file with 7 additions and 0 deletions.
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

0 comments on commit 168b5be

Please sign in to comment.