tx · AiNgrN5Z8DTeANk9oSHSHxGrrTSvfiYuCj5NyUtPAPks 3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb: -0.00700000 Waves 2023.03.17 17:02 [2494090] smart account 3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb > SELF 0.00000000 Waves
{ "type": 13, "id": "AiNgrN5Z8DTeANk9oSHSHxGrrTSvfiYuCj5NyUtPAPks", "fee": 700000, "feeAssetId": null, "timestamp": 1679061794502, "version": 2, "chainId": 84, "sender": "3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb", "senderPublicKey": "2VQGRNRWyFAZvjDtkgZwdZcTwZvBJJ61n8zJfYYxm5eK", "proofs": [ "5tMeasXQmeCjt2AXSAWYCyg9RZgkefYYXXJLkFuBhLxCdZA5dsRufmXwhWTaDieGfPxino5nCdA6bL3DGtZCf4fX" ], "script": "base64:BgJVCAISBAoCGBgSBQoDCBgYEgQKAggIEgQKAggIEgQKAggIEgUKAwgICBIDCgECEgMKAQgSBAoCCAgSBQoDCAgIEgQKAggIEgYKBAgBAQESBgoECAEBAQoADmNvbGxlY3Rpb25OYW1lCQERQGV4dHJOYXRpdmUoMTA1OCkBAg5jb2xsZWN0aW9uTmFtZQAGc3ltYm9sCQERQGV4dHJOYXRpdmUoMTA1OCkBAgZzeW1ib2wAC2Rlc2NyaXB0aW9uCQERQGV4dHJOYXRpdmUoMTA1OCkBAgtkZXNjcmlwdGlvbgALdG90YWxBbW91bnQJARFAZXh0ck5hdGl2ZSgxMDU1KQECC3RvdGFsQW1vdW50AAhkQXBwSnNvbgkBB0FkZHJlc3MBCQDZBAECIzNNckdhWlZSaGtuRUdmSEoxOXR0VVBObkRSb0ZxY0hoVk43AAx0b2tlblBheW1lbnQJAQdBZGRyZXNzAQkBEUBleHRyTmF0aXZlKDEwNTcpAQIMdG9rZW5QYXltZW50AQxvbmx5SW50ZXJuYWwBBmNhbGxlcgMJAAACBQZjYWxsZXIFBHRoaXM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AMJAAECBQFAAgZTdHJpbmcFAUAJAAIBCQCsAgIJAAMBBQFAAhsgY291bGRuJ3QgYmUgY2FzdCB0byBTdHJpbmcDCQAAAgUEbWFrZQUEbWFrZQQGaW5zZXJ0CgABQAkA/AcEBQhkQXBwSnNvbgIJYWRkVG9KU09OCQDMCAIIBQZkZWxldGUCXzIJAMwIAgkAzAgCBQZsZW5kSWQJAMwIAgIJbGVuZENvdW50BQNuaWwJAMwIAgkAzAgCBQRtYWtlCQDMCAIFCG5ld0NvdW50BQNuaWwFA25pbAUDbmlsAwkAAQIFAUACBlN0cmluZwUBQAkAAgEJAKwCAgkAAwEFAUACGyBjb3VsZG4ndCBiZSBjYXN0IHRvIFN0cmluZwMJAAACBQZpbnNlcnQFBmluc2VydAkAzAgCCQELU3RyaW5nRW50cnkCAgVMZW5kcwUGaW5zZXJ0BQNuaWwJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4ANVEu0w==", "height": 2494090, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2vQTGyNue4umHeujUbxiBSXfFwevACf8Z5AuN3qKjfFL Next: 5mtLk5yDbhh7ZsS8NNH5W3B1B2vrjSL5KmL1rqxpEwh4 Diff:
Old | New | Differences | |
---|---|---|---|
112 | 112 | ||
113 | 113 | ||
114 | 114 | @Callable(i) | |
115 | - | func mint (to,tokenURI) = | |
115 | + | func mint (to,tokenURI) = { | |
116 | 116 | let tokenId = (totalAmount + 1) | |
117 | 117 | let preName = ((symbol + "#") + toString(tokenId)) | |
118 | 118 | let name = if ((16 >= size(preName))) | |
131 | 131 | if ((transfer == transfer)) | |
132 | 132 | then [asset, transfer, IntegerEntry("totalAmount", tokenId), StringEntry(name, tokenURI)] | |
133 | 133 | else throw("Strict value is not equal to itself.") | |
134 | - | } | |
134 | + | } | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | ||
168 | 168 | else throw(($getType(@) + " couldn't be cast to String")) | |
169 | 169 | } | |
170 | 170 | if ((insert == insert)) | |
171 | - | then [StringEntry("Debug1", delete._2), StringEntry("Debug2", lendId), StringEntry("Debug3", make), StringEntry("Debug4", newCount), StringEntry("Lends", insert)] | |
171 | + | then [StringEntry("Lends", insert)] | |
172 | + | else throw("Strict value is not equal to itself.") | |
173 | + | } | |
174 | + | else throw("Strict value is not equal to itself.") | |
175 | + | }) | |
176 | + | ||
177 | + | ||
178 | + | ||
179 | + | @Callable(i) | |
180 | + | func initRent (assetId,timeUnitSeconds,timeUnitPrice,timeUnitCount) = valueOrElse(checkAssetOwner(i.caller, assetId), { | |
181 | + | let asset = parseIdtoAsset(assetId) | |
182 | + | let tokenURI = { | |
183 | + | let @ = invoke(dAppJson, "readByJSONKey", [asset.description, "tokenURI"], nil) | |
184 | + | if ($isInstanceOf(@, "String")) | |
185 | + | then @ | |
186 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
187 | + | } | |
188 | + | let lends = getStringValue("Lends") | |
189 | + | let delete = { | |
190 | + | let @ = invoke(dAppJson, "deleteByJSONKey", [lends, "lendCount"], nil) | |
191 | + | if ($isInstanceOf(@, "(String, String)")) | |
192 | + | then @ | |
193 | + | else throw(($getType(@) + " couldn't be cast to (String, String)")) | |
194 | + | } | |
195 | + | let lendId = delete._1 | |
196 | + | let newCount = toString((parseIntValue(lendId) + 1)) | |
197 | + | let make = { | |
198 | + | let @ = invoke(dAppJson, "makeJSON", [["supportedInterface", "assetdId", "tokenURI", "owner", "timeUnitSeconds", "timeUnitPrice", "timeUnitCount", "startTimestamp", "endTimestamp", "deposit", "claimed", "rents"], ["0", assetId, tokenURI, toString(i.caller), toString(timeUnitSeconds), toString(timeUnitPrice), toString(timeUnitCount), toString(lastBlock.timestamp), toString((lastBlock.timestamp + (timeUnitSeconds * timeUnitCount))), "0", "0", "{\"rentCount\":\"0\"}"]], nil) | |
199 | + | if ($isInstanceOf(@, "String")) | |
200 | + | then @ | |
201 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
202 | + | } | |
203 | + | if ((make == make)) | |
204 | + | then { | |
205 | + | let insert = { | |
206 | + | let @ = invoke(dAppJson, "addToJSON", [delete._2, [lendId, "lendCount"], [make, newCount]], nil) | |
207 | + | if ($isInstanceOf(@, "String")) | |
208 | + | then @ | |
209 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
210 | + | } | |
211 | + | if ((insert == insert)) | |
212 | + | then [StringEntry("Lends", insert)] | |
172 | 213 | else throw("Strict value is not equal to itself.") | |
173 | 214 | } | |
174 | 215 | else throw("Strict value is not equal to itself.") |
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 dAppJson = Address(fromBase58String("3MrGaZVRhknEGfHJ19ttUPNnDRoFqcHhVN7")) | |
13 | 13 | ||
14 | 14 | let tokenPayment = Address(getBinaryValue("tokenPayment")) | |
15 | 15 | ||
16 | 16 | func onlyInternal (caller) = if ((caller == this)) | |
17 | 17 | then unit | |
18 | 18 | else throw("Only internal call") | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | func transferOrNot (to,assetId) = if ((to == this)) | |
22 | 22 | then StringEntry("костыль", "костыль") | |
23 | 23 | else ScriptTransfer(to, 1, assetId) | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func parseIdtoAsset (assetId) = valueOrErrorMessage(assetInfo(fromBase58String(assetId)), "Can't find asset by asset id") | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func checkAssetOwner (caller,assetId) = if ((assetBalance(caller, fromBase58String(assetId)) == 1)) | |
30 | 30 | then unit | |
31 | 31 | else throw("Only asset owner") | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | @Callable(i) | |
35 | 35 | func makeJSONInternal (arrKeys,arrValues) = valueOrElse(onlyInternal(i.caller), { | |
36 | 36 | let res = invoke(dAppJson, "makeJSON", [arrKeys, arrValues], nil) | |
37 | 37 | if ((res == res)) | |
38 | 38 | then $Tuple2(nil, res) | |
39 | 39 | else throw("Strict value is not equal to itself.") | |
40 | 40 | }) | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | ||
44 | 44 | @Callable(i) | |
45 | 45 | func addToJSONInternal (json,arrKeys,arrValues) = valueOrElse(onlyInternal(i.caller), { | |
46 | 46 | let res = invoke(dAppJson, "addToJSON", [json, arrKeys, arrValues], nil) | |
47 | 47 | if ((res == res)) | |
48 | 48 | then $Tuple2(nil, res) | |
49 | 49 | else throw("Strict value is not equal to itself.") | |
50 | 50 | }) | |
51 | 51 | ||
52 | 52 | ||
53 | 53 | ||
54 | 54 | @Callable(i) | |
55 | 55 | func readByJSONKeyInternal (json,key) = valueOrElse(onlyInternal(i.caller), { | |
56 | 56 | let res = invoke(dAppJson, "readByJSONKey", [json, key], nil) | |
57 | 57 | if ((res == res)) | |
58 | 58 | then $Tuple2(nil, res) | |
59 | 59 | else throw("Strict value is not equal to itself.") | |
60 | 60 | }) | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | ||
64 | 64 | @Callable(i) | |
65 | 65 | func deleteByJSONKeyInternal (json,key) = valueOrElse(onlyInternal(i.caller), { | |
66 | 66 | let res = invoke(dAppJson, "deleteByJSONKey", [json, key], nil) | |
67 | 67 | if ((res == res)) | |
68 | 68 | then $Tuple2(nil, res) | |
69 | 69 | else throw("Strict value is not equal to itself.") | |
70 | 70 | }) | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | ||
74 | 74 | @Callable(i) | |
75 | 75 | func storageJsonInternal (jsonKey,jsonString) = valueOrElse(onlyInternal(i.caller), [StringEntry(jsonKey, jsonString)]) | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | ||
79 | 79 | @Callable(i) | |
80 | 80 | func setUser (assetId,user,expires) = { | |
81 | 81 | let res = invoke(dAppJson, "makeJSON", [["user", "expires"], [user, expires]], nil) | |
82 | 82 | if ((res == res)) | |
83 | 83 | then $Tuple2([StringEntry(("userOf-" + assetId), { | |
84 | 84 | let @ = res | |
85 | 85 | if ($isInstanceOf(@, "String")) | |
86 | 86 | then @ | |
87 | 87 | else throw(($getType(@) + " couldn't be cast to String")) | |
88 | 88 | })], res) | |
89 | 89 | else throw("Strict value is not equal to itself.") | |
90 | 90 | } | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | ||
94 | 94 | @Callable(i) | |
95 | 95 | func setTokenPayment (assetId) = valueOrElse(onlyInternal(i.caller), [BinaryEntry("tokenPayment", assetId)]) | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | ||
99 | 99 | @Callable(i) | |
100 | 100 | func deleteValueByKey (key) = valueOrElse(onlyInternal(i.caller), [DeleteEntry(key)]) | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | ||
104 | 104 | @Callable(i) | |
105 | 105 | func setString (key,value) = valueOrElse(onlyInternal(i.caller), [StringEntry(key, value)]) | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | ||
109 | 109 | @Callable(i) | |
110 | 110 | func init (collectionName,symbol,description) = valueOrElse(onlyInternal(i.caller), [StringEntry("collectionName", collectionName), StringEntry("symbol", symbol), StringEntry("description", description), IntegerEntry("totalAmount", 0)]) | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | ||
114 | 114 | @Callable(i) | |
115 | - | func mint (to,tokenURI) = | |
115 | + | func mint (to,tokenURI) = { | |
116 | 116 | let tokenId = (totalAmount + 1) | |
117 | 117 | let preName = ((symbol + "#") + toString(tokenId)) | |
118 | 118 | let name = if ((16 >= size(preName))) | |
119 | 119 | then preName | |
120 | 120 | else toString(tokenId) | |
121 | 121 | let json = { | |
122 | 122 | let @ = invoke(dAppJson, "makeJSON", [["tokenURI"], [tokenURI]], nil) | |
123 | 123 | if ($isInstanceOf(@, "String")) | |
124 | 124 | then @ | |
125 | 125 | else throw(($getType(@) + " couldn't be cast to String")) | |
126 | 126 | } | |
127 | 127 | let asset = Issue(name, json, 1, 0, false, unit, height) | |
128 | 128 | let assetId = calculateAssetId(asset) | |
129 | 129 | let toAddress = Address(fromBase58String(to)) | |
130 | 130 | let transfer = transferOrNot(toAddress, assetId) | |
131 | 131 | if ((transfer == transfer)) | |
132 | 132 | then [asset, transfer, IntegerEntry("totalAmount", tokenId), StringEntry(name, tokenURI)] | |
133 | 133 | else throw("Strict value is not equal to itself.") | |
134 | - | } | |
134 | + | } | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | ||
138 | 138 | @Callable(i) | |
139 | 139 | func initLend (assetId,timeUnitSeconds,timeUnitPrice,timeUnitCount) = valueOrElse(checkAssetOwner(i.caller, assetId), { | |
140 | 140 | let asset = parseIdtoAsset(assetId) | |
141 | 141 | let tokenURI = { | |
142 | 142 | let @ = invoke(dAppJson, "readByJSONKey", [asset.description, "tokenURI"], nil) | |
143 | 143 | if ($isInstanceOf(@, "String")) | |
144 | 144 | then @ | |
145 | 145 | else throw(($getType(@) + " couldn't be cast to String")) | |
146 | 146 | } | |
147 | 147 | let lends = getStringValue("Lends") | |
148 | 148 | let delete = { | |
149 | 149 | let @ = invoke(dAppJson, "deleteByJSONKey", [lends, "lendCount"], nil) | |
150 | 150 | if ($isInstanceOf(@, "(String, String)")) | |
151 | 151 | then @ | |
152 | 152 | else throw(($getType(@) + " couldn't be cast to (String, String)")) | |
153 | 153 | } | |
154 | 154 | let lendId = delete._1 | |
155 | 155 | let newCount = toString((parseIntValue(lendId) + 1)) | |
156 | 156 | let make = { | |
157 | 157 | let @ = invoke(dAppJson, "makeJSON", [["supportedInterface", "assetdId", "tokenURI", "owner", "timeUnitSeconds", "timeUnitPrice", "timeUnitCount", "startTimestamp", "endTimestamp", "deposit", "claimed", "rents"], ["0", assetId, tokenURI, toString(i.caller), toString(timeUnitSeconds), toString(timeUnitPrice), toString(timeUnitCount), toString(lastBlock.timestamp), toString((lastBlock.timestamp + (timeUnitSeconds * timeUnitCount))), "0", "0", "{\"rentCount\":\"0\"}"]], nil) | |
158 | 158 | if ($isInstanceOf(@, "String")) | |
159 | 159 | then @ | |
160 | 160 | else throw(($getType(@) + " couldn't be cast to String")) | |
161 | 161 | } | |
162 | 162 | if ((make == make)) | |
163 | 163 | then { | |
164 | 164 | let insert = { | |
165 | 165 | let @ = invoke(dAppJson, "addToJSON", [delete._2, [lendId, "lendCount"], [make, newCount]], nil) | |
166 | 166 | if ($isInstanceOf(@, "String")) | |
167 | 167 | then @ | |
168 | 168 | else throw(($getType(@) + " couldn't be cast to String")) | |
169 | 169 | } | |
170 | 170 | if ((insert == insert)) | |
171 | - | then [StringEntry("Debug1", delete._2), StringEntry("Debug2", lendId), StringEntry("Debug3", make), StringEntry("Debug4", newCount), StringEntry("Lends", insert)] | |
171 | + | then [StringEntry("Lends", insert)] | |
172 | + | else throw("Strict value is not equal to itself.") | |
173 | + | } | |
174 | + | else throw("Strict value is not equal to itself.") | |
175 | + | }) | |
176 | + | ||
177 | + | ||
178 | + | ||
179 | + | @Callable(i) | |
180 | + | func initRent (assetId,timeUnitSeconds,timeUnitPrice,timeUnitCount) = valueOrElse(checkAssetOwner(i.caller, assetId), { | |
181 | + | let asset = parseIdtoAsset(assetId) | |
182 | + | let tokenURI = { | |
183 | + | let @ = invoke(dAppJson, "readByJSONKey", [asset.description, "tokenURI"], nil) | |
184 | + | if ($isInstanceOf(@, "String")) | |
185 | + | then @ | |
186 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
187 | + | } | |
188 | + | let lends = getStringValue("Lends") | |
189 | + | let delete = { | |
190 | + | let @ = invoke(dAppJson, "deleteByJSONKey", [lends, "lendCount"], nil) | |
191 | + | if ($isInstanceOf(@, "(String, String)")) | |
192 | + | then @ | |
193 | + | else throw(($getType(@) + " couldn't be cast to (String, String)")) | |
194 | + | } | |
195 | + | let lendId = delete._1 | |
196 | + | let newCount = toString((parseIntValue(lendId) + 1)) | |
197 | + | let make = { | |
198 | + | let @ = invoke(dAppJson, "makeJSON", [["supportedInterface", "assetdId", "tokenURI", "owner", "timeUnitSeconds", "timeUnitPrice", "timeUnitCount", "startTimestamp", "endTimestamp", "deposit", "claimed", "rents"], ["0", assetId, tokenURI, toString(i.caller), toString(timeUnitSeconds), toString(timeUnitPrice), toString(timeUnitCount), toString(lastBlock.timestamp), toString((lastBlock.timestamp + (timeUnitSeconds * timeUnitCount))), "0", "0", "{\"rentCount\":\"0\"}"]], nil) | |
199 | + | if ($isInstanceOf(@, "String")) | |
200 | + | then @ | |
201 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
202 | + | } | |
203 | + | if ((make == make)) | |
204 | + | then { | |
205 | + | let insert = { | |
206 | + | let @ = invoke(dAppJson, "addToJSON", [delete._2, [lendId, "lendCount"], [make, newCount]], nil) | |
207 | + | if ($isInstanceOf(@, "String")) | |
208 | + | then @ | |
209 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
210 | + | } | |
211 | + | if ((insert == insert)) | |
212 | + | then [StringEntry("Lends", insert)] | |
172 | 213 | else throw("Strict value is not equal to itself.") | |
173 | 214 | } | |
174 | 215 | else throw("Strict value is not equal to itself.") | |
175 | 216 | }) | |
176 | 217 | ||
177 | 218 |
github/deemru/w8io/169f3d6 44.11 ms ◑