pub trait StorageProvider {
    // Required methods
    fn new_uref<T: CLTyped + ToBytes>(&mut self, init: T) -> Result<URef, Error>;
    fn read<T: CLTyped + FromBytes>(
        &mut self,
        uref: URef
    ) -> Result<Option<T>, Error>;
    fn write<T: CLTyped + ToBytes>(
        &mut self,
        uref: URef,
        value: T
    ) -> Result<(), Error>;
    fn add<T: CLTyped + ToBytes>(
        &mut self,
        uref: URef,
        value: T
    ) -> Result<(), Error>;
    fn read_balance(&mut self, uref: URef) -> Result<Option<U512>, Error>;
    fn write_balance(&mut self, uref: URef, balance: U512) -> Result<(), Error>;
    fn add_balance(&mut self, uref: URef, value: U512) -> Result<(), Error>;
}
Expand description

Provides functionality of a contract storage.

Required Methods§

source

fn new_uref<T: CLTyped + ToBytes>(&mut self, init: T) -> Result<URef, Error>

Create new URef.

source

fn read<T: CLTyped + FromBytes>( &mut self, uref: URef ) -> Result<Option<T>, Error>

Read data from URef.

source

fn write<T: CLTyped + ToBytes>( &mut self, uref: URef, value: T ) -> Result<(), Error>

Write data under a URef.

source

fn add<T: CLTyped + ToBytes>( &mut self, uref: URef, value: T ) -> Result<(), Error>

Add data to a URef.

source

fn read_balance(&mut self, uref: URef) -> Result<Option<U512>, Error>

Read balance.

source

fn write_balance(&mut self, uref: URef, balance: U512) -> Result<(), Error>

Write balance.

source

fn add_balance(&mut self, uref: URef, value: U512) -> Result<(), Error>

Add amount to an existing balance.

Implementors§