Skip to content

Commit

Permalink
use builder for RC<blockstore>
Browse files Browse the repository at this point in the history
  • Loading branch information
aarshkshah1992 committed Oct 20, 2023
1 parent aa6cefa commit c3c2d87
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test_vm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,17 @@ pub struct TestVM {
}

impl TestVM {
pub fn new(store: Rc<MemoryBlockstore>) -> TestVM {
pub fn new(store: impl Into<Rc<MemoryBlockstore>>) -> TestVM {
let store = store.into();
let mut actors =
Hamt::<Rc<MemoryBlockstore>, ActorState, BytesKey, Sha256>::new_with_config(
Rc::clone(&store),
DEFAULT_HAMT_CONFIG,
);

TestVM {
primitives: FakePrimitives {},
store,
store: store,
state_root: RefCell::new(actors.flush().unwrap()),
circulating_supply: RefCell::new(TokenAmount::zero()),
actors_dirty: RefCell::new(false),
Expand All @@ -83,10 +85,12 @@ impl TestVM {
}
}

pub fn new_with_singletons(store: Rc<MemoryBlockstore>) -> TestVM {
pub fn new_with_singletons(store: impl Into<Rc<MemoryBlockstore>>) -> TestVM {
let reward_total = TokenAmount::from_whole(1_100_000_000i64);
let faucet_total = TokenAmount::from_whole(1_000_000_000i64);

let store = store.into();

let v = TestVM::new(Rc::clone(&store));
v.set_circulating_supply(&reward_total + &faucet_total);

Expand Down

0 comments on commit c3c2d87

Please sign in to comment.