Skip to content

Commit 506e110

Browse files
committed
Add is_account_empty
1 parent 9cc0d51 commit 506e110

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/lib.rs

+9
Original file line numberDiff line numberDiff line change
@@ -604,3 +604,12 @@ pub fn selfdestruct(address: &Address) -> ! {
604604
native::ethereum_selfDestruct(address.bytes.as_ptr() as *const u32);
605605
}
606606
}
607+
608+
pub fn is_account_empty(address: &Address) -> bool {
609+
let ret = unsafe { native::ethereum_isAccountEmpty(address.bytes.as_ptr() as *const u32) };
610+
if ret != 0 && ret != 1 {
611+
panic!();
612+
}
613+
614+
ret == 1
615+
}

src/native.rs

+1
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,5 @@ extern "C" {
7474
pub fn ethereum_storageLoad(keyOffset: *const u32, resultOffset: *const u32);
7575
pub fn ethereum_storageStore(keyOffset: *const u32, valueOffset: *const u32);
7676
pub fn ethereum_selfDestruct(addressOffset: *const u32) -> !;
77+
pub fn ethereum_isAccountEmpty(addressOffset: *const u32) -> u32;
7778
}

0 commit comments

Comments
 (0)