Struct casper_execution_engine::core::runtime_context::RuntimeContext[][src]

pub struct RuntimeContext<'a, R> { /* fields omitted */ }

Holds information specific to the deployed contract.

Implementations

impl<'a, R> RuntimeContext<'a, R> where
    R: StateReader<Key, StoredValue>,
    R::Error: Into<Error>, 
[src]

pub fn new(
    tracking_copy: Rc<RefCell<TrackingCopy<R>>>,
    entry_point_type: EntryPointType,
    named_keys: &'a mut NamedKeys,
    access_rights: HashMap<Address, HashSet<AccessRights>>,
    runtime_args: RuntimeArgs,
    authorization_keys: BTreeSet<AccountHash>,
    account: &'a Account,
    base_key: Key,
    blocktime: BlockTime,
    deploy_hash: DeployHash,
    gas_limit: Gas,
    gas_counter: Gas,
    hash_address_generator: Rc<RefCell<AddressGenerator>>,
    uref_address_generator: Rc<RefCell<AddressGenerator>>,
    transfer_address_generator: Rc<RefCell<AddressGenerator>>,
    protocol_version: ProtocolVersion,
    correlation_id: CorrelationId,
    phase: Phase,
    protocol_data: ProtocolData,
    transfers: Vec<TransferAddr>
) -> Self
[src]

pub fn authorization_keys(&self) -> &BTreeSet<AccountHash>[src]

pub fn named_keys_get(&self, name: &str) -> Option<&Key>[src]

pub fn named_keys(&self) -> &NamedKeys[src]

pub fn named_keys_mut(&mut self) -> &mut NamedKeys[src]

pub fn named_keys_contains_key(&self, name: &str) -> bool[src]

pub fn remove_key(&mut self, name: &str) -> Result<(), Error>[src]

Remove Key from the named_keys map of the current context. It removes both from the ephemeral map (RuntimeContext::named_keys) but also persistable map (one that is found in the TrackingCopy/GlobalState).

pub fn get_caller(&self) -> AccountHash[src]

pub fn get_blocktime(&self) -> BlockTime[src]

pub fn get_deploy_hash(&self) -> DeployHash[src]

pub fn access_rights_extend(
    &mut self,
    access_rights: HashMap<Address, HashSet<AccessRights>>
)
[src]

pub fn access_rights(&self) -> &HashMap<Address, HashSet<AccessRights>>[src]

pub fn account(&self) -> &'a Account[src]

pub fn args(&self) -> &RuntimeArgs[src]

pub fn uref_address_generator(&self) -> Rc<RefCell<AddressGenerator>>[src]

pub fn hash_address_generator(&self) -> Rc<RefCell<AddressGenerator>>[src]

pub fn transfer_address_generator(&self) -> Rc<RefCell<AddressGenerator>>[src]

pub fn gas_limit(&self) -> Gas[src]

pub fn gas_counter(&self) -> Gas[src]

pub fn set_gas_counter(&mut self, new_gas_counter: Gas)[src]

pub fn base_key(&self) -> Key[src]

pub fn protocol_version(&self) -> ProtocolVersion[src]

pub fn correlation_id(&self) -> CorrelationId[src]

pub fn phase(&self) -> Phase[src]

pub fn new_hash_address(&mut self) -> Result<[u8; 32], Error>[src]

Generates new deterministic hash for uses as an address.

pub fn new_uref(&mut self, value: StoredValue) -> Result<URef, Error>[src]

pub fn new_transfer_addr(&mut self) -> Result<TransferAddr, Error>[src]

pub fn put_key(&mut self, name: String, key: Key) -> Result<(), Error>[src]

Puts key to the map of named keys of current context.

pub fn read_purse_uref(
    &mut self,
    purse_uref: &URef
) -> Result<Option<CLValue>, Error>
[src]

pub fn write_purse_uref(
    &mut self,
    purse_uref: URef,
    cl_value: CLValue
) -> Result<(), Error>
[src]

