pub fn contract_create(
    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,
            vm_type,
            name.as_ptr(),
            name.len() as u32,
            ver.as_ptr(),
            ver.len() as u32,
            author.as_ptr(),
            author.len() as u32,
            email.as_ptr(),
            email.len() as u32,
            desc.as_ptr(),
            desc.len() as u32,
            addr.as_mut().as_mut_ptr(),
        )
    };

    addr
}
/// Create a new contract based on the parameters passed in
///
/// code: new contract code
///
/// vm_type: 1 for neovm, 3 for wasmvm
///
/// name: contract name
///
/// ver: contract version
///
/// author: contract author
///
/// email: contract email
///
/// desc: contract desc
///
/// return value: new contract address
///
/// # Example
/// ```no_run
/// # use ontio_std::abi::{Sink, Source};
/// # use ontio_std::runtime;
///   let input = runtime::input();
///   let mut source = Source::new(&input);
///   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);
/// ```
///
Create a new contract based on the parameters passed in
code: new contract code

1 for neovm, 3 for wasmvm

contract name

contract version

contract author

contract email

contract desc

return value: new contract address
Create a new contract based on the parameters passed in code : new contract code 1 for neovm 3 for wasmvm contract name contract version contract author contract email contract desc return value : new contract address
pub fn contract_create(
    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,
            vm_type,
            name.as_ptr(),
            name.len() as u32,
            ver.as_ptr(),
            ver.len() as u32,
            author.as_ptr(),
            author.len() as u32,
            email.as_ptr(),
            email.len() as u32,
            desc.as_ptr(),
            desc.len() as u32,
            addr.as_mut().as_mut_ptr(),
        )
    };
    addr
}
pub fn contract_create ( 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 , vm_type , name . as_ptr ( ) , name . len ( ) as u32 , ver . as_ptr ( ) , ver . len ( ) as u32 , author . as_ptr ( ) , author . len ( ) as u32 , email . as_ptr ( ) , email . len ( ) as u32 , desc . as_ptr ( ) , desc . len ( ) as u32 , addr . as_mut ( ) . as_mut_ptr ( ) , ) } ; addr }
Create a new contract based on the parameters passed in
code: new contract code
Create a new contract based on the parameters passed in code : new contract code
code
&[u8]
vm_type
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
example
None
use ontio_std::abi::{sink, source};
None
use ontio_std::runtime;
let input = runtime::input();
let mut source = Source::new(&input);
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);
```
let input = runtime :: input () ; let mut source = Source :: new ( &input ) ; 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 ) ; ` ` `