tx · Dm7A3MW91DxkKcPe4AxFusKkQ1UV3BmfLbRWRfFbwnSJ 3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb: -0.00600000 Waves 2023.03.17 20:14 [2494290] smart account 3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb > SELF 0.00000000 Waves
{ "type": 13, "id": "Dm7A3MW91DxkKcPe4AxFusKkQ1UV3BmfLbRWRfFbwnSJ", "fee": 600000, "feeAssetId": null, "timestamp": 1679073253197, "version": 2, "chainId": 84, "sender": "3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb", "senderPublicKey": "2VQGRNRWyFAZvjDtkgZwdZcTwZvBJJ61n8zJfYYxm5eK", "proofs": [ "4PDcAAHBda5Evuk7jcTMiFLkRpcMLLaRdQwgcS43vCTb11m3Pspo4c4CzTqyfMsoSXmXaWAqZrQje7wtnDaJ5Aks" ], "script": "base64:BgJTCAISBAoCGBgSBQoDCBgYEgQKAggIEgQKAggIEgQKAggIEgUKAwgICBIDCgECEgMKAQgSBAoCCAgSBQoDCAgIEgQKAggIEgYKBAgBAQESBAoCAQEKAA5jb2xsZWN0aW9uTmFtZQkBEUBleHRyTmF0aXZlKDEwNTgpAQIOY29sbGVjdGlvbk5hbWUABnN5bWJvbAkBEUBleHRyTmF0aXZlKDEwNTgpAQIGc3ltYm9sAAtkZXNjcmlwdGlvbgkBEUBleHRyTmF0aXZlKDEwNTgpAQILZGVzY3JpcHRpb24AC3RvdGFsQW1vdW50CQERQGV4dHJOYXRpdmUoMTA1NSkBAgt0b3RhbEFtb3VudAAIZEFwcEpzb24JAQdBZGRyZXNzAQkA2QQBAiMzTXJHYVpWUmhrbkVHZkhKMTl0dFVQTm5EUm9GcWNIaFZONwAMdG9rZW5QYXltZW50CQEHQWRkcmVzcwEJARFAZXh0ck5hdGl2ZSgxMDU3KQECDHRva2VuUGF5bWVudAEMb25seUludGVybmFsAQZjYWxsZXIDCQAAAgUGY2FsbGVyBQR0aGlz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IlIGNvdWxkbid0IGJlIGNhc3QgdG8gKFN0cmluZywgU3RyaW5nKQMJAAACBQ9kZWxldGVMZW5kQ291bnQFD2RlbGV0ZUxlbmRDb3VudAUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAOuofDQ=", "height": 2494290, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5mtLk5yDbhh7ZsS8NNH5W3B1B2vrjSL5KmL1rqxpEwh4 Next: 74gWiNLeHK3PfEpamv3RDRrdqFC5M8CSBkesQ6wXMRQJ Diff:
Old | New | Differences | |
---|---|---|---|
195 | 195 | else throw(($getType(@) + " couldn't be cast to (String, String)")) | |
196 | 196 | } | |
197 | 197 | if ((deleteLendCount == deleteLendCount)) | |
198 | - | then { | |
199 | - | let deleteLend = { | |
200 | - | let @ = invoke(dAppJson, "deleteByJSONKey", [deleteLendCount._2, lendIdString], nil) | |
201 | - | if ($isInstanceOf(@, "(String, String)")) | |
202 | - | then @ | |
203 | - | else throw(($getType(@) + " couldn't be cast to (String, String)")) | |
204 | - | } | |
205 | - | if ((deleteLend == deleteLend)) | |
206 | - | then { | |
207 | - | let deleteRents = { | |
208 | - | let @ = invoke(dAppJson, "deleteByJSONKey", [deleteLend._1, "rents"], nil) | |
209 | - | if ($isInstanceOf(@, "(String, String)")) | |
210 | - | then @ | |
211 | - | else throw(($getType(@) + " couldn't be cast to (String, String)")) | |
212 | - | } | |
213 | - | if ((deleteRents == deleteRents)) | |
214 | - | then { | |
215 | - | let deleteRentCount = { | |
216 | - | let @ = invoke(dAppJson, "deleteByJSONKey", [deleteRents._1, "rentCount"], nil) | |
217 | - | if ($isInstanceOf(@, "(String, String)")) | |
218 | - | then @ | |
219 | - | else throw(($getType(@) + " couldn't be cast to (String, String)")) | |
220 | - | } | |
221 | - | if ((deleteRentCount == deleteRentCount)) | |
222 | - | then { | |
223 | - | let rentId = deleteRentCount._1 | |
224 | - | let newLendCount = toString((parseIntValue(deleteLendCount._1) + 1)) | |
225 | - | let newRentCount = toString((parseIntValue(rentId) + 1)) | |
226 | - | let timeUnitSeconds = parseIntValue({ | |
227 | - | let @ = invoke(dAppJson, "readByJSONKey", [deleteRents._2, "timeUnitSeconds"], nil) | |
228 | - | if ($isInstanceOf(@, "String")) | |
229 | - | then @ | |
230 | - | else throw(($getType(@) + " couldn't be cast to String")) | |
231 | - | }) | |
232 | - | if ((timeUnitSeconds == timeUnitSeconds)) | |
233 | - | then { | |
234 | - | let rentJson = { | |
235 | - | let @ = invoke(dAppJson, "makeJSON", [["customer", "timeUnitCount", "startTimestamp", "endTimestamp", "closed"], [toString(i.caller), "0", timeUnitCount, toString(lastBlock.timestamp), toString((lastBlock.timestamp + (timeUnitSeconds * timeUnitCount))), "0"]], nil) | |
236 | - | if ($isInstanceOf(@, "String")) | |
237 | - | then @ | |
238 | - | else throw(($getType(@) + " couldn't be cast to String")) | |
239 | - | } | |
240 | - | if ((rentJson == rentJson)) | |
241 | - | then { | |
242 | - | let newRentsJson = invoke(dAppJson, "addToJSON", [deleteRentCount._2, [rentId, "rentCount"], [rentJson, newRentCount]], nil) | |
243 | - | if ((newRentsJson == newRentsJson)) | |
244 | - | then { | |
245 | - | let newLendJson = invoke(dAppJson, "addToJSON", [deleteRents._2, ["rents"], [newRentsJson]], nil) | |
246 | - | if ((newLendJson == newLendJson)) | |
247 | - | then { | |
248 | - | let insert = { | |
249 | - | let @ = invoke(dAppJson, "addToJSON", [deleteLend._2, [lendId, "lendCount"], [newLendJson, newLendCount]], nil) | |
250 | - | if ($isInstanceOf(@, "String")) | |
251 | - | then @ | |
252 | - | else throw(($getType(@) + " couldn't be cast to String")) | |
253 | - | } | |
254 | - | if ((insert == insert)) | |
255 | - | then [StringEntry("Lends", insert)] | |
256 | - | else throw("Strict value is not equal to itself.") | |
257 | - | } | |
258 | - | else throw("Strict value is not equal to itself.") | |
259 | - | } | |
260 | - | else throw("Strict value is not equal to itself.") | |
261 | - | } | |
262 | - | else throw("Strict value is not equal to itself.") | |
263 | - | } | |
264 | - | else throw("Strict value is not equal to itself.") | |
265 | - | } | |
266 | - | else throw("Strict value is not equal to itself.") | |
267 | - | } | |
268 | - | else throw("Strict value is not equal to itself.") | |
269 | - | } | |
270 | - | else throw("Strict value is not equal to itself.") | |
271 | - | } | |
198 | + | then nil | |
272 | 199 | else throw("Strict value is not equal to itself.") | |
273 | 200 | } | |
274 | 201 |
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 | 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 | if ((tokenURI == tokenURI)) | |
148 | 148 | then { | |
149 | 149 | let lends = getStringValue("Lends") | |
150 | 150 | let delete = { | |
151 | 151 | let @ = invoke(dAppJson, "deleteByJSONKey", [lends, "lendCount"], nil) | |
152 | 152 | if ($isInstanceOf(@, "(String, String)")) | |
153 | 153 | then @ | |
154 | 154 | else throw(($getType(@) + " couldn't be cast to (String, String)")) | |
155 | 155 | } | |
156 | 156 | if ((delete == delete)) | |
157 | 157 | then { | |
158 | 158 | let lendId = delete._1 | |
159 | 159 | let newCount = toString((parseIntValue(lendId) + 1)) | |
160 | 160 | let make = { | |
161 | 161 | 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) | |
162 | 162 | if ($isInstanceOf(@, "String")) | |
163 | 163 | then @ | |
164 | 164 | else throw(($getType(@) + " couldn't be cast to String")) | |
165 | 165 | } | |
166 | 166 | if ((make == make)) | |
167 | 167 | then { | |
168 | 168 | let insert = { | |
169 | 169 | let @ = invoke(dAppJson, "addToJSON", [delete._2, [lendId, "lendCount"], [make, newCount]], nil) | |
170 | 170 | if ($isInstanceOf(@, "String")) | |
171 | 171 | then @ | |
172 | 172 | else throw(($getType(@) + " couldn't be cast to String")) | |
173 | 173 | } | |
174 | 174 | if ((insert == insert)) | |
175 | 175 | then [StringEntry("Lends", insert)] | |
176 | 176 | else throw("Strict value is not equal to itself.") | |
177 | 177 | } | |
178 | 178 | else throw("Strict value is not equal to itself.") | |
179 | 179 | } | |
180 | 180 | else throw("Strict value is not equal to itself.") | |
181 | 181 | } | |
182 | 182 | else throw("Strict value is not equal to itself.") | |
183 | 183 | }) | |
184 | 184 | ||
185 | 185 | ||
186 | 186 | ||
187 | 187 | @Callable(i) | |
188 | 188 | func initRent (lendId,timeUnitCount) = { | |
189 | 189 | let lendIdString = toString(lendId) | |
190 | 190 | let lends = getStringValue("Lends") | |
191 | 191 | let deleteLendCount = { | |
192 | 192 | let @ = invoke(dAppJson, "deleteByJSONKey", [lends, "lendCount"], nil) | |
193 | 193 | if ($isInstanceOf(@, "(String, String)")) | |
194 | 194 | then @ | |
195 | 195 | else throw(($getType(@) + " couldn't be cast to (String, String)")) | |
196 | 196 | } | |
197 | 197 | if ((deleteLendCount == deleteLendCount)) | |
198 | - | then { | |
199 | - | let deleteLend = { | |
200 | - | let @ = invoke(dAppJson, "deleteByJSONKey", [deleteLendCount._2, lendIdString], nil) | |
201 | - | if ($isInstanceOf(@, "(String, String)")) | |
202 | - | then @ | |
203 | - | else throw(($getType(@) + " couldn't be cast to (String, String)")) | |
204 | - | } | |
205 | - | if ((deleteLend == deleteLend)) | |
206 | - | then { | |
207 | - | let deleteRents = { | |
208 | - | let @ = invoke(dAppJson, "deleteByJSONKey", [deleteLend._1, "rents"], nil) | |
209 | - | if ($isInstanceOf(@, "(String, String)")) | |
210 | - | then @ | |
211 | - | else throw(($getType(@) + " couldn't be cast to (String, String)")) | |
212 | - | } | |
213 | - | if ((deleteRents == deleteRents)) | |
214 | - | then { | |
215 | - | let deleteRentCount = { | |
216 | - | let @ = invoke(dAppJson, "deleteByJSONKey", [deleteRents._1, "rentCount"], nil) | |
217 | - | if ($isInstanceOf(@, "(String, String)")) | |
218 | - | then @ | |
219 | - | else throw(($getType(@) + " couldn't be cast to (String, String)")) | |
220 | - | } | |
221 | - | if ((deleteRentCount == deleteRentCount)) | |
222 | - | then { | |
223 | - | let rentId = deleteRentCount._1 | |
224 | - | let newLendCount = toString((parseIntValue(deleteLendCount._1) + 1)) | |
225 | - | let newRentCount = toString((parseIntValue(rentId) + 1)) | |
226 | - | let timeUnitSeconds = parseIntValue({ | |
227 | - | let @ = invoke(dAppJson, "readByJSONKey", [deleteRents._2, "timeUnitSeconds"], nil) | |
228 | - | if ($isInstanceOf(@, "String")) | |
229 | - | then @ | |
230 | - | else throw(($getType(@) + " couldn't be cast to String")) | |
231 | - | }) | |
232 | - | if ((timeUnitSeconds == timeUnitSeconds)) | |
233 | - | then { | |
234 | - | let rentJson = { | |
235 | - | let @ = invoke(dAppJson, "makeJSON", [["customer", "timeUnitCount", "startTimestamp", "endTimestamp", "closed"], [toString(i.caller), "0", timeUnitCount, toString(lastBlock.timestamp), toString((lastBlock.timestamp + (timeUnitSeconds * timeUnitCount))), "0"]], nil) | |
236 | - | if ($isInstanceOf(@, "String")) | |
237 | - | then @ | |
238 | - | else throw(($getType(@) + " couldn't be cast to String")) | |
239 | - | } | |
240 | - | if ((rentJson == rentJson)) | |
241 | - | then { | |
242 | - | let newRentsJson = invoke(dAppJson, "addToJSON", [deleteRentCount._2, [rentId, "rentCount"], [rentJson, newRentCount]], nil) | |
243 | - | if ((newRentsJson == newRentsJson)) | |
244 | - | then { | |
245 | - | let newLendJson = invoke(dAppJson, "addToJSON", [deleteRents._2, ["rents"], [newRentsJson]], nil) | |
246 | - | if ((newLendJson == newLendJson)) | |
247 | - | then { | |
248 | - | let insert = { | |
249 | - | let @ = invoke(dAppJson, "addToJSON", [deleteLend._2, [lendId, "lendCount"], [newLendJson, newLendCount]], nil) | |
250 | - | if ($isInstanceOf(@, "String")) | |
251 | - | then @ | |
252 | - | else throw(($getType(@) + " couldn't be cast to String")) | |
253 | - | } | |
254 | - | if ((insert == insert)) | |
255 | - | then [StringEntry("Lends", insert)] | |
256 | - | else throw("Strict value is not equal to itself.") | |
257 | - | } | |
258 | - | else throw("Strict value is not equal to itself.") | |
259 | - | } | |
260 | - | else throw("Strict value is not equal to itself.") | |
261 | - | } | |
262 | - | else throw("Strict value is not equal to itself.") | |
263 | - | } | |
264 | - | else throw("Strict value is not equal to itself.") | |
265 | - | } | |
266 | - | else throw("Strict value is not equal to itself.") | |
267 | - | } | |
268 | - | else throw("Strict value is not equal to itself.") | |
269 | - | } | |
270 | - | else throw("Strict value is not equal to itself.") | |
271 | - | } | |
198 | + | then nil | |
272 | 199 | else throw("Strict value is not equal to itself.") | |
273 | 200 | } | |
274 | 201 | ||
275 | 202 |
github/deemru/w8io/169f3d6 34.20 ms ◑