File tree Expand file tree Collapse file tree 2 files changed +17
-20
lines changed
Expand file tree Collapse file tree 2 files changed +17
-20
lines changed Original file line number Diff line number Diff line change @@ -13,28 +13,25 @@ impl GasPrice {
1313 pub fn from_db (
1414 gas_price_db : GasPriceDb ,
1515 tokens : Vec < ( TokenDb , Option < IbcTokenDb > ) > ,
16- ) -> Self {
17- let token = tokens
18- . into_iter ( )
19- . find_map ( |( token, ibc_token) | {
20- if gas_price_db. token == token. address {
21- match ibc_token {
22- Some ( ibc_token) => Some ( Token :: Ibc ( IbcToken {
23- address : Id :: Account ( ibc_token. address ) ,
24- trace : Some ( Id :: IbcTrace ( ibc_token. ibc_trace ) ) ,
25- } ) ) ,
26- None => Some ( Token :: Native ( Id :: Account ( token. address ) ) ) ,
27- }
28- } else {
29- None
16+ ) -> Option < Self > {
17+ let token = tokens. into_iter ( ) . find_map ( |( token, ibc_token) | {
18+ if gas_price_db. token == token. address {
19+ match ibc_token {
20+ Some ( ibc_token) => Some ( Token :: Ibc ( IbcToken {
21+ address : Id :: Account ( ibc_token. address ) ,
22+ trace : Some ( Id :: IbcTrace ( ibc_token. ibc_trace ) ) ,
23+ } ) ) ,
24+ None => Some ( Token :: Native ( Id :: Account ( token. address ) ) ) ,
3025 }
31- } )
32- . expect ( "Fee token should be known." ) ;
26+ } else {
27+ None
28+ }
29+ } ) ?;
3330
34- Self {
31+ Some ( Self {
3532 token,
3633 min_denom_amount : gas_price_db. amount . to_string ( ) ,
37- }
34+ } )
3835 }
3936}
4037
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ impl GasService {
4040 . map ( |r| {
4141 r. iter ( )
4242 . cloned ( )
43- . map ( |gas_price| {
43+ . filter_map ( |gas_price| {
4444 GasPrice :: from_db ( gas_price, tokens. clone ( ) )
4545 } )
4646 . collect ( )
@@ -61,7 +61,7 @@ impl GasService {
6161 . map ( |r| {
6262 r. iter ( )
6363 . cloned ( )
64- . map ( |gas_price| {
64+ . filter_map ( |gas_price| {
6565 GasPrice :: from_db ( gas_price, tokens. clone ( ) )
6666 } )
6767 . collect ( )
You can’t perform that action at this time.
0 commit comments