tx · Es3A8zivcJhgDjiVdfvY82kTjvMSctdFBJPirMcb6wja 3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb: -0.00300000 Waves 2023.03.15 21:46 [2491515] smart account 3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb > SELF 0.00000000 Waves
{ "type": 13, "id": "Es3A8zivcJhgDjiVdfvY82kTjvMSctdFBJPirMcb6wja", "fee": 300000, "feeAssetId": null, "timestamp": 1678906039670, "version": 2, "chainId": 84, "sender": "3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb", "senderPublicKey": "2VQGRNRWyFAZvjDtkgZwdZcTwZvBJJ61n8zJfYYxm5eK", "proofs": [ "WWvWFX8vp9vLRrCoYXXCPYjuBu4xM1SDuCgCSWJpWHLiDEhKWofMyMbNqg1fPKWG4Y8DaSYNPKcD2cfbBf9SqjV" ], "script": "base64:BgIxCAISBAoCGBgSBAoCGBgSAwoBCBIDCgEIEgUKAwgICBIECgIICBIDCgEIEgUKAwgYGAgADmNvbGxlY3Rpb25OYW1lCQERQGV4dHJOYXRpdmUoMTA1MykCBQR0aGlzAg5jb2xsZWN0aW9uTmFtZQAGc3ltYm9sCQERQGV4dHJOYXRpdmUoMTA1MykCBQR0aGlzAgZzeW1ib2wAC2Rlc2NyaXB0aW9uCQERQGV4dHJOYXRpdmUoMTA1MykCBQR0aGlzAgtkZXNjcmlwdGlvbgALdG90YWxBbW91bnQJARFAZXh0ck5hdGl2ZSgxMDUwKQIFBHRoaXMCC3RvdGFsQW1vdW50AAhkQXBwSnNvbgkBB0FkZHJlc3MBCQDZBAEJARFAZXh0ck5hdGl2ZSgxMDUzKQIFBHRoaXMCCGRBcHBKc29uAQxvbmx5SW50ZXJuYWwBBmNhbGxlcgMJAAACBQZjYWxsZXIFBHRoaXMFBHVuaXQJAAIBAhJPbmx5IGludGVybmFsIGNhbGwBDXRyYW5zZmVyT3JOb3QCAnRvB2Fzc2V0SWQDCQAAAgUCdG8FBH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AAgUIdHJhbnNmZXIFCHRyYW5zZmVyCQDMCAIFBWFzc2V0CQDMCAIFCHRyYW5zZmVyCQDMCAIJAQxJbnRlZ2VyRW50cnkCAgt0b3RhbEFtb3VudAUHdG9rZW5JZAkAzAgCCQELU3RyaW5nRW50cnkCBQRuYW1lBQh0b2tlblVSSQUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAWkBC3NldERBcHBKc29uAQtkQXBwQWRkcmVzcwkBC3ZhbHVlT3JFbHNlAgkBDG9ubHlJbnRlcm5hbAEIBQFpBmNhbGxlcgkAzAgCCQELU3RyaW5nRW50cnkCAghkQXBwSnNvbgULZEFwcEFkZHJlc3MFA25pbAFpAQ90ZXN0U3RvcmFnZUpzb24DB2pzb25LZXkHYXJyS2V5cwlhcnJWYWx1ZXMEA3JlcwkA/AcEBQR0aGlzAhBtYWtlSlNPTkludGVybmFsCQDMCAIFB2FycktleXMJAMwIAgUJYXJyVmFsdWVzBQNuaWwFA25pbAMJAAACBQNyZXMFA3JlcwkAlAoCCQDMCAIJAQtTdHJpbmdFbnRyeQIFB2pzb25LZXkKAAFABQNyZXMDCQABAgUBQAIGU3RyaW5nBQFACQACAQkArAICCQADAQUBQAIbIGNvdWxkbid0IGJlIGNhc3QgdG8gU3RyaW5nBQNuaWwFA3JlcwkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgC72APk", "height": 2491515, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: JAB8kqzybDWuAineJXCyTAcGDtXPwuEb9Lf3tkmWbGbs Next: 4M1KzdxQvgMasE2qgtMcKNdw4ETXJEfirz4kXf8LVfAe Diff:
Old | New | Differences | |
---|---|---|---|
9 | 9 | ||
10 | 10 | let totalAmount = getIntegerValue(this, "totalAmount") | |
11 | 11 | ||
12 | + | let dAppJson = Address(fromBase58String(getStringValue(this, "dAppJson"))) | |
13 | + | ||
14 | + | func onlyInternal (caller) = if ((caller == this)) | |
15 | + | then unit | |
16 | + | else throw("Only internal call") | |
17 | + | ||
18 | + | ||
12 | 19 | func transferOrNot (to,assetId) = if ((to == this)) | |
13 | 20 | then StringEntry("костыль", "костыль") | |
14 | 21 | else ScriptTransfer(to, 1, assetId) | |
15 | 22 | ||
16 | 23 | ||
24 | + | func setUser (assetId,user,expires) = throw() | |
25 | + | ||
26 | + | ||
17 | 27 | @Callable(i) | |
18 | - | func init (collectionName,symbol,description) = if ((i.caller == this)) | |
19 | - | then [StringEntry("collectionName", collectionName), StringEntry("symbol", symbol), StringEntry("description", description), IntegerEntry("totalAmount", 0)] | |
20 | - | else throw("only dApp") | |
28 | + | func makeJSONInternal (arrKeys,arrValues) = valueOrElse(onlyInternal(i.caller), { | |
29 | + | let res = invoke(dAppJson, "makeJSON", [arrKeys, arrValues], nil) | |
30 | + | if ((res == res)) | |
31 | + | then $Tuple2(nil, res) | |
32 | + | else throw("Strict value is not equal to itself.") | |
33 | + | }) | |
21 | 34 | ||
22 | 35 | ||
23 | 36 | ||
24 | 37 | @Callable(i) | |
25 | - | func mint (to,tokenURI) = if ((i.caller == this)) | |
26 | - | then { | |
27 | - | let tokenId = (totalAmount + 1) | |
28 | - | let preName = ((symbol + "#") + toString(tokenId)) | |
29 | - | let name = if ((16 >= size(preName))) | |
30 | - | then preName | |
31 | - | else toString(tokenId) | |
32 | - | let asset = Issue(name, (("{uri:\"" + tokenURI) + "\"}"), 1, 0, false, unit, height) | |
33 | - | let assetId = calculateAssetId(asset) | |
34 | - | let toAddress = Address(fromBase58String(to)) | |
35 | - | let transfer = transferOrNot(toAddress, assetId) | |
36 | - | if ((transfer == transfer)) | |
37 | - | then [asset, transfer, IntegerEntry("totalAmount", tokenId), StringEntry(name, tokenURI)] | |
38 | - | else throw("Strict value is not equal to itself.") | |
39 | - | } | |
40 | - | else throw("only dApp") | |
38 | + | func addToJSONInternal (arrKeys,arrValues) = valueOrElse(onlyInternal(i.caller), { | |
39 | + | let res = invoke(dAppJson, "addToJSON", [arrKeys, arrValues], nil) | |
40 | + | if ((res == res)) | |
41 | + | then $Tuple2(nil, res) | |
42 | + | else throw("Strict value is not equal to itself.") | |
43 | + | }) | |
44 | + | ||
45 | + | ||
46 | + | ||
47 | + | @Callable(i) | |
48 | + | func readByJSONKeyInternal (key) = valueOrElse(onlyInternal(i.caller), { | |
49 | + | let res = invoke(dAppJson, "readByJSONKey", [key], nil) | |
50 | + | if ((res == res)) | |
51 | + | then $Tuple2(nil, res) | |
52 | + | else throw("Strict value is not equal to itself.") | |
53 | + | }) | |
54 | + | ||
55 | + | ||
56 | + | ||
57 | + | @Callable(i) | |
58 | + | func deleteByJSONKeyInternal (key) = valueOrElse(onlyInternal(i.caller), { | |
59 | + | let res = invoke(dAppJson, "deleteByJSONKey", [key], nil) | |
60 | + | if ((res == res)) | |
61 | + | then $Tuple2(nil, res) | |
62 | + | else throw("Strict value is not equal to itself.") | |
63 | + | }) | |
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | @Callable(i) | |
68 | + | func init (collectionName,symbol,description) = valueOrElse(onlyInternal(i.caller), [StringEntry("collectionName", collectionName), StringEntry("symbol", symbol), StringEntry("description", description), IntegerEntry("totalAmount", 0)]) | |
69 | + | ||
70 | + | ||
71 | + | ||
72 | + | @Callable(i) | |
73 | + | func mint (to,tokenURI) = valueOrElse(onlyInternal(i.caller), { | |
74 | + | let tokenId = (totalAmount + 1) | |
75 | + | let preName = ((symbol + "#") + toString(tokenId)) | |
76 | + | let name = if ((16 >= size(preName))) | |
77 | + | then preName | |
78 | + | else toString(tokenId) | |
79 | + | let asset = Issue(name, (("{uri:\"" + tokenURI) + "\"}"), 1, 0, false, unit, height) | |
80 | + | let assetId = calculateAssetId(asset) | |
81 | + | let toAddress = Address(fromBase58String(to)) | |
82 | + | let transfer = transferOrNot(toAddress, assetId) | |
83 | + | if ((transfer == transfer)) | |
84 | + | then [asset, transfer, IntegerEntry("totalAmount", tokenId), StringEntry(name, tokenURI)] | |
85 | + | else throw("Strict value is not equal to itself.") | |
86 | + | }) | |
87 | + | ||
88 | + | ||
89 | + | ||
90 | + | @Callable(i) | |
91 | + | func setDAppJson (dAppAddress) = valueOrElse(onlyInternal(i.caller), [StringEntry("dAppJson", dAppAddress)]) | |
92 | + | ||
93 | + | ||
94 | + | ||
95 | + | @Callable(i) | |
96 | + | func testStorageJson (jsonKey,arrKeys,arrValues) = { | |
97 | + | let res = invoke(this, "makeJSONInternal", [arrKeys, arrValues], nil) | |
98 | + | if ((res == res)) | |
99 | + | then $Tuple2([StringEntry(jsonKey, { | |
100 | + | let @ = res | |
101 | + | if ($isInstanceOf(@, "String")) | |
102 | + | then @ | |
103 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
104 | + | })], res) | |
105 | + | else throw("Strict value is not equal to itself.") | |
106 | + | } | |
41 | 107 | ||
42 | 108 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let collectionName = getStringValue(this, "collectionName") | |
5 | 5 | ||
6 | 6 | let symbol = getStringValue(this, "symbol") | |
7 | 7 | ||
8 | 8 | let description = getStringValue(this, "description") | |
9 | 9 | ||
10 | 10 | let totalAmount = getIntegerValue(this, "totalAmount") | |
11 | 11 | ||
12 | + | let dAppJson = Address(fromBase58String(getStringValue(this, "dAppJson"))) | |
13 | + | ||
14 | + | func onlyInternal (caller) = if ((caller == this)) | |
15 | + | then unit | |
16 | + | else throw("Only internal call") | |
17 | + | ||
18 | + | ||
12 | 19 | func transferOrNot (to,assetId) = if ((to == this)) | |
13 | 20 | then StringEntry("костыль", "костыль") | |
14 | 21 | else ScriptTransfer(to, 1, assetId) | |
15 | 22 | ||
16 | 23 | ||
24 | + | func setUser (assetId,user,expires) = throw() | |
25 | + | ||
26 | + | ||
17 | 27 | @Callable(i) | |
18 | - | func init (collectionName,symbol,description) = if ((i.caller == this)) | |
19 | - | then [StringEntry("collectionName", collectionName), StringEntry("symbol", symbol), StringEntry("description", description), IntegerEntry("totalAmount", 0)] | |
20 | - | else throw("only dApp") | |
28 | + | func makeJSONInternal (arrKeys,arrValues) = valueOrElse(onlyInternal(i.caller), { | |
29 | + | let res = invoke(dAppJson, "makeJSON", [arrKeys, arrValues], nil) | |
30 | + | if ((res == res)) | |
31 | + | then $Tuple2(nil, res) | |
32 | + | else throw("Strict value is not equal to itself.") | |
33 | + | }) | |
21 | 34 | ||
22 | 35 | ||
23 | 36 | ||
24 | 37 | @Callable(i) | |
25 | - | func mint (to,tokenURI) = if ((i.caller == this)) | |
26 | - | then { | |
27 | - | let tokenId = (totalAmount + 1) | |
28 | - | let preName = ((symbol + "#") + toString(tokenId)) | |
29 | - | let name = if ((16 >= size(preName))) | |
30 | - | then preName | |
31 | - | else toString(tokenId) | |
32 | - | let asset = Issue(name, (("{uri:\"" + tokenURI) + "\"}"), 1, 0, false, unit, height) | |
33 | - | let assetId = calculateAssetId(asset) | |
34 | - | let toAddress = Address(fromBase58String(to)) | |
35 | - | let transfer = transferOrNot(toAddress, assetId) | |
36 | - | if ((transfer == transfer)) | |
37 | - | then [asset, transfer, IntegerEntry("totalAmount", tokenId), StringEntry(name, tokenURI)] | |
38 | - | else throw("Strict value is not equal to itself.") | |
39 | - | } | |
40 | - | else throw("only dApp") | |
38 | + | func addToJSONInternal (arrKeys,arrValues) = valueOrElse(onlyInternal(i.caller), { | |
39 | + | let res = invoke(dAppJson, "addToJSON", [arrKeys, arrValues], nil) | |
40 | + | if ((res == res)) | |
41 | + | then $Tuple2(nil, res) | |
42 | + | else throw("Strict value is not equal to itself.") | |
43 | + | }) | |
44 | + | ||
45 | + | ||
46 | + | ||
47 | + | @Callable(i) | |
48 | + | func readByJSONKeyInternal (key) = valueOrElse(onlyInternal(i.caller), { | |
49 | + | let res = invoke(dAppJson, "readByJSONKey", [key], nil) | |
50 | + | if ((res == res)) | |
51 | + | then $Tuple2(nil, res) | |
52 | + | else throw("Strict value is not equal to itself.") | |
53 | + | }) | |
54 | + | ||
55 | + | ||
56 | + | ||
57 | + | @Callable(i) | |
58 | + | func deleteByJSONKeyInternal (key) = valueOrElse(onlyInternal(i.caller), { | |
59 | + | let res = invoke(dAppJson, "deleteByJSONKey", [key], nil) | |
60 | + | if ((res == res)) | |
61 | + | then $Tuple2(nil, res) | |
62 | + | else throw("Strict value is not equal to itself.") | |
63 | + | }) | |
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | @Callable(i) | |
68 | + | func init (collectionName,symbol,description) = valueOrElse(onlyInternal(i.caller), [StringEntry("collectionName", collectionName), StringEntry("symbol", symbol), StringEntry("description", description), IntegerEntry("totalAmount", 0)]) | |
69 | + | ||
70 | + | ||
71 | + | ||
72 | + | @Callable(i) | |
73 | + | func mint (to,tokenURI) = valueOrElse(onlyInternal(i.caller), { | |
74 | + | let tokenId = (totalAmount + 1) | |
75 | + | let preName = ((symbol + "#") + toString(tokenId)) | |
76 | + | let name = if ((16 >= size(preName))) | |
77 | + | then preName | |
78 | + | else toString(tokenId) | |
79 | + | let asset = Issue(name, (("{uri:\"" + tokenURI) + "\"}"), 1, 0, false, unit, height) | |
80 | + | let assetId = calculateAssetId(asset) | |
81 | + | let toAddress = Address(fromBase58String(to)) | |
82 | + | let transfer = transferOrNot(toAddress, assetId) | |
83 | + | if ((transfer == transfer)) | |
84 | + | then [asset, transfer, IntegerEntry("totalAmount", tokenId), StringEntry(name, tokenURI)] | |
85 | + | else throw("Strict value is not equal to itself.") | |
86 | + | }) | |
87 | + | ||
88 | + | ||
89 | + | ||
90 | + | @Callable(i) | |
91 | + | func setDAppJson (dAppAddress) = valueOrElse(onlyInternal(i.caller), [StringEntry("dAppJson", dAppAddress)]) | |
92 | + | ||
93 | + | ||
94 | + | ||
95 | + | @Callable(i) | |
96 | + | func testStorageJson (jsonKey,arrKeys,arrValues) = { | |
97 | + | let res = invoke(this, "makeJSONInternal", [arrKeys, arrValues], nil) | |
98 | + | if ((res == res)) | |
99 | + | then $Tuple2([StringEntry(jsonKey, { | |
100 | + | let @ = res | |
101 | + | if ($isInstanceOf(@, "String")) | |
102 | + | then @ | |
103 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
104 | + | })], res) | |
105 | + | else throw("Strict value is not equal to itself.") | |
106 | + | } | |
41 | 107 | ||
42 | 108 |
github/deemru/w8io/169f3d6 35.46 ms ◑