Skip to content

Commit e37c360

Browse files
committed
add error code
1 parent cb96887 commit e37c360

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crates/sui-framework/packages/sui-framework/sources/registries/coin_registry.move

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ const ESupplyNotBurnOnly: vector<u8> = b"Cannot burn on a non burn-only supply."
5252
const EInvariantViolation: vector<u8> = b"Code invariant violation.";
5353
#[error(code = 12)]
5454
const EDeletionNotSupported: vector<u8> = b"Deleting legacy metadata is not supported.";
55+
#[error(code = 13)]
56+
const EIsNotOTW: vector<u8> = b"Is not one-time witness.";
5557

5658
/// Incremental identifier for regulated coin versions in the deny list.
5759
/// We start from `0` in the new system, which aligns with the state of `DenyCapV2`.
@@ -70,7 +72,6 @@ public struct CoinRegistry has key {
7072
/// Store only object that enables more flexible coin data
7173
/// registration, allowing for additional fields to be added
7274
/// without changing the `Currency` structure.
73-
#[allow(unused_field)]
7475
public struct ExtraField(TypeName, vector<u8>) has store;
7576

7677
/// Key used to derive addresses when creating `Currency<T>` objects.
@@ -205,7 +206,7 @@ public fun new_currency_with_otw<T: drop>(
205206
icon_url: String,
206207
ctx: &mut TxContext,
207208
): (CurrencyInitializer<T>, TreasuryCap<T>) {
208-
assert!(sui::types::is_one_time_witness(&otw));
209+
assert!(sui::types::is_one_time_witness(&otw), EIsNotOTW);
209210
assert!(is_ascii_printable!(&symbol), EInvalidSymbol);
210211

211212
let treasury_cap = coin::new_treasury_cap(ctx);

0 commit comments

Comments
 (0)