From 4bacde2d3269f63bd24bb7eafd0025a115dab120 Mon Sep 17 00:00:00 2001 From: Kerber0x Date: Thu, 28 Mar 2024 14:40:14 +0000 Subject: [PATCH 1/3] feat: add operator able to call SetAssetRewardDistribution --- Cargo.lock | 7 +- Cargo.toml | 1 + contracts/alliance-hub/Cargo.toml | 3 +- contracts/alliance-hub/src/contract.rs | 94 +++++++++++++++---- contracts/alliance-hub/src/error.rs | 9 ++ .../src/alliance_protocol.rs | 8 +- 6 files changed, 99 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 893cdd9..1d3b8f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,7 +15,7 @@ dependencies = [ [[package]] name = "alliance-hub" -version = "0.1.0" +version = "0.1.1" dependencies = [ "alliance-protocol", "cosmwasm-schema", @@ -28,6 +28,7 @@ dependencies = [ "cw20 1.1.1", "cw20-base", "schemars", + "semver", "serde", "terra-proto-rs", "thiserror", @@ -825,9 +826,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.17" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" [[package]] name = "serde" diff --git a/Cargo.toml b/Cargo.toml index cd6455f..236b422 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,5 +41,6 @@ terra-proto-rs = { version = "3.0.1", default-features = false} thiserror = { version = "1.0.38" } cw2 = "1.0.1" cw20 ="1.0.1" +semver = "1.0.22" alliance-protocol = { path = "./packages/alliance-protocol" } \ No newline at end of file diff --git a/contracts/alliance-hub/Cargo.toml b/contracts/alliance-hub/Cargo.toml index 5ef3d58..f577876 100644 --- a/contracts/alliance-hub/Cargo.toml +++ b/contracts/alliance-hub/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "alliance-hub" -version = "0.1.0" +version = "0.1.1" authors = ["Terra Money "] edition = "2018" @@ -26,6 +26,7 @@ schemars = { workspace = true } serde = { workspace = true, features = ["derive"] } thiserror = { workspace = true } alliance-protocol = { workspace = true } +semver = { workspace = true } cw2 = "1.0.1" cw20 = "1.0.1" diff --git a/contracts/alliance-hub/src/contract.rs b/contracts/alliance-hub/src/contract.rs index 99811d0..63a57a4 100644 --- a/contracts/alliance-hub/src/contract.rs +++ b/contracts/alliance-hub/src/contract.rs @@ -1,5 +1,24 @@ +use std::collections::{HashMap, HashSet}; + +use cosmwasm_schema::cw_serde; #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; +use cosmwasm_std::{ + ensure, from_binary, to_binary, Addr, Binary, Coin as CwCoin, CosmosMsg, Decimal, DepsMut, + Empty, Env, MessageInfo, Reply, Response, StdError, StdResult, Storage, SubMsg, Timestamp, + Uint128, WasmMsg, +}; +use cw2::{get_contract_version, set_contract_version}; +use cw20::Cw20ReceiveMsg; +use cw_asset::{Asset, AssetInfo, AssetInfoBase, AssetInfoKey}; +use cw_storage_plus::Item; +use cw_utils::parse_instantiate_response_data; +use semver::Version; +use terra_proto_rs::alliance::alliance::{ + MsgClaimDelegationRewards, MsgDelegate, MsgRedelegate, MsgUndelegate, +}; +use terra_proto_rs::cosmos::base::v1beta1::Coin; +use terra_proto_rs::traits::Message; // use alliance_protocol::alliance_oracle_types::QueryMsg as OracleQueryMsg; use alliance_protocol::alliance_oracle_types::ChainId; @@ -7,15 +26,7 @@ use alliance_protocol::alliance_protocol::{ AllianceDelegateMsg, AllianceRedelegateMsg, AllianceUndelegateMsg, AssetDistribution, Config, Cw20HookMsg, ExecuteMsg, InstantiateMsg, MigrateMsg, }; -use cosmwasm_std::{ - from_binary, to_binary, Addr, Binary, Coin as CwCoin, CosmosMsg, Decimal, DepsMut, Empty, Env, - MessageInfo, Reply, Response, StdError, StdResult, Storage, SubMsg, Timestamp, Uint128, - WasmMsg, -}; -use cw2::set_contract_version; -use cw_asset::{Asset, AssetInfo, AssetInfoBase, AssetInfoKey}; -use cw_utils::parse_instantiate_response_data; -use std::collections::{HashMap, HashSet}; + // use alliance_protocol::alliance_oracle_types::{AssetStaked, ChainId, EmissionsDistribution}; use crate::error::ContractError; use crate::state::{ @@ -23,12 +34,6 @@ use crate::state::{ UNCLAIMED_REWARDS, USER_ASSET_REWARD_RATE, VALIDATORS, WHITELIST, }; use crate::token_factory::{CustomExecuteMsg, DenomUnit, Metadata, TokenExecuteMsg}; -use cw20::Cw20ReceiveMsg; -use terra_proto_rs::alliance::alliance::{ - MsgClaimDelegationRewards, MsgDelegate, MsgRedelegate, MsgUndelegate, -}; -use terra_proto_rs::cosmos::base::v1beta1::Coin; -use terra_proto_rs::traits::Message; // version info for migration info const CONTRACT_NAME: &str = "crates.io:terra-alliance-protocol"; @@ -37,7 +42,51 @@ const CREATE_REPLY_ID: u64 = 1; const CLAIM_REWARD_ERROR_REPLY_ID: u64 = 2; #[cfg_attr(not(feature = "library"), entry_point)] -pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> StdResult { +pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result { + let version: Version = CONTRACT_VERSION.parse()?; + let storage_version: Version = get_contract_version(deps.storage)?.version.parse()?; + + ensure!( + storage_version < version, + StdError::generic_err("Invalid contract version") + ); + + if storage_version <= Version::parse("0.1.1")? { + // parse operator address + let operator = deps + .api + .addr_validate(&from_binary::(&msg.params)?)?; + + #[cw_serde] + pub struct ConfigV010 { + pub governance: Addr, + pub controller: Addr, + pub oracle: Addr, + pub last_reward_update_timestamp: Timestamp, + pub alliance_token_denom: String, + pub alliance_token_supply: Uint128, + pub reward_denom: String, + } + const CONFIG_V010: Item = Item::new("config"); + let config_v010 = CONFIG_V010.load(deps.storage)?; + + CONFIG.update(deps.storage, |mut config| -> StdResult<_> { + // add operator to the new config + config.operator = operator; + + config.governance = config_v010.governance; + config.controller = config_v010.controller; + config.oracle = config_v010.oracle; + config.last_reward_update_timestamp = config_v010.last_reward_update_timestamp; + config.alliance_token_denom = config_v010.alliance_token_denom; + config.alliance_token_supply = config_v010.alliance_token_supply; + config.reward_denom = config_v010.reward_denom; + + Ok(config) + })?; + } + + set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; Ok(Response::default()) } @@ -52,6 +101,7 @@ pub fn instantiate( let governance_address = deps.api.addr_validate(msg.governance.as_str())?; let controller_address = deps.api.addr_validate(msg.controller.as_str())?; let oracle_address = deps.api.addr_validate(msg.oracle.as_str())?; + let operator_address = deps.api.addr_validate(msg.operator.as_str())?; let create_msg = TokenExecuteMsg::CreateDenom { subdenom: msg.alliance_token_denom.to_string(), }; @@ -77,6 +127,7 @@ pub fn instantiate( governance: governance_address, controller: controller_address, oracle: oracle_address, + operator: operator_address, alliance_token_denom: "".to_string(), alliance_token_supply: Uint128::zero(), last_reward_update_timestamp: Timestamp::default(), @@ -168,7 +219,7 @@ fn set_asset_reward_distribution( asset_reward_distribution: Vec, ) -> Result { let config = CONFIG.load(deps.storage)?; - is_governance(&info, &config)?; + is_authorized(&info, &config)?; // Ensure the dsitributions add up to 100% let total_distribution = asset_reward_distribution @@ -775,3 +826,12 @@ fn is_governance(info: &MessageInfo, config: &Config) -> Result<(), ContractErro } Ok(()) } + +// Only governance or the operator can pass through this function +fn is_authorized(info: &MessageInfo, config: &Config) -> Result<(), ContractError> { + ensure!( + info.sender == config.governance || info.sender == config.operator, + ContractError::Unauthorized {} + ); + Ok(()) +} diff --git a/contracts/alliance-hub/src/error.rs b/contracts/alliance-hub/src/error.rs index 069ae61..593f7b7 100644 --- a/contracts/alliance-hub/src/error.rs +++ b/contracts/alliance-hub/src/error.rs @@ -36,4 +36,13 @@ pub enum ContractError { #[error("Invalid Distribution")] InvalidDistribution {}, + + #[error("Semver parsing error: {0}")] + SemVer(String), +} + +impl From for ContractError { + fn from(err: semver::Error) -> Self { + Self::SemVer(err.to_string()) + } } diff --git a/packages/alliance-protocol/src/alliance_protocol.rs b/packages/alliance-protocol/src/alliance_protocol.rs index 010a8bc..86b303d 100644 --- a/packages/alliance-protocol/src/alliance_protocol.rs +++ b/packages/alliance-protocol/src/alliance_protocol.rs @@ -1,6 +1,6 @@ use crate::alliance_oracle_types::ChainId; use cosmwasm_schema::{cw_serde, QueryResponses}; -use cosmwasm_std::{Addr, Decimal, Timestamp, Uint128}; +use cosmwasm_std::{Addr, Binary, Decimal, Timestamp, Uint128}; use cw20::Cw20ReceiveMsg; use cw_asset::{Asset, AssetInfo}; use std::collections::{HashMap, HashSet}; @@ -10,6 +10,7 @@ pub struct Config { pub governance: Addr, pub controller: Addr, pub oracle: Addr, + pub operator: Addr, pub last_reward_update_timestamp: Timestamp, pub alliance_token_denom: String, pub alliance_token_supply: Uint128, @@ -28,6 +29,7 @@ pub struct InstantiateMsg { pub controller: String, pub alliance_token_denom: String, pub oracle: String, + pub operator: String, pub reward_denom: String, } @@ -137,7 +139,9 @@ pub struct AllPendingRewardsQuery { } #[cw_serde] -pub struct MigrateMsg {} +pub struct MigrateMsg { + pub params: Binary, +} #[cw_serde] pub struct StakedBalanceRes { From c77bc157ba54b82f2f45ab9f85911354015bc48a Mon Sep 17 00:00:00 2001 From: Kerber0x Date: Thu, 28 Mar 2024 15:16:13 +0000 Subject: [PATCH 2/3] test: add tests for new operator feature --- contracts/alliance-hub/src/contract.rs | 29 ++--- contracts/alliance-hub/src/tests/helpers.rs | 93 +++++++++++++-- .../alliance-hub/src/tests/instantiate.rs | 2 + contracts/alliance-hub/src/tests/rewards.rs | 108 +++++++++++++++--- .../src/alliance_protocol.rs | 2 +- 5 files changed, 189 insertions(+), 45 deletions(-) diff --git a/contracts/alliance-hub/src/contract.rs b/contracts/alliance-hub/src/contract.rs index 63a57a4..a9ee4c7 100644 --- a/contracts/alliance-hub/src/contract.rs +++ b/contracts/alliance-hub/src/contract.rs @@ -53,9 +53,7 @@ pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result(&msg.params)?)?; + let operator = deps.api.addr_validate(&msg.operator.as_str())?; #[cw_serde] pub struct ConfigV010 { @@ -70,20 +68,17 @@ pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result = Item::new("config"); let config_v010 = CONFIG_V010.load(deps.storage)?; - CONFIG.update(deps.storage, |mut config| -> StdResult<_> { - // add operator to the new config - config.operator = operator; - - config.governance = config_v010.governance; - config.controller = config_v010.controller; - config.oracle = config_v010.oracle; - config.last_reward_update_timestamp = config_v010.last_reward_update_timestamp; - config.alliance_token_denom = config_v010.alliance_token_denom; - config.alliance_token_supply = config_v010.alliance_token_supply; - config.reward_denom = config_v010.reward_denom; - - Ok(config) - })?; + let config = Config { + governance: config_v010.governance, + controller: config_v010.controller, + oracle: config_v010.oracle, + operator, + last_reward_update_timestamp: config_v010.last_reward_update_timestamp, + alliance_token_denom: config_v010.alliance_token_denom, + alliance_token_supply: config_v010.alliance_token_supply, + reward_denom: config_v010.reward_denom, + }; + CONFIG.save(deps.storage, &config)?; } set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; diff --git a/contracts/alliance-hub/src/tests/helpers.rs b/contracts/alliance-hub/src/tests/helpers.rs index c5d337d..e524138 100644 --- a/contracts/alliance-hub/src/tests/helpers.rs +++ b/contracts/alliance-hub/src/tests/helpers.rs @@ -1,18 +1,23 @@ -use crate::contract::{execute, instantiate}; -use crate::query::query; -use crate::state::CONFIG; -use crate::token_factory::CustomExecuteMsg; +use std::collections::HashMap; + +use cosmwasm_std::testing::{mock_env, mock_info}; +use cosmwasm_std::{ + coin, from_binary, to_binary, Decimal, Deps, DepsMut, Response, StdResult, Uint128, +}; +use cw20::Cw20ReceiveMsg; +use cw_asset::{Asset, AssetInfo}; + use alliance_protocol::alliance_oracle_types::ChainId; use alliance_protocol::alliance_protocol::{ AllPendingRewardsQuery, AllianceDelegateMsg, AllianceDelegation, AllianceRedelegateMsg, - AllianceRedelegation, AllianceUndelegateMsg, AssetQuery, Config, Cw20HookMsg, ExecuteMsg, - InstantiateMsg, PendingRewardsRes, QueryMsg, StakedBalanceRes, + AllianceRedelegation, AllianceUndelegateMsg, AssetDistribution, AssetQuery, Config, + Cw20HookMsg, ExecuteMsg, InstantiateMsg, PendingRewardsRes, QueryMsg, StakedBalanceRes, }; -use cosmwasm_std::testing::{mock_env, mock_info}; -use cosmwasm_std::{coin, from_binary, to_binary, Deps, DepsMut, Response, StdResult, Uint128}; -use cw20::Cw20ReceiveMsg; -use cw_asset::{Asset, AssetInfo}; -use std::collections::HashMap; + +use crate::contract::{execute, instantiate}; +use crate::query::query; +use crate::state::CONFIG; +use crate::token_factory::CustomExecuteMsg; pub const DENOM: &str = "token_factory/token"; @@ -24,6 +29,7 @@ pub fn setup_contract(deps: DepsMut) -> Response { governance: "gov".to_string(), controller: "controller".to_string(), oracle: "oracle".to_string(), + operator: "operator".to_string(), alliance_token_denom: "ualliance".to_string(), reward_denom: "uluna".to_string(), }; @@ -64,6 +70,7 @@ pub fn stake(deps: DepsMut, user: &str, amount: u128, denom: &str) -> Response { let msg = ExecuteMsg::Stake {}; execute(deps, env, info, msg).unwrap() } + pub fn stake_cw20(deps: DepsMut, user: &str, amount: u128, denom: &str) -> Response { let info = mock_info(denom, &[]); let env = mock_env(); @@ -173,3 +180,67 @@ pub fn query_all_rewards(deps: Deps, user: &str) -> Vec { pub fn query_all_staked_balances(deps: Deps) -> Vec { from_binary(&query(deps, mock_env(), QueryMsg::TotalStakedBalances {}).unwrap()).unwrap() } + +pub fn query_asset_reward_distribution(deps: Deps) -> Vec { + from_binary(&query(deps, mock_env(), QueryMsg::RewardDistribution {}).unwrap()).unwrap() +} + +#[inline] +pub fn asset_distribution_1() -> Vec { + vec![ + AssetDistribution { + asset: AssetInfo::Native("aWHALE".to_string()), + distribution: Decimal::percent(50), + }, + AssetDistribution { + asset: AssetInfo::Native("bWHALE".to_string()), + distribution: Decimal::percent(50), + }, + ] +} + +#[inline] +pub fn asset_distribution_2() -> Vec { + vec![ + AssetDistribution { + asset: AssetInfo::Native("aWHALE".to_string()), + distribution: Decimal::percent(40), + }, + AssetDistribution { + asset: AssetInfo::Native("bWHALE".to_string()), + distribution: Decimal::percent(40), + }, + AssetDistribution { + asset: AssetInfo::Native("willy".to_string()), + distribution: Decimal::percent(20), + }, + ] +} + +#[inline] +pub fn asset_distribution_broken_1() -> Vec { + vec![ + AssetDistribution { + asset: AssetInfo::Native("aWHALE".to_string()), + distribution: Decimal::percent(40), + }, + AssetDistribution { + asset: AssetInfo::Native("bWHALE".to_string()), + distribution: Decimal::percent(70), + }, + ] +} + +#[inline] +pub fn asset_distribution_broken_2() -> Vec { + vec![ + AssetDistribution { + asset: AssetInfo::Native("aWHALE".to_string()), + distribution: Decimal::percent(40), + }, + AssetDistribution { + asset: AssetInfo::Native("bWHALE".to_string()), + distribution: Decimal::percent(20), + }, + ] +} diff --git a/contracts/alliance-hub/src/tests/instantiate.rs b/contracts/alliance-hub/src/tests/instantiate.rs index 6a884cc..e2779e5 100644 --- a/contracts/alliance-hub/src/tests/instantiate.rs +++ b/contracts/alliance-hub/src/tests/instantiate.rs @@ -38,6 +38,7 @@ fn test_setup_contract() { governance: Addr::unchecked("gov"), controller: Addr::unchecked("controller"), oracle: Addr::unchecked("oracle"), + operator: Addr::unchecked("operator"), reward_denom: "uluna".to_string(), alliance_token_denom: "".to_string(), alliance_token_supply: Uint128::new(0), @@ -107,6 +108,7 @@ fn test_reply_create_token() { governance: Addr::unchecked("gov"), controller: Addr::unchecked("controller"), oracle: Addr::unchecked("oracle"), + operator: Addr::unchecked("operator"), reward_denom: "uluna".to_string(), alliance_token_denom: "factory/cosmos2contract/ualliance".to_string(), alliance_token_supply: Uint128::new(1000000000000), diff --git a/contracts/alliance-hub/src/tests/rewards.rs b/contracts/alliance-hub/src/tests/rewards.rs index 9bb035e..0183172 100644 --- a/contracts/alliance-hub/src/tests/rewards.rs +++ b/contracts/alliance-hub/src/tests/rewards.rs @@ -1,23 +1,28 @@ -use crate::contract::execute; -use crate::state::{ - ASSET_REWARD_DISTRIBUTION, ASSET_REWARD_RATE, TEMP_BALANCE, TOTAL_BALANCES, - USER_ASSET_REWARD_RATE, VALIDATORS, -}; -use crate::tests::helpers::{ - claim_rewards, query_all_rewards, query_rewards, set_alliance_asset, setup_contract, stake, - unstake, whitelist_assets, DENOM, -}; -use alliance_protocol::alliance_protocol::{AssetDistribution, ExecuteMsg, PendingRewardsRes}; +use std::collections::{HashMap, HashSet}; + use cosmwasm_std::testing::{mock_dependencies_with_balance, mock_env, mock_info}; use cosmwasm_std::{ coin, coins, to_binary, Addr, BankMsg, Binary, CosmosMsg, Decimal, Response, SubMsg, Uint128, WasmMsg, }; use cw_asset::{AssetInfo, AssetInfoKey}; -use std::collections::{HashMap, HashSet}; use terra_proto_rs::alliance::alliance::MsgClaimDelegationRewards; use terra_proto_rs::traits::Message; +use alliance_protocol::alliance_protocol::{AssetDistribution, ExecuteMsg, PendingRewardsRes}; + +use crate::contract::execute; +use crate::error::ContractError; +use crate::state::{ + ASSET_REWARD_DISTRIBUTION, ASSET_REWARD_RATE, TEMP_BALANCE, TOTAL_BALANCES, + USER_ASSET_REWARD_RATE, VALIDATORS, +}; +use crate::tests::helpers::{ + asset_distribution_1, asset_distribution_2, asset_distribution_broken_1, + asset_distribution_broken_2, claim_rewards, query_all_rewards, query_asset_reward_distribution, + query_rewards, set_alliance_asset, setup_contract, stake, unstake, whitelist_assets, DENOM, +}; + #[test] fn test_update_rewards() { let mut deps = mock_dependencies_with_balance(&[coin(1000000, "uluna")]); @@ -51,15 +56,15 @@ fn test_update_rewards() { denom: DENOM.to_string(), } .encode_to_vec() - ) + ), }, - 2 + 2, ), SubMsg::new(CosmosMsg::Wasm(WasmMsg::Execute { funds: vec![], contract_addr: "cosmos2contract".to_string(), - msg: to_binary(&ExecuteMsg::UpdateRewardsCallback {}).unwrap() - })) + msg: to_binary(&ExecuteMsg::UpdateRewardsCallback {}).unwrap(), + })), ] ); let prev_balance = TEMP_BALANCE.load(deps.as_ref().storage).unwrap(); @@ -174,7 +179,7 @@ fn update_reward_callback() { assert_eq!( res, - Response::new().add_attributes(vec![("action", "update_rewards_callback"),]) + Response::new().add_attributes(vec![("action", "update_rewards_callback")]) ); } @@ -574,3 +579,74 @@ fn claim_rewards_after_rebalancing_emissions() { let rewards = query_rewards(deps.as_ref(), "user2", "bWHALE"); assert_eq!(rewards.rewards, Uint128::new(500000)); } + +#[test] +fn test_set_asset_reward_distribution() { + let mut deps = mock_dependencies_with_balance(&[coin(2000000, "uluna")]); + setup_contract(deps.as_mut()); + set_alliance_asset(deps.as_mut()); + + let err = execute( + deps.as_mut(), + mock_env(), + mock_info("unauthorized", &[]), + ExecuteMsg::SetAssetRewardDistribution(asset_distribution_1()), + ) + .unwrap_err(); + + // only the governance or operator can set the asset reward distribution + assert_eq!(err, ContractError::Unauthorized {}); + + let res = execute( + deps.as_mut(), + mock_env(), + mock_info("operator", &[]), + ExecuteMsg::SetAssetRewardDistribution(asset_distribution_1()), + ) + .unwrap(); + + let reward_distribution = query_asset_reward_distribution(deps.as_ref()); + assert_eq!(reward_distribution, asset_distribution_1()); + + let res = execute( + deps.as_mut(), + mock_env(), + mock_info("operator", &[]), + ExecuteMsg::SetAssetRewardDistribution(asset_distribution_2()), + ) + .unwrap(); + + let reward_distribution = query_asset_reward_distribution(deps.as_ref()); + assert_eq!(reward_distribution, asset_distribution_2()); + + let res = execute( + deps.as_mut(), + mock_env(), + mock_info("gov", &[]), + ExecuteMsg::SetAssetRewardDistribution(asset_distribution_1()), + ) + .unwrap(); + + let reward_distribution = query_asset_reward_distribution(deps.as_ref()); + assert_eq!(reward_distribution, asset_distribution_1()); + + let err = execute( + deps.as_mut(), + mock_env(), + mock_info("gov", &[]), + ExecuteMsg::SetAssetRewardDistribution(asset_distribution_broken_1()), + ) + .unwrap_err(); + + assert_eq!(err, ContractError::InvalidDistribution {}); + + let err = execute( + deps.as_mut(), + mock_env(), + mock_info("gov", &[]), + ExecuteMsg::SetAssetRewardDistribution(asset_distribution_broken_2()), + ) + .unwrap_err(); + + assert_eq!(err, ContractError::InvalidDistribution {}); +} diff --git a/packages/alliance-protocol/src/alliance_protocol.rs b/packages/alliance-protocol/src/alliance_protocol.rs index 86b303d..6316b12 100644 --- a/packages/alliance-protocol/src/alliance_protocol.rs +++ b/packages/alliance-protocol/src/alliance_protocol.rs @@ -140,7 +140,7 @@ pub struct AllPendingRewardsQuery { #[cw_serde] pub struct MigrateMsg { - pub params: Binary, + pub operator: String, } #[cw_serde] From 180846f2a02a5cfa75964e715e82c558d8e9f04b Mon Sep 17 00:00:00 2001 From: Kerber0x Date: Thu, 28 Mar 2024 16:01:39 +0000 Subject: [PATCH 3/3] fix: make clippy happy --- contracts/alliance-hub/src/contract.rs | 2 +- contracts/alliance-hub/src/tests/rewards.rs | 6 +++--- packages/alliance-protocol/src/alliance_protocol.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/contracts/alliance-hub/src/contract.rs b/contracts/alliance-hub/src/contract.rs index a9ee4c7..363feed 100644 --- a/contracts/alliance-hub/src/contract.rs +++ b/contracts/alliance-hub/src/contract.rs @@ -53,7 +53,7 @@ pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result