From ae81bce8e1cb42df40b28aa811e9f701a4d78738 Mon Sep 17 00:00:00 2001 From: Jack Swenson Date: Wed, 1 Nov 2023 12:32:25 -0400 Subject: [PATCH] all building (#375) --- contracts/snip20_derivative/Cargo.toml | 4 ++-- contracts/snip20_derivative/src/contract.rs | 20 ++++++++++--------- packages/shade_protocol/Cargo.toml | 2 +- packages/shade_protocol/src/utils/callback.rs | 15 ++++---------- 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/contracts/snip20_derivative/Cargo.toml b/contracts/snip20_derivative/Cargo.toml index 06b1518ff..23566a941 100644 --- a/contracts/snip20_derivative/Cargo.toml +++ b/contracts/snip20_derivative/Cargo.toml @@ -38,11 +38,11 @@ shade-protocol = { version = "0.1.0", path = "../../packages/shade_protocol", fe "snip20", "storage_plus", ] } -secret-toolkit = { version = "0.7.0", features = [ +secret-toolkit = { version = "0.10.0", features = [ "permit", "viewing-key", ] } -secret-toolkit-crypto = { version = "0.7.0", features = ["rand", "hash"]} +secret-toolkit-crypto = { version = "0.10.0", features = ["rand", "hash"]} schemars = "0.8.11" serde = { version = "1.0.114", default-features = false, features = ["derive"] } diff --git a/contracts/snip20_derivative/src/contract.rs b/contracts/snip20_derivative/src/contract.rs index 67a9bd940..43b1cfb7f 100644 --- a/contracts/snip20_derivative/src/contract.rs +++ b/contracts/snip20_derivative/src/contract.rs @@ -39,7 +39,7 @@ use secret_toolkit::{ utils::{pad_handle_result, pad_query_result}, }; -use secret_toolkit_crypto::{sha_256, Prng}; +use secret_toolkit_crypto::{sha_256, ContractPrng}; use serde::de::DeserializeOwned; use shade_protocol::query_auth::QueryPermit; @@ -1172,13 +1172,15 @@ fn query_rewards( fn query_rewards(_: QuerierWrapper, _: &Addr, _: &Config) -> StdResult { use crate::staking_interface::RewardToken; - Ok(Rewards { rewards: vec![Reward{ - token: RewardToken { - address: Addr::unchecked("shade_contract_info_address"), - code_hash: String::from("shade_contract_info_code_hash"), - }, - amount: Uint128::from(100000000_u128) - }] }) + Ok(Rewards { + rewards: vec![Reward { + token: RewardToken { + address: Addr::unchecked("shade_contract_info_address"), + code_hash: String::from("shade_contract_info_code_hash"), + }, + amount: Uint128::from(100000000_u128), + }], + }) } #[cfg(test)] @@ -1477,7 +1479,7 @@ pub fn new_viewing_key( rng_entropy.extend_from_slice(sender.as_bytes()); rng_entropy.extend_from_slice(entropy); - let mut rng = Prng::new(seed, &rng_entropy); + let mut rng = ContractPrng::new(seed, &rng_entropy); let rand_slice = rng.rand_bytes(); diff --git a/packages/shade_protocol/Cargo.toml b/packages/shade_protocol/Cargo.toml index 61c1643be..9e307df1c 100644 --- a/packages/shade_protocol/Cargo.toml +++ b/packages/shade_protocol/Cargo.toml @@ -117,7 +117,7 @@ schemars = "0.8.9" serde = { version = "1.0.103", default-features = false, features = ["derive", "alloc"] } thiserror = "1.0" -secret-storage-plus = { git = "https://github.com/securesecrets/secret-plus-utils", version = "0.13.4", optional = true } +secret-storage-plus = { git = "https://github.com/securesecrets/secret-plus-utils", tag = "v0.1.1", optional = true, features = [] } # Testing anyhow = { version = "1", optional = true } diff --git a/packages/shade_protocol/src/utils/callback.rs b/packages/shade_protocol/src/utils/callback.rs index f77450960..6c0ebba6d 100644 --- a/packages/shade_protocol/src/utils/callback.rs +++ b/packages/shade_protocol/src/utils/callback.rs @@ -7,17 +7,8 @@ use crate::multi_test::{App, AppResponse, Contract as MultiContract, Executor}; use crate::AnyResult; use crate::{ c_std::{ - to_binary, - Addr, - Coin, - ContractInfo, - CosmosMsg, - Empty, - QuerierWrapper, - QueryRequest, - StdResult, - WasmMsg, - WasmQuery, + to_binary, Addr, Coin, ContractInfo, CosmosMsg, Empty, QuerierWrapper, QueryRequest, + StdResult, WasmMsg, WasmQuery, }, serde::{de::DeserializeOwned, Serialize}, Contract, @@ -64,6 +55,7 @@ pub trait InstantiateCallback: Serialize { msg, label, funds, + admin: None, }; Ok(init.into()) } @@ -321,6 +313,7 @@ mod tests { code_hash, funds, label, + admin: None, }) => { assert_eq!(code_id, id); let mut expected_msg = r#"{"f1":1,"f2":2}"#.as_bytes().to_vec();