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 18, 2024
1 parent b3c4517 commit 449c289
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
15 changes: 12 additions & 3 deletions contracts/cw-ics20-latest/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,9 +821,18 @@ pub fn execute_delete_mapping_pair(
#[entry_point]
pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result<Response, ContractError> {
// we don't need to save anything if migrating from the same version
let mut config = CONFIG.load(deps.storage)?;
config.osor_entrypoint_contract = msg.osor_entrypoint_contract;
CONFIG.save(deps.storage, &config)?;
let cfg = Config {
default_timeout: msg.default_timeout,
default_gas_limit: msg.default_gas_limit,
fee_denom: "orai".to_string(),
swap_router_contract: RouterController(msg.swap_router_contract),
token_fee_receiver: msg.token_fee_receiver,
relayer_fee_receiver: msg.relayer_fee_receiver,
converter_contract: ConverterController(msg.converter_contract),
osor_entrypoint_contract: msg.osor_entrypoint_contract,
token_factory_addr: msg.token_factory_addr,
};
CONFIG.save(deps.storage, &cfg)?;

set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;

Expand Down
15 changes: 15 additions & 0 deletions contracts/cw-ics20-latest/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,22 @@ pub struct AllowMsg {

#[cw_serde]
pub struct MigrateMsg {
pub token_fee_receiver: Addr,

pub relayer_fee_receiver: Addr,
/// Default timeout for ics20 packets, specified in seconds
pub default_timeout: u64,
/// If set, contracts off the allowlist will run with this gas limit.
/// If unset, will refuse to accept any contract off the allow list.
pub default_gas_limit: Option<u64>,
/// router contract for fee swap
pub swap_router_contract: String,
/// converter contract for convert token
pub converter_contract: String,
// entrypoint for handling swap and post actions like IBC transfer to remote
pub osor_entrypoint_contract: String,
// token factory proxy address
pub token_factory_addr: Addr,
}

#[cw_serde]
Expand Down

0 comments on commit 449c289

Please sign in to comment.