Skip to content

Commit

Permalink
Merge pull request #183 from PeggyJV/zaki/empty_fees_for_zero_fees
Browse files Browse the repository at this point in the history
Use an empty struct zero fees
  • Loading branch information
zmanian authored Sep 8, 2021
2 parents 3372ca1 + ebd648c commit 909af6a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion orchestrator/cosmos_gravity/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ extern crate log;
pub mod build;
pub mod query;
pub mod send;
pub mod utils;
pub mod utils;
33 changes: 21 additions & 12 deletions orchestrator/cosmos_gravity/src/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,31 @@ pub async fn send_messages(
) -> Result<TxResponse, CosmosGrpcError> {
let cosmos_address = cosmos_key.to_address(&contact.get_prefix()).unwrap();

let gas_limit = 500_000_000 * messages.len();
let gas_limit = 500_000_000 * messages.len() as u64;

let fee_amount: f64 = (gas_limit as f64) * gas_price.0;
let fee_amount: u64 = fee_amount.abs().ceil() as u64;

let fee_amount = Coin {
denom: gas_price.1,
amount: fee_amount.into(),
};

let gas_limit = gas_limit as u64;
let fee = Fee {
amount: vec![fee_amount],
gas_limit,
granter: None,
payer: None,
let fee = if fee_amount > 0 {
let fee_amount = Coin {
denom: gas_price.1,
amount: fee_amount.into(),
};

let gas_limit = gas_limit as u64;
Fee {
amount: vec![fee_amount],
gas_limit,
granter: None,
payer: None,
}
} else {
Fee {
amount: Vec::new(),
gas_limit,
granter: None,
payer: None,
}
};

let args = contact.get_message_args(cosmos_address, fee).await?;
Expand Down

0 comments on commit 909af6a

Please sign in to comment.