pub fn read_gs(&mut self, key: &Key) -> Result<Option<StoredValue>, Error>[src]

pub fn read_gs_direct(
    &mut self,
    key: &Key
) -> Result<Option<StoredValue>, Error>
[src]

DO NOT EXPOSE THIS VIA THE FFI

pub fn read_gs_typed<T>(&mut self, key: &Key) -> Result<T, Error> where
    T: TryFrom<StoredValue>,
    T::Error: Debug
[src]

This method is a wrapper over read_gs in the sense that it extracts the type held by a StoredValue stored in the global state in a type safe manner.

This is useful if you want to get the exact type from global state.

pub fn get_keys(&mut self, key_tag: &KeyTag) -> Result<BTreeSet<Key>, Error>[src]

pub fn read_account(&mut self, key: &Key) -> Result<Option<StoredValue>, Error>[src]

pub fn write_account(&mut self, key: Key, account: Account) -> Result<(), Error>[src]

pub fn write_transfer(&mut self, key: Key, value: Transfer)[src]

pub fn write_era_info(&mut self, key: Key, value: EraInfo)[src]

pub fn store_function(
    &mut self,
    contract: StoredValue
) -> Result<[u8; 32], Error>
[src]

pub fn store_function_at_hash(
    &mut self,
    contract: StoredValue
) -> Result<[u8; 32], Error>
[src]

pub fn insert_key(&mut self, name: String, key: Key)[src]

pub fn insert_uref(&mut self, uref: URef)[src]

pub fn effect(&self) -> ExecutionEffect[src]

pub fn transfers(&self) -> &Vec<TransferAddr>[src]

pub fn transfers_mut(&mut self) -> &mut Vec<TransferAddr>[src]

pub fn validate_key(&self, key: &Key) -> Result<(), Error>[src]

Validates whether key is not forged (whether it can be found in the named_keys) and whether the version of a key that contract wants to use, has access rights that are less powerful than access rights’ of the key in the named_keys.

pub fn validate_uref(&self, uref: &URef) -> Result<(), Error>[src]

pub fn deserialize_keys(&self, bytes: Vec<u8>) -> Result<Vec<Key>, Error>[src]

pub fn deserialize_urefs(&self, bytes: Vec<u8>) -> Result<Vec<URef>, Error>[src]

pub fn is_readable(&self, key: &Key) -> bool[src]

Tests whether reading from the key is valid.

pub fn is_addable(&self, key: &Key) -> bool[src]

Tests whether addition to key is valid.

pub fn is_writeable(&self, key: &Key) -> bool[src]

Tests whether writing to key is valid.

pub fn metered_write_gs<T>(&mut self, key: Key, value: T) -> Result<(), Error> where
    T: Into<StoredValue>, 
[src]

pub fn add_associated_key(
    &mut self,
    account_hash: AccountHash,
    weight: Weight
) -> Result<(), Error>
[src]

pub fn remove_associated_key(
    &mut self,
    account_hash: AccountHash
) -> Result<(), Error>
[src]

pub fn update_associated_key(
    &mut self,
    account_hash: AccountHash,
    weight: Weight
) -> Result<(), Error>
[src]

pub fn set_action_threshold(
    &mut self,
    action_type: ActionType,
    threshold: Weight
) -> Result<(), Error>
[src]

pub fn protocol_data(&self) -> &ProtocolData[src]

pub fn get_main_purse(&self) -> Result<URef, Error>[src]

Gets main purse id

pub fn entry_point_type(&self) -> EntryPointType[src]

Gets entry point type.

Auto Trait Implementations

impl<'a, R> !RefUnwindSafe for RuntimeContext<'a, R>

impl<'a, R> !Send for RuntimeContext<'a, R>

impl<'a, R> !Sync for RuntimeContext<'a, R>

impl<'a, R> Unpin for RuntimeContext<'a, R>

impl<'a, R> !UnwindSafe for RuntimeContext<'a, R>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Downcast for T where
    T: Any

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,