1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
use crate::{
account::AccountHash,
system::{mint::Error, CallStackElement},
Key, Phase,
};
/// Provider of runtime host functionality.
pub trait RuntimeProvider {
/// This method should return the caller of the current context.
fn get_caller(&self) -> AccountHash;
/// This method should return the immediate caller of the current context.
fn get_immediate_caller(&self) -> Option<&CallStackElement>;
/// Gets execution phase
fn get_phase(&self) -> Phase;
/// This method should handle storing given [`Key`] under `name`.
fn put_key(&mut self, name: &str, key: Key) -> Result<(), Error>;
/// This method should handle obtaining a given named [`Key`] under a `name`.
fn get_key(&self, name: &str) -> Option<Key>;
}