tx · 7EeBbnUoJwSP5K3CckXy1KqUXnhUhTNBvasyZHYYiiHP 3MxVYj6ScMArhAamy7nB6b342kh1Pso1LTn: -0.00400000 Waves 2023.03.21 17:45 [2499911] smart account 3MxVYj6ScMArhAamy7nB6b342kh1Pso1LTn > SELF 0.00000000 Waves
{ "type": 13, "id": "7EeBbnUoJwSP5K3CckXy1KqUXnhUhTNBvasyZHYYiiHP", "fee": 400000, "feeAssetId": null, "timestamp": 1679409972900, "version": 2, "chainId": 84, "sender": "3MxVYj6ScMArhAamy7nB6b342kh1Pso1LTn", "senderPublicKey": "CZeucjRLCKrkiP9zuj9KbLe23Wv9DywFzHBqNDnte51B", "proofs": [ "fPthJLgihANZhUoU4Dz6ksdtQNXEKXZh1zVj8QEm9yRZSE33xEarvBprTyHE96rfLQMUz2h69GihVc2pSGdoHD6" ], "script": "base64:BgIpCAISBAoCCAgSBAoCCAESBgoECAgICBIDCgEIEgYKBAgBAQESBAoCAQEMAA5jb2xsZWN0aW9uTmFtZQkBEUBleHRyTmF0aXZlKDEwNTgpAQIOY29sbGVjdGlvbk5hbWUABnN5bWJvbAkBEUBleHRyTmF0aXZlKDEwNTgpAQIGc3ltYm9sAAtkZXNjcmlwdGlvbgkBEUBleHRyTmF0aXZlKDEwNTgpAQILZGVzY3JpcHRpb24AC3RvdGFsQW1vdW50CQERQGV4dHJOYXRpdmUoMTA1NSkBAgt0b3RhbEFtb3VudAAHYmFzZVVSSQkBEUBleHRyTmF0aXZlKDEwNTgpAQIHYmFzZVVSSQAIZEFwcEpzb24JAQdBZGRyZXNzAQkA2QQBAiMzTXJHYVpWUmhrbkVHZkhKMTl0dFVQTm5EUm9GcWNIaFZONwAJbGVuZENvdW50CQERQGV4dHJOYXRpdmUoMTA1NSkBAglsZW5kQ291bnQBDG9ubHlJbnRlcm5hbAEGY2FsbGVyAwkAAAIFBmNhbGxlcgUEdGhpcwUEdW5pdAkAAgECEk9ubHkgaW50ZXJuYWwgY2FsbAENdHJhbnNmZXJP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yBub3QgZXF1YWwgdG8gaXRzZWxmLgAxh9B9", "height": 2499911, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CVBdkDABpciGSfextYZNwqaxkVEfLxi3rYB8TSw97goP Next: GGEvvkzeVBksxYcxre81KGWBx4QAaSs4R8gy1mfxidyN Full:
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 | 16 | let lendCount = getIntegerValue("lendCount") | |
17 | 17 | ||
18 | 18 | func onlyInternal (caller) = if ((caller == this)) | |
19 | 19 | then unit | |
20 | 20 | else throw("Only internal call") | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func transferOrNot (to,assetId) = if ((to == this)) | |
24 | 24 | then StringEntry("smth", "smth") | |
25 | 25 | else ScriptTransfer(to, 1, assetId) | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func parseIdtoAsset (assetId) = valueOrErrorMessage(assetInfo(fromBase58String(assetId)), "Can't find asset by asset id") | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func checkAssetOwner (caller,assetId) = if ((assetBalance(caller, fromBase58String(assetId)) == 1)) | |
32 | 32 | then unit | |
33 | 33 | else throw("Only asset owner") | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func getRentCount (lendId) = { | |
37 | 37 | let lendIdString = toString(lendId) | |
38 | 38 | getIntegerValue(("lend-rentCount-" + lendIdString)) | |
39 | 39 | } | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | @Callable(i) | |
43 | 43 | func setString (_key,_value) = [StringEntry(_key, _value)] | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | ||
47 | 47 | @Callable(i) | |
48 | 48 | func setInt (_key,_value) = [IntegerEntry(_key, _value)] | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | ||
52 | 52 | @Callable(i) | |
53 | 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)]) | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | ||
57 | 57 | @Callable(i) | |
58 | 58 | func mint (to) = { | |
59 | 59 | let tokenId = (totalAmount + 1) | |
60 | 60 | let tokenIdString = toString(tokenId) | |
61 | 61 | let preName = ((symbol + "#") + tokenIdString) | |
62 | 62 | let name = if ((16 >= size(preName))) | |
63 | 63 | then preName | |
64 | 64 | else tokenIdString | |
65 | 65 | let tokenURI = (baseURI + tokenIdString) | |
66 | 66 | let json = { | |
67 | 67 | let @ = invoke(dAppJson, "makeJSON", [["tokenURI"], [tokenURI]], nil) | |
68 | 68 | if ($isInstanceOf(@, "String")) | |
69 | 69 | then @ | |
70 | 70 | else throw(($getType(@) + " couldn't be cast to String")) | |
71 | 71 | } | |
72 | 72 | let asset = Issue(name, json, 1, 0, false, unit, height) | |
73 | 73 | let assetId = calculateAssetId(asset) | |
74 | 74 | let toAddress = Address(fromBase58String(to)) | |
75 | 75 | let transfer = transferOrNot(toAddress, assetId) | |
76 | 76 | if ((transfer == transfer)) | |
77 | 77 | then [asset, transfer, IntegerEntry("totalAmount", tokenId), StringEntry(name, tokenURI)] | |
78 | 78 | else throw("Strict value is not equal to itself.") | |
79 | 79 | } | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | ||
83 | 83 | @Callable(i) | |
84 | 84 | func initLend (assetId,timeUnitSeconds,timeUnitPrice,timeUnitCount) = valueOrElse(checkAssetOwner(i.caller, assetId), { | |
85 | 85 | let asset = parseIdtoAsset(assetId) | |
86 | 86 | let tokenURI = { | |
87 | 87 | let @ = invoke(dAppJson, "readByJSONKey", [asset.description, "tokenURI"], nil) | |
88 | 88 | if ($isInstanceOf(@, "String")) | |
89 | 89 | then @ | |
90 | 90 | else throw(($getType(@) + " couldn't be cast to String")) | |
91 | 91 | } | |
92 | 92 | if ((tokenURI == tokenURI)) | |
93 | 93 | then { | |
94 | 94 | let lendJson = { | |
95 | 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 | 96 | if ($isInstanceOf(@, "String")) | |
97 | 97 | then @ | |
98 | 98 | else throw(($getType(@) + " couldn't be cast to String")) | |
99 | 99 | } | |
100 | 100 | if ((lendJson == lendJson)) | |
101 | 101 | then { | |
102 | 102 | let lendIdString = toString(lendCount) | |
103 | 103 | [IntegerEntry("lendCount", (lendCount + 1)), IntegerEntry(("lend-rentCount-" + lendIdString), 0), StringEntry(("lend-" + lendIdString), lendJson)] | |
104 | 104 | } | |
105 | 105 | else throw("Strict value is not equal to itself.") | |
106 | 106 | } | |
107 | 107 | else throw("Strict value is not equal to itself.") | |
108 | 108 | }) | |
109 | 109 | ||
110 | 110 | ||
111 | 111 | ||
112 | 112 | @Callable(i) | |
113 | 113 | func initRent (lendId,timeUnitCount) = { | |
114 | 114 | let lendIdString = toString(lendId) | |
115 | 115 | let lendJson = getStringValue(("lend-" + lendIdString)) | |
116 | 116 | let rentId = getRentCount(lendId) | |
117 | 117 | let rentIdString = toString(rentId) | |
118 | 118 | let timeUnitSeconds = { | |
119 | 119 | let @ = invoke(dAppJson, "readByJSONKey", [lendJson, "timeUnitSeconds"], nil) | |
120 | 120 | if ($isInstanceOf(@, "String")) | |
121 | 121 | then @ | |
122 | 122 | else throw(($getType(@) + " couldn't be cast to String")) | |
123 | 123 | } | |
124 | 124 | if ((timeUnitSeconds == timeUnitSeconds)) | |
125 | 125 | then { | |
126 | 126 | let timeUnitSecondsInt = parseIntValue(timeUnitSeconds) | |
127 | 127 | nil | |
128 | 128 | } | |
129 | 129 | else throw("Strict value is not equal to itself.") | |
130 | 130 | } | |
131 | 131 | ||
132 | 132 |
github/deemru/w8io/169f3d6 26.21 ms ◑