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

Warning cleanup #134

Merged
merged 2 commits into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,14 @@ members = [
# Mock contracts
"contracts/mock_band",
]

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = true
debug-assertions = false
codegen-units = 1
panic = 'abort'
incremental = false
overflow-checks = true
11 changes: 0 additions & 11 deletions contracts/airdrop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@ exclude = [
[lib]
crate-type = ["cdylib", "rlib"]

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = true
debug-assertions = false
codegen-units = 1
panic = 'abort'
incremental = false
overflow-checks = true

[features]
default = []
# for quicker tests, cargo test --lib
Expand Down
5 changes: 2 additions & 3 deletions contracts/airdrop/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cosmwasm_std::{debug_print, to_binary, Api, Binary, Env, Extern, HandleResponse, InitResponse, Querier, StdResult, Storage, Uint128, HumanAddr};
use cosmwasm_std::{to_binary, Api, Binary, Env, Extern, HandleResponse, InitResponse, Querier, StdResult, Storage};
use shade_protocol::{
airdrop::{
InitMsg, HandleMsg,
Expand All @@ -8,7 +8,6 @@ use shade_protocol::{
use crate::{state::{config_w, reward_w, claim_status_w},
handle::{try_update_config, try_claim},
query };
use secret_toolkit::snip20::token_info_query;

pub fn init<S: Storage, A: Api, Q: Querier>(
deps: &mut Extern<S, A, Q>,
Expand Down Expand Up @@ -67,4 +66,4 @@ pub fn query<S: Storage, A: Api, Q: Querier>(
QueryMsg::GetEligibility { address } => to_binary(
&query::airdrop_amount(&deps, address)?),
}
}
}
11 changes: 4 additions & 7 deletions contracts/airdrop/src/handle.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use cosmwasm_std::{debug_print, to_binary, Api, Binary, Env, Extern, HandleResponse, Querier, StdError, StdResult, Storage, CosmosMsg, HumanAddr, Uint128, from_binary, Empty};
use shade_protocol::asset::Contract;
use cosmwasm_std::{to_binary, Api, Env, Extern, HandleResponse, Querier, StdError, StdResult, Storage, HumanAddr};
use crate::state::{config_r, config_w, reward_r, claim_status_w, claim_status_r};
use shade_protocol::airdrop::{HandleAnswer};
use shade_protocol::generic_response::ResponseStatus;
Expand Down Expand Up @@ -32,7 +31,7 @@ pub fn try_update_config<S: Storage, A: Api, Q: Querier>(
}

Ok(state)
});
})?;

Ok(HandleResponse {
messages: vec![],
Expand Down Expand Up @@ -80,14 +79,12 @@ pub fn try_claim<S: Storage, A: Api, Q: Querier>(
config.airdrop_snip20.address)?];

// Mark reward as redeemed
claim_status_w(&mut deps.storage).update(key.as_bytes(), |claimed| {
Ok(true)
})?;
claim_status_w(&mut deps.storage).save(key.as_bytes(), &true)?;

Ok(HandleResponse {
messages,
log: vec![],
data: Some( to_binary( &HandleAnswer::Claim {
status: ResponseStatus::Success } )? )
})
}
}
4 changes: 2 additions & 2 deletions contracts/airdrop/src/query.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cosmwasm_std::{Api, Extern, Querier, StdError, StdResult, Storage, HumanAddr, Uint128};
use cosmwasm_std::{Api, Extern, Querier, StdResult, Storage, HumanAddr};
use shade_protocol::airdrop::{QueryAnswer};
use crate::{state::{config_r, reward_r}};
use crate::state::claim_status_r;
Expand All @@ -23,4 +23,4 @@ pub fn airdrop_amount<S: Storage, A: Api, Q: Querier>
amount: reward_r(&deps.storage).load(key.as_bytes())?.amount,
claimed: claim_status_r(&deps.storage).load(key.as_bytes())?
})
}
}
4 changes: 2 additions & 2 deletions contracts/airdrop/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cosmwasm_std::{Storage, Uint128};
use cosmwasm_std::Storage;
use cosmwasm_storage::{singleton, singleton_read, ReadonlySingleton, Singleton, bucket, Bucket, bucket_read, ReadonlyBucket};
use shade_protocol::airdrop::{Config, Reward};

