Introduced denom check when trying to withdraw vested coins (#1018)
* Introduced denom check when trying to withdraw vested coins * Using correct denom in the relevant unit test
This commit is contained in:
committed by
GitHub
parent
d71ef635e2
commit
835d4f46f6
@@ -96,6 +96,10 @@ pub fn try_withdraw_vested_coins(
|
||||
info: MessageInfo,
|
||||
deps: DepsMut,
|
||||
) -> Result<Response, ContractError> {
|
||||
if amount.denom != DENOM {
|
||||
return Err(ContractError::WrongDenom(amount.denom, DENOM.to_string()));
|
||||
}
|
||||
|
||||
let address = info.sender.clone();
|
||||
let account = account_from_address(info.sender.as_str(), deps.storage, deps.api)?;
|
||||
if address != account.owner_address() {
|
||||
|
||||
@@ -24,11 +24,11 @@ pub enum ContractError {
|
||||
ImprobableVestingAmount(u128),
|
||||
#[error("Address {0} has already bonded a node")]
|
||||
AlreadyBonded(String),
|
||||
#[error("Recieved empty funds vector")]
|
||||
#[error("Received empty funds vector")]
|
||||
EmptyFunds,
|
||||
#[error("Recieved wrong denom: {0}, expected {1}")]
|
||||
#[error("Received wrong denom: {0}, expected {1}")]
|
||||
WrongDenom(String, String),
|
||||
#[error("Recieved multiple denoms, expected 1")]
|
||||
#[error("Received multiple denoms, expected 1")]
|
||||
MultipleDenoms,
|
||||
#[error("No delegations found for account {0}, mix_identity {1}")]
|
||||
NoSuchDelegation(Addr, IdentityKey),
|
||||
|
||||
@@ -124,7 +124,7 @@ mod tests {
|
||||
let msg = ExecuteMsg::WithdrawVestedCoins {
|
||||
amount: Coin {
|
||||
amount: Uint128::new(1),
|
||||
denom: "nym".to_string(),
|
||||
denom: DENOM.to_string(),
|
||||
},
|
||||
};
|
||||
let info = mock_info("new_owner", &[]);
|
||||
|
||||
Reference in New Issue
Block a user