tx · 7SfFTJqUydayBUrar47WWRTcs9kJujtpe58pyV28qTcf 3MxVYj6ScMArhAamy7nB6b342kh1Pso1LTn: -0.00500000 Waves 2023.03.21 17:52 [2499917] smart account 3MxVYj6ScMArhAamy7nB6b342kh1Pso1LTn > SELF 0.00000000 Waves
{ "type": 13, "id": "7SfFTJqUydayBUrar47WWRTcs9kJujtpe58pyV28qTcf", "fee": 500000, "feeAssetId": null, "timestamp": 1679410385326, "version": 2, "chainId": 84, "sender": "3MxVYj6ScMArhAamy7nB6b342kh1Pso1LTn", "senderPublicKey": "CZeucjRLCKrkiP9zuj9KbLe23Wv9DywFzHBqNDnte51B", "proofs": [ "DB4aJEq9yfjZMGmyqG3BMUxKpdtnxp6NLoD69mcSwrf4WBGs8FoPiAq34RUXha5JUNbjZRGURm3trLWixX3ofSy" ], "script": "base64:BgIuCAISBAoCCAgSBAoCCAESAwoBCBIGCgQICAgIEgMKAQgSBgoECAEBARIECgIBAQwADmNvbGxlY3Rpb25OYW1lCQERQGV4dHJOYXRpdmUoMTA1OCkBAg5jb2xsZWN0aW9uTmFtZQAGc3ltYm9sCQERQGV4dHJOYXRpdmUoMTA1OCkBAgZzeW1ib2wAC2Rlc2NyaXB0aW9uCQERQGV4dHJOYXRpdmUoMTA1OCkBAgtkZXNjcmlwdGlvbgALdG90YWxBbW91bnQJARFAZXh0ck5hdGl2ZSgxMDU1KQECC3RvdGFsQW1vdW50AAdiYXNlVVJJCQERQGV4dHJOYXRpdmUoMTA1OCkBAgdiYXNlVVJJAAhkQXBwSnNvbgkBB0FkZHJlc3MBCQDZBAECIzNNckdhWlZSaGtuRUdmSEoxOXR0VVBObkRSb0ZxY0hoVk43AAlsZW5kQ291bnQJARFAZXh0ck5hdGl2ZSgxMDU1KQECCWxlbmRDb3VudAEMb25seUludGVybmFsAQZjYWxsZXIDCQAAAgUGY2FsbGVyBQR0aGlzBQR1bml0CQACAQIST25seSBpbnRlcm5hbCBjYWxsAQ10cmFuc2Zlck9yTm90AgJ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sdWUBBQ90aW1lVW5pdFNlY29uZHMDCQAAAgUSdGltZVVuaXRTZWNvbmRzSW50BRJ0aW1lVW5pdFNlY29uZHNJbnQECHJlbnRKc29uCgABQAkA/AcEBQhkQXBwSnNvbgIIbWFrZUpTT04JAMwIAgkAzAgCAghjdXN0b21lcgkAzAgCAg10aW1lVW5pdENvdW50CQDMCAICDnN0YXJ0VGltZXN0YW1wCQDMCAICDGVuZFRpbWVzdGFtcAkAzAgCAgZjbG9zZWQFA25pbAkAzAgCCQDMCAIJAKUIAQgFAWkGY2FsbGVyCQDMCAIJAKQDAQUNdGltZVVuaXRDb3VudAkAzAgCCQCkAwEIBQlsYXN0QmxvY2sJdGltZXN0YW1wCQDMCAIJAKQDAQkAZAIIBQlsYXN0QmxvY2sJdGltZXN0YW1wCQBoAgUSdGltZVVuaXRTZWNvbmRzSW50BQ10aW1lVW5pdENvdW50CQDMCAICATAFA25pbAUDbmlsBQNuaWwDCQABAgUBQAIGU3RyaW5nBQFACQACAQkArAICCQADAQUBQAIbIGNvdWxkbid0IGJlIGNhc3QgdG8gU3RyaW5nAwkAAAIFCHJlbnRKc29uBQhyZW50SnNvbgkAzAgCCQEMSW50ZWdlckVudHJ5AgkArAICAg9sZW5kLXJlbnRDb3VudC0FDGxlbmRJZFN0cmluZwkAZAIFBnJlbnRJZAABCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgkArAICCQCsAgICCmxlbmQtcmVudC0FDGxlbmRJZFN0cmluZwIBLQUMcmVudElkU3RyaW5nBQhyZW50SnNvbgUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAMl09pU=", "height": 2499917, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5D4csGQEgnVfYtnWxw2QUrq1HTDCKsEi3kAf1fzBKRr1 Next: 4LgSfj2daKsGaDic2KWV5ouEwGWbzKoNrmL7J7qUdFh7 Diff:
Old | New | Differences | |
---|---|---|---|
46 | 46 | ||
47 | 47 | @Callable(i) | |
48 | 48 | func setInt (_key,_value) = [IntegerEntry(_key, _value)] | |
49 | + | ||
50 | + | ||
51 | + | ||
52 | + | @Callable(i) | |
53 | + | func deleteEntry (_key) = [DeleteEntry(_key)] | |
49 | 54 | ||
50 | 55 | ||
51 | 56 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let collectionName = getStringValue("collectionName") | |
5 | 5 | ||
6 | 6 | let symbol = getStringValue("symbol") | |
7 | 7 | ||
8 | 8 | let description = getStringValue("description") | |
9 | 9 | ||
10 | 10 | let totalAmount = getIntegerValue("totalAmount") | |
11 | 11 | ||
12 | 12 | let baseURI = getStringValue("baseURI") | |
13 | 13 | ||
14 | 14 | let dAppJson = Address(fromBase58String("3MrGaZVRhknEGfHJ19ttUPNnDRoFqcHhVN7")) | |
15 | 15 | ||
16 | 16 | let lendCount = getIntegerValue("lendCount") | |
17 | 17 | ||
18 | 18 | func onlyInternal (caller) = if ((caller == this)) | |
19 | 19 | then unit | |
20 | 20 | else throw("Only internal call") | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func transferOrNot (to,assetId) = if ((to == this)) | |
24 | 24 | then StringEntry("smth", "smth") | |
25 | 25 | else ScriptTransfer(to, 1, assetId) | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func parseIdtoAsset (assetId) = valueOrErrorMessage(assetInfo(fromBase58String(assetId)), "Can't find asset by asset id") | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func checkAssetOwner (caller,assetId) = if ((assetBalance(caller, fromBase58String(assetId)) == 1)) | |
32 | 32 | then unit | |
33 | 33 | else throw("Only asset owner") | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func getRentCount (lendId) = { | |
37 | 37 | let lendIdString = toString(lendId) | |
38 | 38 | getIntegerValue(("lend-rentCount-" + lendIdString)) | |
39 | 39 | } | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | @Callable(i) | |
43 | 43 | func setString (_key,_value) = [StringEntry(_key, _value)] | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | ||
47 | 47 | @Callable(i) | |
48 | 48 | func setInt (_key,_value) = [IntegerEntry(_key, _value)] | |
49 | + | ||
50 | + | ||
51 | + | ||
52 | + | @Callable(i) | |
53 | + | func deleteEntry (_key) = [DeleteEntry(_key)] | |
49 | 54 | ||
50 | 55 | ||
51 | 56 | ||
52 | 57 | @Callable(i) | |
53 | 58 | 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)]) | |
54 | 59 | ||
55 | 60 | ||
56 | 61 | ||
57 | 62 | @Callable(i) | |
58 | 63 | func mint (to) = { | |
59 | 64 | let tokenId = (totalAmount + 1) | |
60 | 65 | let tokenIdString = toString(tokenId) | |
61 | 66 | let preName = ((symbol + "#") + tokenIdString) | |
62 | 67 | let name = if ((16 >= size(preName))) | |
63 | 68 | then preName | |
64 | 69 | else tokenIdString | |
65 | 70 | let tokenURI = (baseURI + tokenIdString) | |
66 | 71 | let json = { | |
67 | 72 | let @ = invoke(dAppJson, "makeJSON", [["tokenURI"], [tokenURI]], nil) | |
68 | 73 | if ($isInstanceOf(@, "String")) | |
69 | 74 | then @ | |
70 | 75 | else throw(($getType(@) + " couldn't be cast to String")) | |
71 | 76 | } | |
72 | 77 | let asset = Issue(name, json, 1, 0, false, unit, height) | |
73 | 78 | let assetId = calculateAssetId(asset) | |
74 | 79 | let toAddress = Address(fromBase58String(to)) | |
75 | 80 | let transfer = transferOrNot(toAddress, assetId) | |
76 | 81 | if ((transfer == transfer)) | |
77 | 82 | then [asset, transfer, IntegerEntry("totalAmount", tokenId), StringEntry(name, tokenURI)] | |
78 | 83 | else throw("Strict value is not equal to itself.") | |
79 | 84 | } | |
80 | 85 | ||
81 | 86 | ||
82 | 87 | ||
83 | 88 | @Callable(i) | |
84 | 89 | func initLend (assetId,timeUnitSeconds,timeUnitPrice,timeUnitCount) = valueOrElse(checkAssetOwner(i.caller, assetId), { | |
85 | 90 | let asset = parseIdtoAsset(assetId) | |
86 | 91 | let tokenURI = { | |
87 | 92 | let @ = invoke(dAppJson, "readByJSONKey", [asset.description, "tokenURI"], nil) | |
88 | 93 | if ($isInstanceOf(@, "String")) | |
89 | 94 | then @ | |
90 | 95 | else throw(($getType(@) + " couldn't be cast to String")) | |
91 | 96 | } | |
92 | 97 | if ((tokenURI == tokenURI)) | |
93 | 98 | then { | |
94 | 99 | let lendJson = { | |
95 | 100 | let @ = invoke(dAppJson, "makeJSON", [["supportedInterface", "assetdId", "tokenURI", "owner", "timeUnitSeconds", "timeUnitPrice", "timeUnitCount", "startTimestamp", "endTimestamp", "deposit", "claimed"], ["0", assetId, tokenURI, toString(i.caller), toString(timeUnitSeconds), toString(timeUnitPrice), toString(timeUnitCount), toString(lastBlock.timestamp), toString((lastBlock.timestamp + (timeUnitSeconds * timeUnitCount))), "0", "0"]], nil) | |
96 | 101 | if ($isInstanceOf(@, "String")) | |
97 | 102 | then @ | |
98 | 103 | else throw(($getType(@) + " couldn't be cast to String")) | |
99 | 104 | } | |
100 | 105 | if ((lendJson == lendJson)) | |
101 | 106 | then { | |
102 | 107 | let lendIdString = toString(lendCount) | |
103 | 108 | [IntegerEntry("lendCount", (lendCount + 1)), IntegerEntry(("lend-rentCount-" + lendIdString), 0), StringEntry(("lend-" + lendIdString), lendJson)] | |
104 | 109 | } | |
105 | 110 | else throw("Strict value is not equal to itself.") | |
106 | 111 | } | |
107 | 112 | else throw("Strict value is not equal to itself.") | |
108 | 113 | }) | |
109 | 114 | ||
110 | 115 | ||
111 | 116 | ||
112 | 117 | @Callable(i) | |
113 | 118 | func initRent (lendId,timeUnitCount) = { | |
114 | 119 | let lendIdString = toString(lendId) | |
115 | 120 | let lendJson = getStringValue(("lend-" + lendIdString)) | |
116 | 121 | let rentId = getRentCount(lendId) | |
117 | 122 | let rentIdString = toString(rentId) | |
118 | 123 | let timeUnitSeconds = { | |
119 | 124 | let @ = invoke(dAppJson, "readByJSONKey", [lendJson, "timeUnitSeconds"], nil) | |
120 | 125 | if ($isInstanceOf(@, "String")) | |
121 | 126 | then @ | |
122 | 127 | else throw(($getType(@) + " couldn't be cast to String")) | |
123 | 128 | } | |
124 | 129 | if ((timeUnitSeconds == timeUnitSeconds)) | |
125 | 130 | then { | |
126 | 131 | let timeUnitSecondsInt = parseIntValue(timeUnitSeconds) | |
127 | 132 | if ((timeUnitSecondsInt == timeUnitSecondsInt)) | |
128 | 133 | then { | |
129 | 134 | let rentJson = { | |
130 | 135 | let @ = invoke(dAppJson, "makeJSON", [["customer", "timeUnitCount", "startTimestamp", "endTimestamp", "closed"], [toString(i.caller), toString(timeUnitCount), toString(lastBlock.timestamp), toString((lastBlock.timestamp + (timeUnitSecondsInt * timeUnitCount))), "0"]], nil) | |
131 | 136 | if ($isInstanceOf(@, "String")) | |
132 | 137 | then @ | |
133 | 138 | else throw(($getType(@) + " couldn't be cast to String")) | |
134 | 139 | } | |
135 | 140 | if ((rentJson == rentJson)) | |
136 | 141 | then [IntegerEntry(("lend-rentCount-" + lendIdString), (rentId + 1)), StringEntry(((("lend-rent-" + lendIdString) + "-") + rentIdString), rentJson)] | |
137 | 142 | else throw("Strict value is not equal to itself.") | |
138 | 143 | } | |
139 | 144 | else throw("Strict value is not equal to itself.") | |
140 | 145 | } | |
141 | 146 | else throw("Strict value is not equal to itself.") | |
142 | 147 | } | |
143 | 148 | ||
144 | 149 |
github/deemru/w8io/169f3d6 34.27 ms ◑