Skip to content

Commit

Permalink
code completed
Browse files Browse the repository at this point in the history
  • Loading branch information
itsHaseebSaeed committed Dec 13, 2023
1 parent e712d84 commit f7ea22b
Show file tree
Hide file tree
Showing 11 changed files with 1,116 additions and 298 deletions.
26 changes: 17 additions & 9 deletions contracts/liquidity_book/lb_token/src/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,24 @@ use secret_toolkit::{
};

use crate::state::{
balances_r, blockinfo_r, contr_conf_r, get_receiver_hash,
balances_r,
blockinfo_r,
contr_conf_r,
get_receiver_hash,
permissions::{list_owner_permission_keys, may_load_any_permission},
tkn_info_r, tkn_tot_supply_r,
tkn_info_r,
tkn_tot_supply_r,
txhistory::{get_txs, may_get_current_owner},
PREFIX_REVOKED_PERMITS,
};

use shade_protocol::lb_libraries::lb_token::{
permissions::{Permission, PermissionKey},
state_structs::OwnerBalance,
use shade_protocol::{
lb_libraries::lb_token::{
permissions::{Permission, PermissionKey},
state_structs::OwnerBalance,
},
liquidity_book::lb_token::{QueryAnswer, QueryMsg, QueryWithPermit},
};
use shade_protocol::liquidity_book::lb_token::{QueryAnswer, QueryMsg, QueryWithPermit};
/////////////////////////////////////////////////////////////////////////////////
// Queries
/////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -94,7 +100,9 @@ fn permit_queries(deps: Deps, permit: Permit, query: QueryWithPermit) -> Result<
if account != owner.as_str() && account != allowed_address.as_str() {
return Err(StdError::generic_err(format!(
"Cannot query permission. Requires permit for either owner {:?} or viewer||spender {:?}, got permit for {:?}",
owner.as_str(), allowed_address.as_str(), account.as_str()
owner.as_str(),
allowed_address.as_str(),
account.as_str()
)));
}

Expand Down Expand Up @@ -243,7 +251,7 @@ fn query_token_id_private_info(deps: Deps, viewer: &Addr, token_id: String) -> S
None => {
return Err(StdError::generic_err(
"you do have have permission to view private token info",
))
));
}
Some(perm) => {
let block: BlockInfo =
Expand Down Expand Up @@ -296,7 +304,7 @@ fn query_balance(deps: Deps, owner: &Addr, viewer: &Addr, token_id: String) -> S
None => {
return Err(StdError::generic_err(
"you do have have permission to view balance",
))
));
}
Some(perm) => {
let block: BlockInfo =
Expand Down
Loading

0 comments on commit f7ea22b

Please sign in to comment.