@pbgtoken/rwa-contract 1.0.3 → 1.0.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.js +78 -80
- package/dist/validators/index.d.ts +49 -248
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -168,20 +168,18 @@ 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
|
|
172
|
-
$name: "
|
|
171
|
+
var one_to_one_asset = {
|
|
172
|
+
$name: "one_to_one_asset",
|
|
173
173
|
$purpose: "mixed",
|
|
174
|
-
$currentScriptIndex:
|
|
175
|
-
$sourceCode: `mixed
|
|
174
|
+
$currentScriptIndex: 0,
|
|
175
|
+
$sourceCode: `mixed one_to_one_asset
|
|
176
176
|
|
|
177
177
|
import { get_current_input, tx } from ScriptContext
|
|
178
178
|
|
|
179
179
|
struct State {
|
|
180
|
-
|
|
181
|
-
supply_after_last_mint: Int "supply_after_last_mint"
|
|
182
|
-
transfer_id_before_last_mint: ByteArray "transfer_id_before_last_mint" // this is hash, because it might contain data that shouldn't be public
|
|
180
|
+
supply: Int "supply"
|
|
183
181
|
|
|
184
|
-
type: String "type" // eg.
|
|
182
|
+
type: String "type" // eg. Bitcoin or ERC20
|
|
185
183
|
account: ByteArray "account" // if type==Private -> this is a hash of the actual account type + address
|
|
186
184
|
|
|
187
185
|
name: String "name"
|
|
@@ -211,20 +209,17 @@ enum Metadata {
|
|
|
211
209
|
}
|
|
212
210
|
|
|
213
211
|
struct Redeemer {
|
|
214
|
-
|
|
215
|
-
reserves_change: Real
|
|
216
|
-
latest_transfer_id: ByteArray
|
|
212
|
+
reserves: Int
|
|
217
213
|
}
|
|
218
214
|
|
|
219
215
|
const SEED_ID = TxOutputId::new(TxId::new(#), 0)
|
|
220
216
|
const ORACLE_KEYS = []PubKeyHash{}
|
|
221
|
-
const
|
|
222
|
-
const TYPE = "Private"
|
|
217
|
+
const TYPE = "BitcoinNative"
|
|
223
218
|
const ACCOUNT = #
|
|
224
|
-
const TICKER = "
|
|
225
|
-
const NAME =
|
|
226
|
-
const DESCRIPTION = TICKER + "
|
|
227
|
-
const DECIMALS =
|
|
219
|
+
const TICKER = "BTC"
|
|
220
|
+
const NAME = "wrapped " + TICKER
|
|
221
|
+
const DESCRIPTION = "wrapped" + TICKER + " operated by PBG"
|
|
222
|
+
const DECIMALS = 8
|
|
228
223
|
const URL = "https://www.pbg.io"
|
|
229
224
|
const LOGO = "https://assets.pbg.io/usdt_bridge.png"
|
|
230
225
|
|
|
@@ -232,7 +227,7 @@ const ticker_bytes = TICKER.encode_utf8()
|
|
|
232
227
|
const user_token_name = Cip67::fungible_token_label + ticker_bytes
|
|
233
228
|
const ref_token_name = Cip67::reference_token_label + ticker_bytes
|
|
234
229
|
|
|
235
|
-
const own_hash = Scripts::
|
|
230
|
+
const own_hash = Scripts::one_to_one_asset
|
|
236
231
|
const own_mph = MintingPolicyHash::from_script_hash(own_hash)
|
|
237
232
|
const own_address = Address::new(
|
|
238
233
|
SpendingCredential::new_validator(
|
|
@@ -258,10 +253,7 @@ func validate_initialization() -> () {
|
|
|
258
253
|
|
|
259
254
|
assert(metadata == Metadata::Cip68{
|
|
260
255
|
State{
|
|
261
|
-
|
|
262
|
-
supply_after_last_mint: 0,
|
|
263
|
-
transfer_id_before_last_mint: #,
|
|
264
|
-
|
|
256
|
+
supply: 0,
|
|
265
257
|
type: TYPE,
|
|
266
258
|
account: ACCOUNT,
|
|
267
259
|
|
|
@@ -285,21 +277,6 @@ func signed_by_quorum() -> Bool {
|
|
|
285
277
|
n_signers > (ORACLE_KEYS.length/2)
|
|
286
278
|
}
|
|
287
279
|
|
|
288
|
-
func calc_token_price(R: Real, Delta: Real, current_supply: Int, supply_after_last_mint: Int) -> Real {
|
|
289
|
-
if (current_supply == 0 || supply_after_last_mint == 0) {
|
|
290
|
-
INITIAL_PRICE
|
|
291
|
-
} else {
|
|
292
|
-
p_last = (R - Delta)/supply_after_last_mint
|
|
293
|
-
p_curr = R / current_supply
|
|
294
|
-
|
|
295
|
-
if (p_last < p_curr) {
|
|
296
|
-
p_last
|
|
297
|
-
} else {
|
|
298
|
-
p_curr
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
280
|
func validate_state_change(redeemer: Redeemer, input: TxInput) -> () {
|
|
304
281
|
state0 = input.datum.inline.as[Metadata].state()
|
|
305
282
|
|
|
@@ -317,23 +294,16 @@ func validate_state_change(redeemer: Redeemer, input: TxInput) -> () {
|
|
|
317
294
|
assert(state1.decimals == state0.decimals, "metadata decimals not constant")
|
|
318
295
|
|
|
319
296
|
n = tx.minted.get_safe(user_token_asset_class)
|
|
320
|
-
N0 = state0.
|
|
321
|
-
N1 = state1.
|
|
297
|
+
N0 = state0.supply
|
|
298
|
+
N1 = state1.supply
|
|
322
299
|
|
|
323
300
|
assert((N1 - N0) == n, "current token supply not updated correctly")
|
|
324
301
|
|
|
325
302
|
if (n > 0) {
|
|
326
|
-
Redeemer{R
|
|
327
|
-
|
|
328
|
-
p = calc_token_price(R, Delta, N0, state0.supply_after_last_mint)
|
|
303
|
+
Redeemer{R} = redeemer
|
|
329
304
|
|
|
330
|
-
assert(N1
|
|
331
|
-
assert(state1.transfer_id_before_last_mint == latest_transfer_id, "transfer_id_before_last_mint not updated correctly")
|
|
332
|
-
assert(state1.supply_after_last_mint == N1, "supply_after_last_mint not updated correctly")
|
|
305
|
+
assert(N1 <= R, "too many tokens minted")
|
|
333
306
|
assert(signed_by_quorum(), "not signed by simple quorum of oracles")
|
|
334
|
-
} else {
|
|
335
|
-
assert(state1.supply_after_last_mint == state0.supply_after_last_mint, "supply_after_last_mint can't change during burn")
|
|
336
|
-
assert(state1.transfer_id_before_last_mint == state0.transfer_id_before_last_mint, "transfer_id_before_last_mint can't change during burn")
|
|
337
307
|
}
|
|
338
308
|
}
|
|
339
309
|
|
|
@@ -388,16 +358,15 @@ func main(args: MixedArgs) -> () {
|
|
|
388
358
|
$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
359
|
$Datum: (config) => makeCast({ "kind": "internal", "name": "Data" }, config),
|
|
390
360
|
$types: {
|
|
391
|
-
State: (config) => makeCast({ "kind": "struct", "format": "map", "id": "
|
|
392
|
-
Cip68Extra: (config) => makeCast({ "kind": "enum", "name": "Cip68Extra", "id": "
|
|
393
|
-
Metadata: (config) => makeCast({ "kind": "enum", "name": "Metadata", "id": "
|
|
394
|
-
Redeemer: (config) => makeCast({ "kind": "struct", "format": "
|
|
361
|
+
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),
|
|
362
|
+
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),
|
|
363
|
+
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),
|
|
364
|
+
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)
|
|
395
365
|
},
|
|
396
366
|
$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": "
|
|
367
|
+
"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 }),
|
|
398
368
|
"SEED_ID": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "SEED_ID", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "TxOutputId" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
399
369
|
"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
|
-
"INITIAL_PRICE": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "INITIAL_PRICE", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "Real" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
401
370
|
"TYPE": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "TYPE", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
402
371
|
"ACCOUNT": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "ACCOUNT", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "ByteArray" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
403
372
|
"TICKER": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "TICKER", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
@@ -416,23 +385,24 @@ func main(args: MixedArgs) -> () {
|
|
|
416
385
|
"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 }),
|
|
417
386
|
"validate_initialization": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "validate_initialization", "requiresCurrentScript": false, "requiresScriptContext": true, "arguments": [] }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
418
387
|
"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
|
-
"
|
|
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 }),
|
|
388
|
+
"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 }),
|
|
421
389
|
"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
390
|
}
|
|
423
391
|
};
|
|
424
|
-
var
|
|
425
|
-
$name: "
|
|
392
|
+
var tokenized_account = {
|
|
393
|
+
$name: "tokenized_account",
|
|
426
394
|
$purpose: "mixed",
|
|
427
|
-
$currentScriptIndex:
|
|
428
|
-
$sourceCode: `mixed
|
|
395
|
+
$currentScriptIndex: 1,
|
|
396
|
+
$sourceCode: `mixed tokenized_account
|
|
429
397
|
|
|
430
398
|
import { get_current_input, tx } from ScriptContext
|
|
431
399
|
|
|
432
400
|
struct State {
|
|
433
|
-
|
|
401
|
+
current_supply: Int "current_supply" // smaller or equal to supply_after_last_mint
|
|
402
|
+
supply_after_last_mint: Int "supply_after_last_mint"
|
|
403
|
+
transfer_id_before_last_mint: ByteArray "transfer_id_before_last_mint" // this is hash, because it might contain data that shouldn't be public
|
|
434
404
|
|
|
435
|
-
type: String "type" // eg.
|
|
405
|
+
type: String "type" // eg. CardanoWallet or Private
|
|
436
406
|
account: ByteArray "account" // if type==Private -> this is a hash of the actual account type + address
|
|
437
407
|
|
|
438
408
|
name: String "name"
|
|
@@ -462,17 +432,19 @@ enum Metadata {
|
|
|
462
432
|
}
|
|
463
433
|
|
|
464
434
|
struct Redeemer {
|
|
465
|
-
|
|
435
|
+
total_reserves: Real // usually a USD value, 6 decimal places is enough
|
|
436
|
+
reserves_change: Real
|
|
437
|
+
latest_transfer_id: ByteArray
|
|
466
438
|
}
|
|
467
439
|
|
|
468
440
|
const SEED_ID = TxOutputId::new(TxId::new(#), 0)
|
|
469
441
|
const ORACLE_KEYS = []PubKeyHash{}
|
|
470
442
|
const INITIAL_PRICE: Real = 0.001 // 1000 USD per token -> 0.001 USD per microtoken
|
|
471
|
-
const TYPE = "
|
|
443
|
+
const TYPE = "Private"
|
|
472
444
|
const ACCOUNT = #
|
|
473
|
-
const TICKER = "
|
|
474
|
-
const NAME = "
|
|
475
|
-
const DESCRIPTION =
|
|
445
|
+
const TICKER = "USDT"
|
|
446
|
+
const NAME = TICKER + " RWA"
|
|
447
|
+
const DESCRIPTION = TICKER + " RWA operated by PBG"
|
|
476
448
|
const DECIMALS = 6
|
|
477
449
|
const URL = "https://www.pbg.io"
|
|
478
450
|
const LOGO = "https://assets.pbg.io/usdt_bridge.png"
|
|
@@ -507,7 +479,10 @@ func validate_initialization() -> () {
|
|
|
507
479
|
|
|
508
480
|
assert(metadata == Metadata::Cip68{
|
|
509
481
|
State{
|
|
510
|
-
|
|
482
|
+
current_supply: 0,
|
|
483
|
+
supply_after_last_mint: 0,
|
|
484
|
+
transfer_id_before_last_mint: #,
|
|
485
|
+
|
|
511
486
|
type: TYPE,
|
|
512
487
|
account: ACCOUNT,
|
|
513
488
|
|
|
@@ -531,6 +506,21 @@ func signed_by_quorum() -> Bool {
|
|
|
531
506
|
n_signers > (ORACLE_KEYS.length/2)
|
|
532
507
|
}
|
|
533
508
|
|
|
509
|
+
func calc_token_price(R: Real, Delta: Real, current_supply: Int, supply_after_last_mint: Int) -> Real {
|
|
510
|
+
if (current_supply == 0 || supply_after_last_mint == 0) {
|
|
511
|
+
INITIAL_PRICE
|
|
512
|
+
} else {
|
|
513
|
+
p_last = (R - Delta)/supply_after_last_mint
|
|
514
|
+
p_curr = R / current_supply
|
|
515
|
+
|
|
516
|
+
if (p_last < p_curr) {
|
|
517
|
+
p_last
|
|
518
|
+
} else {
|
|
519
|
+
p_curr
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
534
524
|
func validate_state_change(redeemer: Redeemer, input: TxInput) -> () {
|
|
535
525
|
state0 = input.datum.inline.as[Metadata].state()
|
|
536
526
|
|
|
@@ -548,16 +538,23 @@ func validate_state_change(redeemer: Redeemer, input: TxInput) -> () {
|
|
|
548
538
|
assert(state1.decimals == state0.decimals, "metadata decimals not constant")
|
|
549
539
|
|
|
550
540
|
n = tx.minted.get_safe(user_token_asset_class)
|
|
551
|
-
N0 = state0.
|
|
552
|
-
N1 = state1.
|
|
541
|
+
N0 = state0.current_supply
|
|
542
|
+
N1 = state1.current_supply
|
|
553
543
|
|
|
554
544
|
assert((N1 - N0) == n, "current token supply not updated correctly")
|
|
555
545
|
|
|
556
546
|
if (n > 0) {
|
|
557
|
-
Redeemer{R} = redeemer
|
|
547
|
+
Redeemer{R, Delta, latest_transfer_id} = redeemer
|
|
558
548
|
|
|
559
|
-
|
|
549
|
+
p = calc_token_price(R, Delta, N0, state0.supply_after_last_mint)
|
|
550
|
+
|
|
551
|
+
assert(N1*p <= R, "too many tokens minted")
|
|
552
|
+
assert(state1.transfer_id_before_last_mint == latest_transfer_id, "transfer_id_before_last_mint not updated correctly")
|
|
553
|
+
assert(state1.supply_after_last_mint == N1, "supply_after_last_mint not updated correctly")
|
|
560
554
|
assert(signed_by_quorum(), "not signed by simple quorum of oracles")
|
|
555
|
+
} else {
|
|
556
|
+
assert(state1.supply_after_last_mint == state0.supply_after_last_mint, "supply_after_last_mint can't change during burn")
|
|
557
|
+
assert(state1.transfer_id_before_last_mint == state0.transfer_id_before_last_mint, "transfer_id_before_last_mint can't change during burn")
|
|
561
558
|
}
|
|
562
559
|
}
|
|
563
560
|
|
|
@@ -607,18 +604,18 @@ func main(args: MixedArgs) -> () {
|
|
|
607
604
|
}
|
|
608
605
|
}`,
|
|
609
606
|
$dependencies: [],
|
|
610
|
-
$hashDependencies: [
|
|
611
|
-
$dependsOnOwnHash:
|
|
607
|
+
$hashDependencies: [],
|
|
608
|
+
$dependsOnOwnHash: true,
|
|
612
609
|
$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
610
|
$Datum: (config) => makeCast({ "kind": "internal", "name": "Data" }, config),
|
|
614
611
|
$types: {
|
|
615
|
-
State: (config) => makeCast({ "kind": "struct", "format": "map", "id": "
|
|
616
|
-
Cip68Extra: (config) => makeCast({ "kind": "enum", "name": "Cip68Extra", "id": "
|
|
617
|
-
Metadata: (config) => makeCast({ "kind": "enum", "name": "Metadata", "id": "
|
|
618
|
-
Redeemer: (config) => makeCast({ "kind": "struct", "format": "
|
|
612
|
+
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),
|
|
613
|
+
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),
|
|
614
|
+
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),
|
|
615
|
+
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)
|
|
619
616
|
},
|
|
620
617
|
$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": "
|
|
618
|
+
"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 }),
|
|
622
619
|
"SEED_ID": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "SEED_ID", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "TxOutputId" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
623
620
|
"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
621
|
"INITIAL_PRICE": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "INITIAL_PRICE", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "Real" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
@@ -640,7 +637,8 @@ func main(args: MixedArgs) -> () {
|
|
|
640
637
|
"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
638
|
"validate_initialization": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "validate_initialization", "requiresCurrentScript": false, "requiresScriptContext": true, "arguments": [] }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
642
639
|
"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
|
-
"
|
|
640
|
+
"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 }),
|
|
641
|
+
"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 }),
|
|
644
642
|
"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
643
|
}
|
|
646
644
|
};
|
|
@@ -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
|
|
6
|
-
$name: "
|
|
5
|
+
export declare const one_to_one_asset: {
|
|
6
|
+
$name: "one_to_one_asset";
|
|
7
7
|
$purpose: "mixed";
|
|
8
|
-
$currentScriptIndex:
|
|
8
|
+
$currentScriptIndex: 0;
|
|
9
9
|
$sourceCode: string;
|
|
10
10
|
$dependencies: readonly [];
|
|
11
11
|
$hashDependencies: never[];
|
|
@@ -30,9 +30,7 @@ export declare const tokenized_account: {
|
|
|
30
30
|
$Datum: (config: CastConfig) => Cast<UplcData, UplcData>;
|
|
31
31
|
$types: {
|
|
32
32
|
State: (config: CastConfig) => Cast<{
|
|
33
|
-
|
|
34
|
-
supply_after_last_mint: bigint;
|
|
35
|
-
transfer_id_before_last_mint: number[];
|
|
33
|
+
supply: bigint;
|
|
36
34
|
type: string;
|
|
37
35
|
account: number[];
|
|
38
36
|
name: string;
|
|
@@ -42,9 +40,7 @@ export declare const tokenized_account: {
|
|
|
42
40
|
url: string;
|
|
43
41
|
logo: string;
|
|
44
42
|
}, {
|
|
45
|
-
|
|
46
|
-
supply_after_last_mint: IntLike;
|
|
47
|
-
transfer_id_before_last_mint: number[];
|
|
43
|
+
supply: IntLike;
|
|
48
44
|
type: string;
|
|
49
45
|
account: number[];
|
|
50
46
|
name: string;
|
|
@@ -62,9 +58,7 @@ export declare const tokenized_account: {
|
|
|
62
58
|
Metadata: (config: CastConfig) => Cast<{
|
|
63
59
|
Cip68: {
|
|
64
60
|
state: {
|
|
65
|
-
|
|
66
|
-
supply_after_last_mint: bigint;
|
|
67
|
-
transfer_id_before_last_mint: number[];
|
|
61
|
+
supply: bigint;
|
|
68
62
|
type: string;
|
|
69
63
|
account: number[];
|
|
70
64
|
name: string;
|
|
@@ -82,9 +76,7 @@ export declare const tokenized_account: {
|
|
|
82
76
|
}, {
|
|
83
77
|
Cip68: {
|
|
84
78
|
state: {
|
|
85
|
-
|
|
86
|
-
supply_after_last_mint: IntLike;
|
|
87
|
-
transfer_id_before_last_mint: number[];
|
|
79
|
+
supply: IntLike;
|
|
88
80
|
type: string;
|
|
89
81
|
account: number[];
|
|
90
82
|
name: string;
|
|
@@ -101,13 +93,9 @@ export declare const tokenized_account: {
|
|
|
101
93
|
};
|
|
102
94
|
}>;
|
|
103
95
|
Redeemer: (config: CastConfig) => Cast<{
|
|
104
|
-
|
|
105
|
-
reserves_change: number;
|
|
106
|
-
latest_transfer_id: number[];
|
|
96
|
+
reserves: bigint;
|
|
107
97
|
}, {
|
|
108
|
-
|
|
109
|
-
reserves_change: number;
|
|
110
|
-
latest_transfer_id: number[];
|
|
98
|
+
reserves: IntLike;
|
|
111
99
|
}>;
|
|
112
100
|
};
|
|
113
101
|
$functions: {
|
|
@@ -115,9 +103,7 @@ export declare const tokenized_account: {
|
|
|
115
103
|
self: {
|
|
116
104
|
Cip68: {
|
|
117
105
|
state: {
|
|
118
|
-
|
|
119
|
-
supply_after_last_mint: IntLike;
|
|
120
|
-
transfer_id_before_last_mint: number[];
|
|
106
|
+
supply: IntLike;
|
|
121
107
|
type: string;
|
|
122
108
|
account: number[];
|
|
123
109
|
name: string;
|
|
@@ -134,9 +120,7 @@ export declare const tokenized_account: {
|
|
|
134
120
|
};
|
|
135
121
|
};
|
|
136
122
|
}, {
|
|
137
|
-
|
|
138
|
-
supply_after_last_mint: bigint;
|
|
139
|
-
transfer_id_before_last_mint: number[];
|
|
123
|
+
supply: bigint;
|
|
140
124
|
type: string;
|
|
141
125
|
account: number[];
|
|
142
126
|
name: string;
|
|
@@ -148,7 +132,6 @@ export declare const tokenized_account: {
|
|
|
148
132
|
}>;
|
|
149
133
|
SEED_ID: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, TxOutputId>;
|
|
150
134
|
ORACLE_KEYS: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, PubKeyHash[]>;
|
|
151
|
-
INITIAL_PRICE: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, number>;
|
|
152
135
|
TYPE: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
|
|
153
136
|
ACCOUNT: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, number[]>;
|
|
154
137
|
TICKER: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
|
|
@@ -171,18 +154,10 @@ export declare const tokenized_account: {
|
|
|
171
154
|
signed_by_quorum: (uplc: UplcProgram, config: CastConfig) => UserFunc<{
|
|
172
155
|
$scriptContext: UplcData;
|
|
173
156
|
}, boolean>;
|
|
174
|
-
calc_token_price: (uplc: UplcProgram, config: CastConfig) => UserFunc<{
|
|
175
|
-
R: number;
|
|
176
|
-
Delta: number;
|
|
177
|
-
current_supply: IntLike;
|
|
178
|
-
supply_after_last_mint: IntLike;
|
|
179
|
-
}, number>;
|
|
180
157
|
validate_state_change: (uplc: UplcProgram, config: CastConfig) => UserFunc<{
|
|
181
158
|
$scriptContext: UplcData;
|
|
182
159
|
redeemer: {
|
|
183
|
-
|
|
184
|
-
reserves_change: number;
|
|
185
|
-
latest_transfer_id: number[];
|
|
160
|
+
reserves: IntLike;
|
|
186
161
|
};
|
|
187
162
|
input: TxInput;
|
|
188
163
|
}, void>;
|
|
@@ -201,211 +176,13 @@ export declare const tokenized_account: {
|
|
|
201
176
|
}, void>;
|
|
202
177
|
};
|
|
203
178
|
};
|
|
204
|
-
export declare const
|
|
205
|
-
$name: "
|
|
179
|
+
export declare const tokenized_account: {
|
|
180
|
+
$name: "tokenized_account";
|
|
206
181
|
$purpose: "mixed";
|
|
207
|
-
$currentScriptIndex:
|
|
182
|
+
$currentScriptIndex: 1;
|
|
208
183
|
$sourceCode: string;
|
|
209
184
|
$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
|
-
}[];
|
|
185
|
+
$hashDependencies: never[];
|
|
409
186
|
$dependsOnOwnHash: boolean;
|
|
410
187
|
$Redeemer: (config: CastConfig) => Cast<{
|
|
411
188
|
Other: {
|
|
@@ -427,7 +204,9 @@ export declare const one_to_one_asset: {
|
|
|
427
204
|
$Datum: (config: CastConfig) => Cast<UplcData, UplcData>;
|
|
428
205
|
$types: {
|
|
429
206
|
State: (config: CastConfig) => Cast<{
|
|
430
|
-
|
|
207
|
+
current_supply: bigint;
|
|
208
|
+
supply_after_last_mint: bigint;
|
|
209
|
+
transfer_id_before_last_mint: number[];
|
|
431
210
|
type: string;
|
|
432
211
|
account: number[];
|
|
433
212
|
name: string;
|
|
@@ -437,7 +216,9 @@ export declare const one_to_one_asset: {
|
|
|
437
216
|
url: string;
|
|
438
217
|
logo: string;
|
|
439
218
|
}, {
|
|
440
|
-
|
|
219
|
+
current_supply: IntLike;
|
|
220
|
+
supply_after_last_mint: IntLike;
|
|
221
|
+
transfer_id_before_last_mint: number[];
|
|
441
222
|
type: string;
|
|
442
223
|
account: number[];
|
|
443
224
|
name: string;
|
|
@@ -455,7 +236,9 @@ export declare const one_to_one_asset: {
|
|
|
455
236
|
Metadata: (config: CastConfig) => Cast<{
|
|
456
237
|
Cip68: {
|
|
457
238
|
state: {
|
|
458
|
-
|
|
239
|
+
current_supply: bigint;
|
|
240
|
+
supply_after_last_mint: bigint;
|
|
241
|
+
transfer_id_before_last_mint: number[];
|
|
459
242
|
type: string;
|
|
460
243
|
account: number[];
|
|
461
244
|
name: string;
|
|
@@ -473,7 +256,9 @@ export declare const one_to_one_asset: {
|
|
|
473
256
|
}, {
|
|
474
257
|
Cip68: {
|
|
475
258
|
state: {
|
|
476
|
-
|
|
259
|
+
current_supply: IntLike;
|
|
260
|
+
supply_after_last_mint: IntLike;
|
|
261
|
+
transfer_id_before_last_mint: number[];
|
|
477
262
|
type: string;
|
|
478
263
|
account: number[];
|
|
479
264
|
name: string;
|
|
@@ -490,9 +275,13 @@ export declare const one_to_one_asset: {
|
|
|
490
275
|
};
|
|
491
276
|
}>;
|
|
492
277
|
Redeemer: (config: CastConfig) => Cast<{
|
|
493
|
-
|
|
278
|
+
total_reserves: number;
|
|
279
|
+
reserves_change: number;
|
|
280
|
+
latest_transfer_id: number[];
|
|
494
281
|
}, {
|
|
495
|
-
|
|
282
|
+
total_reserves: number;
|
|
283
|
+
reserves_change: number;
|
|
284
|
+
latest_transfer_id: number[];
|
|
496
285
|
}>;
|
|
497
286
|
};
|
|
498
287
|
$functions: {
|
|
@@ -500,7 +289,9 @@ export declare const one_to_one_asset: {
|
|
|
500
289
|
self: {
|
|
501
290
|
Cip68: {
|
|
502
291
|
state: {
|
|
503
|
-
|
|
292
|
+
current_supply: IntLike;
|
|
293
|
+
supply_after_last_mint: IntLike;
|
|
294
|
+
transfer_id_before_last_mint: number[];
|
|
504
295
|
type: string;
|
|
505
296
|
account: number[];
|
|
506
297
|
name: string;
|
|
@@ -517,7 +308,9 @@ export declare const one_to_one_asset: {
|
|
|
517
308
|
};
|
|
518
309
|
};
|
|
519
310
|
}, {
|
|
520
|
-
|
|
311
|
+
current_supply: bigint;
|
|
312
|
+
supply_after_last_mint: bigint;
|
|
313
|
+
transfer_id_before_last_mint: number[];
|
|
521
314
|
type: string;
|
|
522
315
|
account: number[];
|
|
523
316
|
name: string;
|
|
@@ -552,10 +345,18 @@ export declare const one_to_one_asset: {
|
|
|
552
345
|
signed_by_quorum: (uplc: UplcProgram, config: CastConfig) => UserFunc<{
|
|
553
346
|
$scriptContext: UplcData;
|
|
554
347
|
}, boolean>;
|
|
348
|
+
calc_token_price: (uplc: UplcProgram, config: CastConfig) => UserFunc<{
|
|
349
|
+
R: number;
|
|
350
|
+
Delta: number;
|
|
351
|
+
current_supply: IntLike;
|
|
352
|
+
supply_after_last_mint: IntLike;
|
|
353
|
+
}, number>;
|
|
555
354
|
validate_state_change: (uplc: UplcProgram, config: CastConfig) => UserFunc<{
|
|
556
355
|
$scriptContext: UplcData;
|
|
557
356
|
redeemer: {
|
|
558
|
-
|
|
357
|
+
total_reserves: number;
|
|
358
|
+
reserves_change: number;
|
|
359
|
+
latest_transfer_id: number[];
|
|
559
360
|
};
|
|
560
361
|
input: TxInput;
|
|
561
362
|
}, void>;
|