@pbgtoken/rwa-contract 1.0.3 → 1.1.4

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.d.ts CHANGED
@@ -3,7 +3,7 @@ export { type PricesProvider } from "./PricesProvider";
3
3
  export { makeRWADatumProvider, type RWADatumProvider } from "./RWADatumProvider";
4
4
  export { type TokenizedAccountProvider } from "./TokenizedAccountProvider";
5
5
  export { filterTransfersAfter, type TransferID } from "./TransferID";
6
- export { one_to_one_asset, tokenized_account } from "./validators";
6
+ export { wrapped_asset, account_aggregate } from "./validators";
7
7
  export { makeCoinGeckoProvider } from "./CoinGeckoProvider";
8
8
  export { makeBitcoinWalletProvider } from "./BitcoinWalletProvider";
9
9
  export { makeEthereumERC20AccountProvider } from "./EthereumERC20AccountProvider";
package/dist/index.js CHANGED
@@ -168,11 +168,11 @@ import { expectDefined } from "@helios-lang/type-utils";
168
168
 
169
169
  // src/validators/index.ts
170
170
  import { makeCast, makeUserFunc } from "@helios-lang/contract-utils";
171
- var tokenized_account = {
172
- $name: "tokenized_account",
171
+ var account_aggregate = {
172
+ $name: "account_aggregate",
173
173
  $purpose: "mixed",
174
- $currentScriptIndex: 1,
175
- $sourceCode: `mixed tokenized_account
174
+ $currentScriptIndex: 0,
175
+ $sourceCode: `mixed account_aggregate
176
176
 
177
177
  import { get_current_input, tx } from ScriptContext
178
178
 
@@ -232,7 +232,7 @@ const ticker_bytes = TICKER.encode_utf8()
232
232
  const user_token_name = Cip67::fungible_token_label + ticker_bytes
233
233
  const ref_token_name = Cip67::reference_token_label + ticker_bytes
234
234
 
235
- const own_hash = Scripts::tokenized_account
235
+ const own_hash = Scripts::account_aggregate
236
236
  const own_mph = MintingPolicyHash::from_script_hash(own_hash)
237
237
  const own_address = Address::new(
238
238
  SpendingCredential::new_validator(
@@ -388,13 +388,13 @@ func main(args: MixedArgs) -> () {
388
388
  $Redeemer: (config) => makeCast({ "kind": "enum", "id": "__helios__mixedargs", "name": "MixedArgs", "variantTypes": [{ "kind": "variant", "name": "Other", "id": "__helios__mixedargs__other", "tag": 0, "fieldTypes": [{ "name": "redeemer", "type": { "kind": "internal", "name": "Data" } }] }, { "kind": "variant", "name": "Spending", "id": "__helios__mixedargs__spending", "tag": 1, "fieldTypes": [{ "name": "redeemer", "type": { "kind": "internal", "name": "Data" } }] }] }, config),
389
389
  $Datum: (config) => makeCast({ "kind": "internal", "name": "Data" }, config),
390
390
  $types: {
391
- State: (config) => makeCast({ "kind": "struct", "format": "map", "id": "__module__tokenized_account__State[]", "name": "State", "fieldTypes": [{ "name": "current_supply", "type": { "kind": "internal", "name": "Int" }, "key": "current_supply" }, { "name": "supply_after_last_mint", "type": { "kind": "internal", "name": "Int" }, "key": "supply_after_last_mint" }, { "name": "transfer_id_before_last_mint", "type": { "kind": "internal", "name": "ByteArray" }, "key": "transfer_id_before_last_mint" }, { "name": "type", "type": { "kind": "internal", "name": "String" }, "key": "type" }, { "name": "account", "type": { "kind": "internal", "name": "ByteArray" }, "key": "account" }, { "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": "ticker", "type": { "kind": "internal", "name": "String" }, "key": "ticker" }, { "name": "url", "type": { "kind": "internal", "name": "String" }, "key": "url" }, { "name": "logo", "type": { "kind": "internal", "name": "String" }, "key": "logo" }] }, config),
392
- Cip68Extra: (config) => makeCast({ "kind": "enum", "name": "Cip68Extra", "id": "__module__tokenized_account__Cip68Extra[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__tokenized_account__Cip68Extra[]__Unused", "name": "Unused", "fieldTypes": [] }] }, config),
393
- Metadata: (config) => makeCast({ "kind": "enum", "name": "Metadata", "id": "__module__tokenized_account__Metadata[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__tokenized_account__Metadata[]__Cip68", "name": "Cip68", "fieldTypes": [{ "name": "state", "type": { "kind": "struct", "format": "map", "id": "__module__tokenized_account__State[]", "name": "State", "fieldTypes": [{ "name": "current_supply", "type": { "kind": "internal", "name": "Int" }, "key": "current_supply" }, { "name": "supply_after_last_mint", "type": { "kind": "internal", "name": "Int" }, "key": "supply_after_last_mint" }, { "name": "transfer_id_before_last_mint", "type": { "kind": "internal", "name": "ByteArray" }, "key": "transfer_id_before_last_mint" }, { "name": "type", "type": { "kind": "internal", "name": "String" }, "key": "type" }, { "name": "account", "type": { "kind": "internal", "name": "ByteArray" }, "key": "account" }, { "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": "ticker", "type": { "kind": "internal", "name": "String" }, "key": "ticker" }, { "name": "url", "type": { "kind": "internal", "name": "String" }, "key": "url" }, { "name": "logo", "type": { "kind": "internal", "name": "String" }, "key": "logo" }] } }, { "name": "version", "type": { "kind": "internal", "name": "Int" } }, { "name": "extra", "type": { "kind": "enum", "name": "Cip68Extra", "id": "__module__tokenized_account__Cip68Extra[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__tokenized_account__Cip68Extra[]__Unused", "name": "Unused", "fieldTypes": [] }] } }] }] }, config),
394
- Redeemer: (config) => makeCast({ "kind": "struct", "format": "list", "id": "__module__tokenized_account__Redeemer[]", "name": "Redeemer", "fieldTypes": [{ "name": "total_reserves", "type": { "kind": "internal", "name": "Real" } }, { "name": "reserves_change", "type": { "kind": "internal", "name": "Real" } }, { "name": "latest_transfer_id", "type": { "kind": "internal", "name": "ByteArray" } }] }, config)
391
+ State: (config) => makeCast({ "kind": "struct", "format": "map", "id": "__module__account_aggregate__State[]", "name": "State", "fieldTypes": [{ "name": "current_supply", "type": { "kind": "internal", "name": "Int" }, "key": "current_supply" }, { "name": "supply_after_last_mint", "type": { "kind": "internal", "name": "Int" }, "key": "supply_after_last_mint" }, { "name": "transfer_id_before_last_mint", "type": { "kind": "internal", "name": "ByteArray" }, "key": "transfer_id_before_last_mint" }, { "name": "type", "type": { "kind": "internal", "name": "String" }, "key": "type" }, { "name": "account", "type": { "kind": "internal", "name": "ByteArray" }, "key": "account" }, { "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": "ticker", "type": { "kind": "internal", "name": "String" }, "key": "ticker" }, { "name": "url", "type": { "kind": "internal", "name": "String" }, "key": "url" }, { "name": "logo", "type": { "kind": "internal", "name": "String" }, "key": "logo" }] }, config),
392
+ Cip68Extra: (config) => makeCast({ "kind": "enum", "name": "Cip68Extra", "id": "__module__account_aggregate__Cip68Extra[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__account_aggregate__Cip68Extra[]__Unused", "name": "Unused", "fieldTypes": [] }] }, config),
393
+ Metadata: (config) => makeCast({ "kind": "enum", "name": "Metadata", "id": "__module__account_aggregate__Metadata[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__account_aggregate__Metadata[]__Cip68", "name": "Cip68", "fieldTypes": [{ "name": "state", "type": { "kind": "struct", "format": "map", "id": "__module__account_aggregate__State[]", "name": "State", "fieldTypes": [{ "name": "current_supply", "type": { "kind": "internal", "name": "Int" }, "key": "current_supply" }, { "name": "supply_after_last_mint", "type": { "kind": "internal", "name": "Int" }, "key": "supply_after_last_mint" }, { "name": "transfer_id_before_last_mint", "type": { "kind": "internal", "name": "ByteArray" }, "key": "transfer_id_before_last_mint" }, { "name": "type", "type": { "kind": "internal", "name": "String" }, "key": "type" }, { "name": "account", "type": { "kind": "internal", "name": "ByteArray" }, "key": "account" }, { "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": "ticker", "type": { "kind": "internal", "name": "String" }, "key": "ticker" }, { "name": "url", "type": { "kind": "internal", "name": "String" }, "key": "url" }, { "name": "logo", "type": { "kind": "internal", "name": "String" }, "key": "logo" }] } }, { "name": "version", "type": { "kind": "internal", "name": "Int" } }, { "name": "extra", "type": { "kind": "enum", "name": "Cip68Extra", "id": "__module__account_aggregate__Cip68Extra[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__account_aggregate__Cip68Extra[]__Unused", "name": "Unused", "fieldTypes": [] }] } }] }] }, config),
394
+ Redeemer: (config) => makeCast({ "kind": "struct", "format": "list", "id": "__module__account_aggregate__Redeemer[]", "name": "Redeemer", "fieldTypes": [{ "name": "total_reserves", "type": { "kind": "internal", "name": "Real" } }, { "name": "reserves_change", "type": { "kind": "internal", "name": "Real" } }, { "name": "latest_transfer_id", "type": { "kind": "internal", "name": "ByteArray" } }] }, config)
395
395
  },
