diff --git a/CHANGELOG.md b/CHANGELOG.md index 488091b..4caceab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +# [0.4.2] - 2024-02-26 + +### Added + +- Added event attributes `staked_base_tokens_after_action` and `vault_token_supply_after_action` to `apollo/vaults/execute_deposit`, `apollo/vaults/execute_redeem`, and `apollo/vaults/execute_compound` events. + # [0.4.1] - 2024-02-14 ### Changed diff --git a/Cargo.lock b/Cargo.lock index 42bf9a8..5256cf6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1994,7 +1994,7 @@ dependencies = [ [[package]] name = "locked-astroport-vault" -version = "0.4.1" +version = "0.4.2" dependencies = [ "apollo-cw-asset", "apollo-utils", @@ -2029,7 +2029,7 @@ dependencies = [ [[package]] name = "locked-astroport-vault-test-helpers" -version = "0.4.1" +version = "0.4.2" dependencies = [ "apollo-cw-asset", "astroport-liquidity-helper", @@ -2046,7 +2046,7 @@ dependencies = [ "cw2 1.1.2", "cw20 1.1.2", "liquidity-helper", - "locked-astroport-vault 0.4.1", + "locked-astroport-vault 0.4.2", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 230d8c6..2a9f413 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ members = [ resolver = "2" [workspace.package] -version = "0.4.1" +version = "0.4.2" edition = "2021" license = "BUSL-1.1" @@ -36,7 +36,7 @@ schemars = "0.8.12" semver = "1.0.21" # Repo packages -locked-astroport-vault = { version = "0.4.1", path = "./contracts/locked-astroport-vault" } +locked-astroport-vault = { version = "0.4.2", path = "./contracts/locked-astroport-vault" } locked-astroport-vault-test-helpers = { path = "./test-helpers" } # Dev dependencies diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index 96c7319..e1628a9 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -188,3 +188,9 @@ Details of deployment on Neutron mainnet `neutron-1`. - Contract Address: `neutron1qzf6t478xuutq0ahkm07pl2y2tctreccrlafkrl38k4cafk3rgdq3lfky5` - CodeID: `709` - Contract admin: `neutron1qnpwxhrgd8mmsfgql7df6kusgjr3wvm4trl05xu260seelwh845qtqqq9t` + +### XYK (stTIA/TIA)VT/APOLLO 0d Vault + +- Contract Address: `neutron19h6eltj6dem7a6jp6r2plwl95fgcryxeylvnm8ezlglezxzzkzrsnkj006` +- CodeID: `714` +- Contract admin: `neutron1qnpwxhrgd8mmsfgql7df6kusgjr3wvm4trl05xu260seelwh845qtqqq9t` diff --git a/Makefile.toml b/Makefile.toml index 2607744..c76d0a6 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -123,7 +123,7 @@ command = "cargo" args = [ "build", "-p", - "locked-astroport-vault@0.4.1", + "locked-astroport-vault@0.4.2", "--target", "wasm32-unknown-unknown", "--lib", diff --git a/contracts/locked-astroport-vault/src/contract.rs b/contracts/locked-astroport-vault/src/contract.rs index 7ae4745..1fa4fdc 100644 --- a/contracts/locked-astroport-vault/src/contract.rs +++ b/contracts/locked-astroport-vault/src/contract.rs @@ -3,7 +3,7 @@ use cosmwasm_std::entry_point; use cosmwasm_std::{ to_json_binary, Binary, CosmosMsg, Deps, DepsMut, Env, Event, MessageInfo, QueryRequest, Reply, - Response, StdResult, SubMsg, Uint128, WasmQuery, + Response, StdError, StdResult, SubMsg, Uint128, WasmQuery, }; use cw2::ensure_from_older_version; use cw_dex_astroport::{astroport, AstroportPool, AstroportStaking}; @@ -326,15 +326,22 @@ pub fn migrate(mut deps: DepsMut, env: Env, msg: MigrateMsg) -> Result { crate::migrations::migrate_from_0_2_0_to_0_3_0(deps.branch())?; - crate::migrations::migrate_from_0_3_0_to_0_4_1(deps.branch(), env, incentives_contract)? - } - "0.3.0" => { - crate::migrations::migrate_from_0_3_0_to_0_4_1(deps.branch(), env, incentives_contract)? + crate::migrations::migrate_from_0_3_0_to_current( + deps.branch(), + env, + incentives_contract, + )? } + "0.3.0" => crate::migrations::migrate_from_0_3_0_to_current( + deps.branch(), + env, + incentives_contract, + )?, + "0.4.0" | "0.4.1" => Response::default(), _ => { - return Err(ContractError::Std(cosmwasm_std::StdError::generic_err( - "Cannot migrate from a version of the contract other than v0.2.0 or v0.3.0", - ))) + return Err(StdError::generic_err( + "Cannot migrate from a version of the contract other than v0.2.0, v0.3.0, v0.4.0, or v0.4.1", + ).into()) } }; diff --git a/contracts/locked-astroport-vault/src/execute/basic_vault.rs b/contracts/locked-astroport-vault/src/execute/basic_vault.rs index 9c14513..8de1b7a 100644 --- a/contracts/locked-astroport-vault/src/execute/basic_vault.rs +++ b/contracts/locked-astroport-vault/src/execute/basic_vault.rs @@ -11,13 +11,13 @@ use optional_struct::Applyable; use crate::error::{ContractError, ContractResponse}; use crate::helpers::{self, burn_vault_tokens, mint_vault_tokens, IsZero}; use crate::state::{ - self, ConfigUnchecked, ConfigUpdates, BASE_TOKEN, CONFIG, STAKING, VAULT_TOKEN_DENOM, + self, ConfigUnchecked, ConfigUpdates, BASE_TOKEN, CONFIG, STAKING, STATE, VAULT_TOKEN_DENOM, }; use cw_dex::traits::{Stake, Unstake}; pub fn execute_deposit( - deps: DepsMut, + mut deps: DepsMut, env: Env, amount: Uint128, depositor: Addr, @@ -45,8 +45,12 @@ pub fn execute_deposit( let staking_res = staking.stake(deps.as_ref(), &env, asset_after_fee.amount)?; // Mint vault tokens - let (mint_msg, mint_amount) = - mint_vault_tokens(deps, env, asset_after_fee.amount, &vault_token_denom)?; + let (mint_msg, mint_amount) = mint_vault_tokens( + deps.branch(), + env, + asset_after_fee.amount, + &vault_token_denom, + )?; // Send minted vault tokens to recipient let send_msg: CosmosMsg = BankMsg::Send { @@ -55,10 +59,13 @@ pub fn execute_deposit( } .into(); + let state = STATE.load(deps.storage)?; let event = Event::new("apollo/vaults/execute_deposit") .add_attribute("deposit_amount", amount) .add_attribute("deposit_fee_amount", amount - asset_after_fee.amount) - .add_attribute("vault_tokens_minted", mint_amount); + .add_attribute("vault_tokens_minted", mint_amount) + .add_attribute("staked_base_tokens_after_action", state.staked_base_tokens) + .add_attribute("vault_token_supply_after_action", state.vault_token_supply); Ok(merge_responses(vec![transfer_from_res, staking_res]) .add_messages(fee_msgs) @@ -123,11 +130,14 @@ pub fn execute_redeem( res.add_event(event) }; + let state = STATE.load(deps.storage)?; let event = Event::new("apollo/vaults/execute_redeem") .add_attribute("is_force_redeem", format!("{}", force_redeem)) .add_attribute("vault_tokens_redeemed", amount) .add_attribute("lp_tokens_claimed", claim_amount) - .add_attribute("withdrawal_fee_amount", fee_amount); + .add_attribute("withdrawal_fee_amount", fee_amount) + .add_attribute("staked_base_tokens_after_action", state.staked_base_tokens) + .add_attribute("vault_token_supply_after_action", state.vault_token_supply); Ok(res .add_message(burn_msg) diff --git a/contracts/locked-astroport-vault/src/execute/compound.rs b/contracts/locked-astroport-vault/src/execute/compound.rs index f59fab1..8d67d6c 100644 --- a/contracts/locked-astroport-vault/src/execute/compound.rs +++ b/contracts/locked-astroport-vault/src/execute/compound.rs @@ -131,9 +131,12 @@ pub fn execute_stake_lps(deps: DepsMut, env: Env) -> ContractResponse { Ok::<_, StdError>(state) })?; + let state = STATE.load(deps.storage)?; let event = Event::new("apollo/vaults/execute_compound") .add_attribute("action", "stake_lps") - .add_attribute("amount_to_stake", lp_token_balance.to_string()); + .add_attribute("amount_to_stake", lp_token_balance.to_string()) + .add_attribute("staked_base_tokens_after_action", state.staked_base_tokens) + .add_attribute("vault_token_supply_after_action", state.vault_token_supply); Ok(staking_res.add_event(event)) } diff --git a/contracts/locked-astroport-vault/src/migrations.rs b/contracts/locked-astroport-vault/src/migrations.rs index ce132d4..13721c7 100644 --- a/contracts/locked-astroport-vault/src/migrations.rs +++ b/contracts/locked-astroport-vault/src/migrations.rs @@ -33,7 +33,7 @@ pub fn migrate_from_0_2_0_to_0_3_0(deps: DepsMut) -> StdResult<()> { } #[allow(deprecated)] -pub fn migrate_from_0_3_0_to_0_4_1( +pub fn migrate_from_0_3_0_to_current( deps: DepsMut, env: Env, incentives_contract: Addr, diff --git a/contracts/locked-astroport-vault/tests/test_migration.rs b/contracts/locked-astroport-vault/tests/test_migration.rs index 6ee53bb..128ca77 100644 --- a/contracts/locked-astroport-vault/tests/test_migration.rs +++ b/contracts/locked-astroport-vault/tests/test_migration.rs @@ -28,7 +28,7 @@ mod test { #[allow(deprecated)] #[test] - fn test_migrate_from_0_2_0_to_0_4_1() { + fn test_migrate_from_0_2_0_to_current() { let owned_runner = get_test_runner(); let runner = owned_runner.as_ref(); let admin = LockedAstroportVaultRobot::new_admin(&runner); @@ -158,9 +158,9 @@ mod test { #[allow(deprecated)] let lp_token_addr = old_staking.lp_token_addr.clone(); - // Upload v0.4.1 code + // Upload current code let new_contract = LockedAstroportVaultRobot::<'_>::contract(&runner, UNOPTIMIZED_PATH); - let code_id_v0_4_1 = runner.store_code(new_contract, &admin).unwrap(); + let code_id_current = runner.store_code(new_contract, &admin).unwrap(); // Migrate runner @@ -168,7 +168,7 @@ mod test { MsgMigrateContract { sender: admin.address(), contract: contract_addr.clone(), - code_id: code_id_v0_4_1, + code_id: code_id_current, msg: to_json_binary(&MigrateMsg { incentives_contract: dependencies .astroport_contracts