@pbgtoken/rwa-contract 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +36 -36
- package/dist/validators/index.d.ts +57 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -465,6 +465,18 @@ enum Metadata {
|
|
|
465
465
|
x: Cip68 => x.state
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
|
+
|
|
469
|
+
func version(self) -> Int {
|
|
470
|
+
self.switch{
|
|
471
|
+
x: Cip68 => x.version
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
func extra(self) -> Cip68Extra {
|
|
476
|
+
self.switch{
|
|
477
|
+
x: Cip68 => x.extra
|
|
478
|
+
}
|
|
479
|
+
}
|
|
468
480
|
}
|
|
469
481
|
|
|
470
482
|
struct Redeemer {
|
|
@@ -472,21 +484,17 @@ struct Redeemer {
|
|
|
472
484
|
}
|
|
473
485
|
|
|
474
486
|
// TODO: ability to leave const params unset during hl2ts transpilation
|
|
475
|
-
const SEED = TxOutputId::new(TxId::new(#), 0)
|
|
476
|
-
const ORACLES = []PubKeyHash{}
|
|
477
|
-
const QUORUM = ORACLES.length/2
|
|
478
|
-
|
|
479
487
|
const TYPE = "WrappedAsset"
|
|
480
488
|
const VENUE = "VENUE"
|
|
481
489
|
const POLICY = "POLICY"
|
|
482
490
|
const ACCOUNT = "ACCOUNT"
|
|
483
491
|
|
|
484
492
|
const TICKER = "TICKER"
|
|
485
|
-
const NAME = "NAME"
|
|
486
|
-
const DESCRIPTION = "DESCRIPTION"
|
|
487
493
|
const DECIMALS = 0
|
|
488
|
-
|
|
489
|
-
const
|
|
494
|
+
|
|
495
|
+
const ORACLES = []PubKeyHash{}
|
|
496
|
+
const QUORUM = (ORACLES.length + 1)/2
|
|
497
|
+
const SEED = TxOutputId::new(TxId::new(#), 0)
|
|
490
498
|
|
|
491
499
|
const ticker_bytes = TICKER.encode_utf8()
|
|
492
500
|
const user_token_name = Cip67::fungible_token_label + ticker_bytes
|
|
@@ -515,30 +523,24 @@ func validate_initialization() -> () {
|
|
|
515
523
|
})
|
|
516
524
|
|
|
517
525
|
metadata = ref_utxo.datum.inline.as_strictly[Metadata]
|
|
526
|
+
state = metadata.state()
|
|
518
527
|
|
|
519
|
-
assert(metadata == Metadata::Cip68{
|
|
520
|
-
State{
|
|
521
|
-
supply: 0,
|
|
522
528
|
|
|
523
|
-
|
|
524
|
-
venue: VENUE,
|
|
525
|
-
policy: POLICY,
|
|
526
|
-
account: ACCOUNT,
|
|
529
|
+
assert(state.supply == 0, "supply not initialized at 0")
|
|
527
530
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
url: URL,
|
|
533
|
-
logo: LOGO,
|
|
531
|
+
assert(state.type == TYPE, "unexpected type")
|
|
532
|
+
assert(state.venue == VENUE, "unexpected venue")
|
|
533
|
+
assert(state.policy == POLICY, "unexpected policy")
|
|
534
|
+
assert(state.account == ACCOUNT, "unexpected account")
|
|
534
535
|
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
536
|
+
assert(state.ticker == TICKER, "unexpected ticker")
|
|
537
|
+
assert(state.decimals == DECIMALS, "unexpected decimals")
|
|
538
|
+
|
|
539
|
+
assert(state.quorum == QUORUM, "unexpected quorum")
|
|
540
|
+
assert(state.seed == SEED, "unexpected seed")
|
|
541
|
+
|
|
542
|
+
assert(metadata.version() == 1, "unexpected metadata version")
|
|
543
|
+
assert(metadata.extra() == Cip68Extra::Unused, "unexpected metadata extra values")
|
|
542
544
|
}
|
|
543
545
|
|
|
544
546
|
func signed_by_quorum() -> Bool {
|
|
@@ -546,7 +548,7 @@ func signed_by_quorum() -> Bool {
|
|
|
546
548
|
n_signers + tx.is_signed_by(key).to_int()
|
|
547
549
|
}, 0)
|
|
548
550
|
|
|
549
|
-
n_signers
|
|
551
|
+
n_signers >= QUORUM
|
|
550
552
|
}
|
|
551
553
|
|
|
552
554
|
func validate_state_change(redeemer: Redeemer, input: TxInput) -> () {
|
|
@@ -644,19 +646,17 @@ func main(args: MixedArgs) -> () {
|
|
|
644
646
|
},
|
|
645
647
|
$functions: {
|
|
646
648
|
"Metadata::state": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "Metadata::state", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [{ "name": "self", "isOptional": false, "type": { "kind": "enum", "name": "Metadata", "id": "__module__wrapped_asset__Metadata[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__wrapped_asset__Metadata[]__Cip68", "name": "Cip68", "fieldTypes": [{ "name": "state", "type": { "kind": "struct", "format": "map", "id": "__module__wrapped_asset__State[]", "name": "State", "fieldTypes": [{ "name": "supply", "type": { "kind": "internal", "name": "Int" }, "key": "supply" }, { "name": "type", "type": { "kind": "internal", "name": "String" }, "key": "type" }, { "name": "venue", "type": { "kind": "internal", "name": "String" }, "key": "venue" }, { "name": "policy", "type": { "kind": "internal", "name": "String" }, "key": "policy" }, { "name": "account", "type": { "kind": "internal", "name": "String" }, "key": "account" }, { "name": "ticker", "type": { "kind": "internal", "name": "String" }, "key": "ticker" }, { "name": "name", "type": { "kind": "internal", "name": "String" }, "key": "name" }, { "name": "description", "type": { "kind": "internal", "name": "String" }, "key": "description" }, { "name": "decimals", "type": { "kind": "internal", "name": "Int" }, "key": "decimals" }, { "name": "url", "type": { "kind": "internal", "name": "String" }, "key": "url" }, { "name": "logo", "type": { "kind": "internal", "name": "String" }, "key": "logo" }, { "name": "quorum", "type": { "kind": "internal", "name": "Int" }, "key": "quorum" }, { "name": "oracles", "type": { "kind": "list", "itemType": { "kind": "internal", "name": "PubKeyHash" } }, "key": "oracles" }, { "name": "seed", "type": { "kind": "internal", "name": "TxOutputId" }, "key": "seed" }] } }, { "name": "version", "type": { "kind": "internal", "name": "Int" } }, { "name": "extra", "type": { "kind": "enum", "name": "Cip68Extra", "id": "__module__wrapped_asset__Cip68Extra[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__wrapped_asset__Cip68Extra[]__Unused", "name": "Unused", "fieldTypes": [] }] } }] }] } }], "returns": { "kind": "struct", "format": "map", "id": "__module__wrapped_asset__State[]", "name": "State", "fieldTypes": [{ "name": "supply", "type": { "kind": "internal", "name": "Int" }, "key": "supply" }, { "name": "type", "type": { "kind": "internal", "name": "String" }, "key": "type" }, { "name": "venue", "type": { "kind": "internal", "name": "String" }, "key": "venue" }, { "name": "policy", "type": { "kind": "internal", "name": "String" }, "key": "policy" }, { "name": "account", "type": { "kind": "internal", "name": "String" }, "key": "account" }, { "name": "ticker", "type": { "kind": "internal", "name": "String" }, "key": "ticker" }, { "name": "name", "type": { "kind": "internal", "name": "String" }, "key": "name" }, { "name": "description", "type": { "kind": "internal", "name": "String" }, "key": "description" }, { "name": "decimals", "type": { "kind": "internal", "name": "Int" }, "key": "decimals" }, { "name": "url", "type": { "kind": "internal", "name": "String" }, "key": "url" }, { "name": "logo", "type": { "kind": "internal", "name": "String" }, "key": "logo" }, { "name": "quorum", "type": { "kind": "internal", "name": "Int" }, "key": "quorum" }, { "name": "oracles", "type": { "kind": "list", "itemType": { "kind": "internal", "name": "PubKeyHash" } }, "key": "oracles" }, { "name": "seed", "type": { "kind": "internal", "name": "TxOutputId" }, "key": "seed" }] } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
647
|
-
"
|
|
648
|
-
"
|
|
649
|
-
"QUORUM": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "QUORUM", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "Int" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
649
|
+
"Metadata::version": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "Metadata::version", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [{ "name": "self", "isOptional": false, "type": { "kind": "enum", "name": "Metadata", "id": "__module__wrapped_asset__Metadata[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__wrapped_asset__Metadata[]__Cip68", "name": "Cip68", "fieldTypes": [{ "name": "state", "type": { "kind": "struct", "format": "map", "id": "__module__wrapped_asset__State[]", "name": "State", "fieldTypes": [{ "name": "supply", "type": { "kind": "internal", "name": "Int" }, "key": "supply" }, { "name": "type", "type": { "kind": "internal", "name": "String" }, "key": "type" }, { "name": "venue", "type": { "kind": "internal", "name": "String" }, "key": "venue" }, { "name": "policy", "type": { "kind": "internal", "name": "String" }, "key": "policy" }, { "name": "account", "type": { "kind": "internal", "name": "String" }, "key": "account" }, { "name": "ticker", "type": { "kind": "internal", "name": "String" }, "key": "ticker" }, { "name": "name", "type": { "kind": "internal", "name": "String" }, "key": "name" }, { "name": "description", "type": { "kind": "internal", "name": "String" }, "key": "description" }, { "name": "decimals", "type": { "kind": "internal", "name": "Int" }, "key": "decimals" }, { "name": "url", "type": { "kind": "internal", "name": "String" }, "key": "url" }, { "name": "logo", "type": { "kind": "internal", "name": "String" }, "key": "logo" }, { "name": "quorum", "type": { "kind": "internal", "name": "Int" }, "key": "quorum" }, { "name": "oracles", "type": { "kind": "list", "itemType": { "kind": "internal", "name": "PubKeyHash" } }, "key": "oracles" }, { "name": "seed", "type": { "kind": "internal", "name": "TxOutputId" }, "key": "seed" }] } }, { "name": "version", "type": { "kind": "internal", "name": "Int" } }, { "name": "extra", "type": { "kind": "enum", "name": "Cip68Extra", "id": "__module__wrapped_asset__Cip68Extra[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__wrapped_asset__Cip68Extra[]__Unused", "name": "Unused", "fieldTypes": [] }] } }] }] } }], "returns": { "kind": "internal", "name": "Int" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
650
|
+
"Metadata::extra": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "Metadata::extra", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [{ "name": "self", "isOptional": false, "type": { "kind": "enum", "name": "Metadata", "id": "__module__wrapped_asset__Metadata[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__wrapped_asset__Metadata[]__Cip68", "name": "Cip68", "fieldTypes": [{ "name": "state", "type": { "kind": "struct", "format": "map", "id": "__module__wrapped_asset__State[]", "name": "State", "fieldTypes": [{ "name": "supply", "type": { "kind": "internal", "name": "Int" }, "key": "supply" }, { "name": "type", "type": { "kind": "internal", "name": "String" }, "key": "type" }, { "name": "venue", "type": { "kind": "internal", "name": "String" }, "key": "venue" }, { "name": "policy", "type": { "kind": "internal", "name": "String" }, "key": "policy" }, { "name": "account", "type": { "kind": "internal", "name": "String" }, "key": "account" }, { "name": "ticker", "type": { "kind": "internal", "name": "String" }, "key": "ticker" }, { "name": "name", "type": { "kind": "internal", "name": "String" }, "key": "name" }, { "name": "description", "type": { "kind": "internal", "name": "String" }, "key": "description" }, { "name": "decimals", "type": { "kind": "internal", "name": "Int" }, "key": "decimals" }, { "name": "url", "type": { "kind": "internal", "name": "String" }, "key": "url" }, { "name": "logo", "type": { "kind": "internal", "name": "String" }, "key": "logo" }, { "name": "quorum", "type": { "kind": "internal", "name": "Int" }, "key": "quorum" }, { "name": "oracles", "type": { "kind": "list", "itemType": { "kind": "internal", "name": "PubKeyHash" } }, "key": "oracles" }, { "name": "seed", "type": { "kind": "internal", "name": "TxOutputId" }, "key": "seed" }] } }, { "name": "version", "type": { "kind": "internal", "name": "Int" } }, { "name": "extra", "type": { "kind": "enum", "name": "Cip68Extra", "id": "__module__wrapped_asset__Cip68Extra[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__wrapped_asset__Cip68Extra[]__Unused", "name": "Unused", "fieldTypes": [] }] } }] }] } }], "returns": { "kind": "enum", "name": "Cip68Extra", "id": "__module__wrapped_asset__Cip68Extra[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__wrapped_asset__Cip68Extra[]__Unused", "name": "Unused", "fieldTypes": [] }] } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
650
651
|
"TYPE": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "TYPE", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
651
652
|
"VENUE": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "VENUE", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
652
653
|
"POLICY": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "POLICY", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
653
654
|
"ACCOUNT": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "ACCOUNT", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
654
655
|
"TICKER": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "TICKER", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
655
|
-
"NAME": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "NAME", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
656
|
-
"DESCRIPTION": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "DESCRIPTION", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
657
656
|
"DECIMALS": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "DECIMALS", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "Int" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
658
|
-
"
|
|
659
|
-
"
|
|
657
|
+
"ORACLES": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "ORACLES", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "list", "itemType": { "kind": "internal", "name": "PubKeyHash" } } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
658
|
+
"QUORUM": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "QUORUM", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "Int" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
659
|
+
"SEED": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "SEED", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "TxOutputId" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
660
660
|
"ticker_bytes": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "ticker_bytes", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "ByteArray" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
661
661
|
"user_token_name": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "user_token_name", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "ByteArray" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
662
662
|
"ref_token_name": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "ref_token_name", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "ByteArray" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
@@ -359,19 +359,69 @@ export declare const wrapped_asset: {
|
|
|
359
359
|
oracles: (PubKeyHash)[];
|
|
360
360
|
seed: TxOutputId;
|
|
361
361
|
}>;
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
362
|
+
"Metadata::version": (uplc: UplcProgram, config: CastConfig) => UserFunc<{
|
|
363
|
+
self: {
|
|
364
|
+
Cip68: {
|
|
365
|
+
state: {
|
|
366
|
+
supply: IntLike;
|
|
367
|
+
type: string;
|
|
368
|
+
venue: string;
|
|
369
|
+
policy: string;
|
|
370
|
+
account: string;
|
|
371
|
+
ticker: string;
|
|
372
|
+
name: string;
|
|
373
|
+
description: string;
|
|
374
|
+
decimals: IntLike;
|
|
375
|
+
url: string;
|
|
376
|
+
logo: string;
|
|
377
|
+
quorum: IntLike;
|
|
378
|
+
oracles: (PubKeyHash | string | number[])[];
|
|
379
|
+
seed: TxOutputId | string;
|
|
380
|
+
};
|
|
381
|
+
version: IntLike;
|
|
382
|
+
extra: {
|
|
383
|
+
Unused: {};
|
|
384
|
+
};
|
|
385
|
+
};
|
|
386
|
+
};
|
|
387
|
+
}, bigint>;
|
|
388
|
+
"Metadata::extra": (uplc: UplcProgram, config: CastConfig) => UserFunc<{
|
|
389
|
+
self: {
|
|
390
|
+
Cip68: {
|
|
391
|
+
state: {
|
|
392
|
+
supply: IntLike;
|
|
393
|
+
type: string;
|
|
394
|
+
venue: string;
|
|
395
|
+
policy: string;
|
|
396
|
+
account: string;
|
|
397
|
+
ticker: string;
|
|
398
|
+
name: string;
|
|
399
|
+
description: string;
|
|
400
|
+
decimals: IntLike;
|
|
401
|
+
url: string;
|
|
402
|
+
logo: string;
|
|
403
|
+
quorum: IntLike;
|
|
404
|
+
oracles: (PubKeyHash | string | number[])[];
|
|
405
|
+
seed: TxOutputId | string;
|
|
406
|
+
};
|
|
407
|
+
version: IntLike;
|
|
408
|
+
extra: {
|
|
409
|
+
Unused: {};
|
|
410
|
+
};
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
}, {
|
|
414
|
+
Unused: {};
|
|
415
|
+
}>;
|
|
365
416
|
TYPE: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
|
|
366
417
|
VENUE: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
|
|
367
418
|
POLICY: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
|
|
368
419
|
ACCOUNT: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
|
|
369
420
|
TICKER: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
|
|
370
|
-
NAME: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
|
|
371
|
-
DESCRIPTION: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
|
|
372
421
|
DECIMALS: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, bigint>;
|
|
373
|
-
|
|
374
|
-
|
|
422
|
+
ORACLES: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, PubKeyHash[]>;
|
|
423
|
+
QUORUM: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, bigint>;
|
|
424
|
+
SEED: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, TxOutputId>;
|
|
375
425
|
ticker_bytes: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, number[]>;
|
|
376
426
|
user_token_name: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, number[]>;
|
|
377
427
|
ref_token_name: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, number[]>;
|