Skip to content

Commit

Permalink
Added cw2 adapters updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Kayanski committed Nov 29, 2024
1 parent bcbab6d commit 317a04a
Show file tree
Hide file tree
Showing 16 changed files with 59 additions and 62 deletions.
4 changes: 2 additions & 2 deletions integrations/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ members = [
"astrovault-adapter",
# "bundles/*",
"osmosis-adapter",
# "wyndex-adapter",
# "kujira-adapter",
"wyndex-adapter",
"kujira-adapter",
# "mars-adapter",
]

Expand Down
2 changes: 1 addition & 1 deletion integrations/astrovault-adapter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ cw20 = { workspace = true, optional = true }

[dev-dependencies]
abstract-dex-standard = { workspace = true, features = ["testing"] }
astrovault = { version = "0.1.1" }
astrovault = { version = "2.0.1" }
cw-orch = { workspace = true }
2 changes: 1 addition & 1 deletion integrations/kujira-adapter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ full_integration = ["dep:kujira", "dep:cw20", "dep:cw-asset", "dep:cw-utils"]
local = []

[dependencies]
kujira = { version = "0.8.2", optional = true }
kujira = { version = "1.3.0", optional = true }

abstract-dex-standard = { workspace = true }
abstract-money-market-standard = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions integrations/kujira-adapter/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[cfg(feature = "local")]
pub const AVAILABLE_CHAINS: &[&str] = abstract_sdk::std::registry::LOCAL_CHAIN;
pub const AVAILABLE_CHAINS: &[&str] = abstract_sdk::std::constants::LOCAL_CHAIN;
#[cfg(not(feature = "local"))]
pub const AVAILABLE_CHAINS: &[&str] = abstract_sdk::std::registry::KUJIRA;
pub const AVAILABLE_CHAINS: &[&str] = abstract_sdk::std::constants::KUJIRA;

