Skip to content

Commit

Permalink
chore: add migrate msg
Browse files Browse the repository at this point in the history
  • Loading branch information
trung2891 committed Sep 5, 2024
1 parent fb3d776 commit 82cb4ea
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
9 changes: 8 additions & 1 deletion contracts/oraiswap-v3/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,16 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult<Binary> {
}

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result<Response, ContractError> {
pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result<Response, ContractError> {
let original_version =
cw2::ensure_from_older_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
let config = Config {
fee_tiers: msg.fee_tiers,
admin: msg.admin,
protocol_fee: msg.protocol_fee,
incentives_fund_manager: msg.incentives_fund_manager,
};
CONFIG.save(deps.storage, &config)?;

// // query all position, then update token id
// let positions: Vec<_> = crate::state::POSITIONS
Expand Down
4 changes: 2 additions & 2 deletions contracts/oraiswap-v3/src/entrypoints/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use crate::{
state::{self, CONFIG, MAX_LIMIT, POSITIONS},
tick_to_position,
token_amount::TokenAmount,
FeeTier, LiquidityTick, Pool, PoolKey, Position, PositionTick, Tick, CHUNK_SIZE,
LIQUIDITY_TICK_LIMIT, MAX_TICKMAP_QUERY_SIZE, POSITION_TICK_LIMIT
FeeTier, LiquidityTick, Pool, PoolKey, Position, PositionTick, Tick, CHUNK_SIZE,
LIQUIDITY_TICK_LIMIT, MAX_TICKMAP_QUERY_SIZE, POSITION_TICK_LIMIT,
};
use oraiswap_v3_common::{asset::Asset, error::ContractError};

Expand Down
7 changes: 6 additions & 1 deletion contracts/oraiswap-v3/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,12 @@ pub enum ExecuteMsg {
}

#[cw_serde]
pub struct MigrateMsg {}
pub struct MigrateMsg {
pub admin: Addr,
pub fee_tiers: Vec<FeeTier>,
pub protocol_fee: Percentage,
pub incentives_fund_manager: Addr,
}

#[cw_serde]
#[derive(QueryResponses)]
Expand Down

0 comments on commit 82cb4ea

Please sign in to comment.