396
396
  $functions: {
397
- "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__tokenized_account__Metadata[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__tokenized_account__Metadata[]__Cip68", "name": "Cip68", "fieldTypes": [{ "name": "state", "type": { "kind": "struct", "format": "map", "id": "__module__tokenized_account__State[]", "name": "State", "fieldTypes": [{ "name": "current_supply", "type": { "kind": "internal", "name": "Int" }, "key": "current_supply" }, { "name": "supply_after_last_mint", "type": { "kind": "internal", "name": "Int" }, "key": "supply_after_last_mint" }, { "name": "transfer_id_before_last_mint", "type": { "kind": "internal", "name": "ByteArray" }, "key": "transfer_id_before_last_mint" }, { "name": "type", "type": { "kind": "internal", "name": "String" }, "key": "type" }, { "name": "account", "type": { "kind": "internal", "name": "ByteArray" }, "key": "account" }, { "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": "ticker", "type": { "kind": "internal", "name": "String" }, "key": "ticker" }, { "name": "url", "type": { "kind": "internal", "name": "String" }, "key": "url" }, { "name": "logo", "type": { "kind": "internal", "name": "String" }, "key": "logo" }] } }, { "name": "version", "type": { "kind": "internal", "name": "Int" } }, { "name": "extra", "type": { "kind": "enum", "name": "Cip68Extra", "id": "__module__tokenized_account__Cip68Extra[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__tokenized_account__Cip68Extra[]__Unused", "name": "Unused", "fieldTypes": [] }] } }] }] } }], "returns": { "kind": "struct", "format": "map", "id": "__module__tokenized_account__State[]", "name": "State", "fieldTypes": [{ "name": "current_supply", "type": { "kind": "internal", "name": "Int" }, "key": "current_supply" }, { "name": "supply_after_last_mint", "type": { "kind": "internal", "name": "Int" }, "key": "supply_after_last_mint" }, { "name": "transfer_id_before_last_mint", "type": { "kind": "internal", "name": "ByteArray" }, "key": "transfer_id_before_last_mint" }, { "name": "type", "type": { "kind": "internal", "name": "String" }, "key": "type" }, { "name": "account", "type": { "kind": "internal", "name": "ByteArray" }, "key": "account" }, { "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": "ticker", "type": { "kind": "internal", "name": "String" }, "key": "ticker" }, { "name": "url", "type": { "kind": "internal", "name": "String" }, "key": "url" }, { "name": "logo", "type": { "kind": "internal", "name": "String" }, "key": "logo" }] } }, castConfig: config, validatorIndices: __validatorIndices }),
397
+ "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__account_aggregate__Metadata[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__account_aggregate__Metadata[]__Cip68", "name": "Cip68", "fieldTypes": [{ "name": "state", "type": { "kind": "struct", "format": "map", "id": "__module__account_aggregate__State[]", "name": "State", "fieldTypes": [{ "name": "current_supply", "type": { "kind": "internal", "name": "Int" }, "key": "current_supply" }, { "name": "supply_after_last_mint", "type": { "kind": "internal", "name": "Int" }, "key": "supply_after_last_mint" }, { "name": "transfer_id_before_last_mint", "type": { "kind": "internal", "name": "ByteArray" }, "key": "transfer_id_before_last_mint" }, { "name": "type", "type": { "kind": "internal", "name": "String" }, "key": "type" }, { "name": "account", "type": { "kind": "internal", "name": "ByteArray" }, "key": "account" }, { "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": "ticker", "type": { "kind": "internal", "name": "String" }, "key": "ticker" }, { "name": "url", "type": { "kind": "internal", "name": "String" }, "key": "url" }, { "name": "logo", "type": { "kind": "internal", "name": "String" }, "key": "logo" }] } }, { "name": "version", "type": { "kind": "internal", "name": "Int" } }, { "name": "extra", "type": { "kind": "enum", "name": "Cip68Extra", "id": "__module__account_aggregate__Cip68Extra[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__account_aggregate__Cip68Extra[]__Unused", "name": "Unused", "fieldTypes": [] }] } }] }] } }], "returns": { "kind": "struct", "format": "map", "id": "__module__account_aggregate__State[]", "name": "State", "fieldTypes": [{ "name": "current_supply", "type": { "kind": "internal", "name": "Int" }, "key": "current_supply" }, { "name": "supply_after_last_mint", "type": { "kind": "internal", "name": "Int" }, "key": "supply_after_last_mint" }, { "name": "transfer_id_before_last_mint", "type": { "kind": "internal", "name": "ByteArray" }, "key": "transfer_id_before_last_mint" }, { "name": "type", "type": { "kind": "internal", "name": "String" }, "key": "type" }, { "name": "account", "type": { "kind": "internal", "name": "ByteArray" }, "key": "account" }, { "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": "ticker", "type": { "kind": "internal", "name": "String" }, "key": "ticker" }, { "name": "url", "type": { "kind": "internal", "name": "String" }, "key": "url" }, { "name": "logo", "type": { "kind": "internal", "name": "String" }, "key": "logo" }] } }, castConfig: config, validatorIndices: __validatorIndices }),
398
398
  "SEED_ID": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "SEED_ID", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "TxOutputId" } }, castConfig: config, validatorIndices: __validatorIndices }),
