tx · GZAxqHoHsKmeybDgHhXdzusp6ATCnfDN2X5T5pE4k2nX 3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb: -0.00500000 Waves 2023.03.16 23:00 [2493031] smart account 3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb > SELF 0.00000000 Waves
{ "type": 13, "id": "GZAxqHoHsKmeybDgHhXdzusp6ATCnfDN2X5T5pE4k2nX", "fee": 500000, "feeAssetId": null, "timestamp": 1678996884121, "version": 2, "chainId": 84, "sender": "3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb", "senderPublicKey": "2VQGRNRWyFAZvjDtkgZwdZcTwZvBJJ61n8zJfYYxm5eK", "proofs": [ "tfYWkiWpHG7mNGPZfK1R6i6rtDeJ2WhBoeFUQqieu91pW1h9H8s6kSePZEVFQDW2D96jH7ZZwUULshZUiaz8xQD" ], "script": "base64:BgJCCAISBAoCGBgSBQoDCBgYEgQKAggIEgQKAggIEgQKAggIEgUKAwgICBIDCgECEgUKAwgICBIECgIICBIGCgQIAQEBCgAOY29sbGVjdGlvbk5hbWUJARFAZXh0ck5hdGl2ZSgxMDU4KQECDmNvbGxlY3Rpb25OYW1lAAZzeW1ib2wJARFAZXh0ck5hdGl2ZSgxMDU4KQECBnN5bWJvbAALZGVzY3JpcHRpb24JARFAZXh0ck5hdGl2ZSgxMDU4KQECC2Rlc2NyaXB0aW9uAAt0b3RhbEFtb3VudAkBEUBleHRyTmF0aXZlKDEwNTUpAQILdG90YWxBbW91bnQACGRBcHBKc29uCQEHQWRkcmVzcwEJANkEAQIjM01yR2FaVlJoa25FR2ZISjE5dHRVUE5uRFJvRnFjSGhWTjcADHRva2VuUGF5bWVudAkBB0FkZHJlc3MBCQERQGV4dHJOYXRpdmUoMTA1NykBAgx0b2tlblBheW1lbnQBDG9ubHlJbnRlcm5hbAEGY2FsbGVyAwkAAAIFBmNhbGxlcgUEdGhpcwUEdW5pdAkAAgECEk9ubHkgaW50ZXJuYW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CQDMCAICB2RlcG9zaXQJAMwIAgIHY2xhaW1lZAkAzAgCAgVyZW50cwUDbmlsCQDMCAIJAMwIAgAACQDMCAIFB2Fzc2V0SWQJAMwIAgUIdG9rZW5VcmkJAMwIAgkApQgBCAUBaQZjYWxsZXIJAMwIAgUPdGltZVVuaXRTZWNvbmRzCQDMCAIFDXRpbWVVbml0UHJpY2UJAMwIAgUNdGltZVVuaXRDb3VudAkAzAgCCAUJbGFzdEJsb2NrCXRpbWVzdGFtcAkAzAgCCQBkAggFCWxhc3RCbG9jawl0aW1lc3RhbXAJAGgCBQ90aW1lVW5pdFNlY29uZHMFDXRpbWVVbml0Q291bnQJAMwIAgAACQDMCAIHCQDMCAICDXsiY291bnQiOiIwIn0FA25pbAUDbmlsBQNuaWwDCQAAAgUEcmVzMgUEcmVzMgkAzAgCCQELU3RyaW5nRW50cnkCAgVMZW5kcwoAAUAFBHJlczIDCQABAgUBQAIGU3RyaW5nBQFACQACAQkArAICCQADAQUBQAIbIGNvdWxkbid0IGJlIGNhc3QgdG8gU3RyaW5nBQNuaWwJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4APwP32Q==", "height": 2493031, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Bgc366aQ2T1tEam2r6AE3DYdSodG8owVmXG6tyBBF7eU Next: 4FvmnaNaKh3PmNYgNXtzRoPqrJ3Ma7XB5zusAWNVJJxL Diff:
Old | New | Differences | |
---|---|---|---|
131 | 131 | then @ | |
132 | 132 | else throw(($getType(@) + " couldn't be cast to String")) | |
133 | 133 | }) + 1) | |
134 | - | nil | |
134 | + | let res2 = invoke(dAppJson, "makeJSON", [["supportedInterface", "assetdId", "tokenUri", "owner", "timeUnitSeconds", "timeUnitPrice", "timeUnitCount", "startTimestamp", "endTimestamp", "deposit", "claimed", "rents"], [0, assetId, tokenUri, toString(i.caller), timeUnitSeconds, timeUnitPrice, timeUnitCount, lastBlock.timestamp, (lastBlock.timestamp + (timeUnitSeconds * timeUnitCount)), 0, false, "{\"count\":\"0\"}"]], nil) | |
135 | + | if ((res2 == res2)) | |
136 | + | then [StringEntry("Lends", { | |
137 | + | let @ = res2 | |
138 | + | if ($isInstanceOf(@, "String")) | |
139 | + | then @ | |
140 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
141 | + | })] | |
142 | + | else throw("Strict value is not equal to itself.") | |
135 | 143 | }) | |
136 | 144 | ||
137 | 145 |
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 init (collectionName,symbol,description) = valueOrElse(onlyInternal(i.caller), [StringEntry("collectionName", collectionName), StringEntry("symbol", symbol), StringEntry("description", description), IntegerEntry("totalAmount", 0)]) | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | ||
104 | 104 | @Callable(i) | |
105 | 105 | func mint (to,tokenURI) = valueOrElse(onlyInternal(i.caller), { | |
106 | 106 | let tokenId = (totalAmount + 1) | |
107 | 107 | let preName = ((symbol + "#") + toString(tokenId)) | |
108 | 108 | let name = if ((16 >= size(preName))) | |
109 | 109 | then preName | |
110 | 110 | else toString(tokenId) | |
111 | 111 | let asset = Issue(name, (("{uri:\"" + tokenURI) + "\"}"), 1, 0, false, unit, height) | |
112 | 112 | let assetId = calculateAssetId(asset) | |
113 | 113 | let toAddress = Address(fromBase58String(to)) | |
114 | 114 | let transfer = transferOrNot(toAddress, assetId) | |
115 | 115 | if ((transfer == transfer)) | |
116 | 116 | then [asset, transfer, IntegerEntry("totalAmount", tokenId), StringEntry(name, tokenURI)] | |
117 | 117 | else throw("Strict value is not equal to itself.") | |
118 | 118 | }) | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | ||
122 | 122 | @Callable(i) | |
123 | 123 | func initLend (assetId,timeUnitSeconds,timeUnitPrice,timeUnitCount) = valueOrElse(checkAssetOwner(i.caller, assetId), { | |
124 | 124 | let asset = parseIdtoAsset(assetId) | |
125 | 125 | let tokenUri = asset.description | |
126 | 126 | let lends = getStringValue("Lends") | |
127 | 127 | let res1 = invoke(dAppJson, "readByJSONKey", [lends, "count"], nil) | |
128 | 128 | let lendId = (parseIntValue({ | |
129 | 129 | let @ = res1 | |
130 | 130 | if ($isInstanceOf(@, "String")) | |
131 | 131 | then @ | |
132 | 132 | else throw(($getType(@) + " couldn't be cast to String")) | |
133 | 133 | }) + 1) | |
134 | - | nil | |
134 | + | let res2 = invoke(dAppJson, "makeJSON", [["supportedInterface", "assetdId", "tokenUri", "owner", "timeUnitSeconds", "timeUnitPrice", "timeUnitCount", "startTimestamp", "endTimestamp", "deposit", "claimed", "rents"], [0, assetId, tokenUri, toString(i.caller), timeUnitSeconds, timeUnitPrice, timeUnitCount, lastBlock.timestamp, (lastBlock.timestamp + (timeUnitSeconds * timeUnitCount)), 0, false, "{\"count\":\"0\"}"]], nil) | |
135 | + | if ((res2 == res2)) | |
136 | + | then [StringEntry("Lends", { | |
137 | + | let @ = res2 | |
138 | + | if ($isInstanceOf(@, "String")) | |
139 | + | then @ | |
140 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
141 | + | })] | |
142 | + | else throw("Strict value is not equal to itself.") | |
135 | 143 | }) | |
136 | 144 | ||
137 | 145 |
github/deemru/w8io/026f985 27.91 ms ◑