unc_vm_runner/logic/types.rs
1pub use unc_primitives_core::types::*;
2
3pub type PublicKey = Vec<u8>;
4pub type PromiseIndex = u64;
5pub type ReceiptIndex = u64;
6pub type IteratorIndex = u64;
7
8#[derive(Debug, PartialEq, Clone)]
9pub enum ReturnData {
10 /// Method returned some value or data.
11 Value(Vec<u8>),
12
13 /// The return value of the method should be taken from the return value of another method
14 /// identified through receipt index.
15 ReceiptIndex(ReceiptIndex),
16
17 /// Method hasn't returned any data or promise.
18 None,
19}
20
21impl ReturnData {
22 /// Function to extract value from ReturnData.
23 pub fn as_value(self) -> Option<Vec<u8>> {
24 match self {
25 ReturnData::Value(value) => Some(value),
26 _ => None,
27 }
28 }
29}
30
31/// When there is a callback attached to one or more contract calls the execution results of these
32/// calls are available to the contract invoked through the callback.
33#[derive(Debug, PartialEq)]
34pub enum PromiseResult {
35 /// Current version of the protocol never returns `PromiseResult::NotReady`.
36 NotReady,
37 Successful(Vec<u8>),
38 Failed,
39}