diff --git a/contracts/igps/core/src/error.rs b/contracts/igps/core/src/error.rs index 1a8ebb72..7eb7c07c 100644 --- a/contracts/igps/core/src/error.rs +++ b/contracts/igps/core/src/error.rs @@ -1,3 +1,5 @@ +use cosmwasm_std::{Coin, Uint256}; + #[derive(thiserror::Error, Debug, PartialEq)] pub enum ContractError { #[error("{0}")] @@ -12,8 +14,11 @@ pub enum ContractError { #[error("unauthorized")] Unauthorized {}, - #[error("insufficient funds")] - InsufficientFunds {}, + #[error("insufficient funds: needed {gas_needed:?}, but only received {received:?}")] + InsufficientFunds { + received: Uint256, + gas_needed: Uint256, + }, #[error("gas oracle not found for {0}")] GasOracleNotFound(u32), diff --git a/contracts/igps/core/src/execute.rs b/contracts/igps/core/src/execute.rs index ba375d03..c8dd1c64 100644 --- a/contracts/igps/core/src/execute.rs +++ b/contracts/igps/core/src/execute.rs @@ -97,7 +97,13 @@ pub fn pay_for_gas( let gas_token = GAS_TOKEN.load(deps.storage)?; let received = Uint256::from(cw_utils::must_pay(&info, &gas_token)?); let gas_needed = quote_gas_price(deps.storage, &deps.querier, dest_domain, gas_amount)?; - ensure!(received >= gas_needed, ContractError::InsufficientFunds {}); + ensure!( + received >= gas_needed, + ContractError::InsufficientFunds { + received, + gas_needed, + } + ); let payment_gap = Uint128::from_str(&(received - gas_needed).to_string())?;