pub fn call_contract(addr: &Address, input: &[u8]) -> Vec<u8> {
    let addr: &[u8] = addr.as_ref();
    let size =
        unsafe { env::ontio_call_contract(addr.as_ptr(), input.as_ptr(), input.len() as u32) };
    let mut output = vec![0u8; size as usize];
    if size != 0 {
        let value = &mut output[..];
        unsafe {
            env::ontio_get_call_output(value.as_mut_ptr());
        }
    }

    output
}
//todo : return result
/// With this method, another contract can be called, When calling Neo contract and native contract across contracts, the parameter construction is slightly different. Please refer to the corresponding examples.
///
/// addr: Called contract address
///
/// input: Parameters required to call the target contract method
///
/// # Example
/// ```no_run
/// # use ontio_std::abi::Sink;
/// # use ontio_std::runtime;
/// # use ontio_std::types::Address;
/// let mut sink = Sink::new(16);
/// let addr = Address::repeat_byte(1u8);
/// sink.write(("balance_of".to_string(), &addr));
/// let res = runtime::call_contract(&addr, sink.bytes());
/// ```


Called contract address

Parameters required to call the target contract method
Called contract address Parameters required to call the target contract method
pub fn call_contract(addr: &Address, input: &[u8]) -> Vec<u8> {
    let addr: &[u8] = addr.as_ref();
    let size =
        unsafe { env::ontio_call_contract(addr.as_ptr(), input.as_ptr(), input.len() as u32) };
    let mut output = vec![0u8; size as usize];
    if size != 0 {
        let value = &mut output[..];
        unsafe {
            env::ontio_get_call_output(value.as_mut_ptr());
        }
    }
    output
}
pub fn call_contract ( addr : & Address , input : & [ u8 ] ) -> Vec < u8 > { let addr : & [ u8 ] = addr . as_ref ( ) ; let size = unsafe { env :: ontio_call_contract ( addr . as_ptr ( ) , input . as_ptr ( ) , input . len ( ) as u32 ) } ; let mut output = vec ! [ 0u8 size as usize ] ; if size != 0 { let value = & mut output [ .. ] ; unsafe { env :: ontio_get_call_output ( value . as_mut_ptr ( ) ) ; } } output }
todo : return result
With this method, another contract can be called, When calling Neo contract and native contract across contracts, the parameter construction is slightly different.
todo : return result With this method another contract can be called When calling Neo contract and native contract across contracts the parameter construction is slightly different .
addr
&Address
input
&[u8]
addr
&Address
input
&[u8]
example
None
use ontio_std::abi::sink;
None
use ontio_std::runtime;
None
use ontio_std::types::address;
let mut sink = Sink::new(16);
let addr = Address::repeat_byte(1u8);
sink.write(("balance_of".to_string(), &addr));
let res = runtime::call_contract(&addr, sink.bytes());
```
let mut sink = Sink :: new ( 16 ) ; let addr = Address :: repeat_byte ( 1u8 ) ; sink . write (( " balance_of " . to_string () &addr )) ; let res = runtime :: call_contract ( &addr sink . bytes () ) ; ` ` `