Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errors #4

Merged
merged 3 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/Basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.70.0
toolchain: stable
target: wasm32-unknown-unknown
override: true

Expand All @@ -39,7 +39,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.70.0
toolchain: stable
override: true
components: rustfmt, clippy

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.70.0
toolchain: stable
target: wasm32-unknown-unknown
override: true

Expand Down
6 changes: 3 additions & 3 deletions contracts/factory/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ pub mod reply {
/// Removes an existing pair from the factory.
///
/// * **asset_infos** is a vector with assets for which we deregister the pair.
/// The LP Staking Contract will also be deregistered and does not need to be provided.
/// The LP Staking Contract will also be deregistered and does not need to be provided.
///
/// ## Executor
/// Only the owner can execute this.
Expand Down Expand Up @@ -716,7 +716,7 @@ pub fn deregister_pool_and_staking(
/// * **QueryMsg::Pair { asset_infos }** Returns a [`PairInfo`] object with information about a specific Palomadex pair.
///
/// * **QueryMsg::Pairs { start_after, limit }** Returns an array that contains items of type [`PairInfo`].
/// This returns information about multiple Palomadex pairs
/// This returns information about multiple Palomadex pairs
///
/// * **QueryMsg::FeeInfo { pair_type }** Returns the fee structure (total and protocol fees) for a specific pair type.
///
Expand Down Expand Up @@ -791,7 +791,7 @@ pub fn query_pair(deps: Deps, asset_infos: Vec<AssetInfo>) -> StdResult<PairInfo

/// Returns a vector with pair data that contains items of type [`PairInfo`]. Querying starts at `start_after` and returns `limit` pairs.
/// * **start_after** is a field which accepts a vector with items of type [`AssetInfo`].
/// This is the pair from which we start a query.
/// This is the pair from which we start a query.
///
/// * **limit** sets the number of pairs to be retrieved.
pub fn query_pairs(
Expand Down
6 changes: 1 addition & 5 deletions contracts/factory/tests/factory_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ use palomadex::fee_config::FeeConfig;
use palomadex::pair::PairInfo;

pub struct FactoryHelper {
pub owner: Addr,
pub astro_token: Addr,
pub factory: Addr,
pub cw20_token_code_id: u64,
}
Expand Down Expand Up @@ -44,7 +42,7 @@ impl FactoryHelper {
marketing: None,
};

let astro_token = router
let _astro_token = router
.instantiate_contract(
cw20_token_code_id,
owner.clone(),
Expand Down Expand Up @@ -125,8 +123,6 @@ impl FactoryHelper {
.unwrap();

Self {
owner: owner.clone(),
astro_token,
factory,
cw20_token_code_id,
}
Expand Down
2 changes: 0 additions & 2 deletions contracts/gauge-adapter/src/multitest/suite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ impl SuiteBuilder {
gauge_adapter,
cw20_code_id,
reward: self.reward,
epoch_length,
}
}
}
Expand All @@ -291,7 +290,6 @@ pub struct Suite {
pub gauge_adapter: Addr,
cw20_code_id: u64,
pub reward: Asset,
pub epoch_length: u64,
}

impl Suite {
Expand Down
4 changes: 0 additions & 4 deletions contracts/lp-converter/src/multitest/suite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ pub(super) fn native_asset(amount: u128, denom: &str) -> Asset {
#[derive(Debug)]
pub struct SuiteBuilder {
pub unbonding_periods: Vec<UnbondingPeriod>,
pub admin: Option<String>,
pub native_balances: Vec<(Addr, Coin)>,
pub no_converter: bool,
}
Expand All @@ -115,7 +114,6 @@ impl SuiteBuilder {
pub fn new() -> Self {
Self {
unbonding_periods: vec![7 * DAY, 14 * DAY],
admin: None,
native_balances: vec![],
no_converter: false,
}
Expand Down Expand Up @@ -347,7 +345,6 @@ impl SuiteBuilder {
Suite {
app,

converter,
factory,
native_pair,
native_staking,
Expand All @@ -362,7 +359,6 @@ impl SuiteBuilder {
pub struct Suite {
pub app: App,

pub converter: Addr,
factory: Addr,
pub native_pair: Addr,
native_staking: Addr,
Expand Down
4 changes: 2 additions & 2 deletions contracts/multi-hop/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ mod query {
/// * **offer_amount** amount of offer assets being swapped.
///
/// * **operations** is a vector that contains objects of type [`SwapOperation`].
/// These are all the swap operations for which we perform a simulation.
/// These are all the swap operations for which we perform a simulation.
pub fn simulate_swap_operations(
deps: Deps,
offer_amount: Uint128,
Expand Down Expand Up @@ -487,7 +487,7 @@ mod query {
/// * **ask_amount** amount of offer assets being swapped.
///
/// * **operations** is a vector that contains objects of type [`SwapOperation`].
/// These are all the swap operations for which we perform a simulation.
/// These are all the swap operations for which we perform a simulation.
pub fn simulate_reverse_swap_operations(
deps: Deps,
ask_amount: Uint128,
Expand Down
2 changes: 1 addition & 1 deletion contracts/multi-hop/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub enum Cw20HookMsg {
operations: Vec<SwapOperation>,
/// The minimum amount of tokens to get from a swap
minimum_receive: Option<Uint128>,
///
/// The recipient of the ask tokens
receiver: Option<String>,
/// Max spread
max_spread: Option<Decimal>,
Expand Down
18 changes: 9 additions & 9 deletions contracts/pair/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result<Response, ContractE
/// * **ExecuteMsg::UpdateConfig { params: Binary }** Not supported.
///
/// * **ExecuteMsg::Receive(msg)** Receives a message of type [`Cw20ReceiveMsg`] and processes
/// it depending on the received template.
/// it depending on the received template.
///
/// * **ExecuteMsg::ProvideLiquidity {
/// assets,
Expand Down Expand Up @@ -249,11 +249,11 @@ pub fn update_fees(
/// * **assets** is an array with assets available in the pool.
///
/// * **slippage_tolerance** is an optional parameter which is used to specify how much
/// the pool price can move until the provide liquidity transaction goes through.
/// the pool price can move until the provide liquidity transaction goes through.
///
///
/// * **receiver** is an optional parameter which defines the receiver of the LP tokens.
/// If no custom receiver is specified, the pair will mint LP tokens for the function caller.
/// If no custom receiver is specified, the pair will mint LP tokens for the function caller.
///
/// NOTE - the address that wants to provide liquidity should approve the pair contract to pull its relevant tokens.
pub fn provide_liquidity(
Expand Down Expand Up @@ -828,21 +828,21 @@ pub fn calculate_protocol_fee(
/// * **QueryMsg::Pair {}** Returns information about the pair in an object of type [`PairInfo`].
///
/// * **QueryMsg::Pool {}** Returns information about the amount of assets in the pair contract as
/// well as the amount of LP tokens issued using an object of type [`PoolResponse`].
/// well as the amount of LP tokens issued using an object of type [`PoolResponse`].
///
/// * **QueryMsg::Share { amount }** Returns the amount of assets that could be withdrawn from the pool
/// using a specific amount of LP tokens. The result is returned in a vector that contains objects of type [`Asset`].
/// using a specific amount of LP tokens. The result is returned in a vector that contains objects of type [`Asset`].
///
/// * **QueryMsg::Simulation { offer_asset }** Returns the result of a swap simulation using a [`SimulationResponse`] object.
///
/// * **QueryMsg::ReverseSimulation { ask_asset }** Returns the result of a reverse swap simulation using
/// a [`ReverseSimulationResponse`] object.
/// a [`ReverseSimulationResponse`] object.
///
/// * **QueryMsg::CumulativePrices {}** Returns information about cumulative prices for the assets in the
/// pool using a [`CumulativePricesResponse`] object.
/// pool using a [`CumulativePricesResponse`] object.
///
/// * **QueryMsg::HistoricalPrices { duration }** Returns historical price information for the assets in the
/// pool using a [`HistoricalPricesResponse`] object.
/// pool using a [`HistoricalPricesResponse`] object.
///
/// * **QueryMsg::Config {}** Returns the configuration for the pair contract using a [`ConfigResponse`] object.
#[cfg_attr(not(feature = "library"), entry_point)]
Expand Down Expand Up @@ -972,7 +972,7 @@ pub fn query_simulation(
/// Returns information about a reverse swap simulation in a [`ReverseSimulationResponse`] object.
///
/// * **ask_asset** is the asset to swap to as well as the desired amount of ask
/// assets to receive from the swap.
/// assets to receive from the swap.
pub fn query_reverse_simulation(
deps: Deps,
ask_asset: Asset,
Expand Down
10 changes: 5 additions & 5 deletions contracts/pair/src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ fn provide_liquidity() {
}],
);
let res = execute(deps.as_mut(), env.clone(), info, msg).unwrap();
let transfer_from_msg = res.messages.get(0).expect("no message");
let transfer_from_msg = res.messages.first().expect("no message");
let mint_min_liquidity_msg = res.messages.get(1).expect("no message");
let mint_receiver_msg = res.messages.get(2).expect("no message");
assert_eq!(
Expand Down Expand Up @@ -310,7 +310,7 @@ fn provide_liquidity() {

// Only accept 100, then 50 share will be generated with 100 * (100 / 200)
let res: Response = execute(deps.as_mut(), env, info, msg).unwrap();
let transfer_from_msg = res.messages.get(0).expect("no message");
let transfer_from_msg = res.messages.first().expect("no message");
let mint_msg = res.messages.get(1).expect("no message");
assert_eq!(
transfer_from_msg,
Expand Down Expand Up @@ -658,7 +658,7 @@ fn withdraw_liquidity() {
let res = execute(deps.as_mut(), env, info, msg).unwrap();
let log_withdrawn_share = res.attributes.get(2).expect("no log");
let log_refund_assets = res.attributes.get(3).expect("no log");
let msg_refund_0 = res.messages.get(0).expect("no message");
let msg_refund_0 = res.messages.first().expect("no message");
let msg_refund_1 = res.messages.get(1).expect("no message");
let msg_burn_liquidity = res.messages.get(2).expect("no message");
assert_eq!(
Expand Down Expand Up @@ -959,7 +959,7 @@ fn try_native_to_token() {
);

let res = execute(deps.as_mut(), env, info, msg).unwrap();
let msg_transfer = res.messages.get(0).expect("no message");
let msg_transfer = res.messages.first().expect("no message");

// Current price is 1.5, so expected return without spread is 1000
// 952380952 = 20000000000 - (30000000000 * 20000000000) / (30000000000 + 1500000000)
Expand Down Expand Up @@ -1190,7 +1190,7 @@ fn try_token_to_native() {
let info = mock_info("asset0000", &[]);

let res = execute(deps.as_mut(), env, info, msg).unwrap();
let msg_transfer = res.messages.get(0).expect("no message");
let msg_transfer = res.messages.first().expect("no message");

// Current price is 1.5, so expected return without spread is 1000
// 952380952,3809524 = 20000000000 - (30000000000 * 20000000000) / (30000000000 + 1500000000)
Expand Down
1 change: 1 addition & 0 deletions contracts/pair_lsd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ crate-type = ["cdylib", "rlib"]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
library = []
requires-python-sim = []

[dependencies]
cosmwasm-schema = { workspace = true }
Expand Down
18 changes: 9 additions & 9 deletions contracts/pair_lsd/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@ fn check_if_frozen(deps: &DepsMut) -> Result<(), ContractError> {
///
/// ## Variants
/// * **ExecuteMsg::UpdateConfig { params: Binary }** Updates the contract configuration with the specified
/// input parameters.
/// input parameters.
///
/// * **ExecuteMsg::Receive(msg)** Receives a message of type [`Cw20ReceiveMsg`] and processes
/// it depending on the received template.
/// it depending on the received template.
///
/// * **ExecuteMsg::ProvideLiquidity {
/// assets,
Expand Down Expand Up @@ -1067,21 +1067,21 @@ pub fn calculate_protocol_fee(
/// * **QueryMsg::Pair {}** Returns information about the pair in an object of type [`PairInfo`].
///
/// * **QueryMsg::Pool {}** Returns information about the amount of assets in the pair contract as
/// well as the amount of LP tokens issued using an object of type [`PoolResponse`].
/// well as the amount of LP tokens issued using an object of type [`PoolResponse`].
///
/// * **QueryMsg::Share { amount }** Returns the amount of assets that could be withdrawn from the pool
/// using a specific amount of LP tokens. The result is returned in a vector that contains objects of type [`Asset`].
/// using a specific amount of LP tokens. The result is returned in a vector that contains objects of type [`Asset`].
///
/// * **QueryMsg::Simulation { offer_asset }** Returns the result of a swap simulation using a [`SimulationResponse`] object.
///
/// * **QueryMsg::ReverseSimulation { ask_asset }** Returns the result of a reverse swap simulation using
/// a [`ReverseSimulationResponse`] object.
/// a [`ReverseSimulationResponse`] object.
///
/// * **QueryMsg::CumulativePrices {}** Returns information about cumulative prices for the assets in the
/// pool using a [`CumulativePricesResponse`] object.
/// pool using a [`CumulativePricesResponse`] object.
///
/// * **QueryMsg::HistoricalPrices { duration }** Returns historical price information for the assets in the
/// pool using a [`HistoricalPricesResponse`] object.
/// pool using a [`HistoricalPricesResponse`] object.
///
/// * **QueryMsg::Config {}** Returns the configuration for the pair contract using a [`ConfigResponse`] object.
#[cfg_attr(not(feature = "library"), entry_point)]
Expand Down Expand Up @@ -1260,10 +1260,10 @@ pub fn query_simulation(
/// Returns information about a reverse swap simulation in a [`ReverseSimulationResponse`] object.
///
/// * **ask_asset** is the asset to swap to as well as the desired amount of ask
/// assets to receive from the swap.
/// assets to receive from the swap.
///
/// * **offer_asset_info** is optional field which specifies the asset to swap from.
/// May be omitted only in case the pool length is 2.
/// May be omitted only in case the pool length is 2.
pub fn query_reverse_simulation(
deps: Deps,
env: Env,
Expand Down
4 changes: 1 addition & 3 deletions contracts/pair_lsd/src/multitest/target_rate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ fn provide_liquidity_changing_rate() {

#[test]
fn changing_target_rate() {
let target_rate = Decimal::from_str("1.5").unwrap();
let mut target_rate = Decimal::from_str("1.5").unwrap();
let mut suite = SuiteBuilder::new()
.with_funds("sender", &[coin(1_000_000_000_000_000_000_000, "juno")])
.with_funds(
Expand Down Expand Up @@ -370,7 +370,6 @@ fn changing_target_rate() {

let max_target_rate = Decimal::from_str("1.6").unwrap();
let target_rate_step = Decimal::from_str("0.01").unwrap();
let mut target_rate = target_rate;
while target_rate < max_target_rate {
// change target rate and wait for cache to expire
target_rate += target_rate_step;
Expand Down Expand Up @@ -409,7 +408,6 @@ fn changing_target_rate() {

let min_target_rate = Decimal::from_str("1.4").unwrap();
let target_rate_step = Decimal::from_str("0.1").unwrap();
let mut target_rate = target_rate;
while target_rate > min_target_rate {
// change target rate and wait for cache to expire
target_rate -= target_rate_step;
Expand Down
10 changes: 5 additions & 5 deletions contracts/pair_lsd/src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ fn provide_liquidity() {
}],
);
let res = execute(deps.as_mut(), env.clone(), info, msg).unwrap();
let transfer_from_msg = res.messages.get(0).expect("no message");
let transfer_from_msg = res.messages.first().expect("no message");
let mint_min_liquidity_msg = res.messages.get(1).expect("no message");
let mint_receiver_msg = res.messages.get(2).expect("no message");

Expand Down Expand Up @@ -690,7 +690,7 @@ fn provide_liquidity() {
);

let res: Response = execute(deps.as_mut(), env, info, msg).unwrap();
let transfer_from_msg = res.messages.get(0).expect("no message");
let transfer_from_msg = res.messages.first().expect("no message");
let mint_msg = res.messages.get(1).expect("no message");
assert_eq!(
transfer_from_msg,
Expand Down Expand Up @@ -945,7 +945,7 @@ fn withdraw_liquidity() {
let res = execute(deps.as_mut(), env, info, msg).unwrap();
let log_withdrawn_share = res.attributes.get(2).expect("no log");
let log_refund_assets = res.attributes.get(3).expect("no log");
let msg_refund_0 = res.messages.get(0).expect("no message");
let msg_refund_0 = res.messages.first().expect("no message");
let msg_refund_1 = res.messages.get(1).expect("no message");
let msg_burn_liquidity = res.messages.get(2).expect("no message");
assert_eq!(
Expand Down Expand Up @@ -1257,7 +1257,7 @@ mod disabled {
);

let res = execute(deps.as_mut(), env.clone(), info, msg).unwrap();
let msg_transfer = res.messages.get(0).expect("no message");
let msg_transfer = res.messages.first().expect("no message");

let model: StableSwapModel = StableSwapModel::new(
100,
Expand Down Expand Up @@ -1422,7 +1422,7 @@ mod disabled {
let info = mock_info("asset0000", &[]);

let res = execute(deps.as_mut(), env.clone(), info, msg).unwrap();
let msg_transfer = res.messages.get(0).expect("no message");
let msg_transfer = res.messages.first().expect("no message");

let model: StableSwapModel = StableSwapModel::new(
100,
Expand Down
Loading
Loading