diff --git a/contracts/puppeteer/src/contract.rs b/contracts/puppeteer/src/contract.rs index dbed618e..40428707 100644 --- a/contracts/puppeteer/src/contract.rs +++ b/contracts/puppeteer/src/contract.rs @@ -36,7 +36,7 @@ use lido_puppeteer_base::{ }, }; use lido_staking_base::{ - msg::puppeteer::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryExtMsg}, + msg::puppeteer::{ExecuteMsg, FeesResponse, InstantiateMsg, MigrateMsg, QueryExtMsg}, state::puppeteer::{Config, KVQueryType, DELEGATIONS_AND_BALANCE}, }; use neutron_sdk::interchain_queries::v045::new_register_delegator_unbonding_delegations_query_msg; @@ -115,11 +115,23 @@ pub fn query( .collect::>>()?, ) .map_err(ContractError::Std), + QueryExtMsg::Fees {} => query_fees(deps), }, _ => Puppeteer::default().query(deps, env, msg), } } +fn query_fees(deps: Deps) -> ContractResult { + let fees = Puppeteer::default().ibc_fee.load(deps.storage)?; + let register_fee = Puppeteer::default().register_fee.load(deps.storage)?; + Ok(to_json_binary(&FeesResponse { + recv_fee: fees.recv_fee, + ack_fee: fees.ack_fee, + timeout_fee: fees.timeout_fee, + register_fee, + })?) +} + fn query_delegations(deps: Deps) -> ContractResult { let data = DELEGATIONS_AND_BALANCE.load(deps.storage)?; to_json_binary(&(data.0, data.2)).map_err(ContractError::Std) diff --git a/integration_tests/src/generated/contractLib/lidoPuppeteer.ts b/integration_tests/src/generated/contractLib/lidoPuppeteer.ts index 12d0febd..e18518cb 100644 --- a/integration_tests/src/generated/contractLib/lidoPuppeteer.ts +++ b/integration_tests/src/generated/contractLib/lidoPuppeteer.ts @@ -107,6 +107,9 @@ export type QueryExtMsg = | { balances: {}; } + | { + fees: {}; + } | { unbonding_delegations: {}; }; diff --git a/integration_tests/src/testcases/core.test.ts b/integration_tests/src/testcases/core.test.ts index 3ae4715b..672849c3 100644 --- a/integration_tests/src/testcases/core.test.ts +++ b/integration_tests/src/testcases/core.test.ts @@ -467,6 +467,15 @@ describe('Core', () => { 1.5, ); expect(res.transactionHash).toHaveLength(64); + const fees: any = await context.puppeteerContractClient.queryExtention({ + msg: { fees: {} }, + }); + expect(fees).toEqual({ + recv_fee: [{ denom: 'untrn', amount: '0' }], + ack_fee: [{ denom: 'untrn', amount: '10000' }], + timeout_fee: [{ denom: 'untrn', amount: '10000' }], + register_fee: { denom: 'untrn', amount: '1000000' }, + }); }); it('register ICA', async () => { @@ -608,12 +617,7 @@ describe('Core', () => { ], ); expect(res.transactionHash).toHaveLength(64); - const newExchangeRate = parseFloat( - await coreContractClient.queryExchangeRate(), - ); - console.log({ newExchangeRate }); const amount = Math.floor(100_000 / context.exchangeRate).toString(); - console.log({ amount }); res = await coreContractClient.unbond(neutronUserAddress, 1.6, undefined, [ { amount, @@ -659,7 +663,6 @@ describe('Core', () => { owner: context.neutronUserAddress, }); expect(vouchers.tokens.length).toBe(2); - expect(vouchers.tokens[0]).toBe(`0_${neutronUserAddress}_1`); let tokenId = vouchers.tokens[0]; let voucher = await withdrawalVoucherContractClient.queryNftInfo({ @@ -698,7 +701,6 @@ describe('Core', () => { }, token_uri: null, }); - expect(vouchers.tokens[1]).toBe(`0_${neutronUserAddress}_2`); tokenId = vouchers.tokens[1]; voucher = await withdrawalVoucherContractClient.queryNftInfo({ diff --git a/packages/base/src/msg/puppeteer.rs b/packages/base/src/msg/puppeteer.rs index f1c1a78a..b6dc9e8d 100644 --- a/packages/base/src/msg/puppeteer.rs +++ b/packages/base/src/msg/puppeteer.rs @@ -102,6 +102,14 @@ pub type DelegationsResponse = (Delegations, u64); pub type BalancesResponse = (Balances, u64); +#[cw_serde] +pub struct FeesResponse { + pub recv_fee: Vec, + pub ack_fee: Vec, + pub timeout_fee: Vec, + pub register_fee: cosmwasm_std::Coin, +} + #[cw_serde] #[derive(QueryResponses)] pub enum QueryExtMsg { @@ -109,6 +117,8 @@ pub enum QueryExtMsg { Delegations {}, #[returns(BalancesResponse)] Balances {}, + #[returns(FeesResponse)] + Fees {}, #[returns(Vec)] UnbondingDelegations {}, }