use cid::Cid;
use fvm_sdk as sdk;
use fvm_sdk::error::StateReadError;
use thiserror::Error;
#[derive(Error, Clone, Debug)]
pub enum ActorError {
#[error("root state not found {0}")]
NoState(#[from] StateReadError),
}
type Result<T> = std::result::Result<T, ActorError>;
pub trait Actor {
fn root_cid(&self) -> Result<Cid>;
}
pub struct FvmActor {}
impl Actor for FvmActor {
fn root_cid(&self) -> Result<Cid> {
Ok(sdk::sself::root()?)
}
}
#[derive(Default, Clone, Debug)]
pub struct FakeActor {
pub root: Cid,
}
impl Actor for FakeActor {
fn root_cid(&self) -> Result<Cid> {
Ok(self.root)
}
}