Skip to content

Commit

Permalink
Merge pull request #163 from securesecrets/code-cleanup
Browse files Browse the repository at this point in the history
Code cleanup
  • Loading branch information
FloppyDisck authored Jan 17, 2022
2 parents 3935fb3 + 1dd88cd commit 29acb70
Show file tree
Hide file tree
Showing 19 changed files with 68 additions and 61 deletions.
10 changes: 5 additions & 5 deletions contracts/airdrop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ backtraces = ["cosmwasm-std/backtraces"]
debug-print = ["cosmwasm-std/debug-print"]

[dependencies]
cosmwasm-schema = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-std = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-storage = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
secret-toolkit = { git = "https://github.com/enigmampc/secret-toolkit", branch = "debug-print"}
cosmwasm-std = { version = "0.10", package = "secret-cosmwasm-std" }
cosmwasm-storage = { version = "0.10", package = "secret-cosmwasm-storage" }
cosmwasm-schema = "0.10.1"
secret-toolkit = { version = "0.2" }
shade-protocol = { version = "0.1.0", path = "../../packages/shade_protocol" }
schemars = "0.7"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
Expand All @@ -38,4 +38,4 @@ mockall = "0.10.2"
mockall_double = "0.2.0"

[dev-dependencies]
flexible-permits = {git = "https://github.com/securesecrets/flexible-permits", tag = "v1.0.0"}
flexible-permits = {git = "https://github.com/securesecrets/flexible-permits", tag = "v1.0.1"}
4 changes: 4 additions & 0 deletions contracts/airdrop/src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ pub fn try_create_account<S: Storage, A: Api, Q: Querier>(
redeem_amount,
None,
None,
None,
0,
config.airdrop_snip20.code_hash,
config.airdrop_snip20.address,
Expand Down Expand Up @@ -323,6 +324,7 @@ pub fn try_update_account<S: Storage, A: Api, Q: Querier>(
redeem_amount,
None,
None,
None,
0,
config.airdrop_snip20.code_hash,
config.airdrop_snip20.address,
Expand Down Expand Up @@ -426,6 +428,7 @@ pub fn try_claim<S: Storage, A: Api, Q: Querier>(
redeem_amount,
None,
None,
None,
0,
config.airdrop_snip20.code_hash,
config.airdrop_snip20.address,
Expand Down Expand Up @@ -462,6 +465,7 @@ pub fn try_claim_decay<S: Storage, A: Api, Q: Querier>(
send_total,
None,
None,
None,
1,
config.airdrop_snip20.code_hash,
config.airdrop_snip20.address,
Expand Down
13 changes: 4 additions & 9 deletions contracts/airdrop/src/test.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#[cfg(test)]
pub mod tests {
use crate::{contract::init, handle::inverse_normalizer};
use crate::handle::inverse_normalizer;
use cosmwasm_std::{
testing::{mock_dependencies, mock_env},
Binary,
CanonicalAddr,
HumanAddr,
Uint128,
};
Expand All @@ -15,10 +13,7 @@ pub mod tests {
use shade_protocol::{
airdrop::{
account::{AddressProofMsg, AddressProofPermit},
claim_info::RequiredTask,
InitMsg,
},
asset::Contract,
math::{div, mult},
};

Expand Down Expand Up @@ -59,7 +54,7 @@ pub mod tests {
let permit_addr = permit.validate().expect("Signature validation failed");
assert_eq!(
permit_addr.as_canonical(),
bech32_to_canonical(permit.params.address.clone().as_str())
bech32_to_canonical(permit.params.address.as_str())
);
assert_ne!(
permit_addr.as_canonical(),
Expand Down Expand Up @@ -94,7 +89,7 @@ pub mod tests {
let permit_addr = permit.validate().expect("Signature validation failed");
assert_eq!(
permit_addr.as_canonical(),
bech32_to_canonical(permit.params.address.clone().as_str())
bech32_to_canonical(permit.params.address.as_str())
);
assert_ne!(
permit_addr.as_canonical(),
Expand Down Expand Up @@ -129,7 +124,7 @@ pub mod tests {
let permit_addr = permit.validate().expect("Signature validation failed");
assert_eq!(
permit_addr.as_canonical(),
bech32_to_canonical(permit.params.address.clone().as_str())
bech32_to_canonical(permit.params.address.as_str())
);
assert_ne!(
permit_addr.as_canonical(),
Expand Down
9 changes: 4 additions & 5 deletions contracts/governance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ backtraces = ["cosmwasm-std/backtraces"]
debug-print = ["cosmwasm-std/debug-print"]

[dependencies]
cosmwasm-schema = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-std = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-storage = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
# TODO: Update when secret-toolkit accepts the branch
secret-toolkit = { git = "https://github.com/FloppyDisck/secret-toolkit", branch = "snip20-batch-transactions"}
cosmwasm-std = { version = "0.10", package = "secret-cosmwasm-std" }
cosmwasm-storage = { version = "0.10", package = "secret-cosmwasm-storage" }
cosmwasm-schema = "0.10.1"
secret-toolkit = { version = "0.2" }
shade-protocol = { version = "0.1.0", path = "../../packages/shade_protocol" }
schemars = "0.7"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
Expand Down
3 changes: 2 additions & 1 deletion contracts/governance/src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ use cosmwasm_std::{
Uint128,
WasmMsg,
};
use secret_toolkit::snip20::{batch_send_msg, send_msg, SendAction};
use secret_toolkit::snip20::{batch_send_msg, send_msg, batch::SendAction};
use shade_protocol::{
asset::Contract,
generic_response::{
Expand Down Expand Up @@ -213,6 +213,7 @@ pub fn try_fund_proposal<S: Storage, A: Api, Q: Querier>(
if let Some(mut amounts) = amounts {
amounts.push(SendAction {
recipient: sender.clone(),
recipient_code_hash: None,
amount: adjusted_amount,
msg: None,
memo: None,
Expand Down
8 changes: 4 additions & 4 deletions contracts/initializer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ backtraces = ["cosmwasm-std/backtraces"]
debug-print = ["cosmwasm-std/debug-print"]

[dependencies]
cosmwasm-schema = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-std = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-storage = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
secret-toolkit = { git = "https://github.com/enigmampc/secret-toolkit", branch = "debug-print"}
cosmwasm-std = { version = "0.10", package = "secret-cosmwasm-std" }
cosmwasm-storage = { version = "0.10", package = "secret-cosmwasm-storage" }
cosmwasm-schema = "0.10.1"
secret-toolkit = { version = "0.2" }
shade-protocol = { version = "0.1.0", path = "../../packages/shade_protocol" }
schemars = "0.7"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
Expand Down
8 changes: 4 additions & 4 deletions contracts/micro_mint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ backtraces = ["cosmwasm-std/backtraces"]
debug-print = ["cosmwasm-std/debug-print"]

[dependencies]
cosmwasm-schema = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-std = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-storage = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
secret-toolkit = { git = "https://github.com/enigmampc/secret-toolkit", branch = "debug-print"}
cosmwasm-std = { version = "0.10", package = "secret-cosmwasm-std" }
cosmwasm-storage = { version = "0.10", package = "secret-cosmwasm-storage" }
cosmwasm-schema = "0.10.1"
secret-toolkit = { version = "0.2" }
shade-protocol = { version = "0.1.0", path = "../../packages/shade_protocol" }
schemars = "0.7"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
Expand Down
5 changes: 5 additions & 0 deletions contracts/micro_mint/src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ pub fn try_burn<S: Storage, A: Api, Q: Querier>(
capture_amount,
None,
None,
None,
1,
burn_asset.asset.contract.code_hash.clone(),
burn_asset.asset.contract.address.clone(),
Expand All @@ -152,6 +153,7 @@ pub fn try_burn<S: Storage, A: Api, Q: Querier>(
messages.push(burn_msg(
burn_amount,
None,
None,
256,
burn_asset.asset.contract.code_hash.clone(),
burn_asset.asset.contract.address.clone(),
Expand All @@ -162,6 +164,7 @@ pub fn try_burn<S: Storage, A: Api, Q: Querier>(
burn_amount,
None,
None,
None,
1,
burn_asset.asset.contract.code_hash.clone(),
burn_asset.asset.contract.address.clone(),
Expand All @@ -173,6 +176,7 @@ pub fn try_burn<S: Storage, A: Api, Q: Querier>(
burn_amount,
None,
None,
None,
1,
burn_asset.asset.contract.code_hash.clone(),
burn_asset.asset.contract.address.clone(),
Expand Down Expand Up @@ -235,6 +239,7 @@ pub fn try_burn<S: Storage, A: Api, Q: Querier>(
from,
amount_to_mint,
None,
None,
256,
mint_asset.contract.code_hash.clone(),
mint_asset.contract.address,
Expand Down
8 changes: 4 additions & 4 deletions contracts/mint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ backtraces = ["cosmwasm-std/backtraces"]
debug-print = ["cosmwasm-std/debug-print"]

[dependencies]
cosmwasm-schema = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-std = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-storage = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
secret-toolkit = { git = "https://github.com/enigmampc/secret-toolkit", branch = "debug-print"}
cosmwasm-std = { version = "0.10", package = "secret-cosmwasm-std" }
cosmwasm-storage = { version = "0.10", package = "secret-cosmwasm-storage" }
cosmwasm-schema = "0.10.1"
secret-toolkit = { version = "0.2" }
shade-protocol = { version = "0.1.0", path = "../../packages/shade_protocol" }
schemars = "0.7"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
Expand Down
2 changes: 2 additions & 0 deletions contracts/mint/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ pub fn try_burn<S: Storage, A: Api, Q: Querier>(
messages.push(burn_msg(
amount,
None,
None,
256,
burning_asset.contract.code_hash,
burning_asset.contract.address,
Expand All @@ -330,6 +331,7 @@ pub fn try_burn<S: Storage, A: Api, Q: Querier>(
from,
amount_to_mint,
None,
None,
256,
minting_asset.contract.code_hash,
minting_asset.contract.address,
Expand Down
8 changes: 4 additions & 4 deletions contracts/mock_band/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ debug-print = ["cosmwasm-std/debug-print"]

[dependencies]
bincode = "1.3.1"
cosmwasm-schema = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-std = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-storage = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
secret-toolkit = { git = "https://github.com/enigmampc/secret-toolkit", branch = "debug-print"}
cosmwasm-std = { version = "0.10", package = "secret-cosmwasm-std" }
cosmwasm-storage = { version = "0.10", package = "secret-cosmwasm-storage" }
cosmwasm-schema = "0.10.1"
secret-toolkit = { version = "0.2" }
shade-protocol = { version = "0.1.0", path = "../../packages/shade_protocol" }
schemars = "0.7"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
Expand Down
8 changes: 4 additions & 4 deletions contracts/oracle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ debug-print = ["cosmwasm-std/debug-print"]

[dependencies]
bincode = "1.3.1"
cosmwasm-schema = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-std = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-storage = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
secret-toolkit = { git = "https://github.com/enigmampc/secret-toolkit", branch = "debug-print"}
cosmwasm-std = { version = "0.10", package = "secret-cosmwasm-std" }
cosmwasm-storage = { version = "0.10", package = "secret-cosmwasm-storage" }
cosmwasm-schema = "0.10.1"
secret-toolkit = { version = "0.2" }
shade-protocol = { version = "0.1.0", path = "../../packages/shade_protocol" }
schemars = "0.7"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion contracts/oracle/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub fn prices<S: Storage, A: Api, Q: Querier>(
let result_index = symbols
.iter()
.enumerate()
.find(|&s| s.1.to_string() == sym.to_string())
.find(|&s| *s.1 == *sym)
.unwrap()
.0;
results[result_index] = data.rate;
Expand Down
9 changes: 4 additions & 5 deletions contracts/scrt_staking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ backtraces = ["cosmwasm-std/backtraces"]
debug-print = ["cosmwasm-std/debug-print"]

[dependencies]
cosmwasm-schema = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-std = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print", features = ["staking"] }

cosmwasm-storage = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
secret-toolkit = { git = "https://github.com/enigmampc/secret-toolkit", branch = "debug-print"}
cosmwasm-std = { version = "0.10", package = "secret-cosmwasm-std", features = ["staking"] }
cosmwasm-storage = { version = "0.10", package = "secret-cosmwasm-storage" }
cosmwasm-schema = "0.10.1"
secret-toolkit = { version = "0.2" }
shade-protocol = { version = "0.1.0", path = "../../packages/shade_protocol" }
schemars = "0.7"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
Expand Down
8 changes: 4 additions & 4 deletions contracts/staking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ backtraces = ["cosmwasm-std/backtraces"]
debug-print = ["cosmwasm-std/debug-print"]

[dependencies]
cosmwasm-schema = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-std = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-storage = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
secret-toolkit = { git = "https://github.com/enigmampc/secret-toolkit", branch = "debug-print"}
cosmwasm-std = { version = "0.10", package = "secret-cosmwasm-std" }
cosmwasm-storage = { version = "0.10", package = "secret-cosmwasm-storage" }
cosmwasm-schema = "0.10.1"
secret-toolkit = { version = "0.2" }
shade-protocol = { version = "0.1.0", path = "../../packages/shade_protocol" }
schemars = "0.7"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
Expand Down
2 changes: 2 additions & 0 deletions contracts/staking/src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ pub fn try_claim_unbond<S: Storage, A: Api, Q: Querier>(
total,
None,
None,
None,
1,
config.staked_token.code_hash.clone(),
config.staked_token.address.clone(),
Expand Down Expand Up @@ -342,6 +343,7 @@ pub fn try_claim_rewards<S: Storage, A: Api, Q: Querier>(
rewards,
None,
None,
None,
1,
config.staked_token.code_hash.clone(),
config.staked_token.address.clone(),
Expand Down
8 changes: 4 additions & 4 deletions contracts/treasury/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ backtraces = ["cosmwasm-std/backtraces"]
debug-print = ["cosmwasm-std/debug-print"]

[dependencies]
cosmwasm-schema = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-std = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-storage = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
secret-toolkit = { git = "https://github.com/enigmampc/secret-toolkit", branch = "debug-print"}
cosmwasm-std = { version = "0.10", package = "secret-cosmwasm-std" }
cosmwasm-storage = { version = "0.10", package = "secret-cosmwasm-storage" }
cosmwasm-schema = "0.10.1"
secret-toolkit = { version = "0.2" }
shade-protocol = { version = "0.1.0", path = "../../packages/shade_protocol" }
schemars = "0.7"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
Expand Down
4 changes: 2 additions & 2 deletions packages/network_integration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ serde = { version = "1.0.103", default-features = false, features = ["derive"] }
serde_json = { version = "1.0.67"}
getrandom = { version = "0.2", features = ["js"] } # Prevents wasm from freaking out when running make
rand = { version = "0.8.4"}
cosmwasm-std = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-std = { version = "0.10", package = "secret-cosmwasm-std" }
rs_merkle = { git = "https://github.com/FloppyDisck/rs-merkle", branch = "node_export" }
flexible-permits = {git = "https://github.com/securesecrets/flexible-permits", tag = "v1.0.0"}
flexible-permits = {git = "https://github.com/securesecrets/flexible-permits", tag = "v1.0.1"}

10 changes: 5 additions & 5 deletions packages/shade_protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ backtraces = ["cosmwasm-std/backtraces"]
debug-print = ["cosmwasm-std/debug-print"]

[dependencies]
cosmwasm-schema = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-std = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
cosmwasm-storage = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" }
secret-toolkit = { git = "https://github.com/enigmampc/secret-toolkit", branch = "debug-print"}
cosmwasm-std = { version = "0.10", package = "secret-cosmwasm-std" }
cosmwasm-storage = { version = "0.10", package = "secret-cosmwasm-storage" }
cosmwasm-schema = "0.10.1"
secret-toolkit = { version = "0.2" }
schemars = "0.7"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
snafu = { version = "0.6.3" }
# Needed for airdrop
rs_merkle = { git = "https://github.com/FloppyDisck/rs-merkle", branch = "node_export" }
# Needed for transactions
flexible-permits = {git = "https://github.com/securesecrets/flexible-permits", tag = "v1.0.0"}
flexible-permits = {git = "https://github.com/securesecrets/flexible-permits", tag = "v1.0.1"}
remain = "0.2.2"

[dev-dependencies]
Expand Down

0 comments on commit 29acb70

Please sign in to comment.