Skip to content

Commit

Permalink
chore: add migrage entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
trung2891 committed Aug 7, 2024
1 parent d730cd8 commit b7faaaa
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions contracts/adapters/ibc/orai-ibc-wasm/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,28 @@ use skip::{
///////////////

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> ContractResult<Response> {
unimplemented!()
pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> ContractResult<Response> {
// Validate entry point contract address
let checked_entry_point_contract_address =
deps.api.addr_validate(&msg.entry_point_contract_address)?;
// Validate ibc bridge wasm contract address
let checked_ibc_wasm_contract_address =
deps.api.addr_validate(&msg.ibc_wasm_contract_address)?;

// Store the entry point contract address
ENTRY_POINT_CONTRACT_ADDRESS.save(deps.storage, &checked_entry_point_contract_address)?;
IBC_WASM_CONTRACT_ADDRESS.save(deps.storage, &checked_ibc_wasm_contract_address)?;

Ok(Response::new()
.add_attribute("action", "migrate")
.add_attribute(
"entry_point_contract_address",
checked_entry_point_contract_address.to_string(),
)
.add_attribute(
"ibc_wasm_contract_address",
checked_ibc_wasm_contract_address.to_string(),
))
}

///////////////////
Expand Down

0 comments on commit b7faaaa

Please sign in to comment.