Skip to content

Commit

Permalink
expose read address and h256
Browse files Browse the repository at this point in the history
  • Loading branch information
laizy committed Mar 26, 2020
1 parent 20d1d15 commit 4eed8a9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ontio-std/src/abi/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ impl<'a> Source<'a> {
T::decode(self)
}

pub(crate) fn read_address(&mut self) -> Result<&'a Address, Error> {
pub fn read_address(&mut self) -> Result<&'a Address, Error> {
let buf = self.next_bytes(20)?;
Ok(unsafe { &*(buf.as_ptr() as *const Address) })
}

pub(crate) fn read_h256(&mut self) -> Result<&'a H256, Error> {
pub fn read_h256(&mut self) -> Result<&'a H256, Error> {
let buf = self.next_bytes(32)?;
Ok(unsafe { &*(buf.as_ptr() as *const H256) })
}
Expand Down
4 changes: 2 additions & 2 deletions ontio-std/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ mod env {
author_len: u32, email_ptr: *const u8, email_len: u32, desc_ptr: *const u8,
desc_len: u32, new_addr_ptr: *mut u8,
) -> u32;
pub fn ontio_contract_delete() -> !;
pub fn ontio_contract_destroy() -> !;
}
}

Expand Down Expand Up @@ -187,7 +187,7 @@ pub fn contract_migrate(
///delete the contract
pub fn contract_delete() -> ! {
unsafe {
env::ontio_contract_delete();
env::ontio_contract_destroy();
}
}
///Save key-value as a key-value pair
Expand Down

0 comments on commit 4eed8a9

Please sign in to comment.