Skip to content

Commit

Permalink
Fix logic for immediate unbonding
Browse files Browse the repository at this point in the history
  • Loading branch information
trinitys7 committed Aug 27, 2024
1 parent 10142f0 commit 5d9d7f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion contracts/provider/native-staking-proxy/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ impl NativeStakingProxyContract<'_> {
ContractError::InvalidDenom(amount.denom)
);

let msg = ProviderMsg::Unstake { validator, amount };
let msg = ProviderMsg::Unstake { delegator: ctx.info.sender.to_string(), validator, amount };
Ok(Response::new().add_message(msg))
}

Expand Down
5 changes: 3 additions & 2 deletions packages/bindings/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ pub enum ProviderMsg {
///
/// If these conditions are met, it will instantly unstake
/// amount.amount tokens from the native staking proxy contract.
Unstake { validator: String, amount: Coin },
Unstake { delegator: String, validator: String, amount: Coin },
}

impl ProviderMsg {
Expand All @@ -118,12 +118,13 @@ impl ProviderMsg {
}
}

pub fn unstake(denom: &str, validator: &str, amount: impl Into<Uint128>) -> ProviderMsg {
pub fn unstake(denom: &str, delegator:&str, validator: &str, amount: impl Into<Uint128>) -> ProviderMsg {
let coin = Coin {
amount: amount.into(),
denom: denom.into(),
};
ProviderMsg::Unstake {
delegator: delegator.to_string(),
validator: validator.to_string(),
amount: coin,
}
Expand Down

0 comments on commit 5d9d7f9

Please sign in to comment.