1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2019-2024 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

mod state;

use crate::shim::address::Address;
use ahash::HashMap;
use fil_actor_interface::verifreg::{Allocation, AllocationID, Claim, State};
use fil_actor_verifreg_state::v13::ClaimID;
use fvm_ipld_blockstore::Blockstore;

pub trait VerifiedRegistryStateExt {
    fn get_allocations<BS: Blockstore>(
        &self,
        store: &BS,
        address: &Address,
    ) -> anyhow::Result<HashMap<AllocationID, Allocation>>;

    fn get_all_allocations<BS: Blockstore>(
        &self,
        store: &BS,
    ) -> anyhow::Result<HashMap<AllocationID, Allocation>>;

    fn get_claims<BS: Blockstore>(
        &self,
        store: &BS,
        provider_id_address: &Address,
    ) -> anyhow::Result<HashMap<ClaimID, Claim>>;

    fn get_all_claims<BS: Blockstore>(&self, store: &BS)
        -> anyhow::Result<HashMap<ClaimID, Claim>>;

    fn root_key(&self) -> Address;
}