Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

Commit

Permalink
chore: fix omitted item in asset profile
Browse files Browse the repository at this point in the history
  • Loading branch information
kenta-elys committed Dec 20, 2023
1 parent 4ef4ec2 commit 8a35b20
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 45 deletions.
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "financial_snapshot_contract"
version = "0.0.0"
version = "0.1.0"
edition = "2021"

[lib]
Expand Down
53 changes: 51 additions & 2 deletions src/bindings/querier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use super::{

use crate::msg::query_resp::earn::QueryEarnPoolResponse;
use crate::types::{BalanceBorrowed, QueryAprResponse, PageRequest};
use elys_bindings::types::BalanceAvailable;
use elys_bindings::{types::BalanceAvailable, query_resp::*};

#[allow(dead_code)]
pub struct ElysQuerier<'a> {
Expand Down Expand Up @@ -184,7 +184,56 @@ impl<'a> ElysQuerier<'a> {
pub fn get_asset_profile(&self, base_denom: String ) -> StdResult<QueryGetEntryResponse> {
let asset_profile = ElysQuery::get_asset_profile(base_denom.to_owned());
let request: QueryRequest<ElysQuery> = QueryRequest::Custom(asset_profile);
let resp: QueryGetEntryResponse = self.querier.query(&request)?;
let QueryGetEntryResponseRaw { entry: raw_entry }: QueryGetEntryResponseRaw =
self.querier.query(&request)?;

let resp = QueryGetEntryResponse {
entry: Entry {
base_denom: raw_entry.base_denom,
decimals: raw_entry.decimals,
denom: raw_entry.denom,
path: raw_entry.path.map_or("".to_string(), |path| path),
ibc_channel_id: raw_entry
.ibc_channel_id
.map_or("".to_string(), |ibc_channel_id| ibc_channel_id),
ibc_counterparty_channel_id: raw_entry
.ibc_counterparty_channel_id
.map_or("".to_string(), |ibc_counterparty_channel_id| {
ibc_counterparty_channel_id
}),
display_name: raw_entry.display_name,
display_symbol: raw_entry
.display_symbol
.map_or("".to_string(), |display_symbol| display_symbol),
external_symbol: raw_entry
.external_symbol
.map_or("".to_string(), |external_symbol| external_symbol),
unit_denom: raw_entry
.unit_denom
.map_or("".to_string(), |unit_denom| unit_denom),
authority: raw_entry.authority,
commit_enabled: raw_entry.commit_enabled,
withdraw_enabled: raw_entry.withdraw_enabled,
network: raw_entry.network.map_or("".to_string(), |network| network),
address: raw_entry.address.map_or("".to_string(), |address| address),
transfer_limit: raw_entry
.transfer_limit
.map_or("".to_string(), |transfer_limit| transfer_limit),
ibc_counterparty_denom: raw_entry
.ibc_counterparty_denom
.map_or("".to_string(), |ibc_counterparty_denom| {
ibc_counterparty_denom
}),
ibc_counterparty_chain_id: raw_entry
.ibc_counterparty_chain_id
.map_or("".to_string(), |ibc_counterparty_chain_id| {
ibc_counterparty_chain_id
}),
permissions: raw_entry
.permissions
.map_or(vec![], |permissions| permissions),
},
};
Ok(resp)
}
}
3 changes: 3 additions & 0 deletions src/bindings/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ use cosmwasm_std::{CustomQuery, Decimal, Coin};
#[allow(unused_imports)]
use crate::msg::query_resp::earn::QueryEarnPoolResponse;

use elys_bindings::query_resp::QueryGetEntryResponse;


#[cw_serde]
#[derive(QueryResponses)]
pub enum ElysQuery {
Expand Down
31 changes: 0 additions & 31 deletions src/bindings/query_resp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,34 +135,3 @@ pub struct Price {
pub struct QueryGetPriceResponse {
pub price: Price,
}

// TODO:
// Some of the items are commented because of the omitempty flag in protobuf.
// Until we fix this problem, we keep the items commented to be same result from the live elys testnet asset entry.
#[cw_serde]
pub struct Entry {
pub base_denom: String,
pub decimals: u64,
pub denom: String,
pub path: String,
pub ibc_channel_id: String,
pub ibc_counterparty_channel_id: String,
pub display_name: String,
pub display_symbol: String,
// pub network: String,
// pub address: String,
pub external_symbol: String,
// pub transfer_limit: String,
// pub permissions: Vec<String>,
pub unit_denom: String,
// pub ibc_counterparty_denom: String,
// pub ibc_counterparty_chain_id: String,
pub authority: String,
pub commit_enabled: bool,
pub withdraw_enabled: bool,
}

#[cw_serde]
pub struct QueryGetEntryResponse {
pub entry: Entry,
}

0 comments on commit 8a35b20

Please sign in to comment.