Skip to content

Commit

Permalink
[1.0.rc-1] Withdraw Feature Removal (#321)
Browse files Browse the repository at this point in the history
* removed Withdraw and Deposit from Andromeda message, applied them to the vault contract's ExecuteMsg

* removed withdrawable_tokens from ADOContract, removed the withdraw feature, commented out withdraw.rs in ado_contract

* deleted withdraw.rs in ado_contract

* linting
  • Loading branch information
joemonem authored Mar 14, 2024
1 parent 0dd0696 commit e2a17b8
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 56 deletions.
2 changes: 1 addition & 1 deletion contracts/ecosystem/andromeda-vault/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ semver = { workspace = true }
cw-utils = { workspace = true }

andromeda-ecosystem = { workspace = true }
andromeda-std = { workspace = true, features = ["withdraw"] }
andromeda-std = { workspace = true }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
cw-multi-test = { version = "0.16.0", optional = true }
Expand Down
4 changes: 2 additions & 2 deletions contracts/ecosystem/andromeda-vault/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use andromeda_std::amp::{AndrAddr, Recipient};
use andromeda_std::common::context::ExecuteContext;
use andromeda_std::{
ado_base::withdraw::{Withdrawal, WithdrawalType},
ado_base::{AndromedaMsg, AndromedaQuery, InstantiateMsg as BaseInstantiateMsg},
ado_base::{AndromedaQuery, InstantiateMsg as BaseInstantiateMsg},
error::{from_semver, ContractError},
};

Expand Down Expand Up @@ -313,7 +313,7 @@ pub fn withdraw_strategy(
}

let addr = addr_opt.unwrap();
let withdraw_exec = to_binary(&AndromedaMsg::Withdraw {
let withdraw_exec = to_binary(&ExecuteMsg::Withdraw {
recipient: Some(recipient),
tokens_to_withdraw: Some(withdrawals),
})?;
Expand Down
3 changes: 1 addition & 2 deletions contracts/ecosystem/andromeda-vault/src/testing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use andromeda_std::amp::{AndrAddr, Recipient};
use andromeda_std::testing::mock_querier::MOCK_KERNEL_CONTRACT;
use andromeda_std::{
ado_base::withdraw::{Withdrawal, WithdrawalType},
ado_base::AndromedaMsg,
error::ContractError,
};
use cosmwasm_std::attr;
Expand Down Expand Up @@ -737,7 +736,7 @@ fn test_withdraw_single_strategy() {
};

let res = execute(deps.as_mut(), env, info, msg).unwrap();
let withdraw_exec = to_binary(&AndromedaMsg::Withdraw {
let withdraw_exec = to_binary(&ExecuteMsg::Withdraw {
recipient: Some(Recipient::from_string("depositor")),
tokens_to_withdraw: Some(withdrawals),
})
Expand Down
10 changes: 10 additions & 0 deletions packages/andromeda-ecosystem/src/vault.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@ pub enum ExecuteMsg {
strategy: StrategyType,
address: AndrAddr,
},
// Originally was an Andromeda Msg
Withdraw {
recipient: Option<Recipient>,
tokens_to_withdraw: Option<Vec<Withdrawal>>,
},
// Originally was an Andromeda Msg
Deposit {
recipient: Option<::andromeda_std::amp::AndrAddr>,
msg: Option<::cosmwasm_std::Binary>,
},
}

#[andr_query]
Expand Down
1 change: 0 additions & 1 deletion packages/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ description = "The standard library for creating an Andromeda Digital Object"
license = "MIT"

[features]
withdraw = ["andromeda-macros/withdraw"]
primitive = []
modules = ["andromeda-macros/modules"]
module_hooks = ["andromeda-macros/module_hooks"]
Expand Down
1 change: 0 additions & 1 deletion packages/std/macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ proc-macro = true

[features]
modules = []
withdraw = []
module_hooks = []

[dependencies]
Expand Down
20 changes: 0 additions & 20 deletions packages/std/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,26 +77,6 @@ pub fn andr_exec(_args: TokenStream, input: TokenStream) -> TokenStream {
.into(),
)
}

#[cfg(feature = "withdraw")]
{
merged = merge_variants(
merged,
quote! {
enum Right {
Deposit {
recipient: Option<::andromeda_std::amp::AndrAddr>,
msg: Option<::cosmwasm_std::Binary>,
},
Withdraw {
recipient: Option<::andromeda_std::amp::Recipient>,
tokens_to_withdraw: Option<Vec<::andromeda_std::common::withdraw::Withdrawal>>,
},
}
}
.into(),
)
}
let input = parse_macro_input!(merged);
TokenStream::from(andr_exec_derive(input).into_token_stream())
}
Expand Down
16 changes: 1 addition & 15 deletions packages/std/src/ado_base/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@ pub mod permissioning;
pub mod version;

pub mod withdraw;
#[cfg(feature = "withdraw")]
use crate::ado_base::withdraw::Withdrawal;
#[cfg(feature = "withdraw")]
use crate::amp::recipient::Recipient;
use crate::amp::{messages::AMPPkt, AndrAddr};
use cosmwasm_schema::{cw_serde, QueryResponses};
use cosmwasm_std::{Addr, Binary};
use cosmwasm_std::Addr;
pub use modules::Module;

#[cfg(feature = "modules")]
Expand All @@ -41,11 +37,6 @@ pub enum AndromedaMsg {
UpdateKernelAddress {
address: Addr,
},
#[cfg(feature = "withdraw")]
Withdraw {
recipient: Option<Recipient>,
tokens_to_withdraw: Option<Vec<Withdrawal>>,
},
#[cfg(feature = "modules")]
RegisterModule {
module: Module,
Expand All @@ -59,10 +50,6 @@ pub enum AndromedaMsg {
module_idx: Uint64,
module: Module,
},
Deposit {
recipient: Option<AndrAddr>,
msg: Option<Binary>,
},
#[serde(rename = "amp_receive")]
AMPReceive(AMPPkt),
Permissioning(PermissioningMessage),
Expand Down Expand Up @@ -91,7 +78,6 @@ pub enum AndromedaQuery {
#[cfg(feature = "modules")]
#[returns(Vec<String>)]
ModuleIds {},
#[cfg(feature = "withdraw")]
#[returns(::cosmwasm_std::BalanceResponse)]
Balance { address: AndrAddr },
#[returns(Vec<self::permissioning::PermissionInfo>)]
Expand Down
6 changes: 0 additions & 6 deletions packages/std/src/ado_contract/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ impl<'a> ADOContract<'a> {
AndromedaMsg::UpdateKernelAddress { address } => {
self.update_kernel_address(ctx.deps, ctx.info, address)
}
#[cfg(feature = "withdraw")]
AndromedaMsg::Withdraw {
recipient,
tokens_to_withdraw,
} => self.execute_withdraw(ctx, recipient, tokens_to_withdraw),
#[cfg(feature = "modules")]
AndromedaMsg::RegisterModule { module } => {
self.validate_module_address(&ctx.deps.as_ref(), &module)?;
Expand All @@ -83,7 +78,6 @@ impl<'a> ADOContract<'a> {
}
AndromedaMsg::Permissioning(msg) => self.execute_permissioning(ctx, msg),
AndromedaMsg::AMPReceive(_) => panic!("AMP Receive should be handled separately"),
AndromedaMsg::Deposit { .. } => Err(ContractError::NotImplemented { msg: None }),
},
_ => Err(ContractError::NotImplemented { msg: None }),
}
Expand Down
2 changes: 0 additions & 2 deletions packages/std/src/ado_contract/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ mod ownership;
pub mod permissioning;
mod query;
pub mod state;
#[cfg(feature = "withdraw")]
pub mod withdraw;

pub use crate::ado_contract::state::ADOContract;
6 changes: 0 additions & 6 deletions packages/std/src/ado_contract/state.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#[cfg(feature = "modules")]
use crate::ado_base::modules::Module;
use cosmwasm_std::Addr;
#[cfg(feature = "withdraw")]
use cw_asset::AssetInfo;
use cw_storage_plus::{Item, Map};

pub struct ADOContract<'a> {
Expand All @@ -17,8 +15,6 @@ pub struct ADOContract<'a> {
pub(crate) module_info: Map<'a, &'a str, Module>,
#[cfg(feature = "modules")]
pub(crate) module_idx: Item<'a, u64>,
#[cfg(feature = "withdraw")]
pub withdrawable_tokens: Map<'a, &'a str, AssetInfo>,
}

impl<'a> Default for ADOContract<'a> {
Expand All @@ -35,8 +31,6 @@ impl<'a> Default for ADOContract<'a> {
module_info: Map::new("andr_modules"),
#[cfg(feature = "modules")]
module_idx: Item::new("andr_module_idx"),
#[cfg(feature = "withdraw")]
withdrawable_tokens: Map::new("withdrawable_tokens"),
}
}
}

0 comments on commit e2a17b8

Please sign in to comment.