Skip to content

Commit

Permalink
Merge pull request #60 from timewave-computer/depositor-hotfix
Browse files Browse the repository at this point in the history
may_loading ica address in depositor tick
  • Loading branch information
bekauz authored Jul 14, 2023
2 parents ad95e81 + 2a1e58e commit 50380f3
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions contracts/depositor/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,24 @@ fn try_tick(deps: ExecuteDeps, env: Env, info: MessageInfo) -> NeutronResult<Res
verify_clock(&info.sender, &CLOCK_ADDRESS.load(deps.storage)?)?;

let current_state = CONTRACT_STATE.load(deps.storage)?;
let ica_address = ICA_ADDRESS.load(deps.storage)?;
let ica_address = ICA_ADDRESS.may_load(deps.storage)?;

match current_state {
ContractState::Instantiated => try_register_gaia_ica(deps, env),
ContractState::ICACreated => try_liquid_stake(deps, env, info, ica_address),
ContractState::LiquidStaked => try_receive_atom_from_ica(deps, env, info, ica_address),
ContractState::ICACreated => {
if let Some(addr) = ica_address {
try_liquid_stake(deps, env, info, addr)
} else {
Ok(Response::default())
}
},
ContractState::LiquidStaked => {
if let Some(addr) = ica_address {
try_receive_atom_from_ica(deps, env, info, addr)
} else {
Ok(Response::default())
}
},
ContractState::Complete => try_completed(deps),
}
}
Expand Down

0 comments on commit 50380f3

Please sign in to comment.