Skip to content

Commit

Permalink
[types] remove currency info
Browse files Browse the repository at this point in the history
  • Loading branch information
davidiw committed Apr 25, 2022
1 parent b1f2ed2 commit 0fa48e4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 173 deletions.
148 changes: 0 additions & 148 deletions types/src/account_config/resources/currency_info.rs

This file was deleted.

2 changes: 0 additions & 2 deletions types/src/account_config/resources/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ pub mod chain_account_info;
pub mod chain_id;
pub mod core_account;
pub mod crsn;
pub mod currency_info;
pub mod designated_dealer;
pub mod dual_attestation;
pub mod freezing_bit;
Expand All @@ -25,7 +24,6 @@ pub use chain_account_info::*;
pub use chain_id::*;
pub use core_account::*;
pub use crsn::*;
pub use currency_info::*;
pub use designated_dealer::*;
pub use dual_attestation::*;
pub use freezing_bit::*;
Expand Down
26 changes: 3 additions & 23 deletions types/src/account_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ use crate::{
account_address::AccountAddress,
account_config::{
currency_code_from_type_tag, AccountResource, AccountRole, BalanceResource, CRSNResource,
ChainIdResource, ChildVASP, Credential, CurrencyInfoResource, DesignatedDealer,
DesignatedDealerPreburns, DiemAccountResource, FreezingBit, ParentVASP,
PreburnQueueResource, PreburnResource,
ChainIdResource, ChildVASP, Credential, DesignatedDealer, DesignatedDealerPreburns,
DiemAccountResource, FreezingBit, ParentVASP, PreburnQueueResource, PreburnResource,
},
account_state_blob::AccountStateBlob,
block_metadata::BlockResource,
on_chain_config::{
access_path_for_config, dpn_access_path_for_config, ConfigurationResource, OnChainConfig,
RegisteredCurrencies, VMPublishingOption, ValidatorSet, Version,
VMPublishingOption, ValidatorSet, Version,
},
state_store::state_value::StateValue,
timestamp::TimestampResource,
Expand Down Expand Up @@ -181,25 +180,6 @@ impl AccountState {
.map_err(Into::into)
}

pub fn get_registered_currency_info_resources(&self) -> Result<Vec<CurrencyInfoResource>> {
let currencies: Option<RegisteredCurrencies> = self.get_config()?;
match currencies {
Some(currencies) => {
let codes = currencies.currency_codes();
let mut resources = vec![];
for code in codes {
let access_path = CurrencyInfoResource::resource_path_for(code.clone());
let info: CurrencyInfoResource = self
.get_resource_impl(&access_path.path)?
.ok_or_else(|| format_err!("currency info resource not found: {}", code))?;
resources.push(info);
}
Ok(resources)
}
None => Ok(vec![]),
}
}

pub fn get_block_resource(&self) -> Result<Option<BlockResource>> {
self.get_resource::<BlockResource>()
}
Expand Down

0 comments on commit 0fa48e4

Please sign in to comment.