tx · Ehr5Ncjzi7jP7gf7wsZkStYdcAAzMXMUHbc7LVWnau8k 3N2id3EX4Zt9GxXKULhzroDUFchSxhmE8dz: -0.05000000 Waves 2023.10.06 14:50 [2786722] smart account 3N2id3EX4Zt9GxXKULhzroDUFchSxhmE8dz > SELF 0.00000000 Waves
{ "type": 13, "id": "Ehr5Ncjzi7jP7gf7wsZkStYdcAAzMXMUHbc7LVWnau8k", "fee": 5000000, "feeAssetId": null, "timestamp": 1696593044205, "version": 1, "sender": "3N2id3EX4Zt9GxXKULhzroDUFchSxhmE8dz", "senderPublicKey": "6tKN4V778SPq7BhkyZX8JEuSm2Qim1MunJNELg6eqT7J", "proofs": [ "Ja3JFeatyg22z6Wyq7HjAdBjFt4aH21quYSjWEbq2JAmnAzd9oUH2Xg6nnDc8EDoHQrYJ3ky2QRTCMVCb5QHt7E" ], "script": "base64:BgINCAISAwoBARIECgIIARABEHdyaXRlQ29uc3RTdHJpbmcCA2tleQV2YWx1ZQMJAQEhAQkBCWlzRGVmaW5lZAEJAJ0IAgUEdGhpcwUDa2V5CQELU3RyaW5nRW50cnkCBQNrZXkFBXZhbHVlCQACAQkArAICAhVhbHJlYWR5IGluaXRpYWxpemVkOiAFA2tleQEId3JpdGVJbnQCA2tleQV2YWx1ZQMJAGYCAAAFBXZhbHVlCQACAQkArAICCQCsAgIJAKwCAgIXd3JpdGluZyBuZWdhdGl2ZSB2YWx1ZSAJAKQDAQUFdmFsdWUCCSBmb3Iga2V5IAUDa2V5CQEMSW50ZWdlckVudHJ5AgUDa2V5BQV2YWx1ZQENd3JpdGVDb25zdEludAIDa2V5BXZhbHVlAwkBASEBCQEJaXNEZWZpbmVkAQkAmggCBQR0aGlzBQNrZXkJAQh3cml0ZUludAIFA2tleQUFdmFsdWUJAAIBCQCsAgICEGFscmVhZHkgZXhpc3RzOiAFA2tleQEIY2hhbmdlQnkCA2tleQV2YWx1ZQkBCHdyaXRlSW50AgUDa2V5CQBkAgkBC3ZhbHVlT3JFbHNl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mlsAIK6kA4=", "chainId": 84, "height": 2786722, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func writeConstString (key,value) = if (!(isDefined(getString(this, key)))) | |
5 | + | then StringEntry(key, value) | |
6 | + | else throw(("already initialized: " + key)) | |
7 | + | ||
8 | + | ||
9 | + | func writeInt (key,value) = if ((0 > value)) | |
10 | + | then throw(((("writing negative value " + toString(value)) + " for key ") + key)) | |
11 | + | else IntegerEntry(key, value) | |
12 | + | ||
13 | + | ||
14 | + | func writeConstInt (key,value) = if (!(isDefined(getInteger(this, key)))) | |
15 | + | then writeInt(key, value) | |
16 | + | else throw(("already exists: " + key)) | |
17 | + | ||
18 | + | ||
19 | + | func changeBy (key,value) = writeInt(key, (valueOrElse(getInteger(this, key), 0) + value)) | |
20 | + | ||
21 | + | ||
22 | + | let configAddressStore = "config" | |
23 | + | ||
24 | + | let configAddress = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(this, configAddressStore), "minter: config address not found")), "invalid config address") | |
25 | + | ||
26 | + | func allowed (op) = invoke(configAddress, "opAllowed", [op], nil) | |
27 | + | ||
28 | + | ||
29 | + | let powerAssetIdStore = "powerAssetId" | |
30 | + | ||
31 | + | let powerTokenId = fromBase58String(getStringValue(this, powerAssetIdStore)) | |
32 | + | ||
33 | + | let minters = split(valueOrErrorMessage(getString(configAddress, "minters"), "minters addresses not found"), ",") | |
34 | + | ||
35 | + | let maxSupplyStore = "maxSupply" | |
36 | + | ||
37 | + | let maxSupply = valueOrErrorMessage(getInteger(this, maxSupplyStore), "maxSupply not set") | |
38 | + | ||
39 | + | let currentSupplyStore = "currentSupply" | |
40 | + | ||
41 | + | let currentSupply = valueOrElse(getInteger(this, currentSupplyStore), 0) | |
42 | + | ||
43 | + | let HEIGHT = height | |
44 | + | ||
45 | + | func advise (account) = ((((("height: " + toString(HEIGHT)) + ", maxSupply: ") + toString(maxSupply)) + ", currentSupply: ") + toString(currentSupply)) | |
46 | + | ||
47 | + | ||
48 | + | @Callable(i) | |
49 | + | func mint (amount) = { | |
50 | + | let a = allowed("mint") | |
51 | + | if ((a == a)) | |
52 | + | then { | |
53 | + | let isMinter = valueOrErrorMessage(indexOf(minters, toString(i.caller)), "mint denied") | |
54 | + | if ((isMinter == isMinter)) | |
55 | + | then { | |
56 | + | let newSupply = (currentSupply + amount) | |
57 | + | if ((newSupply > maxSupply)) | |
58 | + | then throw("exceed max supply") | |
59 | + | else [Reissue(powerTokenId, amount, true), ScriptTransfer(i.caller, amount, powerTokenId), changeBy(("minted_by_" + toString(i.caller)), amount), writeInt(currentSupplyStore, newSupply)] | |
60 | + | } | |
61 | + | else throw("Strict value is not equal to itself.") | |
62 | + | } | |
63 | + | else throw("Strict value is not equal to itself.") | |
64 | + | } | |
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | @Callable(i) | |
69 | + | func init (conf,maxSupply) = { | |
70 | + | let pt = Issue("POWER", "Take the Power back! https://power.tech", 0, 8, true) | |
71 | + | let ptStr = toBase58String(calculateAssetId(pt)) | |
72 | + | [pt, writeConstString(powerAssetIdStore, ptStr), writeConstString(configAddressStore, conf), writeConstInt(maxSupplyStore, maxSupply)] | |
73 | + | } | |
74 | + | ||
75 | + |
github/deemru/w8io/026f985 13.78 ms ◑