pub mod dex;
pub mod money_market;
Expand Down
15 changes: 8 additions & 7 deletions integrations/kujira-adapter/src/money_market.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ use ::{
std::objects::{ans_host::AnsHostError, AssetEntry, ContractEntry},
},
cosmwasm_std::{
coins, wasm_execute, Addr, CosmosMsg, Decimal, Deps, QuerierWrapper, StdError, StdResult,
Uint128,
coins, wasm_execute, Addr, CosmosMsg, Decimal, Deps, GrpcQuery, QuerierWrapper, StdError,
StdResult, Uint128,
},
cw_asset::{Asset, AssetInfo},
kujira::ghost::{
Expand Down Expand Up @@ -76,7 +76,7 @@ impl MoneyMarketCommand for Ghost {
&vault_msg,
coins(
((Decimal::from_ratio(asset.amount, 1u128) / status.deposit_redemption_ratio)
* Uint128::one())
.to_uint_floor())
.u128(),
config.receipt_denom,
),
Expand Down Expand Up @@ -364,10 +364,11 @@ impl Ghost {
querier: &QuerierWrapper,
denom: String,
) -> Result<HumanPrice, StdError> {
let res: ExchangeRateResponse = querier.query(&cosmwasm_std::QueryRequest::Stargate {
path: exchange_rate_type_url(denom),
data: QueryExchangeRateRequest {}.encode_to_vec().into(),
})?;
let res: ExchangeRateResponse =
querier.query(&cosmwasm_std::QueryRequest::Grpc(GrpcQuery {
path: exchange_rate_type_url(denom),
data: QueryExchangeRateRequest {}.encode_to_vec().into(),
}))?;

Ok(res.rate.into())
}
Expand Down
6 changes: 4 additions & 2 deletions integrations/osmosis-adapter/src/dex.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use abstract_dex_standard::Identify;
use abstract_sdk::feature_objects::RegistryContract;
use cosmwasm_std::Addr;

use crate::{AVAILABLE_CHAINS, OSMOSIS};
Expand All @@ -21,7 +20,10 @@ impl Identify for Osmosis {
#[cfg(feature = "full_integration")]
use {
abstract_dex_standard::{DexCommand, DexError, Fee, FeeOnInput, Return, Spread, SwapNode},
abstract_sdk::{feature_objects::AnsHost, std::objects::PoolAddress},
abstract_sdk::{
feature_objects::{AnsHost, RegistryContract},
std::objects::PoolAddress,
},
cosmwasm_std::{
Coin, CosmosMsg, Decimal, Decimal256, Deps, StdError, StdResult, Uint128, Uint256,
},
Expand Down
4 changes: 2 additions & 2 deletions integrations/osmosis-adapter/src/staking.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use abstract_sdk::std::objects::registry::RegistryContract;
use abstract_staking_standard::Identify;
use cosmwasm_std::Addr;

Expand Down Expand Up @@ -29,7 +28,8 @@ pub mod fns {
use std::str::FromStr;

use abstract_sdk::std::objects::{
ans_host::AnsHost, AnsAsset, AnsEntryConvertor, AssetEntry, PoolReference, PoolType,
ans_host::AnsHost, registry::RegistryContract, AnsAsset, AnsEntryConvertor, AssetEntry,
PoolReference, PoolType,
};

use abstract_staking_standard::{
Expand Down
7 changes: 5 additions & 2 deletions integrations/wyndex-adapter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ full_integration = [
local = []

[dependencies]
wyndex = { git = "https://github.com/wynddao/wynddex", tag = "v1.1.2", optional = true }
wyndex-stake = { git = "https://github.com/wynddao/wynddex", tag = "v1.1.2", features = ["library"], optional = true }
# wyndex = { git = "https://github.com/wynddao/wynddex", tag = "v1.1.2", optional = true }
# wyndex-stake = { git = "https://github.com/wynddao/wynddex", tag = "v1.1.2", features = ["library"], optional = true }
# Abstract maintained cosmwasm std 2 update
wyndex = { git = "https://github.com/abstractsdk/wynddex", rev = "cbe316f17c4a89d0c3938ea66747a5ff1fc5a5e9", optional = true }
wyndex-stake = { git = "https://github.com/abstractsdk/wynddex", rev = "cbe316f17c4a89d0c3938ea66747a5ff1fc5a5e9", features = ["library"], optional = true }

abstract-dex-standard = { workspace = true }
abstract-sdk = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions integrations/wyndex-adapter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
pub const WYNDEX: &str = "wyndex";

#[cfg(feature = "local")]
pub const AVAILABLE_CHAINS: &[&str] = abstract_sdk::std::registry::LOCAL_CHAIN;
pub const AVAILABLE_CHAINS: &[&str] = abstract_sdk::std::constants::LOCAL_CHAIN;
#[cfg(not(feature = "local"))]
pub const AVAILABLE_CHAINS: &[&str] = abstract_sdk::std::registry::JUNO;
pub const AVAILABLE_CHAINS: &[&str] = abstract_sdk::std::constants::JUNO;

pub mod dex;
pub mod staking;
4 changes: 2 additions & 2 deletions integrations/wyndex-adapter/src/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ use {
cw20::Cw20ExecuteMsg,
cw_asset::{AssetInfo, AssetInfoBase},
cw_utils::Duration,
wyndex::stake::ReceiveMsg,
wyndex_stake::msg::DistributionDataResponse,
wyndex_stake::msg::ReceiveDelegationMsg,
wyndex_stake::{
msg::{BondingInfoResponse, ExecuteMsg as StakeCw20ExecuteMsg},
state::{BondingInfo, STAKE},
Expand Down Expand Up @@ -98,7 +98,7 @@ impl CwStakingCommand for WynDex {
unbonding_period: Option<Duration>,
) -> Result<Vec<CosmosMsg>, CwStakingError> {
let unbonding_period = unwrap_unbond(self, unbonding_period)?;
let msg = to_json_binary(&ReceiveDelegationMsg::Delegate {
let msg = to_json_binary(&ReceiveMsg::Delegate {
unbonding_period,
delegate_as: None,
})?;
Expand Down
19 changes: 8 additions & 11 deletions modules/contracts/adapters/cw-staking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,24 @@ schema = ["abstract-adapter/schema"]
testing = ["dep:abstract-client", "dep:cw20", "abstract-adapter/test-utils"]

# Supported Dexes
# wynd = ["abstract-wyndex-adapter/full_integration", "dep:cw-controllers"]
osmosis = ["abstract-osmosis-adapter/full_integration"]
wynd = ["abstract-wyndex-adapter/full_integration", "dep:cw-controllers"]
# astroport = ["abstract-astroport-adapter/full_integration"]
# bow = ["abstract-kujira-adapter/full_integration"]
astrovault = ["abstract-astrovault-adapter/full_integration"]
bow = ["abstract-kujira-adapter/full_integration"]

# Builds
[package.metadata.optimizer]
builds = [
# { name = "juno", features = [
# "wynd",
# ] },
{ name = "juno", features = ["wynd"] },
# { name = "terra2", features = [
# "astroport",
# ] },
# { name = "neutron", features = [
# "astroport",
# ] },
{ name = "osmosis", features = ["osmosis"] },
# { name = "kujira", features = [
# "bow",
# ] },
{ name = "kujira", features = ["bow"] },
# { name = "injective", features = [
# "astroport",
# ] },
Expand All @@ -80,16 +76,17 @@ abstract-adapter-utils = { workspace = true }
abstract-staking-standard = { workspace = true }

# # Juno dexes #
# abstract-wyndex-adapter = { workspace = true }
abstract-wyndex-adapter = { workspace = true }
cw-controllers = { workspace = true, optional = true }

# # Osmosis #
abstract-osmosis-adapter = { workspace = true }

# # Terra #
# abstract-astroport-adapter = { workspace = true }

# # Kujira #
# abstract-kujira-adapter = { workspace = true }
# Kujira #
abstract-kujira-adapter = { workspace = true }

# Astrovault #
abstract-astrovault-adapter = { workspace = true }
Expand Down
18 changes: 7 additions & 11 deletions modules/contracts/adapters/dex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,26 @@ schema = ["abstract-adapter/schema"]
testing = ["dep:abstract-client", "dep:cw20", "dep:serde_json", "abstract-adapter/test-utils"]

# Supported Dexes
# wynd = ["abstract-wyndex-adapter/full_integration"]
osmosis = ["abstract-osmosis-adapter/full_integration"]
wynd = ["abstract-wyndex-adapter/full_integration"]
# astroport = ["abstract-astroport-adapter/full_integration"]
# fin = ["abstract-kujira-adapter/full_integration"]
astrovault = ["abstract-astrovault-adapter/full_integration"]
fin = ["abstract-kujira-adapter/full_integration"]

osmosis-test = ["dep:cw-orch-osmosis-test-tube"]

# Builds
[package.metadata.optimizer]
builds = [
# { name = "juno", features = [
# "wynd",
# ] },
{ name = "juno", features = ["wynd"] },
# { name = "terra2", features = [
# "astroport",
# ] },
# { name = "neutron", features = [
# "astroport",
# ] },
{ name = "osmosis", features = ["osmosis"] },
# { name = "kujira", features = [
# "fin",
# ] },
{ name = "kujira", features = ["fin"] },
# { name = "injective", features = [
# "astroport",
# ] },
Expand All @@ -76,16 +72,16 @@ abstract-adapter-utils = { workspace = true }
abstract-dex-standard = { workspace = true }

# # Wyndex #
# abstract-wyndex-adapter = { workspace = true }
abstract-wyndex-adapter = { workspace = true }

# Osmosis #
abstract-osmosis-adapter = { workspace = true }

# # Terra #
# abstract-astroport-adapter = { workspace = true }

# # Kujira #
# abstract-kujira-adapter = { workspace = true }
# Kujira #
abstract-kujira-adapter = { workspace = true }

# # Terra dexes #
# terraswap = { version = "2.8.0", optional = true }
Expand Down
8 changes: 4 additions & 4 deletions modules/contracts/adapters/dex/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub trait DexInterface:
AccountIdentification + Dependencies + ModuleIdentification + AbstractNameService
{
/// Construct a new dex interface.
fn dex<'a>(&'a self, deps: Deps<'a>, env: &'a Env, name: DexName) -> Dex<Self> {
fn dex<'a>(&'a self, deps: Deps<'a>, env: &'a Env, name: DexName) -> Dex<'a, Self> {
Dex {
base: self,
env,
Expand All @@ -34,7 +34,7 @@ pub trait DexInterface:
}
}
/// Construct a new dex interface with ANS support.
fn ans_dex<'a>(&'a self, deps: Deps<'a>, env: &'a Env, name: DexName) -> AnsDex<Self> {
fn ans_dex<'a>(&'a self, deps: Deps<'a>, env: &'a Env, name: DexName) -> AnsDex<'a, Self> {
AnsDex {
base: self,
env,
Expand Down Expand Up @@ -147,7 +147,7 @@ pub mod raw {
}
}

impl<'a, T: DexInterface> Dex<'a, T> {
impl<T: DexInterface> Dex<'_, T> {
/// Do a query in the DEX
fn query<R: DeserializeOwned>(&self, query_msg: DexQueryMsg) -> AbstractSdkResult<R> {
let adapters = self.base.adapters(self.deps);
Expand Down Expand Up @@ -283,7 +283,7 @@ pub mod ans {
}
}

impl<'a, T: DexInterface> AnsDex<'a, T> {
impl<T: DexInterface> AnsDex<'_, T> {
/// Do a query in the DEX
fn query<R: DeserializeOwned>(&self, query_msg: DexQueryMsg) -> AbstractSdkResult<R> {
let adapters = self.base.adapters(self.deps);
Expand Down
10 changes: 4 additions & 6 deletions modules/contracts/adapters/money-market/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ testing = ["dep:abstract-client", "dep:cw20", "abstract-adapter/test-utils"]

# Supported Moneymarkets
# mars = ["abstract-mars-adapter/full_integration"]
# ghost = ["abstract-kujira-adapter/full_integration"]
ghost = ["abstract-kujira-adapter/full_integration"]

# osmosis-test = ["dep:cw-orch-osmosis-test-tube"]

Expand All @@ -39,9 +39,7 @@ builds = [
# { name = "osmosis", features = [
# "mars",
# ] },
# { name = "kujira", features = [
# "ghost",
# ] },
{ name = "kujira", features = ["ghost"] },
]

[dependencies]
Expand All @@ -59,8 +57,8 @@ cw-orch = { workspace = true }
abstract-adapter-utils = { workspace = true }
abstract-money-market-standard = { workspace = true }

# # Kujira #
# abstract-kujira-adapter = { workspace = true }
# Kujira #
abstract-kujira-adapter = { workspace = true }

# # Mars #
# abstract-mars-adapter = { workspace = true }
Expand Down
8 changes: 4 additions & 4 deletions modules/contracts/adapters/money-market/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub trait MoneyMarketInterface:
AccountIdentification + Dependencies + ModuleIdentification
{
/// Construct a new money_market interface.
fn money_market<'a>(&'a self, deps: Deps<'a>, name: MoneyMarketName) -> MoneyMarket<Self> {
fn money_market<'a>(&'a self, deps: Deps<'a>, name: MoneyMarketName) -> MoneyMarket<'a, Self> {
MoneyMarket {
base: self,
deps,
Expand All @@ -34,7 +34,7 @@ pub trait MoneyMarketInterface:
&'a self,
deps: Deps<'a>,
name: MoneyMarketName,
) -> AnsMoneyMarket<Self> {
) -> AnsMoneyMarket<'a, Self> {
AnsMoneyMarket {
base: self,
deps,
Expand Down Expand Up @@ -191,7 +191,7 @@ pub mod raw {
}
}

impl<'a, T: MoneyMarketInterface> MoneyMarket<'a, T> {
impl<T: MoneyMarketInterface> MoneyMarket<'_, T> {
// Queries
pub fn user_deposit(
&self,
Expand Down Expand Up @@ -396,7 +396,7 @@ pub mod ans {
}
}

impl<'a, T: MoneyMarketInterface> AnsMoneyMarket<'a, T> {
impl<T: MoneyMarketInterface> AnsMoneyMarket<'_, T> {
// Queries
pub fn user_deposit(&self, user: String, asset: AssetEntry) -> AbstractSdkResult<Uint128> {
self.query(MoneyMarketQueryMsg::AnsUserDeposit {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use cosmwasm_std::Env;
/// This provides superior UX in case of an IBC execution
pub(crate) fn identify_money_market(value: &str) -> Result<Box<dyn Identify>, MoneyMarketError> {
match value {
// abstract_kujira_adapter::money_market::GHOST => {
// Ok(Box::<abstract_kujira_adapter::money_market::Ghost>::default())
// }
abstract_kujira_adapter::money_market::GHOST => {
Ok(Box::<abstract_kujira_adapter::money_market::Ghost>::default())
}
// abstract_mars_adapter::MARS => {
// Ok(Box::<abstract_mars_adapter::money_market::Mars>::default())
// }
Expand Down

0 comments on commit 317a04a

Please sign in to comment.