Skip to content

Commit

Permalink
migrate changes
Browse files Browse the repository at this point in the history
  • Loading branch information
simke9445 committed Jan 12, 2024
1 parent 0abc781 commit 6df037c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 69 deletions.
66 changes: 1 addition & 65 deletions contracts/warp-controller/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,71 +120,7 @@ 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> {
//STATE
#[cw_serde]
pub struct V1State {
pub current_job_id: Uint64,
pub current_template_id: Uint64,
pub q: Uint64,
}

const V1STATE: Item<V1State> = Item::new("state");
let v1_state = V1STATE.load(deps.storage)?;

STATE.save(
deps.storage,
&State {
current_job_id: v1_state.current_job_id,
q: v1_state.q,
},
)?;

//CONFIG
#[cw_serde]
pub struct V1Config {
pub owner: Addr,
pub fee_denom: String,
pub fee_collector: Addr,
pub warp_account_code_id: Uint64,
pub minimum_reward: Uint128,
pub creation_fee_percentage: Uint64,
pub cancellation_fee_percentage: Uint64,
// maximum time for evictions
pub t_max: Uint64,
// minimum time for evictions
pub t_min: Uint64,
// maximum fee for evictions
pub a_max: Uint128,
// minimum fee for evictions
pub a_min: Uint128,
// maximum length of queue modifier for evictions
pub q_max: Uint64,
}

const V1CONFIG: Item<V1Config> = Item::new("config");

let v1_config = V1CONFIG.load(deps.storage)?;

CONFIG.save(
deps.storage,
&Config {
owner: v1_config.owner,
fee_denom: v1_config.fee_denom,
fee_collector: v1_config.fee_collector,
warp_account_code_id: msg.warp_account_code_id,
minimum_reward: v1_config.minimum_reward,
creation_fee_percentage: v1_config.creation_fee_percentage,
cancellation_fee_percentage: v1_config.cancellation_fee_percentage,
resolver_address: deps.api.addr_validate(&msg.resolver_address)?,
t_max: v1_config.t_max,
t_min: v1_config.t_min,
a_max: v1_config.a_max,
a_min: v1_config.a_min,
q_max: v1_config.q_max,
},
)?;

pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result<Response, ContractError> {
Ok(Response::new())
}

Expand Down
2 changes: 0 additions & 2 deletions packages/controller/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,4 @@ pub struct ConfigResponse {
//migrate//{"resolver_address":"terra1a8dxkrapwj4mkpfnrv7vahd0say0lxvd0ft6qv","warp_account_code_id":"10081"}
#[cw_serde]
pub struct MigrateMsg {
pub warp_account_code_id: Uint64,
pub resolver_address: String,
}
4 changes: 2 additions & 2 deletions tasks/migrate_warp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { MsgMigrateContract } from "@terra-money/terra.js";
import task, { info } from "@terra-money/terrariums";

task(async ({ deployer, signer, refs, network }) => {
// deployer.buildContract("warp-controller");
// deployer.optimizeContract("warp-controller");
deployer.buildContract("warp-controller");
deployer.optimizeContract("warp-controller");

await deployer.storeCode("warp-controller");
await new Promise((resolve) => setTimeout(resolve, 3000));
Expand Down

0 comments on commit 6df037c

Please sign in to comment.