399
399
  "ORACLE_KEYS": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "ORACLE_KEYS", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "list", "itemType": { "kind": "internal", "name": "PubKeyHash" } } }, castConfig: config, validatorIndices: __validatorIndices }),
400
400
  "INITIAL_PRICE": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "INITIAL_PRICE", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "Real" } }, castConfig: config, validatorIndices: __validatorIndices }),
@@ -417,30 +417,36 @@ func main(args: MixedArgs) -> () {
417
417
  "validate_initialization": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "validate_initialization", "requiresCurrentScript": false, "requiresScriptContext": true, "arguments": [] }, castConfig: config, validatorIndices: __validatorIndices }),
418
418
  "signed_by_quorum": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "signed_by_quorum", "requiresCurrentScript": false, "requiresScriptContext": true, "arguments": [], "returns": { "kind": "internal", "name": "Bool" } }, castConfig: config, validatorIndices: __validatorIndices }),
419
419
  "calc_token_price": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "calc_token_price", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [{ "name": "R", "isOptional": false, "type": { "kind": "internal", "name": "Real" } }, { "name": "Delta", "isOptional": false, "type": { "kind": "internal", "name": "Real" } }, { "name": "current_supply", "isOptional": false, "type": { "kind": "internal", "name": "Int" } }, { "name": "supply_after_last_mint", "isOptional": false, "type": { "kind": "internal", "name": "Int" } }], "returns": { "kind": "internal", "name": "Real" } }, castConfig: config, validatorIndices: __validatorIndices }),
420
- "validate_state_change": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "validate_state_change", "requiresCurrentScript": false, "requiresScriptContext": true, "arguments": [{ "name": "redeemer", "isOptional": false, "type": { "kind": "struct", "format": "list", "id": "__module__tokenized_account__Redeemer[]", "name": "Redeemer", "fieldTypes": [{ "name": "total_reserves", "type": { "kind": "internal", "name": "Real" } }, { "name": "reserves_change", "type": { "kind": "internal", "name": "Real" } }, { "name": "latest_transfer_id", "type": { "kind": "internal", "name": "ByteArray" } }] } }, { "name": "input", "isOptional": false, "type": { "kind": "internal", "name": "TxInput" } }] }, castConfig: config, validatorIndices: __validatorIndices }),
420
+ "validate_state_change": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "validate_state_change", "requiresCurrentScript": false, "requiresScriptContext": true, "arguments": [{ "name": "redeemer", "isOptional": false, "type": { "kind": "struct", "format": "list", "id": "__module__account_aggregate__Redeemer[]", "name": "Redeemer", "fieldTypes": [{ "name": "total_reserves", "type": { "kind": "internal", "name": "Real" } }, { "name": "reserves_change", "type": { "kind": "internal", "name": "Real" } }, { "name": "latest_transfer_id", "type": { "kind": "internal", "name": "ByteArray" } }] } }, { "name": "input", "isOptional": false, "type": { "kind": "internal", "name": "TxInput" } }] }, castConfig: config, validatorIndices: __validatorIndices }),
421
421
  "main": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "main", "arguments": [{ "name": "$datum", "isOptional": true, "type": { "kind": "internal", "name": "Data" } }, { "name": "args", "isOptional": false, "type": { "kind": "enum", "id": "__helios__mixedargs", "name": "MixedArgs", "variantTypes": [{ "kind": "variant", "name": "Other", "id": "__helios__mixedargs__other", "tag": 0, "fieldTypes": [{ "name": "redeemer", "type": { "kind": "internal", "name": "Data" } }] }, { "kind": "variant", "name": "Spending", "id": "__helios__mixedargs__spending", "tag": 1, "fieldTypes": [{ "name": "redeemer", "type": { "kind": "internal", "name": "Data" } }] }] } }], "requiresCurrentScript": false, "requiresScriptContext": true }, castConfig: config, validatorIndices: __validatorIndices })
