tx · GHwgUu4v4ZLnHSZAiErCHDGnyFugohjo6EfANK7GtBoz 3MxVYj6ScMArhAamy7nB6b342kh1Pso1LTn: -0.00200000 Waves 2023.03.20 19:41 [2498584] smart account 3MxVYj6ScMArhAamy7nB6b342kh1Pso1LTn > SELF 0.00000000 Waves
{ "type": 13, "id": "GHwgUu4v4ZLnHSZAiErCHDGnyFugohjo6EfANK7GtBoz", "fee": 200000, "feeAssetId": null, "timestamp": 1679330503764, "version": 2, "chainId": 84, "sender": "3MxVYj6ScMArhAamy7nB6b342kh1Pso1LTn", "senderPublicKey": "CZeucjRLCKrkiP9zuj9KbLe23Wv9DywFzHBqNDnte51B", "proofs": [ "51ek1wnYfLhdjqyVY379r5fgcpvfbDS2oBCepSGaPHESXFpthrZJ8RAqoNtZRjr5LCu6C6VWvDCBovVcNTGC4iho" ], "script": "base64:BgIcCAISBAoCCAgSBAoCCAESBgoECAgICBIECgIICAgADmNvbGxlY3Rpb25OYW1lCQERQGV4dHJOYXRpdmUoMTA1OCkBAg5jb2xsZWN0aW9uTmFtZQAGc3ltYm9sCQERQGV4dHJOYXRpdmUoMTA1OCkBAgZzeW1ib2wAC2Rlc2NyaXB0aW9uCQERQGV4dHJOYXRpdmUoMTA1OCkBAgtkZXNjcmlwdGlvbgALdG90YWxBbW91bnQJARFAZXh0ck5hdGl2ZSgxMDU1KQECC3RvdGFsQW1vdW50AAdiYXNlVVJJCQERQGV4dHJOYXRpdmUoMTA1OCkBAgdiYXNlVVJJAAhkQXBwSnNvbgkBB0FkZHJlc3MBCQDZBAECIzNNckdhWlZSaGtuRUdmSEoxOXR0VVBObkRSb0ZxY0hoVk43AQxvbmx5SW50ZXJuYWwBBmNhbGxlcgMJAAACBQZjYWxsZXIFBHRoaXMFBHVuaXQJAAIBAhJPbmx5IGludGVybmFsIGNhbGwBDXRyYW5zZmVyT3JOb3QCAnRvB2Fzc2V0SWQDCQAAAgUCdG8FBHRoaXMJAQtTdHJpbmdFbnRyeQICBHNtdGgCBH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YW1lBQRqc29uAAEAAAcFBHVuaXQFBmhlaWdodAQHYXNzZXRJZAkAuAgBBQVhc3NldAQJdG9BZGRyZXNzCQEHQWRkcmVzcwEJANkEAQUCdG8ECHRyYW5zZmVyCQENdHJhbnNmZXJPck5vdAIFCXRvQWRkcmVzcwUHYXNzZXRJZAMJAAACBQh0cmFuc2ZlcgUIdHJhbnNmZXIJAMwIAgUFYXNzZXQJAMwIAgUIdHJhbnNmZXIJAMwIAgkBDEludGVnZXJFbnRyeQICC3RvdGFsQW1vdW50BQd0b2tlbklkCQDMCAIJAQtTdHJpbmdFbnRyeQIFBG5hbWUFCHRva2VuVVJJBQNuaWwJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4Ai0mKEA==", "height": 2498584, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 49dQDxF8KEWPjmmQQc1vUr6995Kb7EZFJ8v2SzPmWXY4 Next: FCmDoaxe2X3rEjUgCsfGCZgqHm83KNQzTNtREgAQGs7h Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let collectionName = getStringValue("collectionName") | |
5 | + | ||
6 | + | let symbol = getStringValue("symbol") | |
7 | + | ||
8 | + | let description = getStringValue("description") | |
9 | + | ||
10 | + | let totalAmount = getIntegerValue("totalAmount") | |
11 | + | ||
12 | + | let baseURI = getStringValue("baseURI") | |
13 | + | ||
14 | + | let dAppJson = Address(fromBase58String("3MrGaZVRhknEGfHJ19ttUPNnDRoFqcHhVN7")) | |
15 | + | ||
16 | + | func onlyInternal (caller) = if ((caller == this)) | |
17 | + | then unit | |
18 | + | else throw("Only internal call") | |
19 | + | ||
20 | + | ||
21 | + | func transferOrNot (to,assetId) = if ((to == this)) | |
22 | + | then StringEntry("smth", "smth") | |
23 | + | else ScriptTransfer(to, 1, assetId) | |
4 | 24 | ||
5 | 25 | ||
6 | 26 | @Callable(i) | |
12 | 32 | func setInt (_key,_value) = [IntegerEntry(_key, _value)] | |
13 | 33 | ||
14 | 34 | ||
35 | + | ||
36 | + | @Callable(i) | |
37 | + | func init (_collectionName,_symbol,_description,_baseURI) = valueOrElse(onlyInternal(i.caller), [StringEntry("collectionName", _collectionName), StringEntry("symbol", _symbol), StringEntry("description", _description), IntegerEntry("totalAmount", 0), StringEntry("baseURI", _baseURI)]) | |
38 | + | ||
39 | + | ||
40 | + | ||
41 | + | @Callable(i) | |
42 | + | func mint (to,tokenURI) = { | |
43 | + | let tokenId = (totalAmount + 1) | |
44 | + | let preName = ((symbol + "#") + toString(tokenId)) | |
45 | + | let name = if ((16 >= size(preName))) | |
46 | + | then preName | |
47 | + | else toString(tokenId) | |
48 | + | let json = { | |
49 | + | let @ = invoke(dAppJson, "makeJSON", [["tokenURI"], [tokenURI]], nil) | |
50 | + | if ($isInstanceOf(@, "String")) | |
51 | + | then @ | |
52 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
53 | + | } | |
54 | + | let asset = Issue(name, json, 1, 0, false, unit, height) | |
55 | + | let assetId = calculateAssetId(asset) | |
56 | + | let toAddress = Address(fromBase58String(to)) | |
57 | + | let transfer = transferOrNot(toAddress, assetId) | |
58 | + | if ((transfer == transfer)) | |
59 | + | then [asset, transfer, IntegerEntry("totalAmount", tokenId), StringEntry(name, tokenURI)] | |
60 | + | else throw("Strict value is not equal to itself.") | |
61 | + | } | |
62 | + | ||
63 | + |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let collectionName = getStringValue("collectionName") | |
5 | + | ||
6 | + | let symbol = getStringValue("symbol") | |
7 | + | ||
8 | + | let description = getStringValue("description") | |
9 | + | ||
10 | + | let totalAmount = getIntegerValue("totalAmount") | |
11 | + | ||
12 | + | let baseURI = getStringValue("baseURI") | |
13 | + | ||
14 | + | let dAppJson = Address(fromBase58String("3MrGaZVRhknEGfHJ19ttUPNnDRoFqcHhVN7")) | |
15 | + | ||
16 | + | func onlyInternal (caller) = if ((caller == this)) | |
17 | + | then unit | |
18 | + | else throw("Only internal call") | |
19 | + | ||
20 | + | ||
21 | + | func transferOrNot (to,assetId) = if ((to == this)) | |
22 | + | then StringEntry("smth", "smth") | |
23 | + | else ScriptTransfer(to, 1, assetId) | |
4 | 24 | ||
5 | 25 | ||
6 | 26 | @Callable(i) | |
7 | 27 | func setString (_key,_value) = [StringEntry(_key, _value)] | |
8 | 28 | ||
9 | 29 | ||
10 | 30 | ||
11 | 31 | @Callable(i) | |
12 | 32 | func setInt (_key,_value) = [IntegerEntry(_key, _value)] | |
13 | 33 | ||
14 | 34 | ||
35 | + | ||
36 | + | @Callable(i) | |
37 | + | func init (_collectionName,_symbol,_description,_baseURI) = valueOrElse(onlyInternal(i.caller), [StringEntry("collectionName", _collectionName), StringEntry("symbol", _symbol), StringEntry("description", _description), IntegerEntry("totalAmount", 0), StringEntry("baseURI", _baseURI)]) | |
38 | + | ||
39 | + | ||
40 | + | ||
41 | + | @Callable(i) | |
42 | + | func mint (to,tokenURI) = { | |
43 | + | let tokenId = (totalAmount + 1) | |
44 | + | let preName = ((symbol + "#") + toString(tokenId)) | |
45 | + | let name = if ((16 >= size(preName))) | |
46 | + | then preName | |
47 | + | else toString(tokenId) | |
48 | + | let json = { | |
49 | + | let @ = invoke(dAppJson, "makeJSON", [["tokenURI"], [tokenURI]], nil) | |
50 | + | if ($isInstanceOf(@, "String")) | |
51 | + | then @ | |
52 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
53 | + | } | |
54 | + | let asset = Issue(name, json, 1, 0, false, unit, height) | |
55 | + | let assetId = calculateAssetId(asset) | |
56 | + | let toAddress = Address(fromBase58String(to)) | |
57 | + | let transfer = transferOrNot(toAddress, assetId) | |
58 | + | if ((transfer == transfer)) | |
59 | + | then [asset, transfer, IntegerEntry("totalAmount", tokenId), StringEntry(name, tokenURI)] | |
60 | + | else throw("Strict value is not equal to itself.") | |
61 | + | } | |
62 | + | ||
63 | + |
github/deemru/w8io/026f985 82.79 ms ◑