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

Commit

Permalink
Merge pull request #14 from paritytech/gasleft-extern
Browse files Browse the repository at this point in the history
gasleft extern added
  • Loading branch information
NikVolf authored Aug 16, 2018
2 parents be7f8f3 + 168b5be commit b7fea89
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 b7fea89

Please sign in to comment.