6b3700aefe
* Expanded emitted events for delegation-related transactions * Expanded emitted events for gateway-related transactions * Expanded emitted events for mixnode-related transactions * Expanded emitted events for settings update transaction * Expanded emitted events for rewarding-related transactions * Fixed attribute look up in tests * Making linter happier * Reorganised cosmwasm contract-related modules * Introduced similar event handling to the vesting contract
46 lines
1.7 KiB
Rust
46 lines
1.7 KiB
Rust
use cosmwasm_std::{Addr, StdError};
|
|
use mixnet_contract_common::IdentityKey;
|
|
use thiserror::Error;
|
|
|
|
#[derive(Error, Debug, PartialEq)]
|
|
pub enum ContractError {
|
|
#[error("{0}")]
|
|
Std(#[from] StdError),
|
|
#[error("Account does not exist - {0}")]
|
|
NoAccountForAddress(String),
|
|
#[error("Only admin can perform this action, {0} is not admin")]
|
|
NotAdmin(String),
|
|
#[error("Balance not found for existing account ({0}), this is a bug")]
|
|
NoBalanceForAddress(String),
|
|
#[error("Insufficient balance for address {0} -> {1}")]
|
|
InsufficientBalance(String, u128),
|
|
#[error("Insufficient spendable balance for address {0} -> {1}")]
|
|
InsufficientSpendable(String, u128),
|
|
#[error(
|
|
"Only delegation owner can perform delegation actions, {0} is not the delegation owner"
|
|
)]
|
|
NotDelegate(String),
|
|
#[error("Total vesting amount is inprobably low -> {0}, this is likely an error")]
|
|
ImprobableVestingAmount(u128),
|
|
#[error("Address {0} has already bonded a node")]
|
|
AlreadyBonded(String),
|
|
#[error("Received empty funds vector")]
|
|
EmptyFunds,
|
|
#[error("Received wrong denom: {0}, expected {1}")]
|
|
WrongDenom(String, String),
|
|
#[error("Received multiple denoms, expected 1")]
|
|
MultipleDenoms,
|
|
#[error("No delegations found for account {0}, mix_identity {1}")]
|
|
NoSuchDelegation(Addr, IdentityKey),
|
|
#[error("Only mixnet contract can perform this operation, got {0}")]
|
|
NotMixnetContract(Addr),
|
|
#[error("Calculation underflowed")]
|
|
Underflow,
|
|
#[error("No bond found for account {0}")]
|
|
NoBondFound(String),
|
|
#[error("Action can only be executed by account owner -> {0}")]
|
|
NotOwner(String),
|
|
#[error("Invalid address: {0}")]
|
|
InvalidAddress(String),
|
|
}
|