tx · 4Q4yMXF3s6DtSkBqMmwJzGBXdyNSQHqyBhoxE47eP5bv

3MxVYj6ScMArhAamy7nB6b342kh1Pso1LTn:  -0.00700000 Waves

2023.03.21 21:26 [2500131] smart account 3MxVYj6ScMArhAamy7nB6b342kh1Pso1LTn > SELF 0.00000000 Waves

{ "type": 13, "id": "4Q4yMXF3s6DtSkBqMmwJzGBXdyNSQHqyBhoxE47eP5bv", "fee": 700000, "feeAssetId": null, "timestamp": 1679423103563, "version": 2, "chainId": 84, "sender": "3MxVYj6ScMArhAamy7nB6b342kh1Pso1LTn", "senderPublicKey": "CZeucjRLCKrkiP9zuj9KbLe23Wv9DywFzHBqNDnte51B", "proofs": [ "5MBfem38Fe1mSuN37VfFV6N5fM5uyhsvZ4v429gUs6V6gciNcTMSR8VYERoSmXu8eFepnvNoLxzZBQePV5Rrkiup" ], "script": "base64:BgI/CAISBAoCCAgSBAoCCAESAwoBCBIGCgQICAgIEgUKAwgICBIDCgECEgMKAQgSBgoECAEBARIECgIBARIDCgEIFAAOY29sbGVjdGlvbk5hbWUJARFAZXh0ck5hdGl2ZSgxMDU4KQECDmNvbGxlY3Rpb25OYW1lAAZzeW1ib2wJARFAZXh0ck5hdGl2ZSgxMDU4KQECBnN5bWJvbAALZGVzY3JpcHRpb24JARFAZXh0ck5hdGl2ZSgxMDU4KQECC2Rlc2NyaXB0aW9uAAt0b3RhbEFtb3VudAkBEUBleHRyTmF0aXZlKDEwNTUpAQILdG90YWxBbW91bnQAB2Jhc2VVUkkJARFAZXh0ck5hdGl2ZSgxMDU4KQECB2Jhc2VVUkkACGRBcHBKc29uCQEHQWRkcmVzcwEJANkEAQIjM01yR2FaVlJoa25FR2ZISjE5dHRVUE5uRFJvRnFjSGhWTjcADHRva2VuUGF5bWVudAkBEUBleHRyTmF0aXZlKDEwNTcpAQIMdG9rZW5QYXltZW50ABF0b2tlblBheW1lbnRBc3NldAkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQDsBwEJARFAZXh0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2xlbmQtcmVudENvdW50LQUMbGVuZElkU3RyaW5nCQBkAgUGcmVudElkAAEJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICCQCsAgIJAKwCAgIKbGVuZC1yZW50LQUMbGVuZElkU3RyaW5nAgEtBQxyZW50SWRTdHJpbmcFCHJlbnRKc29uBQNuaWwJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BaQEEdGVzdAEHYXNzZXRJZAkAzAgCCQEMQm9vbGVhbkVudHJ5AgIFRGVidWcJAQt2YWx1ZU9yRWxzZQIJAKAIAQUHYXNzZXRJZAcFA25pbADljnZL", "height": 2500131, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FGCEb4exkkEBz5RQ3x9dq7jzfkVwHSf3xyySGcFzVqMg Next: 2yDSbohKjDR9Eok1ngCVzy8CvuzKxNiGBhcCXiX9ZY6e Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let collectionName = getStringValue("collectionName")
55
66 let symbol = getStringValue("symbol")
77
88 let description = getStringValue("description")
99
1010 let totalAmount = getIntegerValue("totalAmount")
1111
1212 let baseURI = getStringValue("baseURI")
1313
1414 let dAppJson = Address(fromBase58String("3MrGaZVRhknEGfHJ19ttUPNnDRoFqcHhVN7"))
1515
1616 let tokenPayment = getBinaryValue("tokenPayment")
1717
1818 let tokenPaymentAsset = valueOrErrorMessage(assetInfo(getBinaryValue("tokenPayment")), "token payment asset doesn't connect")
1919
2020 let lendCount = getIntegerValue("lendCount")
2121
2222 let lendCurrentCount = getIntegerValue("lendCurrentCount")
2323
2424 func parseIdtoAsset (assetId) = valueOrErrorMessage(assetInfo(fromBase58String(assetId)), "Can't find asset by asset id")
2525
2626
2727 func onlyInternal (caller) = if ((caller == this))
2828 then unit
2929 else throw("Only internal call")
3030
3131
3232 func transferOrNot (to,assetId) = if ((to == this))
3333 then StringEntry("smth", "smth")
3434 else ScriptTransfer(to, 1, assetId)
3535
3636
3737 func checkAssetOwner (caller,assetId) = if ((assetBalance(caller, fromBase58String(assetId)) == 1))
3838 then unit
3939 else throw("Only asset owner")
4040
4141
4242 func checkPayment (payments,amount) = if ((payments[0].amount >= amount))
4343 then unit
4444 else throw("amount less then need")
4545
4646
4747 func checkAssetExists (assetId) = if (getBooleanValue(assetId))
4848 then throw("this token already use")
4949 else unit
5050
5151
5252 func getLendJson (lendId) = {
5353 let lendIdString = toString(lendId)
5454 getStringValue(("lend-" + lendIdString))
5555 }
5656
5757
5858 func getKey (lendJson,key) = {
5959 let timeUnitSeconds = {
6060 let @ = invoke(dAppJson, "readByJSONKey", [lendJson, key], nil)
6161 if ($isInstanceOf(@, "String"))
6262 then @
6363 else throw(($getType(@) + " couldn't be cast to String"))
6464 }
6565 if ((timeUnitSeconds == timeUnitSeconds))
6666 then timeUnitSeconds
6767 else throw("Strict value is not equal to itself.")
6868 }
6969
7070
7171 func getRentCount (lendId) = {
7272 let lendIdString = toString(lendId)
7373 getIntegerValue(("lend-rentCount-" + lendIdString))
7474 }
7575
7676
7777 func calcLendCost (lendId,timeUnitSeconds) = {
7878 let lendJson = getLendJson(lendId)
7979 let timeUnitPriceString = getKey(lendJson, "timeUnitPrice")
8080 if ((timeUnitPriceString == timeUnitPriceString))
8181 then {
8282 let timeUnitPrice = parseIntValue(timeUnitPriceString)
8383 (timeUnitSeconds * timeUnitPrice)
8484 }
8585 else throw("Strict value is not equal to itself.")
8686 }
8787
8888
8989 @Callable(i)
9090 func setString (_key,_value) = valueOrElse(onlyInternal(i.caller), [StringEntry(_key, _value)])
9191
9292
9393
9494 @Callable(i)
9595 func setInt (_key,_value) = valueOrElse(onlyInternal(i.caller), [IntegerEntry(_key, _value)])
9696
9797
9898
9999 @Callable(i)
100100 func deleteEntry (_key) = valueOrElse(onlyInternal(i.caller), [DeleteEntry(_key)])
101101
102102
103103
104104 @Callable(i)
105105 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)])
106106
107107
108108
109109 @Callable(i)
110110 func setUser (assetId,user,expires) = {
111111 let res = invoke(dAppJson, "makeJSON", [["user", "expires"], [user, expires]], nil)
112112 if ((res == res))
113113 then $Tuple2([StringEntry(("userOf-" + assetId), {
114114 let @ = res
115115 if ($isInstanceOf(@, "String"))
116116 then @
117117 else throw(($getType(@) + " couldn't be cast to String"))
118118 })], res)
119119 else throw("Strict value is not equal to itself.")
120120 }
121121
122122
123123
124124 @Callable(i)
125125 func setTokenPayment (assetBinary) = valueOrElse(onlyInternal(i.caller), [BinaryEntry("tokenPayment", assetBinary)])
126126
127127
128128
129129 @Callable(i)
130130 func mint (to) = {
131131 let tokenId = (totalAmount + 1)
132132 let tokenIdString = toString(tokenId)
133133 let preName = ((symbol + "#") + tokenIdString)
134134 let name = if ((16 >= size(preName)))
135135 then preName
136136 else tokenIdString
137137 let tokenURI = (baseURI + tokenIdString)
138138 let json = {
139139 let @ = invoke(dAppJson, "makeJSON", [["tokenURI"], [tokenURI]], nil)
140140 if ($isInstanceOf(@, "String"))
141141 then @
142142 else throw(($getType(@) + " couldn't be cast to String"))
143143 }
144144 let asset = Issue(name, json, 1, 0, false, unit, height)
145145 let assetId = calculateAssetId(asset)
146146 let toAddress = Address(fromBase58String(to))
147147 let transfer = transferOrNot(toAddress, assetId)
148148 if ((transfer == transfer))
149149 then [asset, transfer, IntegerEntry("totalAmount", tokenId), StringEntry(name, tokenURI)]
150150 else throw("Strict value is not equal to itself.")
151151 }
152152
153153
154154
155155 @Callable(i)
156156 func initLend (assetId,timeUnitSeconds,timeUnitPrice,timeUnitCount) = valueOrElse(checkAssetOwner(i.caller, assetId), valueOrElse(checkAssetExists(assetId), {
157157 let asset = parseIdtoAsset(assetId)
158158 let tokenURI = {
159159 let @ = invoke(dAppJson, "readByJSONKey", [asset.description, "tokenURI"], nil)
160160 if ($isInstanceOf(@, "String"))
161161 then @
162162 else throw(($getType(@) + " couldn't be cast to String"))
163163 }
164164 if ((tokenURI == tokenURI))
165165 then {
166166 let lendJson = {
167167 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)
168168 if ($isInstanceOf(@, "String"))
169169 then @
170170 else throw(($getType(@) + " couldn't be cast to String"))
171171 }
172172 if ((lendJson == lendJson))
173173 then {
174174 let lendIdString = toString(lendCount)
175175 [IntegerEntry("lendCount", (lendCount + 1)), IntegerEntry("lendCurrentCount", (lendCurrentCount + 1)), IntegerEntry(("lend-rentCount-" + lendIdString), 0), StringEntry(("lend-" + lendIdString), lendJson), BooleanEntry(assetId, true)]
176176 }
177177 else throw("Strict value is not equal to itself.")
178178 }
179179 else throw("Strict value is not equal to itself.")
180180 }))
181181
182182
183183
184184 @Callable(i)
185185 func initRent (lendId,timeUnitCount) = valueOrElse(checkPayment(i.payments, calcLendCost(lendId, timeUnitCount)), {
186186 let lendIdString = toString(lendId)
187187 let lendJson = getStringValue(("lend-" + lendIdString))
188188 let rentId = getRentCount(lendId)
189189 let rentIdString = toString(rentId)
190190 let timeUnitSeconds = {
191191 let @ = invoke(dAppJson, "readByJSONKey", [lendJson, "timeUnitSeconds"], nil)
192192 if ($isInstanceOf(@, "String"))
193193 then @
194194 else throw(($getType(@) + " couldn't be cast to String"))
195195 }
196196 if ((timeUnitSeconds == timeUnitSeconds))
197197 then {
198198 let timeUnitSecondsInt = parseIntValue(timeUnitSeconds)
199199 if ((timeUnitSecondsInt == timeUnitSecondsInt))
200200 then {
201201 let rentJson = {
202202 let @ = invoke(dAppJson, "makeJSON", [["customer", "timeUnitCount", "startTimestamp", "endTimestamp", "closed"], [toString(i.caller), toString(timeUnitCount), toString(lastBlock.timestamp), toString((lastBlock.timestamp + (timeUnitSecondsInt * timeUnitCount))), "0"]], nil)
203203 if ($isInstanceOf(@, "String"))
204204 then @
205205 else throw(($getType(@) + " couldn't be cast to String"))
206206 }
207207 if ((rentJson == rentJson))
208208 then [IntegerEntry(("lend-rentCount-" + lendIdString), (rentId + 1)), StringEntry(((("lend-rent-" + lendIdString) + "-") + rentIdString), rentJson)]
209209 else throw("Strict value is not equal to itself.")
210210 }
211211 else throw("Strict value is not equal to itself.")
212212 }
213213 else throw("Strict value is not equal to itself.")
214214 })
215215
216216
217217
218218 @Callable(i)
219219 func test (assetId) = [BooleanEntry("Debug", valueOrElse(getBoolean(assetId), false))]
220220
221221

github/deemru/w8io/169f3d6 
33.78 ms