From 3db89e9920264bf9addd82d53c8d591f54ad264a Mon Sep 17 00:00:00 2001 From: peartes Date: Sat, 20 Jul 2024 15:49:05 +0100 Subject: [PATCH] fix: failing revokeAllowance call --- contracts/treasury/src/execute.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/treasury/src/execute.rs b/contracts/treasury/src/execute.rs index 988f9b6..6ae9625 100644 --- a/contracts/treasury/src/execute.rs +++ b/contracts/treasury/src/execute.rs @@ -222,20 +222,20 @@ pub fn deploy_fee_grant( // check to see if the user already has an existing feegrant let feegrant_query_msg_bytes = QueryAllowanceRequest { - granter: authz_granter.to_string(), + granter: env.contract.address.to_string(), grantee: authz_grantee.to_string(), } .to_bytes()?; let feegrant_query_res = deps .querier - .query::(&cosmwasm_std::QueryRequest::Stargate { + .query::(&cosmwasm_std::QueryRequest::Stargate { path: "/cosmos.feegrant.v1beta1.Query/Allowance".to_string(), data: feegrant_query_msg_bytes.into(), }) - .unwrap_or_default(); + .unwrap_or_else(|_| serde_json::json!({"allowance": null})); let mut msgs: Vec = Vec::new(); - if feegrant_query_res.allowance.is_some() { + if !feegrant_query_res["allowance"].is_null() { let feegrant_revoke_msg_bytes = cosmos_sdk_proto::cosmos::feegrant::v1beta1::MsgRevokeAllowance { granter: env.contract.address.clone().into_string(),