-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rpc): implement Filecoin.StateMarketParticipants (#4302)
- Loading branch information
1 parent
ece117d
commit e5066ba
Showing
7 changed files
with
104 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2019-2024 ChainSafe Systems | ||
// SPDX-License-Identifier: Apache-2.0, MIT | ||
|
||
mod balance_table; | ||
|
||
use crate::shim::address::Address; | ||
use crate::shim::econ::TokenAmount; | ||
|
||
pub trait BalanceTableExt { | ||
fn for_each<F>(&self, f: F) -> anyhow::Result<()> | ||
where | ||
F: FnMut(&Address, &TokenAmount) -> anyhow::Result<()>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2019-2024 ChainSafe Systems | ||
// SPDX-License-Identifier: Apache-2.0, MIT | ||
|
||
use super::*; | ||
use fil_actor_interface::market::BalanceTable; | ||
use fvm_ipld_blockstore::Blockstore; | ||
|
||
impl<'bs, BS: Blockstore> BalanceTableExt for BalanceTable<'bs, BS> { | ||
fn for_each<F>(&self, mut f: F) -> anyhow::Result<()> | ||
where | ||
F: FnMut(&Address, &TokenAmount) -> anyhow::Result<()>, | ||
{ | ||
match self { | ||
Self::V8(t) => { | ||
t.0.for_each(|key, escrow| f(&Address::from_bytes(&key.0)?, &escrow.into()))? | ||
} | ||
Self::V9(t) => { | ||
t.0.for_each(|key, escrow| f(&Address::from_bytes(&key.0)?, &escrow.into()))? | ||
} | ||
Self::V10(t) => { | ||
t.0.for_each(|key, escrow| f(&Address::from_bytes(&key.0)?, &escrow.into()))? | ||
} | ||
Self::V11(t) => { | ||
t.0.for_each(|key, escrow| f(&Address::from_bytes(&key.0)?, &escrow.into()))? | ||
} | ||
Self::V12(t) => t.0.for_each(|address, escrow| { | ||
f(&address.into(), &escrow.into()) | ||
.map_err(|e| fil_actors_shared::v12::ActorError::unspecified(e.to_string())) | ||
})?, | ||
Self::V13(t) => t.0.for_each(|address, escrow| { | ||
f(&address.into(), &escrow.into()) | ||
.map_err(|e| fil_actors_shared::v13::ActorError::unspecified(e.to_string())) | ||
})?, | ||
}; | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Copyright 2019-2024 ChainSafe Systems | ||
// SPDX-License-Identifier: Apache-2.0, MIT | ||
|
||
pub mod market; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters