@pbgtoken/rwa-contract 1.0.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +147 -118
- package/dist/validators/index.d.ts +149 -66
- package/package.json +1 -1
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 {
|
|
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,18 +168,20 @@ 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 account_aggregate = {
|
|
172
|
+
$name: "account_aggregate",
|
|
173
173
|
$purpose: "mixed",
|
|
174
174
|
$currentScriptIndex: 0,
|
|
175
|
-
$sourceCode: `mixed
|
|
175
|
+
$sourceCode: `mixed account_aggregate
|
|
176
176
|
|
|
177
177
|
import { get_current_input, tx } from ScriptContext
|
|
178
178
|
|
|
179
179
|
struct State {
|
|
180
|
-
|
|
180
|
+
current_supply: Int "current_supply" // smaller or equal to supply_after_last_mint
|
|
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
|
|
181
183
|
|
|
182
|
-
type: String "type" // eg.
|
|
184
|
+
type: String "type" // eg. CardanoWallet or Private
|
|
183
185
|
account: ByteArray "account" // if type==Private -> this is a hash of the actual account type + address
|
|
184
186
|
|
|
185
187
|
name: String "name"
|
|
@@ -209,17 +211,20 @@ enum Metadata {
|
|
|
209
211
|
}
|
|
210
212
|
|
|
211
213
|
struct Redeemer {
|
|
212
|
-
|
|
214
|
+
total_reserves: Real // usually a USD value, 6 decimal places is enough
|
|
215
|
+
reserves_change: Real
|
|
216
|
+
latest_transfer_id: ByteArray
|
|
213
217
|
}
|
|
214
218
|
|
|
215
219
|
const SEED_ID = TxOutputId::new(TxId::new(#), 0)
|
|
216
220
|
const ORACLE_KEYS = []PubKeyHash{}
|
|
217
|
-
const
|
|
221
|
+
const INITIAL_PRICE: Real = 0.001 // 1000 USD per token -> 0.001 USD per microtoken
|
|
222
|
+
const TYPE = "Private"
|
|
218
223
|
const ACCOUNT = #
|
|
219
|
-
const TICKER = "
|
|
220
|
-
const NAME = "
|
|
221
|
-
const DESCRIPTION =
|
|
222
|
-
const DECIMALS =
|
|
224
|
+
const TICKER = "USDT"
|
|
225
|
+
const NAME = TICKER + " RWA"
|
|
226
|
+
const DESCRIPTION = TICKER + " RWA operated by PBG"
|
|
227
|
+
const DECIMALS = 6
|
|
223
228
|
const URL = "https://www.pbg.io"
|
|
224
229
|
const LOGO = "https://assets.pbg.io/usdt_bridge.png"
|
|
225
230
|
|
|
@@ -227,7 +232,7 @@ const ticker_bytes = TICKER.encode_utf8()
|
|
|
227
232
|
const user_token_name = Cip67::fungible_token_label + ticker_bytes
|
|
228
233
|
const ref_token_name = Cip67::reference_token_label + ticker_bytes
|
|
229
234
|
|
|
230
|
-
const own_hash = Scripts::
|
|
235
|
+
const own_hash = Scripts::account_aggregate
|
|
231
236
|
const own_mph = MintingPolicyHash::from_script_hash(own_hash)
|
|
232
237
|
const own_address = Address::new(
|
|
233
238
|
SpendingCredential::new_validator(
|
|
@@ -253,7 +258,10 @@ func validate_initialization() -> () {
|
|
|
253
258
|
|
|
254
259
|
assert(metadata == Metadata::Cip68{
|
|
255
260
|
State{
|
|
256
|
-
|
|
261
|
+
current_supply: 0,
|
|
262
|
+
supply_after_last_mint: 0,
|
|
263
|
+
transfer_id_before_last_mint: #,
|
|
264
|
+
|
|
257
265
|
type: TYPE,
|
|
258
266
|
account: ACCOUNT,
|
|
259
267
|
|
|
@@ -277,6 +285,21 @@ func signed_by_quorum() -> Bool {
|
|
|
277
285
|
n_signers > (ORACLE_KEYS.length/2)
|
|
278
286
|
}
|
|
279
287
|
|
|
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
|
+
|
|
280
303
|
func validate_state_change(redeemer: Redeemer, input: TxInput) -> () {
|
|
281
304
|
state0 = input.datum.inline.as[Metadata].state()
|
|
282
305
|
|
|
@@ -294,16 +317,23 @@ func validate_state_change(redeemer: Redeemer, input: TxInput) -> () {
|
|
|
294
317
|
assert(state1.decimals == state0.decimals, "metadata decimals not constant")
|
|
295
318
|
|
|
296
319
|
n = tx.minted.get_safe(user_token_asset_class)
|
|
297
|
-
N0 = state0.
|
|
298
|
-
N1 = state1.
|
|
320
|
+
N0 = state0.current_supply
|
|
321
|
+
N1 = state1.current_supply
|
|
299
322
|
|
|
300
323
|
assert((N1 - N0) == n, "current token supply not updated correctly")
|
|
301
324
|
|
|
302
325
|
if (n > 0) {
|
|
303
|
-
Redeemer{R} = redeemer
|
|
326
|
+
Redeemer{R, Delta, latest_transfer_id} = redeemer
|
|
304
327
|
|
|
305
|
-
|
|
328
|
+
p = calc_token_price(R, Delta, N0, state0.supply_after_last_mint)
|
|
329
|
+
|
|
330
|
+
assert(N1*p <= R, "too many tokens minted")
|
|
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")
|
|
306
333
|
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")
|
|
307
337
|
}
|
|
308
338
|
}
|
|
309
339
|
|
|
@@ -358,15 +388,16 @@ func main(args: MixedArgs) -> () {
|
|
|
358
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),
|
|
359
389
|
$Datum: (config) => makeCast({ "kind": "internal", "name": "Data" }, config),
|
|
360
390
|
$types: {
|
|
361
|
-
State: (config) => makeCast({ "kind": "struct", "format": "map", "id": "
|
|
362
|
-
Cip68Extra: (config) => makeCast({ "kind": "enum", "name": "Cip68Extra", "id": "
|
|
363
|
-
Metadata: (config) => makeCast({ "kind": "enum", "name": "Metadata", "id": "
|
|
364
|
-
Redeemer: (config) => makeCast({ "kind": "struct", "format": "
|
|
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)
|
|
365
395
|
},
|
|
366
396
|
$functions: {
|
|
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": "
|
|
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 }),
|
|
368
398
|
"SEED_ID": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "SEED_ID", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "TxOutputId" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
369
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
|
+
"INITIAL_PRICE": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "INITIAL_PRICE", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "Real" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
370
401
|
"TYPE": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "TYPE", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
371
402
|
"ACCOUNT": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "ACCOUNT", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "ByteArray" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
372
403
|
"TICKER": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "TICKER", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
@@ -385,32 +416,37 @@ func main(args: MixedArgs) -> () {
|
|
|
385
416
|
"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 }),
|
|
386
417
|
"validate_initialization": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "validate_initialization", "requiresCurrentScript": false, "requiresScriptContext": true, "arguments": [] }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
387
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 }),
|
|
388
|
-
"
|
|
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__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 }),
|
|
389
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 })
|
|
390
422
|
}
|
|
391
423
|
};
|
|
392
|
-
var
|
|
393
|
-
$name: "
|
|
424
|
+
var wrapped_asset = {
|
|
425
|
+
$name: "wrapped_asset",
|
|
394
426
|
$purpose: "mixed",
|
|
395
427
|
$currentScriptIndex: 1,
|
|
396
|
-
$sourceCode: `mixed
|
|
428
|
+
$sourceCode: `mixed wrapped_asset
|
|
397
429
|
|
|
398
430
|
import { get_current_input, tx } from ScriptContext
|
|
399
431
|
|
|
400
432
|
struct State {
|
|
401
|
-
|
|
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
|
|
433
|
+
supply: Int "supply"
|
|
404
434
|
|
|
405
|
-
type: String
|
|
406
|
-
|
|
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
|
|
407
439
|
|
|
440
|
+
ticker: String "ticker" // can't change
|
|
408
441
|
name: String "name"
|
|
409
442
|
description: String "description"
|
|
410
443
|
decimals: Int "decimals" // can't change
|
|
411
|
-
ticker: String "ticker" // can't change
|
|
412
444
|
url: String "url"
|
|
413
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
|
|
414
450
|
}
|
|
415
451
|
|
|
416
452
|
enum Cip68Extra {
|
|
@@ -429,31 +465,42 @@ enum Metadata {
|
|
|
429
465
|
x: Cip68 => x.state
|
|
430
466
|
}
|
|
431
467
|
}
|
|
468
|
+
|
|
469
|
+
func version(self) -> Int {
|
|
470
|
+
self.switch{
|
|
471
|
+
x: Cip68 => x.version
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
func extra(self) -> Cip68Extra {
|
|
476
|
+
self.switch{
|
|
477
|
+
x: Cip68 => x.extra
|
|
478
|
+
}
|
|
479
|
+
}
|
|
432
480
|
}
|
|
433
481
|
|
|
434
482
|
struct Redeemer {
|
|
435
|
-
|
|
436
|
-
reserves_change: Real
|
|
437
|
-
latest_transfer_id: ByteArray
|
|
483
|
+
reserves: Int
|
|
438
484
|
}
|
|
439
485
|
|
|
440
|
-
const
|
|
441
|
-
const
|
|
442
|
-
const
|
|
443
|
-
const
|
|
444
|
-
const ACCOUNT
|
|
445
|
-
|
|
446
|
-
const
|
|
447
|
-
const
|
|
448
|
-
|
|
449
|
-
const
|
|
450
|
-
const
|
|
486
|
+
// TODO: ability to leave const params unset during hl2ts transpilation
|
|
487
|
+
const TYPE = "WrappedAsset"
|
|
488
|
+
const VENUE = "VENUE"
|
|
489
|
+
const POLICY = "POLICY"
|
|
490
|
+
const ACCOUNT = "ACCOUNT"
|
|
491
|
+
|
|
492
|
+
const TICKER = "TICKER"
|
|
493
|
+
const DECIMALS = 0
|
|
494
|
+
|
|
495
|
+
const ORACLES = []PubKeyHash{}
|
|
496
|
+
const QUORUM = (ORACLES.length + 1)/2
|
|
497
|
+
const SEED = TxOutputId::new(TxId::new(#), 0)
|
|
451
498
|
|
|
452
499
|
const ticker_bytes = TICKER.encode_utf8()
|
|
453
500
|
const user_token_name = Cip67::fungible_token_label + ticker_bytes
|
|
454
501
|
const ref_token_name = Cip67::reference_token_label + ticker_bytes
|
|
455
502
|
|
|
456
|
-
const own_hash = Scripts::
|
|
503
|
+
const own_hash = Scripts::wrapped_asset
|
|
457
504
|
const own_mph = MintingPolicyHash::from_script_hash(own_hash)
|
|
458
505
|
const own_address = Address::new(
|
|
459
506
|
SpendingCredential::new_validator(
|
|
@@ -467,8 +514,8 @@ const user_token_asset_class = AssetClass::new(own_mph, user_token_name)
|
|
|
467
514
|
|
|
468
515
|
func validate_initialization() -> () {
|
|
469
516
|
assert(tx.inputs.any((input: TxInput) -> {
|
|
470
|
-
input.output_id ==
|
|
471
|
-
}), "seed
|
|
517
|
+
input.output_id == SEED
|
|
518
|
+
}), "seed not spent")
|
|
472
519
|
|
|
473
520
|
ref_utxo = tx.outputs.find((output: TxOutput) -> {
|
|
474
521
|
output.address == own_address
|
|
@@ -476,49 +523,32 @@ func validate_initialization() -> () {
|
|
|
476
523
|
})
|
|
477
524
|
|
|
478
525
|
metadata = ref_utxo.datum.inline.as_strictly[Metadata]
|
|
526
|
+
state = metadata.state()
|
|
479
527
|
|
|
480
|
-
assert(metadata == Metadata::Cip68{
|
|
481
|
-
State{
|
|
482
|
-
current_supply: 0,
|
|
483
|
-
supply_after_last_mint: 0,
|
|
484
|
-
transfer_id_before_last_mint: #,
|
|
485
528
|
|
|
486
|
-
|
|
487
|
-
account: ACCOUNT,
|
|
529
|
+
assert(state.supply == 0, "supply not initialized at 0")
|
|
488
530
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
531
|
+
assert(state.type == TYPE, "unexpected type")
|
|
532
|
+
assert(state.venue == VENUE, "unexpected venue")
|
|
533
|
+
assert(state.policy == POLICY, "unexpected policy")
|
|
534
|
+
assert(state.account == ACCOUNT, "unexpected account")
|
|
535
|
+
|
|
536
|
+
assert(state.ticker == TICKER, "unexpected ticker")
|
|
537
|
+
assert(state.decimals == DECIMALS, "unexpected decimals")
|
|
538
|
+
|
|
539
|
+
assert(state.quorum == QUORUM, "unexpected quorum")
|
|
540
|
+
assert(state.seed == SEED, "unexpected seed")
|
|
541
|
+
|
|
542
|
+
assert(metadata.version() == 1, "unexpected metadata version")
|
|
543
|
+
assert(metadata.extra() == Cip68Extra::Unused, "unexpected metadata extra values")
|
|
499
544
|
}
|
|
500
545
|
|
|
501
546
|
func signed_by_quorum() -> Bool {
|
|
502
|
-
n_signers =
|
|
547
|
+
n_signers = ORACLES.fold((n_signers: Int, key: PubKeyHash) -> {
|
|
503
548
|
n_signers + tx.is_signed_by(key).to_int()
|
|
504
549
|
}, 0)
|
|
505
550
|
|
|
506
|
-
n_signers
|
|
507
|
-
}
|
|
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
|
-
}
|
|
551
|
+
n_signers >= QUORUM
|
|
522
552
|
}
|
|
523
553
|
|
|
524
554
|
func validate_state_change(redeemer: Redeemer, input: TxInput) -> () {
|
|
@@ -532,29 +562,29 @@ func validate_state_change(redeemer: Redeemer, input: TxInput) -> () {
|
|
|
532
562
|
state1 = output.datum.inline.as_strictly[Metadata].state()
|
|
533
563
|
|
|
534
564
|
// ensure constant metadata fields don't change
|
|
535
|
-
assert(state1.type ==
|
|
536
|
-
assert(state1.
|
|
537
|
-
assert(state1.
|
|
538
|
-
assert(state1.
|
|
565
|
+
assert(state1.type == TYPE, "type changed")
|
|
566
|
+
assert(state1.venue == state0.venue, "venue changed")
|
|
567
|
+
assert(state1.policy == state0.policy, "policy changed")
|
|
568
|
+
assert(state1.account == state0.account, "account changed")
|
|
569
|
+
|
|
570
|
+
assert(state1.ticker == state0.ticker, "ticker changed")
|
|
571
|
+
assert(state1.decimals == state0.decimals, "decimals changed")
|
|
572
|
+
|
|
573
|
+
assert(state1.quorum == QUORUM, "quorum changed")
|
|
574
|
+
assert(state1.oracles == ORACLES, "oracles changed")
|
|
575
|
+
assert(state1.seed == SEED, "seed changed")
|
|
539
576
|
|
|
540
577
|
n = tx.minted.get_safe(user_token_asset_class)
|
|
541
|
-
N0 = state0.
|
|
542
|
-
N1 = state1.
|
|
578
|
+
N0 = state0.supply
|
|
579
|
+
N1 = state1.supply
|
|
543
580
|
|
|
544
581
|
assert((N1 - N0) == n, "current token supply not updated correctly")
|
|
545
582
|
|
|
546
583
|
if (n > 0) {
|
|
547
|
-
Redeemer{R
|
|
548
|
-
|
|
549
|
-
p = calc_token_price(R, Delta, N0, state0.supply_after_last_mint)
|
|
584
|
+
Redeemer{R} = redeemer
|
|
550
585
|
|
|
551
|
-
assert(N1
|
|
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")
|
|
586
|
+
assert(N1 <= R, "too many tokens minted")
|
|
554
587
|
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")
|
|
558
588
|
}
|
|
559
589
|
}
|
|
560
590
|
|
|
@@ -609,24 +639,24 @@ func main(args: MixedArgs) -> () {
|
|
|
609
639
|
$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),
|
|
610
640
|
$Datum: (config) => makeCast({ "kind": "internal", "name": "Data" }, config),
|
|
611
641
|
$types: {
|
|
612
|
-
State: (config) => makeCast({ "kind": "struct", "format": "map", "id": "
|
|
613
|
-
Cip68Extra: (config) => makeCast({ "kind": "enum", "name": "Cip68Extra", "id": "
|
|
614
|
-
Metadata: (config) => makeCast({ "kind": "enum", "name": "Metadata", "id": "
|
|
615
|
-
Redeemer: (config) => makeCast({ "kind": "struct", "format": "
|
|
642
|
+
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),
|
|
643
|
+
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),
|
|
644
|
+
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),
|
|
645
|
+
Redeemer: (config) => makeCast({ "kind": "struct", "format": "singleton", "id": "__module__wrapped_asset__Redeemer[]", "name": "Redeemer", "fieldTypes": [{ "name": "reserves", "type": { "kind": "internal", "name": "Int" } }] }, config)
|
|
616
646
|
},
|
|
617
647
|
$functions: {
|
|
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": "
|
|
619
|
-
"
|
|
620
|
-
"
|
|
621
|
-
"INITIAL_PRICE": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "INITIAL_PRICE", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "Real" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
648
|
+
"Metadata::state": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "Metadata::state", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [{ "name": "self", "isOptional": false, "type": { "kind": "enum", "name": "Metadata", "id": "__module__wrapped_asset__Metadata[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__wrapped_asset__Metadata[]__Cip68", "name": "Cip68", "fieldTypes": [{ "name": "state", "type": { "kind": "struct", "format": "map", "id": "__module__wrapped_asset__State[]", "name": "State", "fieldTypes": [{ "name": "supply", "type": { "kind": "internal", "name": "Int" }, "key": "supply" }, { "name": "type", "type": { "kind": "internal", "name": "String" }, "key": "type" }, { "name": "venue", "type": { "kind": "internal", "name": "String" }, "key": "venue" }, { "name": "policy", "type": { "kind": "internal", "name": "String" }, "key": "policy" }, { "name": "account", "type": { "kind": "internal", "name": "String" }, "key": "account" }, { "name": "ticker", "type": { "kind": "internal", "name": "String" }, "key": "ticker" }, { "name": "name", "type": { "kind": "internal", "name": "String" }, "key": "name" }, { "name": "description", "type": { "kind": "internal", "name": "String" }, "key": "description" }, { "name": "decimals", "type": { "kind": "internal", "name": "Int" }, "key": "decimals" }, { "name": "url", "type": { "kind": "internal", "name": "String" }, "key": "url" }, { "name": "logo", "type": { "kind": "internal", "name": "String" }, "key": "logo" }, { "name": "quorum", "type": { "kind": "internal", "name": "Int" }, "key": "quorum" }, { "name": "oracles", "type": { "kind": "list", "itemType": { "kind": "internal", "name": "PubKeyHash" } }, "key": "oracles" }, { "name": "seed", "type": { "kind": "internal", "name": "TxOutputId" }, "key": "seed" }] } }, { "name": "version", "type": { "kind": "internal", "name": "Int" } }, { "name": "extra", "type": { "kind": "enum", "name": "Cip68Extra", "id": "__module__wrapped_asset__Cip68Extra[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__wrapped_asset__Cip68Extra[]__Unused", "name": "Unused", "fieldTypes": [] }] } }] }] } }], "returns": { "kind": "struct", "format": "map", "id": "__module__wrapped_asset__State[]", "name": "State", "fieldTypes": [{ "name": "supply", "type": { "kind": "internal", "name": "Int" }, "key": "supply" }, { "name": "type", "type": { "kind": "internal", "name": "String" }, "key": "type" }, { "name": "venue", "type": { "kind": "internal", "name": "String" }, "key": "venue" }, { "name": "policy", "type": { "kind": "internal", "name": "String" }, "key": "policy" }, { "name": "account", "type": { "kind": "internal", "name": "String" }, "key": "account" }, { "name": "ticker", "type": { "kind": "internal", "name": "String" }, "key": "ticker" }, { "name": "name", "type": { "kind": "internal", "name": "String" }, "key": "name" }, { "name": "description", "type": { "kind": "internal", "name": "String" }, "key": "description" }, { "name": "decimals", "type": { "kind": "internal", "name": "Int" }, "key": "decimals" }, { "name": "url", "type": { "kind": "internal", "name": "String" }, "key": "url" }, { "name": "logo", "type": { "kind": "internal", "name": "String" }, "key": "logo" }, { "name": "quorum", "type": { "kind": "internal", "name": "Int" }, "key": "quorum" }, { "name": "oracles", "type": { "kind": "list", "itemType": { "kind": "internal", "name": "PubKeyHash" } }, "key": "oracles" }, { "name": "seed", "type": { "kind": "internal", "name": "TxOutputId" }, "key": "seed" }] } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
649
|
+
"Metadata::version": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "Metadata::version", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [{ "name": "self", "isOptional": false, "type": { "kind": "enum", "name": "Metadata", "id": "__module__wrapped_asset__Metadata[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__wrapped_asset__Metadata[]__Cip68", "name": "Cip68", "fieldTypes": [{ "name": "state", "type": { "kind": "struct", "format": "map", "id": "__module__wrapped_asset__State[]", "name": "State", "fieldTypes": [{ "name": "supply", "type": { "kind": "internal", "name": "Int" }, "key": "supply" }, { "name": "type", "type": { "kind": "internal", "name": "String" }, "key": "type" }, { "name": "venue", "type": { "kind": "internal", "name": "String" }, "key": "venue" }, { "name": "policy", "type": { "kind": "internal", "name": "String" }, "key": "policy" }, { "name": "account", "type": { "kind": "internal", "name": "String" }, "key": "account" }, { "name": "ticker", "type": { "kind": "internal", "name": "String" }, "key": "ticker" }, { "name": "name", "type": { "kind": "internal", "name": "String" }, "key": "name" }, { "name": "description", "type": { "kind": "internal", "name": "String" }, "key": "description" }, { "name": "decimals", "type": { "kind": "internal", "name": "Int" }, "key": "decimals" }, { "name": "url", "type": { "kind": "internal", "name": "String" }, "key": "url" }, { "name": "logo", "type": { "kind": "internal", "name": "String" }, "key": "logo" }, { "name": "quorum", "type": { "kind": "internal", "name": "Int" }, "key": "quorum" }, { "name": "oracles", "type": { "kind": "list", "itemType": { "kind": "internal", "name": "PubKeyHash" } }, "key": "oracles" }, { "name": "seed", "type": { "kind": "internal", "name": "TxOutputId" }, "key": "seed" }] } }, { "name": "version", "type": { "kind": "internal", "name": "Int" } }, { "name": "extra", "type": { "kind": "enum", "name": "Cip68Extra", "id": "__module__wrapped_asset__Cip68Extra[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__wrapped_asset__Cip68Extra[]__Unused", "name": "Unused", "fieldTypes": [] }] } }] }] } }], "returns": { "kind": "internal", "name": "Int" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
650
|
+
"Metadata::extra": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "Metadata::extra", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [{ "name": "self", "isOptional": false, "type": { "kind": "enum", "name": "Metadata", "id": "__module__wrapped_asset__Metadata[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__wrapped_asset__Metadata[]__Cip68", "name": "Cip68", "fieldTypes": [{ "name": "state", "type": { "kind": "struct", "format": "map", "id": "__module__wrapped_asset__State[]", "name": "State", "fieldTypes": [{ "name": "supply", "type": { "kind": "internal", "name": "Int" }, "key": "supply" }, { "name": "type", "type": { "kind": "internal", "name": "String" }, "key": "type" }, { "name": "venue", "type": { "kind": "internal", "name": "String" }, "key": "venue" }, { "name": "policy", "type": { "kind": "internal", "name": "String" }, "key": "policy" }, { "name": "account", "type": { "kind": "internal", "name": "String" }, "key": "account" }, { "name": "ticker", "type": { "kind": "internal", "name": "String" }, "key": "ticker" }, { "name": "name", "type": { "kind": "internal", "name": "String" }, "key": "name" }, { "name": "description", "type": { "kind": "internal", "name": "String" }, "key": "description" }, { "name": "decimals", "type": { "kind": "internal", "name": "Int" }, "key": "decimals" }, { "name": "url", "type": { "kind": "internal", "name": "String" }, "key": "url" }, { "name": "logo", "type": { "kind": "internal", "name": "String" }, "key": "logo" }, { "name": "quorum", "type": { "kind": "internal", "name": "Int" }, "key": "quorum" }, { "name": "oracles", "type": { "kind": "list", "itemType": { "kind": "internal", "name": "PubKeyHash" } }, "key": "oracles" }, { "name": "seed", "type": { "kind": "internal", "name": "TxOutputId" }, "key": "seed" }] } }, { "name": "version", "type": { "kind": "internal", "name": "Int" } }, { "name": "extra", "type": { "kind": "enum", "name": "Cip68Extra", "id": "__module__wrapped_asset__Cip68Extra[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__wrapped_asset__Cip68Extra[]__Unused", "name": "Unused", "fieldTypes": [] }] } }] }] } }], "returns": { "kind": "enum", "name": "Cip68Extra", "id": "__module__wrapped_asset__Cip68Extra[]", "variantTypes": [{ "kind": "variant", "tag": 0, "id": "__module__wrapped_asset__Cip68Extra[]__Unused", "name": "Unused", "fieldTypes": [] }] } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
622
651
|
"TYPE": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "TYPE", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
623
|
-
"
|
|
652
|
+
"VENUE": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "VENUE", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
653
|
+
"POLICY": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "POLICY", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
654
|
+
"ACCOUNT": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "ACCOUNT", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
624
655
|
"TICKER": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "TICKER", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
625
|
-
"NAME": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "NAME", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
626
|
-
"DESCRIPTION": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "DESCRIPTION", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "String" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
627
656
|
"DECIMALS": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "DECIMALS", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "Int" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
628
|
-
"
|
|
629
|
-
"
|
|
657
|
+
"ORACLES": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "ORACLES", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "list", "itemType": { "kind": "internal", "name": "PubKeyHash" } } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
658
|
+
"QUORUM": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "QUORUM", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "Int" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
659
|
+
"SEED": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "SEED", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "TxOutputId" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
630
660
|
"ticker_bytes": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "ticker_bytes", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "ByteArray" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
631
661
|
"user_token_name": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "user_token_name", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "ByteArray" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
632
662
|
"ref_token_name": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "ref_token_name", "requiresCurrentScript": false, "requiresScriptContext": false, "arguments": [], "returns": { "kind": "internal", "name": "ByteArray" } }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
@@ -637,16 +667,15 @@ func main(args: MixedArgs) -> () {
|
|
|
637
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 }),
|
|
638
668
|
"validate_initialization": (uplc, config) => makeUserFunc(uplc, { ...{ "name": "validate_initialization", "requiresCurrentScript": false, "requiresScriptContext": true, "arguments": [] }, castConfig: config, validatorIndices: __validatorIndices }),
|
|
639
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 }),
|
|
640
|
-
"
|
|
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 }),
|
|
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 }),
|
|
642
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 })
|
|
643
672
|
}
|
|
644
673
|
};
|
|
645
|
-
var __validatorIndices = { "
|
|
674
|
+
var __validatorIndices = { "account_aggregate": 0, "wrapped_asset": 1 };
|
|
646
675
|
|
|
647
676
|
// src/RWADatumProvider.ts
|
|
648
|
-
var castMetadata =
|
|
649
|
-
var castDatum =
|
|
677
|
+
var castMetadata = account_aggregate.$types.Metadata;
|
|
678
|
+
var castDatum = account_aggregate.$types.State;
|
|
650
679
|
function makeRWADatumProvider(provider) {
|
|
651
680
|
return new RWADatumProviderImpl(provider);
|
|
652
681
|
}
|
|
@@ -1321,6 +1350,7 @@ function makeBSCAccountProvider(walletAddress, priceProvider, alchemyApiKey, tok
|
|
|
1321
1350
|
return new BSCAccountProvider(walletAddress, priceProvider, alchemyApiKey, tokenContractAddress, rpcUrl);
|
|
1322
1351
|
}
|
|
1323
1352
|
export {
|
|
1353
|
+
account_aggregate,
|
|
1324
1354
|
filterTransfersAfter,
|
|
1325
1355
|
makeBSCAccountProvider,
|
|
1326
1356
|
makeBinanceAccountProvider,
|
|
@@ -1329,6 +1359,5 @@ export {
|
|
|
1329
1359
|
makeCoinGeckoProvider,
|
|
1330
1360
|
makeEthereumERC20AccountProvider,
|
|
1331
1361
|
makeRWADatumProvider,
|
|
1332
|
-
|
|
1333
|
-
tokenized_account
|
|
1362
|
+
wrapped_asset
|
|
1334
1363
|
};
|
|
@@ -2,8 +2,8 @@ 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 account_aggregate: {
|
|
6
|
+
$name: "account_aggregate";
|
|
7
7
|
$purpose: "mixed";
|
|
8
8
|
$currentScriptIndex: 0;
|
|
9
9
|
$sourceCode: string;
|
|
@@ -30,7 +30,9 @@ export declare const one_to_one_asset: {
|
|
|
30
30
|
$Datum: (config: CastConfig) => Cast<UplcData, UplcData>;
|
|
31
31
|
$types: {
|
|
32
32
|
State: (config: CastConfig) => Cast<{
|
|
33
|
-
|
|
33
|
+
current_supply: bigint;
|
|
34
|
+
supply_after_last_mint: bigint;
|
|
35
|
+
transfer_id_before_last_mint: number[];
|
|
34
36
|
type: string;
|
|
35
37
|
account: number[];
|
|
36
38
|
name: string;
|
|
@@ -40,7 +42,9 @@ export declare const one_to_one_asset: {
|
|
|
40
42
|
url: string;
|
|
41
43
|
logo: string;
|
|
42
44
|
}, {
|
|
43
|
-
|
|
45
|
+
current_supply: IntLike;
|
|
46
|
+
supply_after_last_mint: IntLike;
|
|
47
|
+
transfer_id_before_last_mint: number[];
|
|
44
48
|
type: string;
|
|
45
49
|
account: number[];
|
|
46
50
|
name: string;
|
|
@@ -58,7 +62,9 @@ export declare const one_to_one_asset: {
|
|
|
58
62
|
Metadata: (config: CastConfig) => Cast<{
|
|
59
63
|
Cip68: {
|
|
60
64
|
state: {
|
|
61
|
-
|
|
65
|
+
current_supply: bigint;
|
|
66
|
+
supply_after_last_mint: bigint;
|
|
67
|
+
transfer_id_before_last_mint: number[];
|
|
62
68
|
type: string;
|
|
63
69
|
account: number[];
|
|
64
70
|
name: string;
|
|
@@ -76,7 +82,9 @@ export declare const one_to_one_asset: {
|
|
|
76
82
|
}, {
|
|
77
83
|
Cip68: {
|
|
78
84
|
state: {
|
|
79
|
-
|
|
85
|
+
current_supply: IntLike;
|
|
86
|
+
supply_after_last_mint: IntLike;
|
|
87
|
+
transfer_id_before_last_mint: number[];
|
|
80
88
|
type: string;
|
|
81
89
|
account: number[];
|
|
82
90
|
name: string;
|
|
@@ -93,9 +101,13 @@ export declare const one_to_one_asset: {
|
|
|
93
101
|
};
|
|
94
102
|
}>;
|
|
95
103
|
Redeemer: (config: CastConfig) => Cast<{
|
|
96
|
-
|
|
104
|
+
total_reserves: number;
|
|
105
|
+
reserves_change: number;
|
|
106
|
+
latest_transfer_id: number[];
|
|
97
107
|
}, {
|
|
98
|
-
|
|
108
|
+
total_reserves: number;
|
|
109
|
+
reserves_change: number;
|
|
110
|
+
latest_transfer_id: number[];
|
|
99
111
|
}>;
|
|
100
112
|
};
|
|
101
113
|
$functions: {
|
|
@@ -103,7 +115,9 @@ export declare const one_to_one_asset: {
|
|
|
103
115
|
self: {
|
|
104
116
|
Cip68: {
|
|
105
117
|
state: {
|
|
106
|
-
|
|
118
|
+
current_supply: IntLike;
|
|
119
|
+
supply_after_last_mint: IntLike;
|
|
120
|
+
transfer_id_before_last_mint: number[];
|
|
107
121
|
type: string;
|
|
108
122
|
account: number[];
|
|
109
123
|
name: string;
|
|
@@ -120,7 +134,9 @@ export declare const one_to_one_asset: {
|
|
|
120
134
|
};
|
|
121
135
|
};
|
|
122
136
|
}, {
|
|
123
|
-
|
|
137
|
+
current_supply: bigint;
|
|
138
|
+
supply_after_last_mint: bigint;
|
|
139
|
+
transfer_id_before_last_mint: number[];
|
|
124
140
|
type: string;
|
|
125
141
|
account: number[];
|
|
126
142
|
name: string;
|
|
@@ -132,6 +148,7 @@ export declare const one_to_one_asset: {
|
|
|
132
148
|
}>;
|
|
133
149
|
SEED_ID: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, TxOutputId>;
|
|
134
150
|
ORACLE_KEYS: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, PubKeyHash[]>;
|
|
151
|
+
INITIAL_PRICE: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, number>;
|
|
135
152
|
TYPE: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
|
|
136
153
|
ACCOUNT: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, number[]>;
|
|
137
154
|
TICKER: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
|
|
@@ -154,10 +171,18 @@ export declare const one_to_one_asset: {
|
|
|
154
171
|
signed_by_quorum: (uplc: UplcProgram, config: CastConfig) => UserFunc<{
|
|
155
172
|
$scriptContext: UplcData;
|
|
156
173
|
}, 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>;
|
|
157
180
|
validate_state_change: (uplc: UplcProgram, config: CastConfig) => UserFunc<{
|
|
158
181
|
$scriptContext: UplcData;
|
|
159
182
|
redeemer: {
|
|
160
|
-
|
|
183
|
+
total_reserves: number;
|
|
184
|
+
reserves_change: number;
|
|
185
|
+
latest_transfer_id: number[];
|
|
161
186
|
};
|
|
162
187
|
input: TxInput;
|
|
163
188
|
}, void>;
|
|
@@ -176,8 +201,8 @@ export declare const one_to_one_asset: {
|
|
|
176
201
|
}, void>;
|
|
177
202
|
};
|
|
178
203
|
};
|
|
179
|
-
export declare const
|
|
180
|
-
$name: "
|
|
204
|
+
export declare const wrapped_asset: {
|
|
205
|
+
$name: "wrapped_asset";
|
|
181
206
|
$purpose: "mixed";
|
|
182
207
|
$currentScriptIndex: 1;
|
|
183
208
|
$sourceCode: string;
|
|
@@ -204,29 +229,35 @@ export declare const tokenized_account: {
|
|
|
204
229
|
$Datum: (config: CastConfig) => Cast<UplcData, UplcData>;
|
|
205
230
|
$types: {
|
|
206
231
|
State: (config: CastConfig) => Cast<{
|
|
207
|
-
|
|
208
|
-
supply_after_last_mint: bigint;
|
|
209
|
-
transfer_id_before_last_mint: number[];
|
|
232
|
+
supply: bigint;
|
|
210
233
|
type: string;
|
|
211
|
-
|
|
234
|
+
venue: string;
|
|
235
|
+
policy: string;
|
|
236
|
+
account: string;
|
|
237
|
+
ticker: string;
|
|
212
238
|
name: string;
|
|
213
239
|
description: string;
|
|
214
240
|
decimals: bigint;
|
|
215
|
-
ticker: string;
|
|
216
241
|
url: string;
|
|
217
242
|
logo: string;
|
|
243
|
+
quorum: bigint;
|
|
244
|
+
oracles: (PubKeyHash)[];
|
|
245
|
+
seed: TxOutputId;
|
|
218
246
|
}, {
|
|
219
|
-
|
|
220
|
-
supply_after_last_mint: IntLike;
|
|
221
|
-
transfer_id_before_last_mint: number[];
|
|
247
|
+
supply: IntLike;
|
|
222
248
|
type: string;
|
|
223
|
-
|
|
249
|
+
venue: string;
|
|
250
|
+
policy: string;
|
|
251
|
+
account: string;
|
|
252
|
+
ticker: string;
|
|
224
253
|
name: string;
|
|
225
254
|
description: string;
|
|
226
255
|
decimals: IntLike;
|
|
227
|
-
ticker: string;
|
|
228
256
|
url: string;
|
|
229
257
|
logo: string;
|
|
258
|
+
quorum: IntLike;
|
|
259
|
+
oracles: (PubKeyHash | string | number[])[];
|
|
260
|
+
seed: TxOutputId | string;
|
|
230
261
|
}>;
|
|
231
262
|
Cip68Extra: (config: CastConfig) => Cast<{
|
|
232
263
|
Unused: {};
|
|
@@ -236,17 +267,20 @@ export declare const tokenized_account: {
|
|
|
236
267
|
Metadata: (config: CastConfig) => Cast<{
|
|
237
268
|
Cip68: {
|
|
238
269
|
state: {
|
|
239
|
-
|
|
240
|
-
supply_after_last_mint: bigint;
|
|
241
|
-
transfer_id_before_last_mint: number[];
|
|
270
|
+
supply: bigint;
|
|
242
271
|
type: string;
|
|
243
|
-
|
|
272
|
+
venue: string;
|
|
273
|
+
policy: string;
|
|
274
|
+
account: string;
|
|
275
|
+
ticker: string;
|
|
244
276
|
name: string;
|
|
245
277
|
description: string;
|
|
246
278
|
decimals: bigint;
|
|
247
|
-
ticker: string;
|
|
248
279
|
url: string;
|
|
249
280
|
logo: string;
|
|
281
|
+
quorum: bigint;
|
|
282
|
+
oracles: (PubKeyHash)[];
|
|
283
|
+
seed: TxOutputId;
|
|
250
284
|
};
|
|
251
285
|
version: bigint;
|
|
252
286
|
extra: {
|
|
@@ -256,17 +290,20 @@ export declare const tokenized_account: {
|
|
|
256
290
|
}, {
|
|
257
291
|
Cip68: {
|
|
258
292
|
state: {
|
|
259
|
-
|
|
260
|
-
supply_after_last_mint: IntLike;
|
|
261
|
-
transfer_id_before_last_mint: number[];
|
|
293
|
+
supply: IntLike;
|
|
262
294
|
type: string;
|
|
263
|
-
|
|
295
|
+
venue: string;
|
|
296
|
+
policy: string;
|
|
297
|
+
account: string;
|
|
298
|
+
ticker: string;
|
|
264
299
|
name: string;
|
|
265
300
|
description: string;
|
|
266
301
|
decimals: IntLike;
|
|
267
|
-
ticker: string;
|
|
268
302
|
url: string;
|
|
269
303
|
logo: string;
|
|
304
|
+
quorum: IntLike;
|
|
305
|
+
oracles: (PubKeyHash | string | number[])[];
|
|
306
|
+
seed: TxOutputId | string;
|
|
270
307
|
};
|
|
271
308
|
version: IntLike;
|
|
272
309
|
extra: {
|
|
@@ -275,13 +312,9 @@ export declare const tokenized_account: {
|
|
|
275
312
|
};
|
|
276
313
|
}>;
|
|
277
314
|
Redeemer: (config: CastConfig) => Cast<{
|
|
278
|
-
|
|
279
|
-
reserves_change: number;
|
|
280
|
-
latest_transfer_id: number[];
|
|
315
|
+
reserves: bigint;
|
|
281
316
|
}, {
|
|
282
|
-
|
|
283
|
-
reserves_change: number;
|
|
284
|
-
latest_transfer_id: number[];
|
|
317
|
+
reserves: IntLike;
|
|
285
318
|
}>;
|
|
286
319
|
};
|
|
287
320
|
$functions: {
|
|
@@ -289,17 +322,20 @@ export declare const tokenized_account: {
|
|
|
289
322
|
self: {
|
|
290
323
|
Cip68: {
|
|
291
324
|
state: {
|
|
292
|
-
|
|
293
|
-
supply_after_last_mint: IntLike;
|
|
294
|
-
transfer_id_before_last_mint: number[];
|
|
325
|
+
supply: IntLike;
|
|
295
326
|
type: string;
|
|
296
|
-
|
|
327
|
+
venue: string;
|
|
328
|
+
policy: string;
|
|
329
|
+
account: string;
|
|
330
|
+
ticker: string;
|
|
297
331
|
name: string;
|
|
298
332
|
description: string;
|
|
299
333
|
decimals: IntLike;
|
|
300
|
-
ticker: string;
|
|
301
334
|
url: string;
|
|
302
335
|
logo: string;
|
|
336
|
+
quorum: IntLike;
|
|
337
|
+
oracles: (PubKeyHash | string | number[])[];
|
|
338
|
+
seed: TxOutputId | string;
|
|
303
339
|
};
|
|
304
340
|
version: IntLike;
|
|
305
341
|
extra: {
|
|
@@ -308,29 +344,84 @@ export declare const tokenized_account: {
|
|
|
308
344
|
};
|
|
309
345
|
};
|
|
310
346
|
}, {
|
|
311
|
-
|
|
312
|
-
supply_after_last_mint: bigint;
|
|
313
|
-
transfer_id_before_last_mint: number[];
|
|
347
|
+
supply: bigint;
|
|
314
348
|
type: string;
|
|
315
|
-
|
|
349
|
+
venue: string;
|
|
350
|
+
policy: string;
|
|
351
|
+
account: string;
|
|
352
|
+
ticker: string;
|
|
316
353
|
name: string;
|
|
317
354
|
description: string;
|
|
318
355
|
decimals: bigint;
|
|
319
|
-
ticker: string;
|
|
320
356
|
url: string;
|
|
321
357
|
logo: string;
|
|
358
|
+
quorum: bigint;
|
|
359
|
+
oracles: (PubKeyHash)[];
|
|
360
|
+
seed: TxOutputId;
|
|
361
|
+
}>;
|
|
362
|
+
"Metadata::version": (uplc: UplcProgram, config: CastConfig) => UserFunc<{
|
|
363
|
+
self: {
|
|
364
|
+
Cip68: {
|
|
365
|
+
state: {
|
|
366
|
+
supply: IntLike;
|
|
367
|
+
type: string;
|
|
368
|
+
venue: string;
|
|
369
|
+
policy: string;
|
|
370
|
+
account: string;
|
|
371
|
+
ticker: string;
|
|
372
|
+
name: string;
|
|
373
|
+
description: string;
|
|
374
|
+
decimals: IntLike;
|
|
375
|
+
url: string;
|
|
376
|
+
logo: string;
|
|
377
|
+
quorum: IntLike;
|
|
378
|
+
oracles: (PubKeyHash | string | number[])[];
|
|
379
|
+
seed: TxOutputId | string;
|
|
380
|
+
};
|
|
381
|
+
version: IntLike;
|
|
382
|
+
extra: {
|
|
383
|
+
Unused: {};
|
|
384
|
+
};
|
|
385
|
+
};
|
|
386
|
+
};
|
|
387
|
+
}, bigint>;
|
|
388
|
+
"Metadata::extra": (uplc: UplcProgram, config: CastConfig) => UserFunc<{
|
|
389
|
+
self: {
|
|
390
|
+
Cip68: {
|
|
391
|
+
state: {
|
|
392
|
+
supply: IntLike;
|
|
393
|
+
type: string;
|
|
394
|
+
venue: string;
|
|
395
|
+
policy: string;
|
|
396
|
+
account: string;
|
|
397
|
+
ticker: string;
|
|
398
|
+
name: string;
|
|
399
|
+
description: string;
|
|
400
|
+
decimals: IntLike;
|
|
401
|
+
url: string;
|
|
402
|
+
logo: string;
|
|
403
|
+
quorum: IntLike;
|
|
404
|
+
oracles: (PubKeyHash | string | number[])[];
|
|
405
|
+
seed: TxOutputId | string;
|
|
406
|
+
};
|
|
407
|
+
version: IntLike;
|
|
408
|
+
extra: {
|
|
409
|
+
Unused: {};
|
|
410
|
+
};
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
}, {
|
|
414
|
+
Unused: {};
|
|
322
415
|
}>;
|
|
323
|
-
SEED_ID: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, TxOutputId>;
|
|
324
|
-
ORACLE_KEYS: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, PubKeyHash[]>;
|
|
325
|
-
INITIAL_PRICE: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, number>;
|
|
326
416
|
TYPE: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
|
|
327
|
-
|
|
417
|
+
VENUE: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
|
|
418
|
+
POLICY: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
|
|
419
|
+
ACCOUNT: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
|
|
328
420
|
TICKER: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
|
|
329
|
-
NAME: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
|
|
330
|
-
DESCRIPTION: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, string>;
|
|
331
421
|
DECIMALS: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, bigint>;
|
|
332
|
-
|
|
333
|
-
|
|
422
|
+
ORACLES: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, PubKeyHash[]>;
|
|
423
|
+
QUORUM: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, bigint>;
|
|
424
|
+
SEED: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, TxOutputId>;
|
|
334
425
|
ticker_bytes: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, number[]>;
|
|
335
426
|
user_token_name: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, number[]>;
|
|
336
427
|
ref_token_name: (uplc: UplcProgram, config: CastConfig) => UserFunc<{}, number[]>;
|
|
@@ -345,18 +436,10 @@ export declare const tokenized_account: {
|
|
|
345
436
|
signed_by_quorum: (uplc: UplcProgram, config: CastConfig) => UserFunc<{
|
|
346
437
|
$scriptContext: UplcData;
|
|
347
438
|
}, 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>;
|
|
354
439
|
validate_state_change: (uplc: UplcProgram, config: CastConfig) => UserFunc<{
|
|
355
440
|
$scriptContext: UplcData;
|
|
356
441
|
redeemer: {
|
|
357
|
-
|
|
358
|
-
reserves_change: number;
|
|
359
|
-
latest_transfer_id: number[];
|
|
442
|
+
reserves: IntLike;
|
|
360
443
|
};
|
|
361
444
|
input: TxInput;
|
|
362
445
|
}, void>;
|