5652eb7ee3
* A pull request for discussion about contract state variables * Updated contract state struct * Introduced transaction to update the contract state * Moved transactions to separate file * Corrected return type on query * Corrected query match * Added test for state params query * Test for state params update * Removed unused imports * Helper functions to query for state params * Removed hardcoded inside bond, old mix bond value * Helper function to update contract state * Changed typescript StateParam from numbers to strings * Somehow unresolved post-merge issues in tests * Introduced additional helpers for the validator client to use the new contract features * Using the state-specified bond values Co-authored-by: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
39 lines
1.1 KiB
Rust
39 lines
1.1 KiB
Rust
use crate::contract::DENOM;
|
|
use cosmwasm_std::{HumanAddr, StdError};
|
|
use thiserror::Error;
|
|
|
|
/// Custom errors for contract failure conditions.
|
|
///
|
|
/// Add any other custom errors you like here.
|
|
/// Look at https://docs.rs/thiserror/1.0.21/thiserror/ for details.
|
|
#[derive(Error, Debug, PartialEq)]
|
|
pub enum ContractError {
|
|
#[error("{0}")]
|
|
Std(#[from] StdError),
|
|
|
|
#[error(
|
|
"Not enough funds sent for mixnode bond. (received {received:?}, minimum {minimum:?})"
|
|
)]
|
|
InsufficientMixNodeBond { received: u128, minimum: u128 },
|
|
|
|
#[error("Account does not own any mixnode bonds")]
|
|
MixNodeBondNotFound {},
|
|
|
|
#[error(
|
|
"Not enough funds sent for gateway bond. (received {received:?}, minimum {minimum:?})"
|
|
)]
|
|
InsufficientGatewayBond { received: u128, minimum: u128 },
|
|
|
|
#[error("Account ({account:?}) does not own any gateway bonds")]
|
|
GatewayBondNotFound { account: HumanAddr },
|
|
|
|
#[error("Unauthorized")]
|
|
Unauthorized,
|
|
|
|
#[error("Wrong coin denomination, you must send {}", DENOM)]
|
|
WrongDenom {},
|
|
|
|
#[error("No coin was sent for the bonding, you must send {}", DENOM)]
|
|
NoBondFound,
|
|
}
|