Skip to content

Commit

Permalink
rename need_storage to vm_type (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqiangxu authored Dec 9, 2020
1 parent 3697a5f commit ff76792
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions ontio-std/src/mock/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,10 @@ mod env {

#[no_mangle]
pub fn ontio_contract_create(
_code_ptr: *const u8, _code_len: u32, _need_storage: u32, _name_ptr: *const u8,
_name_len: u32, _ver_ptr: *const u8, _ver_len: u32, _author_ptr: *const u8,
_author_len: u32, _email_ptr: *const u8, _email_len: u32, _desc_ptr: *const u8,
_desc_len: u32, _new_addr_ptr: *mut u8,
_code_ptr: *const u8, _code_len: u32, _vm_type: u32, _name_ptr: *const u8, _name_len: u32,
_ver_ptr: *const u8, _ver_len: u32, _author_ptr: *const u8, _author_len: u32,
_email_ptr: *const u8, _email_len: u32, _desc_ptr: *const u8, _desc_len: u32,
_new_addr_ptr: *mut u8,
) -> u32 {
unimplemented!()
}
Expand Down
24 changes: 12 additions & 12 deletions ontio-std/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ mod env {
pub fn ontio_storage_delete(key: *const u8, klen: u32);
pub fn ontio_sha256(data: *const u8, len: u32, val: *mut u8);
pub fn ontio_contract_create(
code_ptr: *const u8, code_len: u32, need_storage: u32, name_ptr: *const u8,
name_len: u32, ver_ptr: *const u8, ver_len: u32, author_ptr: *const u8,
author_len: u32, email_ptr: *const u8, email_len: u32, desc_ptr: *const u8,
desc_len: u32, new_addr_ptr: *mut u8,
code_ptr: *const u8, code_len: u32, vm_type: u32, name_ptr: *const u8, name_len: u32,
ver_ptr: *const u8, ver_len: u32, author_ptr: *const u8, 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_destroy() -> !;
}
Expand Down Expand Up @@ -77,7 +77,7 @@ pub fn call_contract(addr: &Address, input: &[u8]) -> Vec<u8> {
///
/// code: new contract code
///
/// need_storage:
/// vm_type: 1 for neovm, 3 for wasmvm
///
/// name: contract name
///
Expand All @@ -97,19 +97,19 @@ pub fn call_contract(addr: &Address, input: &[u8]) -> Vec<u8> {
/// # use ontio_std::runtime;
/// let input = runtime::input();
/// let mut source = Source::new(&input);
/// let (code, need_storage, name, ver, author, email, desc) = source.read().unwrap();
/// let res = runtime::contract_create(code, need_storage, name, ver, author, email, desc);
/// let (code, vm_type, name, ver, author, email, desc) = source.read().unwrap();
/// let res = runtime::contract_create(code, vm_type, name, ver, author, email, desc);
/// ```
///
pub fn contract_create(
code: &[u8], need_storage: u32, name: &str, ver: &str, author: &str, email: &str, desc: &str,
code: &[u8], vm_type: u32, name: &str, ver: &str, author: &str, email: &str, desc: &str,
) -> Address {
let mut addr: Address = Address::zero();
unsafe {
env::ontio_contract_create(
code.as_ptr(),
code.len() as u32,
need_storage,
vm_type,
name.as_ptr(),
name.len() as u32,
ver.as_ptr(),
Expand All @@ -131,7 +131,7 @@ pub fn contract_create(
///
/// code: new contract code
///
/// need_storage:
/// vm_type: 1 for neovm, 3 for wasmvm
///
/// name: contract name
///
Expand All @@ -151,8 +151,8 @@ pub fn contract_create(
/// # use ontio_std::runtime;
/// let input = runtime::input();
/// let mut source = Source::new(&input);
/// let (code, need_storage, name, ver, author, email, desc) = source.read().unwrap();
/// let res = runtime::contract_migrate(code, need_storage, name, ver, author, email, desc);
/// let (code, vm_type, name, ver, author, email, desc) = source.read().unwrap();
/// let res = runtime::contract_migrate(code, vm_type, name, ver, author, email, desc);
/// ```
///
pub fn contract_migrate(
Expand Down

0 comments on commit ff76792

Please sign in to comment.