422
422
  }
423
423
  };
424
- var one_to_one_asset = {
425
- $name: "one_to_one_asset",
424
+ var wrapped_asset = {
425
+ $name: "wrapped_asset",
426
426
  $purpose: "mixed",
427
- $currentScriptIndex: 0,
428
- $sourceCode: `mixed one_to_one_asset
427
+ $currentScriptIndex: 1,
428
+ $sourceCode: `mixed wrapped_asset
429
429
 
430
430
  import { get_current_input, tx } from ScriptContext
431
431
 
432
432
  struct State {
433
- supply: Int "supply"
433
+ supply: Int "supply"
434
434
 
435
- type: String "type" // eg. Bitcoin or ERC20
436
- account: ByteArray "account" // if type==Private -> this is a hash of the actual account type + address
435
+ type: String "type" // "WrappedAsset", can't change
436
+ venue: String "venue" // eg. "Bitcoin" or "Ethereum" or <bank-name>, can't change
437
+ policy: String "policy" // eg. "Native" or "USD" or "MXN", can't change
438
+ account: String "account" // eg. "bc1q23ztqjmh9a32z8j4rstg035y3c3vpfe0la3nck", hash of actual account (+ including secret nonce) if this must remain private, can't change
437
439
 
440
+ ticker: String "ticker" // can't change
438
441
  name: String "name"
439
442
  description: String "description"
440
443
  decimals: Int "decimals" // can't change
441
- ticker: String "ticker" // can't change
442
444
  url: String "url"
443
445
  logo: String "logo"
446
+
447
+ quorum: Int "quorum" // can't change
448
+ oracles: []PubKeyHash "oracles" // can't change
449
+ seed: TxOutputId "seed" // can't change
444
450
  }
445
451
 
446
452
  enum Cip68Extra {
@@ -465,23 +471,28 @@ struct Redeemer {
465
471
  reserves: Int
466
472
  }
467
473
 
468
- const SEED_ID = TxOutputId::new(TxId::new(#), 0)
469
- const ORACLE_KEYS = []PubKeyHash{}
470
- const INITIAL_PRICE: Real = 0.001 // 1000 USD per token -> 0.001 USD per microtoken
471
- const TYPE = "Bitcoin"
472
- const ACCOUNT = #
473
- const TICKER = "BTC"
474
- const NAME = "wrapped " + TICKER
475
- const DESCRIPTION = "wrapped" + TICKER + " operated by PBG"
476
- const DECIMALS = 6
477
- const URL = "https://www.pbg.io"
478
- const LOGO = "https://assets.pbg.io/usdt_bridge.png"
474
+ // 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
+ const TYPE = "WrappedAsset"
480
+ const VENUE = "VENUE"
481
+ const POLICY = "POLICY"
482
+ const ACCOUNT = "ACCOUNT"
483
+
484
+ const TICKER = "TICKER"
485
+ const NAME = "NAME"
486
+ const DESCRIPTION = "DESCRIPTION"
487
+ const DECIMALS = 0
488
+ const URL = "URL"
489
+ const LOGO = "LOGO"
479
490
 
480
491
  const ticker_bytes = TICKER.encode_utf8()
481
492
  const user_token_name = Cip67::fungible_token_label + ticker_bytes
482
493
  const ref_token_name = Cip67::reference_token_label + ticker_bytes
483
494
 
484
- const own_hash = Scripts::tokenized_account
495
+ const own_hash = Scripts::wrapped_asset
485
496
  const own_mph = MintingPolicyHash::from_script_hash(own_hash)
486
497
  const own_address = Address::new(
487
498
  SpendingCredential::new_validator(
@@ -495,8 +506,8 @@ const user_token_asset_class = AssetClass::new(own_mph, user_token_name)
495
506
 
496
507
  func validate_initialization() -> () {
497
508
  assert(tx.inputs.any((input: TxInput) -> {
498
- input.output_id == SEED_ID
499
- }), "seed UTXO not spent")
509
+ input.output_id == SEED
510
+ }), "seed not spent")
500
511
 
501
512
  ref_utxo = tx.outputs.find((output: TxOutput) -> {
502
513
  output.address == own_address
@@ -508,15 +519,22 @@ func validate_initialization() -> () {
508
519
  assert(metadata == Metadata::Cip68{
509
520
  State{
510
521
  supply: 0,
522
+
511
523
  type: TYPE,
524
+ venue: VENUE,
525
+ policy: POLICY,
512
526
  account: ACCOUNT,
513
527
 
528
+ ticker: TICKER,
514
529
  name: NAME,
515
530
  description: DESCRIPTION,
516
531
  decimals: DECIMALS,
517
- ticker: TICKER,
518
532
  url: URL,
519
- logo: LOGO
533
+ logo: LOGO,
534
+
535
+ quorum: QUORUM,
536
+ oracles: ORACLES,
537
+ seed: SEED
520
538
  },
521
539
  1,
522
540
  Cip68Extra::Unused
@@ -524,11 +542,11 @@ func validate_initialization() -> () {
524
542
  }
525
543
 
526
544
  func signed_by_quorum() -> Bool {
527
- n_signers = ORACLE_KEYS.fold((n_signers: Int, key: PubKeyHash) -> {
545
+ n_signers = ORACLES.fold((n_signers: Int, key: PubKeyHash) -> {
528
546
  n_signers + tx.is_signed_by(key).to_int()
529
547
  }, 0)
530
548
 
531
- n_signers > (ORACLE_KEYS.length/2)
549
+ n_signers > QUORUM
532
550
  }
533
551
 
534
552
  func validate_state_change(redeemer: Redeemer, input: TxInput) -> () {
@@ -542,10 +560,17 @@ func validate_state_change(redeemer: Redeemer, input: TxInput) -> () {
542
560
  state1 = output.datum.inline.as_strictly[Metadata].state()
543
561
 
544
562
  // ensure constant metadata fields don't change
545
- assert(state1.type == state0.type, "type not constant")
546
- assert(state1.account == state0.account, "account not constant")
547
- assert(state1.ticker == state0.ticker, "metadata ticker not constant")
548
- assert(state1.decimals == state0.decimals, "metadata decimals not constant")
563
+ assert(state1.type == TYPE, "type changed")
564
+ assert(state1.venue == state0.venue, "venue changed")
565
+ assert(state1.policy == state0.policy, "policy changed")
566
+ assert(state1.account == state0.account, "account changed")
567
+
568
+ assert(state1.ticker == state0.ticker, "ticker changed")
569
+ assert(state1.decimals == state0.decimals, "decimals changed")
570
+
571
+ assert(state1.quorum == QUORUM, "quorum changed")
572
+ assert(state1.oracles == ORACLES, "oracles changed")
573
+ assert(state1.seed == SEED, "seed changed")
549
574
 
550
575
  n = tx.minted.get_safe(user_token_asset_class)
551
576
  N0 = state0.supply
@@ -607,23 +632,25 @@ func main(args: MixedArgs) -> () {
607
632
  }
608
633
  }`,
609
634
  $dependencies: [],
610
- $hashDependencies: [tokenized_account],
611
- $dependsOnOwnHash: false,
635
+ $hashDependencies: [],
636
+ $dependsOnOwnHash: true,
612
637
  $Redeemer: (config) => makeCast({ "kind": "enum", "id": "__helios__mixedargs", "name": "MixedArgs", "variantTypes": [{ "kind": "variant", "name": "Other", "id": "__helios__mixedargs__other", "tag": 0, "fieldTypes": [{ "name": "redeemer", "type": { "kind": "internal", "name": "Data" } }] }, { "kind": "variant", "name": "Spending", "id": "__helios__mixedargs__spending", "tag": 1, "fieldTypes": [{ "name": "redeemer", "type": { "kind": "internal", "name": "Data" } }] }] }, config),
613
638
  $Datum: (config) => makeCast({ "kind": "internal", "name": "Data" }, config),
614
639
  $types: {
615
- State: (config) => makeCast({ "kind": "struct", "format": "map", "id": "__module__one_to_one_asset__State[]", "name": "State", "fieldTypes": [{ "name": "supply", "type": { "kind": "internal", "name": "Int" }, "key": "supply" }, { "name": "type", "type": { "kind": "internal", "name": "String" }, "key": "type" }, { "name": "account", "type": { "kind": "internal", "name": "ByteArray" }, "key": "account" }, { "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": "ticker", "type": { "kind": "internal", "name": "String" }, "key": "ticker" }, { "name": "url", "type": { "kind": "internal", "name": "String" }, "key": "url" }, { "name": "logo", "type": { "kind": "internal", "name": "String" }, "key": "logo" }] }, config),
616
- Cip68Extra: (config) => makeCast({ "kind": "enum", "name": "Cip68Extra", "id": "__module__one_to_one_asset__Cip68Extra[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__one_to_one_asset__Cip68Extra[]__Unused", "name": "Unused", "fieldTypes": [] }] }, config),
617
- Metadata: (config) => makeCast({ "kind": "enum", "name": "Metadata", "id": "__module__one_to_one_asset__Metadata[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__one_to_one_asset__Metadata[]__Cip68", "name": "Cip68", "fieldTypes": [{ "name": "state", "type": { "kind": "struct", "format": "map", "id": "__module__one_to_one_asset__State[]", "name": "State", "fieldTypes": [{ "name": "supply", "type": { "kind": "internal", "name": "Int" }, "key": "supply" }, { "name": "type", "type": { "kind": "internal", "name": "String" }, "key": "type" }, { "name": "account", "type": { "kind": "internal", "name": "ByteArray" }, "key": "account" }, { "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": "ticker", "type": { "kind": "internal", "name": "String" }, "key": "ticker" }, { "name": "url", "type": { "kind": "internal", "name": "String" }, "key": "url" }, { "name": "logo", "type": { "kind": "internal", "name": "String" }, "key": "logo" }] } }, { "name": "version", "type": { "kind": "internal", "name": "Int" } }, { "name": "extra", "type": { "kind": "enum", "name": "Cip68Extra", "id": "__module__one_to_one_asset__Cip68Extra[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__one_to_one_asset__Cip68Extra[]__Unused", "name": "Unused", "fieldTypes": [] }] } }] }] }, config),
618
- Redeemer: (config) => makeCast({ "kind": "struct", "format": "singleton", "id": "__module__one_to_one_asset__Redeemer[]", "name": "Redeemer", "fieldTypes": [{ "name": "reserves", "type": { "kind": "internal", "name": "Int" } }] }, config)
640
+ State: (config) => makeCast({ "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" }] }, config),
641
+ Cip68Extra: (config) => makeCast({ "kind": "enum", "name": "Cip68Extra", "id": "__module__wrapped_asset__Cip68Extra[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__wrapped_asset__Cip68Extra[]__Unused", "name": "Unused", "fieldTypes": [] }] }, config),
642
+ Metadata: (config) => makeCast({ "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": [] }] } }] }] }, config),
643
+ Redeemer: (config) => makeCast({ "kind": "struct", "format": "singleton", "id": "__module__wrapped_asset__Redeemer[]", "name": "Redeemer", "fieldTypes": [{ "name": "reserves", "type": { "kind": "internal", "name": "Int" } }] }, config)
619
644
  },
620
645
  $functions: {
621
- "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__one_to_one_asset__Metadata[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__one_to_one_asset__Metadata[]__Cip68", "name": "Cip68", "fieldTypes": [{ "name": "state", "type": { "kind": "struct", "format": "map", "id": "__module__one_to_one_asset__State[]", "name": "State", "fieldTypes": [{ "name": "supply", "type": { "kind": "internal", "name": "Int" }, "key": "supply" }, { "name": "type", "type": { "kind": "internal", "name": "String" }, "key": "type" }, { "name": "account", "type": { "kind": "internal", "name": "ByteArray" }, "key": "account" }, { "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": "ticker", "type": { "kind": "internal", "name": "String" }, "key": "ticker" }, { "name": "url", "type": { "kind": "internal", "name": "String" }, "key": "url" }, { "name": "logo", "type": { "kind": "internal", "name": "String" }, "key": "logo" }] } }, { "name": "version", "type": { "kind": "internal", "name": "Int" } }, { "name": "extra", "type": { "kind": "enum", "name": "Cip68Extra", "id": "__module__one_to_one_asset__Cip68Extra[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__one_to_one_asset__Cip68Extra[]__Unused", "name": "Unused", "fieldTypes": [] }] } }] }] } }], "returns": { "kind": "struct", "format": "map", "id": "__module__one_to_one_asset__State[]", "name": "State", "fieldTypes": [{ "name": "supply", "type": { "kind": "internal", "name": "Int" }, "key": "supply" }, { "name": "type", "type": { "kind": "internal", "name": "String" }, "key": "type" }, { "name": "account", "type": { "kind": "internal", "name": "ByteArray" }, "key": "account" }, { "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": "ticker", "type": { "kind": "internal", "name": "String" }, "key": "ticker" }, { "name": "url", "type": { "kind": "internal", "name": "String" }, "key": "url" }, { "name": "logo", "type": { "kind": "internal", "name": "String" }, "key": "logo" }] } }, castConfig: config, validatorIndices: __validatorIndices }),
622
- "SEED_ID": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "SEED_ID", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "TxOutputId" } }, castConfig: config, validatorIndices: __validatorIndices }),
623
- "ORACLE_KEYS": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "ORACLE_KEYS", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "list", "itemType": { "kind": "internal", "name": "PubKeyHash" } } }, castConfig: config, validatorIndices: __validatorIndices }),
624
- "INITIAL_PRICE": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "INITIAL_PRICE", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "Real" } }, castConfig: config, validatorIndices: __validatorIndices }),
646
+ "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
+ "SEED": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "SEED", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "TxOutputId" } }, castConfig: config, validatorIndices: __validatorIndices }),
648
+ "ORACLES": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "ORACLES", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "list", "itemType": { "kind": "internal", "name": "PubKeyHash" } } }, castConfig: config, validatorIndices: __validatorIndices }),
649
+ "QUORUM": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "QUORUM", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "Int" } }, castConfig: config, validatorIndices: __validatorIndices }),
625
650
  "TYPE": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "TYPE", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
626
- "ACCOUNT": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "ACCOUNT", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "ByteArray" } }, castConfig: config, validatorIndices: __validatorIndices }),
651
+ "VENUE": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "VENUE", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
652
+ "POLICY": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "POLICY", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
653
+ "ACCOUNT": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "ACCOUNT", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
627
654
  "TICKER": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "TICKER", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
628
655
  "NAME": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "NAME", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
629
656
  "DESCRIPTION": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "DESCRIPTION", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
@@ -640,15 +667,15 @@ func main(args: MixedArgs) -> () {
640
667
  "user_token_asset_class": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "user_token_asset_class", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "AssetClass" } }, castConfig: config, validatorIndices: __validatorIndices }),
641
668
  "validate_initialization": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "validate_initialization", "requiresCurrentScript": false, "requiresScriptContext": true, "arguments": [] }, castConfig: config, validatorIndices: __validatorIndices }),
642
669
  "signed_by_quorum": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "signed_by_quorum", "requiresCurrentScript": false, "requiresScriptContext": true, "arguments": [], "returns": { "kind": "internal", "name": "Bool" } }, castConfig: config, validatorIndices: __validatorIndices }),
643
- "validate_state_change": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "validate_state_change", "requiresCurrentScript": false, "requiresScriptContext": true, "arguments": [{ "name": "redeemer", "isOptional": false, "type": { "kind": "struct", "format": "singleton", "id": "__module__one_to_one_asset__Redeemer[]", "name": "Redeemer", "fieldTypes": [{ "name": "reserves", "type": { "kind": "internal", "name": "Int" } }] } }, { "name": "input", "isOptional": false, "type": { "kind": "internal", "name": "TxInput" } }] }, castConfig: config, validatorIndices: __validatorIndices }),
670
+ "validate_state_change": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "validate_state_change", "requiresCurrentScript": false, "requiresScriptContext": true, "arguments": [{ "name": "redeemer", "isOptional": false, "type": { "kind": "struct", "format": "singleton", "id": "__module__wrapped_asset__Redeemer[]", "name": "Redeemer", "fieldTypes": [{ "name": "reserves", "type": { "kind": "internal", "name": "Int" } }] } }, { "name": "input", "isOptional": false, "type": { "kind": "internal", "name": "TxInput" } }] }, castConfig: config, validatorIndices: __validatorIndices }),
644
671
  "main": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "main", "arguments": [{ "name": "$datum", "isOptional": true, "type": { "kind": "internal", "name": "Data" } }, { "name": "args", "isOptional": false, "type": { "kind": "enum", "id": "__helios__mixedargs", "name": "MixedArgs", "variantTypes": [{ "kind": "variant", "name": "Other", "id": "__helios__mixedargs__other", "tag": 0, "fieldTypes": [{ "name": "redeemer", "type": { "kind": "internal", "name": "Data" } }] }, { "kind": "variant", "name": "Spending", "id": "__helios__mixedargs__spending", "tag": 1, "fieldTypes": [{ "name": "redeemer", "type": { "kind": "internal", "name": "Data" } }] }] } }], "requiresCurrentScript": false, "requiresScriptContext": true }, castConfig: config, validatorIndices: __validatorIndices })
645
672
  }
646
673
  };
647
- var __validatorIndices = { "one_to_one_asset": 0, "tokenized_account": 1 };
674
+ var __validatorIndices = { "account_aggregate": 0, "wrapped_asset": 1 };
648
675
 
649
676
  // src/RWADatumProvider.ts
650
- var castMetadata = tokenized_account.$types.Metadata;
651
- var castDatum = tokenized_account.$types.State;
677
+ var castMetadata = account_aggregate.$types.Metadata;
678
+ var castDatum = account_aggregate.$types.State;
652
679
  function makeRWADatumProvider(provider) {
653
680
  return new RWADatumProviderImpl(provider);
654
681
  }
@@ -1323,6 +1350,7 @@ function makeBSCAccountProvider(walletAddress, priceProvider, alchemyApiKey, tok
1323
1350
  return new BSCAccountProvider(walletAddress, priceProvider, alchemyApiKey, tokenContractAddress, rpcUrl);
1324
1351
  }
1325
1352
  export {
1353
+ account_aggregate,
1326
1354
  filterTransfersAfter,
1327
1355
  makeBSCAccountProvider,
1328
1356
  makeBinanceAccountProvider,
@@ -1331,6 +1359,5 @@ export {
1331
1359
  makeCoinGeckoProvider,
1332
1360
  makeEthereumERC20AccountProvider,
1333
1361
  makeRWADatumProvider,
1334
- one_to_one_asset,
1335
- tokenized_account
1362
+ wrapped_asset
1336
1363
  };
@@ -2,10 +2,10 @@ import type { IntLike } from "@helios-lang/codec-utils";
2
2
  import type { Cast, CastConfig, UserFunc } from "@helios-lang/contract-utils";
3
3
  import type { Address, AssetClass, MintingPolicyHash, PubKeyHash, ScriptHash, TxInput, TxOutputId } from "@helios-lang/ledger";
4
4
  import type { UplcData, UplcProgram } from "@helios-lang/uplc";
5
- export declare const tokenized_account: {
6
- $name: "tokenized_account";
5
+ export declare const account_aggregate: {
6
+ $name: "account_aggregate";
7
7
  $purpose: "mixed";
8
- $currentScriptIndex: 1;
8
+ $currentScriptIndex: 0;
9
9
  $sourceCode: string;
10
10
  $dependencies: readonly [];
11
11
  $hashDependencies: never[];
@@ -201,211 +201,13 @@ export declare const tokenized_account: {
201
201
  }, void>;
202
202
  };
203
203
  };
204
- export declare const one_to_one_asset: {
205
- $name: "one_to_one_asset";
204
+ export declare const wrapped_asset: {
205
+ $name: "wrapped_asset";
206
206
  $purpose: "mixed";
207
- $currentScriptIndex: 0;
207
+ $currentScriptIndex: 1;
208
208
  $sourceCode: string;
209
209
  $dependencies: readonly [];
210
- $hashDependencies: {
211
- $name: "tokenized_account";
212
- $purpose: "mixed";
213
- $currentScriptIndex: 1;
214
- $sourceCode: string;
215
- $dependencies: readonly [];
216
- $hashDependencies: never[];
217
- $dependsOnOwnHash: boolean;
218
- $Redeemer: (config: CastConfig) => Cast<{
219
- Other: {
220
- redeemer: UplcData;
221
- };
222
- } | {
223
- Spending: {
224
- redeemer: UplcData;
225
- };
226
- }, {
227
- Other: {
228
- redeemer: UplcData;
229
- };
230
- } | {
231
- Spending: {
232
- redeemer: UplcData;
233
- };
234
- }>;
235
- $Datum: (config: CastConfig) => Cast<UplcData, UplcData>;
236
- $types: {
237
- State: (config: CastConfig) => Cast<{
238
- current_supply: bigint;
239
- supply_after_last_mint: bigint;
240
- transfer_id_before_last_mint: number[];
241
- type: string;
242
- account: number[];
243
- name: string;
244
- description: string;
245
- decimals: bigint;
246
- ticker: string;
247
- url: string;
248
- logo: string;
249
- }, {
250
- current_supply: IntLike;
251
- supply_after_last_mint: IntLike;
252
- transfer_id_before_last_mint: number[];
253
- type: string;
254
- account: number[];
255
- name: string;
256
- description: string;
257
- decimals: IntLike;
258
- ticker: string;
259
- url: string;
260
- logo: string;
261
- }>;
262
- Cip68Extra: (config: CastConfig) => Cast<{
263
- Unused: {};
264
- }, {
265
- Unused: {};
266
- }>;
267
- Metadata: (config: CastConfig) => Cast<{
268
- Cip68: {
269
- state: {
270
- current_supply: bigint;
271
- supply_after_last_mint: bigint;
272
- transfer_id_before_last_mint: number[];
273
- type: string;
274
- account: number[];
275
- name: string;
276
- description: string;
277
- decimals: bigint;
278
- ticker: string;
279
- url: string;
280
- logo: string;
281
- };
282
- version: bigint;
283
- extra: {
284
- Unused: {};
285
- };
286
- };
287
- }, {
288
- Cip68: {
289
- state: {
290
- current_supply: IntLike;
291
- supply_after_last_mint: IntLike;
292
- transfer_id_before_last_mint: number[];
293
- type: string;
294
- account: number[];
295
- name: string;
296
- description: string;
297
- decimals: IntLike;
298
- ticker: string;
299
- url: string;
300
- logo: string;
301
- };
302
- version: IntLike;
303
- extra: {
304
- Unused: {};
305
- };
306
- };
307
- }>;
308
- Redeemer: (config: CastConfig) => Cast<{
309
- total_reserves: number;
310
- reserves_change: number;
311
- latest_transfer_id: number[];
312
- }, {
313
- total_reserves: number;
314
- reserves_change: number;
315
- latest_transfer_id: number[];
316
- }>;
317
- };
318
- $functions: {
319
- "Metadata::state": (uplc: UplcProgram, config: CastConfig) => UserFunc<{
320
- self: {
321
- Cip68: {
322
- state: {
323
- current_supply: IntLike;
324
- supply_after_last_mint: IntLike;
325
- transfer_id_before_last_mint: number[];
326
- type: string;
327
- account: number[];
328
- name: string;
329
- description: string;
330
- decimals: IntLike;
331
- ticker: string;
332
- url: string;
333
- logo: string;
334
- };
335
- version: IntLike;
336
- extra: {
337
- Unused: {};
338
- };
339
- };
340
- };
341
- }, {
342
- current_supply: bigint;
343
- supply_after_last_mint: bigint;
344
- transfer_id_before_last_mint: number[];
345
- type: string;
346
- account: number[];
347
- name: string;
348
- description: string;
349
- decimals: bigint;
350
- ticker: string;
351
- url: string;
352
- logo: string;
353
- }>;
354
- SEED_ID: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, TxOutputId>;
355
- ORACLE_KEYS: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, PubKeyHash[]>;
356
- INITIAL_PRICE: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, number>;
357
- TYPE: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
358
- ACCOUNT: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, number[]>;
359
- TICKER: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
360
- NAME: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
361
- DESCRIPTION: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
362
- DECIMALS: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, bigint>;
363
- URL: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
364
- LOGO: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
365
- ticker_bytes: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, number[]>;
366
- user_token_name: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, number[]>;
367
- ref_token_name: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, number[]>;
368
- own_hash: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, ScriptHash>;
369
- own_mph: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, MintingPolicyHash>;
370
- own_address: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, Address>;
371
- ref_token_asset_class: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, AssetClass>;
372
- user_token_asset_class: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, AssetClass>;
373
- validate_initialization: (uplc: UplcProgram, config: CastConfig) => UserFunc<{
374
- $scriptContext: UplcData;
375
- }, void>;
376
- signed_by_quorum: (uplc: UplcProgram, config: CastConfig) => UserFunc<{
377
- $scriptContext: UplcData;
378
- }, boolean>;
379
- calc_token_price: (uplc: UplcProgram, config: CastConfig) => UserFunc<{
380
- R: number;
381
- Delta: number;
382
- current_supply: IntLike;
383
- supply_after_last_mint: IntLike;
384
- }, number>;
385
- validate_state_change: (uplc: UplcProgram, config: CastConfig) => UserFunc<{
386
- $scriptContext: UplcData;
387
- redeemer: {
388
- total_reserves: number;
389
- reserves_change: number;
390
- latest_transfer_id: number[];
391
- };
392
- input: TxInput;
393
- }, void>;
394
- main: (uplc: UplcProgram, config: CastConfig) => UserFunc<{
395
- $scriptContext: UplcData;
396
- $datum?: UplcData;
397
- args: {
398
- Other: {
399
- redeemer: UplcData;
400
- };
401
- } | {
402
- Spending: {
403
- redeemer: UplcData;
404
- };
405
- };
406
- }, void>;
407
- };
408
- }[];
210
+ $hashDependencies: never[];
409
211
  $dependsOnOwnHash: boolean;
410
212
  $Redeemer: (config: CastConfig) => Cast<{
411
213
  Other: {
@@ -429,23 +231,33 @@ export declare const one_to_one_asset: {
429
231
  State: (config: CastConfig) => Cast<{
430
232
  supply: bigint;
431
233
  type: string;
432
- account: number[];
234
+ venue: string;
235
+ policy: string;
236
+ account: string;
237
+ ticker: string;
433
238
  name: string;
434
239
  description: string;
435
240
  decimals: bigint;
436
- ticker: string;
437
241
  url: string;
438
242
  logo: string;
243
+ quorum: bigint;
244
+ oracles: (PubKeyHash)[];
245
+ seed: TxOutputId;
439
246
  }, {
440
247
  supply: IntLike;
441
248
  type: string;
442
- account: number[];
249
+ venue: string;
250
+ policy: string;
251
+ account: string;
252
+ ticker: string;
443
253
  name: string;
444
254
  description: string;
445
255
  decimals: IntLike;
446
- ticker: string;
447
256
  url: string;
448
257
  logo: string;
258
+ quorum: IntLike;
259
+ oracles: (PubKeyHash | string | number[])[];
260
+ seed: TxOutputId | string;
449
261
  }>;
450
262
  Cip68Extra: (config: CastConfig) => Cast<{
451
263
  Unused: {};
@@ -457,13 +269,18 @@ export declare const one_to_one_asset: {
457
269
  state: {
458
270
  supply: bigint;
459
271
  type: string;
460
- account: number[];
272
+ venue: string;
273
+ policy: string;
274
+ account: string;
275
+ ticker: string;
461
276
  name: string;
462
277
  description: string;
463
278
  decimals: bigint;
464
- ticker: string;
465
279
  url: string;
466
280
  logo: string;
281
+ quorum: bigint;
282
+ oracles: (PubKeyHash)[];
283
+ seed: TxOutputId;
467
284
  };
468
285
  version: bigint;
469
286
  extra: {
@@ -475,13 +292,18 @@ export declare const one_to_one_asset: {
475
292
  state: {
476
293
  supply: IntLike;
477
294
  type: string;
478
- account: number[];
295
+ venue: string;
296
+ policy: string;
297
+ account: string;
298
+ ticker: string;
479
299
  name: string;
480
300
  description: string;
481
301
  decimals: IntLike;
482
- ticker: string;
483
302
  url: string;
484
303
  logo: string;
304
+ quorum: IntLike;
305
+ oracles: (PubKeyHash | string | number[])[];
306
+ seed: TxOutputId | string;
485
307
  };
486
308
  version: IntLike;
487
309
  extra: {
@@ -502,13 +324,18 @@ export declare const one_to_one_asset: {
502
324
  state: {
503
325
  supply: IntLike;
504
326
  type: string;
505
- account: number[];
327
+ venue: string;
328
+ policy: string;
329
+ account: string;
330
+ ticker: string;
506
331
  name: string;
507
332
  description: string;
508
333
  decimals: IntLike;
509
- ticker: string;
510
334
  url: string;
511
335
  logo: string;
336
+ quorum: IntLike;
337
+ oracles: (PubKeyHash | string | number[])[];
338
+ seed: TxOutputId | string;
512
339
  };
513
340
  version: IntLike;
514
341
  extra: {
@@ -519,19 +346,26 @@ export declare const one_to_one_asset: {
519
346
  }, {
520
347
  supply: bigint;
521
348
  type: string;
522
- account: number[];
349
+ venue: string;
350
+ policy: string;
351
+ account: string;
352
+ ticker: string;
523
353
  name: string;
524
354
  description: string;
525
355
  decimals: bigint;
526
- ticker: string;
527
356
  url: string;
528
357
  logo: string;
358
+ quorum: bigint;
359
+ oracles: (PubKeyHash)[];
360
+ seed: TxOutputId;
529
361
  }>;
530
- SEED_ID: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, TxOutputId>;
531
- ORACLE_KEYS: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, PubKeyHash[]>;
532
- INITIAL_PRICE: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, number>;
362
+ SEED: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, TxOutputId>;
363
+ ORACLES: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, PubKeyHash[]>;
364
+ QUORUM: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, bigint>;
533
365
  TYPE: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
534
- ACCOUNT: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, number[]>;
366
+ VENUE: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
367
+ POLICY: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
368
+ ACCOUNT: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
535
369
  TICKER: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
536
370
  NAME: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
537
371
  DESCRIPTION: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pbgtoken/rwa-contract",
3
- "version": "1.0.3",
3
+ "version": "1.1.4",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",