Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/treasury update fixes #29

Merged
merged 2 commits into from
Jul 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions contracts/treasury/src/execute.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cosmos_sdk_proto::cosmos::authz::v1beta1::{QueryGrantsRequest, QueryGrantsResponse};

Check warning on line 1 in contracts/treasury/src/execute.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused import: `QueryGrantsResponse`

Check failure on line 1 in contracts/treasury/src/execute.rs

View workflow job for this annotation

GitHub Actions / Lints

unused import: `QueryGrantsResponse`
use cosmos_sdk_proto::cosmos::feegrant::v1beta1::{QueryAllowanceRequest, QueryAllowanceResponse};

Check warning on line 2 in contracts/treasury/src/execute.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused import: `QueryAllowanceResponse`

Check failure on line 2 in contracts/treasury/src/execute.rs

View workflow job for this annotation

GitHub Actions / Lints

unused import: `QueryAllowanceResponse`
use cosmos_sdk_proto::traits::MessageExt;
use cosmwasm_std::{Addr, CosmosMsg, DepsMut, Env, Event, MessageInfo, Order, Response};
use pbjson_types::Timestamp;
Expand Down Expand Up @@ -220,20 +220,20 @@

// 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::<QueryAllowanceResponse>(&cosmwasm_std::QueryRequest::Stargate {
.query::<Value>(&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<CosmosMsg> = 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(),
Expand Down
Loading