Skip to content

Commit

Permalink
Merge pull request #17 from axic/feat/extcode
Browse files Browse the repository at this point in the history
Implement extcode and extcodesize
  • Loading branch information
axic authored Apr 11, 2019
2 parents e90b3fd + 96f8e98 commit 97e8393
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,9 @@ impl vm::Ext for EwasmExt {

/// Returns code at given address
fn extcode(&self, address: &Address) -> Result<Option<Arc<Bytes>>> {
// FIXME: implement
unimplemented!()
Ok(Some(Arc::new(ewasm_api::external_code_acquire(&Bytes20 {
bytes: address.0,
}))))
}

/// Returns code hash at given address
Expand All @@ -210,8 +211,9 @@ impl vm::Ext for EwasmExt {

/// Returns code size at given address
fn extcodesize(&self, address: &Address) -> Result<Option<usize>> {
// FIXME: implement
unimplemented!()
Ok(Some(ewasm_api::external_code_size(&Bytes20 {
bytes: address.0,
})))
}

/// Creates log entry with given topics and data
Expand Down

0 comments on commit 97e8393

Please sign in to comment.