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:BgIjCAISBAoCCAgSBAoCCAESBgoECAgICBIDCgEIEgYKBAgBAQEMAA5jb2xsZWN0aW9uTmFtZQkBEUBleHRyTmF0aXZlKDEwNTgpAQIOY29sbGVjdGlvbk5hbWUABnN5bWJvbAkBEUBleHRyTmF0aXZlKDEwNTgpAQIGc3ltYm9sAAtkZXNjcmlwdGlvbgkBEUBleHRyTmF0aXZlKDEwNTgpAQILZGVzY3JpcHRpb24AC3RvdGFsQW1vdW50CQERQGV4dHJOYXRpdmUoMTA1NSkBAgt0b3RhbEFtb3VudAAHYmFzZVVSSQkBEUBleHRyTmF0aXZlKDEwNTgpAQIHYmFzZVVSSQAIZEFwcEpzb24JAQdBZGRyZXNzAQkA2QQBAiMzTXJHYVpWUmhrbkVHZkhKMTl0dFVQTm5EUm9GcWNIaFZONwAJbGVuZENvdW50CQERQGV4dHJOYXRpdmUoMTA1NSkBAglsZW5kQ291bnQBDG9ubHlJbnRlcm5hbAEGY2FsbGVyAwkAAAIFBmNhbGxlcgUEdGhpcwUEdW5pdAkAAgECEk9ubHkgaW50ZXJuYWwgY2FsbAENdHJhbnNmZXJP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ACQACAQkArAICCQADAQUBQAIbIGNvdWxkbid0IGJlIGNhc3QgdG8gU3RyaW5nAwkAAAIFCGxlbmRKc29uBQhsZW5kSnNvbgQGbGVuZElkCQCkAwEFCWxlbmRDb3VudAkAzAgCCQEMSW50ZWdlckVudHJ5AgIJbGVuZENvdW50CQBkAgUJbGVuZENvdW50AAEJAMwIAgkBDEludGVnZXJFbnRyeQIJAKwCAgIPbGVuZC1yZW50Q291bnQtBQZsZW5kSWQAAAkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgICBWxlbmQtBQZsZW5kSWQFCGxlbmRKc29uBQNuaWwJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AbhN5yA==", "height": 2499889, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 26WaF8hpDe22Bmq9WaiBZcHf1AGwCy85d9MrKxSRe4sC Next: Dabb2uMH21wocLT6hQAngkFCmJCDPpAMs12BAuKToafF Diff:
Old | New | Differences | |
---|---|---|---|
13 | 13 | ||
14 | 14 | let dAppJson = Address(fromBase58String("3MrGaZVRhknEGfHJ19ttUPNnDRoFqcHhVN7")) | |
15 | 15 | ||
16 | + | let lendCount = getIntegerValue("lendCount") | |
17 | + | ||
16 | 18 | func onlyInternal (caller) = if ((caller == this)) | |
17 | 19 | then unit | |
18 | 20 | else throw("Only internal call") | |
21 | 23 | func transferOrNot (to,assetId) = if ((to == this)) | |
22 | 24 | then StringEntry("smth", "smth") | |
23 | 25 | 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 | + | } | |
24 | 40 | ||
25 | 41 | ||
26 | 42 | @Callable(i) | |
63 | 79 | } | |
64 | 80 | ||
65 | 81 | ||
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 | + |
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 | + | let lendCount = getIntegerValue("lendCount") | |
17 | + | ||
16 | 18 | func onlyInternal (caller) = if ((caller == this)) | |
17 | 19 | then unit | |
18 | 20 | else throw("Only internal call") | |
19 | 21 | ||
20 | 22 | ||
21 | 23 | func transferOrNot (to,assetId) = if ((to == this)) | |
22 | 24 | then StringEntry("smth", "smth") | |
23 | 25 | 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 | + | } | |
24 | 40 | ||
25 | 41 | ||
26 | 42 | @Callable(i) | |
27 | 43 | func setString (_key,_value) = [StringEntry(_key, _value)] | |
28 | 44 | ||
29 | 45 | ||
30 | 46 | ||
31 | 47 | @Callable(i) | |
32 | 48 | func setInt (_key,_value) = [IntegerEntry(_key, _value)] | |
33 | 49 | ||
34 | 50 | ||
35 | 51 | ||
36 | 52 | @Callable(i) | |
37 | 53 | 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)]) | |
38 | 54 | ||
39 | 55 | ||
40 | 56 | ||
41 | 57 | @Callable(i) | |
42 | 58 | func mint (to) = { | |
43 | 59 | let tokenId = (totalAmount + 1) | |
44 | 60 | let tokenIdString = toString(tokenId) | |
45 | 61 | let preName = ((symbol + "#") + tokenIdString) | |
46 | 62 | let name = if ((16 >= size(preName))) | |
47 | 63 | then preName | |
48 | 64 | else tokenIdString | |
49 | 65 | let tokenURI = (baseURI + tokenIdString) | |
50 | 66 | let json = { | |
51 | 67 | let @ = invoke(dAppJson, "makeJSON", [["tokenURI"], [tokenURI]], nil) | |
52 | 68 | if ($isInstanceOf(@, "String")) | |
53 | 69 | then @ | |
54 | 70 | else throw(($getType(@) + " couldn't be cast to String")) | |
55 | 71 | } | |
56 | 72 | let asset = Issue(name, json, 1, 0, false, unit, height) | |
57 | 73 | let assetId = calculateAssetId(asset) | |
58 | 74 | let toAddress = Address(fromBase58String(to)) | |
59 | 75 | let transfer = transferOrNot(toAddress, assetId) | |
60 | 76 | if ((transfer == transfer)) | |
61 | 77 | then [asset, transfer, IntegerEntry("totalAmount", tokenId), StringEntry(name, tokenURI)] | |
62 | 78 | else throw("Strict value is not equal to itself.") | |
63 | 79 | } | |
64 | 80 | ||
65 | 81 | ||
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 ◑