Expand Down Expand Up @@ -28,4 +28,4 @@ pub fn claim_status_r<S: Storage>(storage: & S) -> ReadonlyBucket<S, bool> {

pub fn claim_status_w<S: Storage>(storage: &mut S) -> Bucket<S, bool> {
bucket(CLAIM_STATUS_KEY, storage)
}
}
13 changes: 1 addition & 12 deletions contracts/governance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,6 @@ exclude = [
[lib]
crate-type = ["cdylib", "rlib"]

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = true
debug-assertions = false
codegen-units = 1
panic = 'abort'
incremental = false
overflow-checks = true

[features]
default = []
# for quicker tests, cargo test --lib
Expand All @@ -43,4 +32,4 @@ schemars = "0.7"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
snafu = { version = "0.6.3" }
mockall = "0.10.2"
mockall_double = "0.2.0"
mockall_double = "0.2.0"
11 changes: 5 additions & 6 deletions contracts/governance/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use crate::{
handle,
query
};
use shade_protocol::asset::Contract;
use crate::state::{admin_commands_list_w, supported_contracts_list_w};
use crate::handle::try_disable_staker;

Expand Down Expand Up @@ -51,12 +50,12 @@ pub fn handle<S: Storage, A: Api, Q: Querier>(
msg: HandleMsg,
) -> StdResult<HandleResponse> {
match msg {
/// Proposals
// Proposals
HandleMsg::CreateProposal { target_contract, proposal, description
} => handle::try_create_proposal(deps, &env, target_contract,
Binary::from(proposal.as_bytes()), description),

/// Self interactions
// Self interactions
// Config
HandleMsg::UpdateConfig { admin, staker, proposal_deadline,
minimum_votes } =>
Expand Down Expand Up @@ -84,14 +83,14 @@ pub fn handle<S: Storage, A: Api, Q: Querier>(
HandleMsg::UpdateAdminCommand { name, proposal
} => handle::try_update_admin_command(deps, &env, name, proposal),

/// User interaction
// User interaction
HandleMsg::MakeVote { voter, proposal_id, votes
} => handle::try_vote(deps, &env, voter, proposal_id, votes),

HandleMsg::TriggerProposal { proposal_id
} => handle::try_trigger_proposal(deps, &env, proposal_id),

/// Admin interactions
// Admin interactions
HandleMsg::TriggerAdminCommand { target, command,
variables, description
} => handle::try_trigger_admin_command(deps, &env, target, command, variables, description),
Expand Down Expand Up @@ -125,4 +124,4 @@ pub fn query<S: Storage, A: Api, Q: Querier>(
QueryMsg::GetAdminCommand { name
} => to_binary(&query::admin_command(deps, name)?),
}
}
}
13 changes: 6 additions & 7 deletions contracts/governance/src/handle.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
use cosmwasm_std::{to_binary, Api, Binary, Env, Extern, HandleResponse, Querier, StdError, StdResult, Storage, CosmosMsg, HumanAddr, Uint128, WasmMsg, Empty};
use cosmwasm_std::{to_binary, Api, Binary, Env, Extern, HandleResponse, Querier, StdError, StdResult, Storage, CosmosMsg, HumanAddr, Uint128, WasmMsg};
use crate::state::{supported_contract_r, config_r, total_proposals_w, proposal_w, config_w, supported_contract_w, proposal_r, admin_commands_r, admin_commands_w, admin_commands_list_w, supported_contracts_list_w, total_proposals_r, total_proposal_votes_w, proposal_votes_w, total_proposal_votes_r, proposal_votes_r};
use shade_protocol::{
governance::{Proposal, ProposalStatus, HandleAnswer, GOVERNANCE_SELF, HandleMsg},
governance::{Proposal, ProposalStatus, HandleAnswer, GOVERNANCE_SELF},
generic_response::ResponseStatus,
asset::Contract,
};
use shade_protocol::governance::ProposalStatus::{Accepted, Expired, Rejected};
use shade_protocol::generic_response::ResponseStatus::{Success, Failure};
use shade_protocol::governance::{AdminCommand, ADMIN_COMMAND_VARIABLE, Vote, UserVote, VoteTally};
use secret_toolkit::utils::HandleCallback;
use shade_protocol::governance::{AdminCommand, ADMIN_COMMAND_VARIABLE, VoteTally};

pub fn create_proposal<S: Storage, A: Api, Q: Querier>(
deps: &mut Extern<S, A, Q>,
Expand Down Expand Up @@ -76,7 +75,7 @@ pub fn try_trigger_proposal<S: Storage, A: Api, Q: Querier>(
// Change proposal behavior according to stake availability
let config = config_r(&deps.storage).load()?;
proposal.vote_status = match config.staker {
Some(staker) => {
Some(_) => {

let total_votes = total_proposal_votes_r(&deps.storage).load(
proposal_id.to_string().as_bytes())?;
Expand Down Expand Up @@ -359,7 +358,7 @@ pub fn try_update_config<S: Storage, A: Api, Q: Querier>(

pub fn try_disable_staker<S: Storage, A: Api, Q: Querier>(
deps: &mut Extern<S, A, Q>,
env: &Env,
_env: &Env,
) -> StdResult<HandleResponse> {

config_w(&mut deps.storage).update(|mut state| {
Expand Down Expand Up @@ -570,4 +569,4 @@ pub fn try_update_admin_command<S: Storage, A: Api, Q: Querier>(
status: ResponseStatus::Success
})?),
})
}
}
2 changes: 1 addition & 1 deletion contracts/governance/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use shade_protocol::{
governance::{Config, Proposal},
asset::Contract,
};
use shade_protocol::governance::{AdminCommand, UserVote, VoteTally};
use shade_protocol::governance::{AdminCommand, VoteTally};

pub static CONFIG_KEY: &[u8] = b"config";
pub static CONTRACT_KEY: &[u8] = b"supported_contracts";
Expand Down
11 changes: 0 additions & 11 deletions contracts/initializer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,6 @@ exclude = [
[lib]
crate-type = ["cdylib", "rlib"]

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = true
debug-assertions = false
codegen-units = 1
panic = 'abort'
incremental = false
overflow-checks = true

[features]
default = []
# for quicker tests, cargo test --lib
Expand Down
10 changes: 5 additions & 5 deletions contracts/initializer/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cosmwasm_std::{debug_print, to_binary, Api, Binary, Env, Extern, HandleResponse, InitResponse, Querier, StdError, StdResult, Storage, HumanAddr};
use cosmwasm_std::{debug_print, to_binary, Api, Binary, Env, Extern, HandleResponse, InitResponse, Querier, StdResult, Storage};
use crate::state::{config_w};
use shade_protocol::initializer::{InitMsg, InitializerConfig, HandleMsg, QueryMsg, Snip20InitHistory};
use secret_toolkit::utils::InitCallback;
Expand Down Expand Up @@ -78,9 +78,9 @@ pub fn init<S: Storage, A: Api, Q: Querier>(
}

pub fn handle<S: Storage, A: Api, Q: Querier>(
deps: &mut Extern<S, A, Q>,
env: Env,
msg: HandleMsg,
_deps: &mut Extern<S, A, Q>,
_env: Env,
_msg: HandleMsg,
) -> StdResult<HandleResponse> {
return Ok(HandleResponse {
messages: vec![],
Expand All @@ -96,4 +96,4 @@ pub fn query<S: Storage, A: Api, Q: Querier>(
match msg {
QueryMsg::Contracts {} => to_binary(&query_contracts(deps)?),
}
}
}
6 changes: 3 additions & 3 deletions contracts/initializer/src/query.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use cosmwasm_std::{Storage, Api, Querier, Extern, StdResult, to_binary, Binary};
use shade_protocol::initializer::{QueryMsg, QueryAnswer};
use cosmwasm_std::{Storage, Api, Querier, Extern, StdResult};
use shade_protocol::initializer::QueryAnswer;
use crate::state::config_r;

pub fn query_contracts<S: Storage, A: Api, Q: Querier>(deps: &Extern<S, A, Q>) -> StdResult<QueryAnswer> {
Ok(QueryAnswer::ContractsAnswer { contracts: config_r(&deps.storage).load()?.contracts })
}
}
5 changes: 1 addition & 4 deletions contracts/initializer/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use cosmwasm_std::{CanonicalAddr, Storage};
use cosmwasm_std::Storage;
use cosmwasm_storage::{singleton, singleton_read, ReadonlySingleton, Singleton};
use shade_protocol::initializer::InitializerConfig;

Expand Down
11 changes: 0 additions & 11 deletions contracts/micro_mint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@ exclude = [
[lib]
crate-type = ["cdylib", "rlib"]

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = true
debug-assertions = false
codegen-units = 1
panic = 'abort'
incremental = false
overflow-checks = true

[features]
default = []
# for quicker tests, cargo test --lib
Expand Down
2 changes: 1 addition & 1 deletion contracts/micro_mint/src/handle.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::convert::TryFrom;
use cosmwasm_std::{debug_print, to_binary, Api, Binary, Env, Extern, HandleResponse, Querier, StdError, StdResult, Storage, CosmosMsg, HumanAddr, Uint128, from_binary, Empty};
use cosmwasm_std::{debug_print, to_binary, Api, Binary, Env, Extern, HandleResponse, Querier, StdError, StdResult, Storage, CosmosMsg, HumanAddr, Uint128, from_binary};
use secret_toolkit::{
snip20::{
token_info_query,
Expand Down
11 changes: 0 additions & 11 deletions contracts/mint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,6 @@ exclude = [
[lib]
crate-type = ["cdylib", "rlib"]

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = true
debug-assertions = false
codegen-units = 1
panic = 'abort'
incremental = false
overflow-checks = true

[features]
default = []
# for quicker tests, cargo test --lib
Expand Down
1 change: 0 additions & 1 deletion contracts/mint/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ fn call_oracle<S: Storage, A: Api, Q: Querier>(
deps: &Extern<S, A, Q>,
symbol: String,
) -> StdResult<Uint128> {
let block_size = 1; //update this later
let config = config_read(&deps.storage).load()?;
let query_msg = GetPrice { symbol };
let answer: ReferenceData = query_msg.query(&deps.querier,
Expand Down
11 changes: 0 additions & 11 deletions contracts/mock_band/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,6 @@ exclude = [
[lib]
crate-type = ["cdylib", "rlib"]

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = true
debug-assertions = false
codegen-units = 1
panic = 'abort'
incremental = false
overflow-checks = true

[features]
default = []
# for quicker tests, cargo test --lib
Expand Down
11 changes: 0 additions & 11 deletions contracts/oracle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@ exclude = [
[lib]
crate-type = ["cdylib", "rlib"]

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = true
debug-assertions = false
codegen-units = 1
panic = 'abort'
incremental = false
overflow-checks = true

[features]
default = []
# for quicker tests, cargo test --lib
Expand Down
2 changes: 1 addition & 1 deletion contracts/oracle/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use cosmwasm_std::{
debug_print, to_binary, Api, Binary,
Env, Extern, HandleResponse, InitResponse,
Querier, StdResult, StdError, Storage, Uint128,
Querier, StdResult, Storage, Uint128,
};
use shade_protocol::{
oracle::{
Expand Down
Loading