tx · 7SBUdGTcTy5aP7Zf2txRxBg8hxP5Hp3i9H72y2ntiHFF

3MxVYj6ScMArhAamy7nB6b342kh1Pso1LTn:  -0.00400000 Waves

2023.03.21 17:25 [2499889] smart account 3MxVYj6ScMArhAamy7nB6b342kh1Pso1LTn > SELF 0.00000000 Waves

{ "type": 13, "id": "7SBUdGTcTy5aP7Zf2txRxBg8hxP5Hp3i9H72y2ntiHFF", "fee": 400000, "feeAssetId": null, "timestamp": 1679408706175, "version": 2, "chainId": 84, "sender": "3MxVYj6ScMArhAamy7nB6b342kh1Pso1LTn", "senderPublicKey": "CZeucjRLCKrkiP9zuj9KbLe23Wv9DywFzHBqNDnte51B", "proofs": [ "2bviMnQTJW53soSGUHXfrqxmMZgUZ6QAH7QRopmBhNguACEXTbfGoNn5TpkMy5BkckqiYcRKd9yfRV6JZKLeiuK6" ], "script": "base64:BgIjCAISBAoCCAgSBAoCCAESBgoECAgICBIDCgEIEgYKBAgBAQEMAA5jb2xsZWN0aW9uTmFtZQkBEUBleHRyTmF0aXZlKDEwNTgpAQIOY29sbGVjdGlvbk5hbWUABnN5bWJvbAkBEUBleHRyTmF0aXZlKDEwNTgpAQIGc3ltYm9sAAtkZXNjcmlwdGlvbgkBEUBleHRyTmF0aXZlKDEwNTgpAQILZGVzY3JpcHRpb24AC3RvdGFsQW1vdW50CQERQGV4dHJOYXRpdmUoMTA1NSkBAgt0b3RhbEFtb3VudAAHYmFzZVVSSQkBEUBleHRyTmF0aXZlKDEwNTgpAQIHYmFzZVVSSQAIZEFwcEpzb24JAQdBZGRyZXNzAQkA2QQBAiMzTXJHYVpWUmhrbkVHZkhKMTl0dFVQTm5EUm9GcWNIaFZONwAJbGVuZENvdW50CQERQGV4dHJOYXRpdmUoMTA1NSkBAglsZW5kQ291bnQBDG9ubHlJbnRlcm5hbAEGY2FsbGVyAwkAAAIFBmNhbGxlcgUEdGhpcwUEdW5pdAkAAgECEk9ubHkgaW50ZXJuYWwgY2FsbAENdHJhbnNmZXJ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FACQACAQkArAICCQADAQUBQAIbIGNvdWxkbid0IGJlIGNhc3QgdG8gU3RyaW5nAwkAAAIFCGxlbmRKc29uBQhsZW5kSnNvbgQGbGVuZElkCQCkAwEFCWxlbmRDb3VudAkAzAgCCQEMSW50ZWdlckVudHJ5AgIJbGVuZENvdW50CQBkAgUJbGVuZENvdW50AAEJAMwIAgkBDEludGVnZXJFbnRyeQIJAKwCAgIPbGVuZC1yZW50Q291bnQtBQZsZW5kSWQAAAkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgICBWxlbmQtBQZsZW5kSWQFCGxlbmRKc29uBQNuaWwJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AbhN5yA==", "height": 2499889, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 26WaF8hpDe22Bmq9WaiBZcHf1AGwCy85d9MrKxSRe4sC Next: Dabb2uMH21wocLT6hQAngkFCmJCDPpAMs12BAuKToafF Diff:
OldNewDifferences
1313
1414 let dAppJson = Address(fromBase58String("3MrGaZVRhknEGfHJ19ttUPNnDRoFqcHhVN7"))
1515
16+let lendCount = getIntegerValue("lendCount")
17+
1618 func onlyInternal (caller) = if ((caller == this))
1719 then unit
1820 else throw("Only internal call")
2123 func transferOrNot (to,assetId) = if ((to == this))
2224 then StringEntry("smth", "smth")
2325 else ScriptTransfer(to, 1, assetId)
26+
27+
28+func parseIdtoAsset (assetId) = valueOrErrorMessage(assetInfo(fromBase58String(assetId)), "Can't find asset by asset id")
29+
30+
31+func checkAssetOwner (caller,assetId) = if ((assetBalance(caller, fromBase58String(assetId)) == 1))
32+ then unit
33+ else throw("Only asset owner")
34+
35+
36+func getRentCount (lendId) = {
37+ let lendIdString = toString(lendId)
38+ getIntegerValue((("lend-" + lendIdString) + "-rents"))
39+ }
2440
2541
2642 @Callable(i)
6379 }
6480
6581
82+
83+@Callable(i)
84+func initLend (assetId,timeUnitSeconds,timeUnitPrice,timeUnitCount) = valueOrElse(checkAssetOwner(i.caller, assetId), {
85+ let asset = parseIdtoAsset(assetId)
86+ let tokenURI = {
87+ let @ = invoke(dAppJson, "readByJSONKey", [asset.description, "tokenURI"], nil)
88+ if ($isInstanceOf(@, "String"))
89+ then @
90+ else throw(($getType(@) + " couldn't be cast to String"))
91+ }
92+ if ((tokenURI == tokenURI))
93+ then {
94+ let lendJson = {
95+ 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+ if ($isInstanceOf(@, "String"))
97+ then @
98+ else throw(($getType(@) + " couldn't be cast to String"))
99+ }
100+ if ((lendJson == lendJson))
101+ then {
102+ let lendId = toString(lendCount)
103+[IntegerEntry("lendCount", (lendCount + 1)), IntegerEntry(("lend-rentCount-" + lendId), 0), StringEntry(("lend-" + lendId), lendJson)]
104+ }
105+ else throw("Strict value is not equal to itself.")
106+ }
107+ else throw("Strict value is not equal to itself.")
108+ })
109+
110+
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
16+let lendCount = getIntegerValue("lendCount")
17+
1618 func onlyInternal (caller) = if ((caller == this))
1719 then unit
1820 else throw("Only internal call")
1921
2022
2123 func transferOrNot (to,assetId) = if ((to == this))
2224 then StringEntry("smth", "smth")
2325 else ScriptTransfer(to, 1, assetId)
26+
27+
28+func parseIdtoAsset (assetId) = valueOrErrorMessage(assetInfo(fromBase58String(assetId)), "Can't find asset by asset id")
29+
30+
31+func checkAssetOwner (caller,assetId) = if ((assetBalance(caller, fromBase58String(assetId)) == 1))
32+ then unit
33+ else throw("Only asset owner")
34+
35+
36+func getRentCount (lendId) = {
37+ let lendIdString = toString(lendId)
38+ getIntegerValue((("lend-" + lendIdString) + "-rents"))
39+ }
2440
2541
2642 @Callable(i)
2743 func setString (_key,_value) = [StringEntry(_key, _value)]
2844
2945
3046
3147 @Callable(i)
3248 func setInt (_key,_value) = [IntegerEntry(_key, _value)]
3349
3450
3551
3652 @Callable(i)
3753 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)])
3854
3955
4056
4157 @Callable(i)
4258 func mint (to) = {
4359 let tokenId = (totalAmount + 1)
4460 let tokenIdString = toString(tokenId)
4561 let preName = ((symbol + "#") + tokenIdString)
4662 let name = if ((16 >= size(preName)))
4763 then preName
4864 else tokenIdString
4965 let tokenURI = (baseURI + tokenIdString)
5066 let json = {
5167 let @ = invoke(dAppJson, "makeJSON", [["tokenURI"], [tokenURI]], nil)
5268 if ($isInstanceOf(@, "String"))
5369 then @
5470 else throw(($getType(@) + " couldn't be cast to String"))
5571 }
5672 let asset = Issue(name, json, 1, 0, false, unit, height)
5773 let assetId = calculateAssetId(asset)
5874 let toAddress = Address(fromBase58String(to))
5975 let transfer = transferOrNot(toAddress, assetId)
6076 if ((transfer == transfer))
6177 then [asset, transfer, IntegerEntry("totalAmount", tokenId), StringEntry(name, tokenURI)]
6278 else throw("Strict value is not equal to itself.")
6379 }
6480
6581
82+
83+@Callable(i)
84+func initLend (assetId,timeUnitSeconds,timeUnitPrice,timeUnitCount) = valueOrElse(checkAssetOwner(i.caller, assetId), {
85+ let asset = parseIdtoAsset(assetId)
86+ let tokenURI = {
87+ let @ = invoke(dAppJson, "readByJSONKey", [asset.description, "tokenURI"], nil)
88+ if ($isInstanceOf(@, "String"))
89+ then @
90+ else throw(($getType(@) + " couldn't be cast to String"))
91+ }
92+ if ((tokenURI == tokenURI))
93+ then {
94+ let lendJson = {
95+ 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+ if ($isInstanceOf(@, "String"))
97+ then @
98+ else throw(($getType(@) + " couldn't be cast to String"))
99+ }
100+ if ((lendJson == lendJson))
101+ then {
102+ let lendId = toString(lendCount)
103+[IntegerEntry("lendCount", (lendCount + 1)), IntegerEntry(("lend-rentCount-" + lendId), 0), StringEntry(("lend-" + lendId), lendJson)]
104+ }
105+ else throw("Strict value is not equal to itself.")
106+ }
107+ else throw("Strict value is not equal to itself.")
108+ })
109+
110+

github/deemru/w8io/169f3d6 
33.83 ms