Skip to content

Commit

Permalink
add error strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Foivos committed Oct 25, 2024
1 parent 0cd4ca3 commit d787666
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
6 changes: 4 additions & 2 deletions move/squid/sources/squid/coin_bag.move
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ use sui::bag::{Self, Bag};
use sui::balance::Balance;
use sui::hash::keccak256;

const EKeyNotExist: u64 = 0;
const ENotEnoughBalance: u64 = 1;
#[error]
const EKeyNotExist: vector<u8> = b"key not found";
#[error]
const ENotEnoughBalance: vector<u8> = b"not enough balance";

public struct CoinBag has store {
bag: Bag,
Expand Down
9 changes: 6 additions & 3 deletions move/squid/sources/squid/deepbook_v3.move
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ use sui::clock::Clock;
use token::deep::DEEP;
use utils::utils::peel;

const EWrongSwapType: u64 = 0;
const EWrongPool: u64 = 1;
const EWrongCoinType: u64 = 2;
#[error]
const EWrongSwapType: vector<u8> = b"wrong swap type";
#[error]
const EWrongPool: vector<u8> = b"pool argument does not match required pool";
#[error]
const EWrongCoinType: vector<u8> = b"coin type expected does not match type argument";

const FLOAT_SCALING: u128 = 1_000_000_000;

Expand Down
3 changes: 2 additions & 1 deletion move/squid/sources/squid/discovery.move
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ use squid::transfers;
use std::ascii::{Self, String};
use sui::bcs;

const EInvalidSwapType: u64 = 0;
#[error]
const EInvalidSwapType: vector<u8> = b"swap type does not exist";

public fun register_transaction(
squid: &Squid,
Expand Down
6 changes: 4 additions & 2 deletions move/squid/sources/squid/transfers.move
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ use sui::clock::Clock;
use sui::coin;
use utils::utils::peel;

const EWrongSwapType: u64 = 0;
const EWrongCoinType: u64 = 1;
#[error]
const EWrongSwapType: vector<u8> = b"wrong swap type";
#[error]
const EWrongCoinType: vector<u8> = b"expected coin type does not match type argument";

/// fallback states whether this transfer happens normally or only on fallback
/// mode.
Expand Down

0 comments on commit d787666

Please sign in to comment.