Skip to main content

NeoContractRuntime

Struct NeoContractRuntime 

Source
pub struct NeoContractRuntime;
Expand description

Neo N3 contract management operations.

These are test/example stubs. In deployed contracts, the #[neo_contract] macro generates Wasm imports that map to NeoVM syscalls (System.Contract.Create, System.Contract.Update, System.Contract.Call). The methods here allow compiling and unit-testing contract code off-chain.

  • create() returns a zero-filled 20-byte hash (placeholder script hash).
  • update() and destroy() succeed immediately with no side effects.
  • call() always returns NeoValue::Null.

Implementations§

Source§

impl NeoContractRuntime

Source

pub fn create( script: &NeoByteString, manifest: &NeoContractManifest, ) -> NeoResult<NeoByteString>

Deploy a new contract. Returns a placeholder 20-byte script hash.

Source

pub fn update( _script_hash: &NeoByteString, script: &NeoByteString, manifest: &NeoContractManifest, ) -> NeoResult<()>

Update an existing contract’s script and manifest.

Source

pub fn destroy(script_hash: &NeoByteString) -> NeoResult<()>

Destroy a contract.

Source

pub fn call( script_hash: &NeoByteString, method: &NeoString, args: &NeoArray<NeoValue>, ) -> NeoResult<NeoValue>

Call another contract’s method. Always returns NeoValue::Null in stubs.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.