tx · HznQE3rrjgNy5Pubx3MwB4hByhJFn5r1i22hMo4HQ2iw 3NDDhSj9Ddd6P9W3s946zqCK41gaQVPGWSQ: -0.01200000 Waves 2022.07.26 19:08 [2156989] smart account 3NDDhSj9Ddd6P9W3s946zqCK41gaQVPGWSQ > SELF 0.00000000 Waves
{ "type": 13, "id": "HznQE3rrjgNy5Pubx3MwB4hByhJFn5r1i22hMo4HQ2iw", "fee": 1200000, "feeAssetId": null, "timestamp": 1658851708870, "version": 2, "chainId": 84, "sender": "3NDDhSj9Ddd6P9W3s946zqCK41gaQVPGWSQ", "senderPublicKey": "H1ngPRkMA7V24vjMJFbB15JNTsro5ME4yDgNiX6zy2tM", "proofs": [ "29HUD9pt1mj3V4oGQr9SJGUutVq89677pxrwBJM5egQ3YAnoddaUbAMPjNFw66R39csczFZGQRNDtc1zzxEcXTEm" ], "script": "base64:AAIFAAAAAAAAABMIAhIAEgYKBAgIAQESAwoBCBIAAAAAHQAAAAAOcmViaXJ0aEFkZHJlc3MBAAAAGgFXcJF11J7rej4f+WQAMMjcRl1cmkTfdcL3AAAAABBpbmN1YmF0b3JBZGRyZXNzAQAAABoBV4y1SJ9+nhXVGJeOG3f7CX9nYtrhbWMlSQAAAAANYmFja2VuZFB1YktleQEAAAAgn+72lLfgCUvbFbUkOM8Gru0gv8TqG55wbGJJdPJs4hwAAAAADlNUQVJUVElNRVNUQU1QAAAAAXwXCGqAAAAAAAlMQVBMRU5HVEgAAAAAAAFJlwAAAAAACkVHR0FTU0VUSUQBAAAAIKOff08jclHRLOIhkmKITQwL8+oiboHVr/wLkxfObbHJAAAAAA1EVUNLTElOR1BSSUNFAAAAAAAExLQAAAAAABZwZXJjZW50R3Jvd3RoUHJlY2lzaW9uAAAjhvJvwQAAAAAAABVleGlzdGluZ0R1Y2tQcmVjaXNpb24AAABa8xB6QAAAAAAAFktHbG9iYWxJc3N1ZWRUaW1lc3RhbXACAAAAF2dsb2JhbF9pc3N1ZWRfdGltZXN0YW1wAAAAA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HVja2xpbmcgaXMgbm90IGdyb3duIHlldC4uLgMJAQAAAAIhPQAAAAIIBQAAAANwbXQAAAAGaXNzdWVyBQAAAAR0aGlzCQAAAgAAAAECAAAAJUNhbiB1c2Ugb25seSBkdWNrbGluZ3MgZnJvbSB0aGlzIGRBcHAEAAAABGNhbGwJAAP8AAAABAkBAAAAB0FkZHJlc3MAAAABBQAAABBpbmN1YmF0b3JBZGRyZXNzAgAAABFzdGFydER1Y2tIYXRjaGluZwkABEwAAAACAgAAAAAFAAAAA25pbAUAAAADbmlsAwkAAAAAAAACBQAAAARjYWxsBQAAAARjYWxsBAAAAA5rRHVja2xpbmdHcm93bgkBAAAAEGtleUR1Y2tsaW5nR3Jvd24AAAABCQACWAAAAAEIBQAAAANwbXQAAAACaWQJAARMAAAAAgkBAAAADEJvb2xlYW5FbnRyeQAAAAIFAAAADmtEdWNrbGluZ0dyb3duBgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAAWS0dsb2JhbElzc3VlZFRpbWVzdGFtcAgFAAAACWxhc3RCbG9jawAAAAl0aW1lc3RhbXAFAAAAA25pbAkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleag6WnI=", "height": 2156989, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let rebirthAddress = base58'3PCC6fVHNa6289DTDmcUo3RuLaFmteZZsmQ' | |
5 | + | ||
6 | + | let incubatorAddress = base58'3PEktVux2RhchSN63DsDo4b4mz4QqzKSeDv' | |
7 | + | ||
8 | + | let backendPubKey = base58'BmKAXRQy7jZm44fa1YxNQDTcAwNSb74EpQwP5CT7UHdV' | |
9 | + | ||
10 | + | let STARTTIMESTAMP = 1632474000000 | |
11 | + | ||
12 | + | let LAPLENGTH = 21600000 | |
13 | + | ||
14 | + | let EGGASSETID = base58'C1iWsKGqLwjHUndiQ7iXpdmPum9PeCDFfyXBdJJosDRS' | |
15 | + | ||
16 | + | let DUCKLINGPRICE = 80000000 | |
17 | + | ||
18 | + | let percentGrowthPrecision = 10000000000000000 | |
19 | + | ||
20 | + | let existingDuckPrecision = 100000000000000 | |
21 | + | ||
22 | + | let KGlobalIssuedTimestamp = "global_issued_timestamp" | |
23 | + | ||
24 | + | let MSINDAY = 86400000 | |
25 | + | ||
26 | + | func keyTotalFeed (ducklingId) = (("duckling_" + ducklingId) + "_feed") | |
27 | + | ||
28 | + | ||
29 | + | func keyDucklingFedLap (ducklingId) = (("duckling_" + ducklingId) + "_fedLap") | |
30 | + | ||
31 | + | ||
32 | + | func keyDucklingFedTimestamp (ducklingId) = (("duckling_" + ducklingId) + "_fedTs") | |
33 | + | ||
34 | + | ||
35 | + | func keyDucklingFedLapTimestamp (ducklingId,lap) = (((("duckling_" + ducklingId) + "_lap_") + toString(lap)) + "_fedTs") | |
36 | + | ||
37 | + | ||
38 | + | func keyAddressFedTimestamp (address,lap,timestamp) = ((((("address_" + address) + "_lap_") + toString(lap)) + "_fedTs_") + toString(timestamp)) | |
39 | + | ||
40 | + | ||
41 | + | func keyAddressNonce (address) = (("address_" + address) + "_nonce") | |
42 | + | ||
43 | + | ||
44 | + | func keyDucklingFedLastTimestamp (ducklingId) = (("duckling_" + ducklingId) + "_fedLastTs") | |
45 | + | ||
46 | + | ||
47 | + | func keyDucklingLevel (ducklingId) = (("duckling_" + ducklingId) + "_level") | |
48 | + | ||
49 | + | ||
50 | + | func keyFeedForLap (address,lap) = (((("address_" + address) + "_lap_") + toString(lap)) + "_feed") | |
51 | + | ||
52 | + | ||
53 | + | func keyDucklingGrown (ducklingId) = (("duckling_" + ducklingId) + "_grown") | |
54 | + | ||
55 | + | ||
56 | + | func keyStartHatchingId (ducklingId) = (("duckling_" + ducklingId) + "_grown") | |
57 | + | ||
58 | + | ||
59 | + | func tryGetInteger (key) = { | |
60 | + | let val = match getInteger(this, key) { | |
61 | + | case b: Int => | |
62 | + | b | |
63 | + | case _ => | |
64 | + | 0 | |
65 | + | } | |
66 | + | val | |
67 | + | } | |
68 | + | ||
69 | + | ||
70 | + | func getBool (key) = match getBoolean(this, key) { | |
71 | + | case b: Boolean => | |
72 | + | b | |
73 | + | case _ => | |
74 | + | false | |
75 | + | } | |
76 | + | ||
77 | + | ||
78 | + | func getCurrentLevelBigInt (ducklingId) = { | |
79 | + | let kDuckLevel = keyDucklingLevel(ducklingId) | |
80 | + | match getString(kDuckLevel) { | |
81 | + | case s: String => | |
82 | + | parseBigIntValue(s) | |
83 | + | case _ => | |
84 | + | match getBoolean((("duckling_" + ducklingId) + "_issuedByFeedCall")) { | |
85 | + | case b: Boolean => | |
86 | + | toBigInt(0) | |
87 | + | case _ => | |
88 | + | toBigInt((20 * existingDuckPrecision)) | |
89 | + | } | |
90 | + | } | |
91 | + | } | |
92 | + | ||
93 | + | ||
94 | + | func getCurrentLap () = (((lastBlock.timestamp - STARTTIMESTAMP) / LAPLENGTH) + 1) | |
95 | + | ||
96 | + | ||
97 | + | func getLastFedTimestamp (ducklingId) = { | |
98 | + | let lastFedTimestamp = tryGetInteger(keyDucklingFedLastTimestamp(ducklingId)) | |
99 | + | if ((lastFedTimestamp > 0)) | |
100 | + | then lastFedTimestamp | |
101 | + | else lastBlock.timestamp | |
102 | + | } | |
103 | + | ||
104 | + | ||
105 | + | func calculateNewDucklingLevel (ducklingId,paymentAmount) = { | |
106 | + | let currentTs = lastBlock.timestamp | |
107 | + | let lastFedTimestampChecked = getLastFedTimestamp(ducklingId) | |
108 | + | let fedDiff = (currentTs - lastFedTimestampChecked) | |
109 | + | let penalty = if (if ((fedDiff == 0)) | |
110 | + | then true | |
111 | + | else ((MSINDAY * 2) >= fedDiff)) | |
112 | + | then toBigInt(0) | |
113 | + | else (toBigInt((fedDiff / MSINDAY)) * toBigInt((existingDuckPrecision / 10))) | |
114 | + | let growth = fraction(toBigInt(paymentAmount), toBigInt(percentGrowthPrecision), toBigInt(DUCKLINGPRICE)) | |
115 | + | let currentLevel = getCurrentLevelBigInt(ducklingId) | |
116 | + | let newLevel = ((currentLevel - penalty) + growth) | |
117 | + | let result = if ((toBigInt(0) > newLevel)) | |
118 | + | then toString(growth) | |
119 | + | else toString(newLevel) | |
120 | + | $Tuple2(result, [("currentLevel=" + toString(currentLevel)), ("newLevel=" + toString(newLevel)), ("growth=" + toString(growth)), ("penalty=" + toString(penalty)), ("lastFedTs=" + toString(lastFedTimestampChecked)), ("fedDiff=" + toString(fedDiff))]) | |
121 | + | } | |
122 | + | ||
123 | + | ||
124 | + | func getBackendProof (maxFeedAmount,userNonce,address) = makeString([toString(maxFeedAmount), toString(userNonce), address], ";") | |
125 | + | ||
126 | + | ||
127 | + | @Callable(i) | |
128 | + | func issueFreeDuckling () = { | |
129 | + | let address = toBase58String(i.caller.bytes) | |
130 | + | let txIdStr = toBase58String(i.transactionId) | |
131 | + | let asset = Issue("BABY-11111111-GZ", "", 1, 0, false, unit, height) | |
132 | + | let assetId = calculateAssetId(asset) | |
133 | + | $Tuple2([StringEntry((((address + "_") + txIdStr) + "_di"), toBase58String(assetId)), StringEntry(toBase58String(assetId), toBase58String(assetId)), StringEntry(toBase58String(i.transactionId), toBase58String(assetId)), IntegerEntry("stats_amount", (tryGetInteger("stats_amount") + 1)), BooleanEntry((("duckling_" + toBase58String(assetId)) + "_issuedByFeedCall"), (i.caller == this)), asset, ScriptTransfer(value(addressFromString(address)), 1, assetId)], toBase58String(assetId)) | |
134 | + | } | |
135 | + | ||
136 | + | ||
137 | + | ||
138 | + | @Callable(i) | |
139 | + | func feedDuckling (ducklingId,backendSignature,maxFeedAmount,userNonce) = { | |
140 | + | let addressString = toString(i.caller) | |
141 | + | let backendProof = getBackendProof(maxFeedAmount, userNonce, addressString) | |
142 | + | let kAddressNonce = keyAddressNonce(addressString) | |
143 | + | let currentNonce = tryGetInteger(kAddressNonce) | |
144 | + | let realDucklingId = if (!(sigVerify_8Kb(toBytes(backendProof), fromBase58String(backendSignature), backendPubKey))) | |
145 | + | then throw("Invalid proof from backend") | |
146 | + | else if (if ((size(i.payments) != 1)) | |
147 | + | then true | |
148 | + | else (value(i.payments[0]).assetId != EGGASSETID)) | |
149 | + | then throw("Bad payment attached (asset[s] or amount)") | |
150 | + | else if (getBool(keyDucklingGrown(ducklingId))) | |
151 | + | then throw("Duckling is already grown") | |
152 | + | else if ((userNonce != (currentNonce + 1))) | |
153 | + | then throw(((("User Nonce should be " + toString(currentNonce)) + " + 1, while received ") + toString(userNonce))) | |
154 | + | else if ((ducklingId == "")) | |
155 | + | then { | |
156 | + | let ducklingAssetId = invoke(this, "issueFreeDuckling", [toString(i.originCaller), toBase58String(i.transactionId)], nil) | |
157 | + | if ((ducklingAssetId == ducklingAssetId)) | |
158 | + | then { | |
159 | + | let id = match ducklingAssetId { | |
160 | + | case v: String => | |
161 | + | v | |
162 | + | case _ => | |
163 | + | throw("Can't generate NFT") | |
164 | + | } | |
165 | + | id | |
166 | + | } | |
167 | + | else throw("Strict value is not equal to itself.") | |
168 | + | } | |
169 | + | else { | |
170 | + | let ducklingIdCheck = value(assetInfo(fromBase58String(ducklingId))) | |
171 | + | if ((assetBalance(i.caller, ducklingIdCheck.id) != 1)) | |
172 | + | then throw("You're not the owner of the duckling") | |
173 | + | else if ((ducklingIdCheck.issuer != this)) | |
174 | + | then throw("Cant find duckling with such id") | |
175 | + | else { | |
176 | + | let ducklingIdString = toBase58String(ducklingIdCheck.id) | |
177 | + | ducklingIdString | |
178 | + | } | |
179 | + | } | |
180 | + | let kDucklingLastFedTs = keyDucklingFedLastTimestamp(ducklingId) | |
181 | + | let lastFedTs = getLastFedTimestamp(realDucklingId) | |
182 | + | let currentPayment = value(i.payments[0]).amount | |
183 | + | let kNewLevel = keyDucklingLevel(realDucklingId) | |
184 | + | let kTotalFeed = keyTotalFeed(realDucklingId) | |
185 | + | let totalFeed = tryGetInteger(kTotalFeed) | |
186 | + | let kFeedTxStats = ((("duckling_" + realDucklingId) + "_stat_") + toString(lastBlock.timestamp)) | |
187 | + | let kAddressFedTimestamp = keyAddressFedTimestamp(addressString, getCurrentLap(), lastBlock.timestamp) | |
188 | + | let kDucklingFedLapTimestamp = keyDucklingFedLapTimestamp(realDucklingId, getCurrentLap()) | |
189 | + | let kDucklingFedLap = keyDucklingFedLap(realDucklingId) | |
190 | + | if ((currentPayment > maxFeedAmount)) | |
191 | + | then throw(("Cannot feed duckling for such amount, max feed amount is: " + toString(maxFeedAmount))) | |
192 | + | else { | |
193 | + | let calculateResults = calculateNewDucklingLevel(realDucklingId, currentPayment) | |
194 | + | [IntegerEntry(kAddressNonce, (currentNonce + 1)), IntegerEntry(kDucklingLastFedTs, lastBlock.timestamp), IntegerEntry(kTotalFeed, (totalFeed + currentPayment)), IntegerEntry(kFeedTxStats, currentPayment), IntegerEntry(kAddressFedTimestamp, currentPayment), IntegerEntry(kDucklingFedLapTimestamp, currentPayment), IntegerEntry(kDucklingFedLap, getCurrentLap()), StringEntry(kNewLevel, calculateResults._1), StringEntry((kFeedTxStats + "_debug"), makeString(calculateResults._2, ";"))] | |
195 | + | } | |
196 | + | } | |
197 | + | ||
198 | + | ||
199 | + | ||
200 | + | @Callable(i) | |
201 | + | func fixLevels (ducklingIds) = if ((i.callerPublicKey != base58'GDxBbsDRmeY39quNrDsTXKJzFWbQVtjxHseF4ikxZ7n9')) | |
202 | + | then throw("") | |
203 | + | else { | |
204 | + | let ducklingIdsList = value(split(ducklingIds, ",")) | |
205 | + | func handleId (acc,id) = { | |
206 | + | let kTotalFeed = keyTotalFeed(id) | |
207 | + | let totalFeed = tryGetInteger(kTotalFeed) | |
208 | + | let kNewLevel = keyDucklingLevel(id) | |
209 | + | let startingLevel = match getBoolean((("duckling_" + id) + "_issuedByFeedCall")) { | |
210 | + | case b: Boolean => | |
211 | + | if ((b == true)) | |
212 | + | then toBigInt(0) | |
213 | + | else toBigInt((20 * existingDuckPrecision)) | |
214 | + | case _ => | |
215 | + | toBigInt((20 * existingDuckPrecision)) | |
216 | + | } | |
217 | + | let growth = fraction(toBigInt(totalFeed), toBigInt(percentGrowthPrecision), toBigInt(DUCKLINGPRICE)) | |
218 | + | (acc ++ [StringEntry(kNewLevel, toString((startingLevel + growth)))]) | |
219 | + | } | |
220 | + | ||
221 | + | let $l = ducklingIdsList | |
222 | + | let $s = size($l) | |
223 | + | let $acc0 = nil | |
224 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
225 | + | then $a | |
226 | + | else handleId($a, $l[$i]) | |
227 | + | ||
228 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
229 | + | then $a | |
230 | + | else throw("List size exceeds 20") | |
231 | + | ||
232 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
233 | + | } | |
234 | + | ||
235 | + | ||
236 | + | ||
237 | + | @Callable(i) | |
238 | + | func turnDucklingIntoDuck () = { | |
239 | + | let address = toString(i.caller) | |
240 | + | let txId = toBase58String(i.transactionId) | |
241 | + | let lastIssuedDucklingTs = tryGetInteger(KGlobalIssuedTimestamp) | |
242 | + | let fiveMinInMs = ((60 * 60) * 1000) | |
243 | + | if (if ((lastIssuedDucklingTs > 0)) | |
244 | + | then (fiveMinInMs > (lastBlock.timestamp - lastIssuedDucklingTs)) | |
245 | + | else false) | |
246 | + | then throw(("Can issue ducklings only once per 5 minutes, please wait for " + toString((fiveMinInMs - (lastBlock.timestamp - lastIssuedDucklingTs))))) | |
247 | + | else if ((size(i.payments) != 1)) | |
248 | + | then throw("Bad payment attached (asset[s] or amount)") | |
249 | + | else { | |
250 | + | let pmt = value(assetInfo(value(value(i.payments[0]).assetId))) | |
251 | + | if ((toBigInt(100) > getCurrentLevelBigInt(toBase58String(pmt.id)))) | |
252 | + | then throw("Duckling is not grown yet...") | |
253 | + | else if ((pmt.issuer != this)) | |
254 | + | then throw("Can use only ducklings from this dApp") | |
255 | + | else { | |
256 | + | let call = invoke(Address(incubatorAddress), "startDuckHatching", [""], nil) | |
257 | + | if ((call == call)) | |
258 | + | then { | |
259 | + | let kDucklingGrown = keyDucklingGrown(toBase58String(pmt.id)) | |
260 | + | [BooleanEntry(kDucklingGrown, true), IntegerEntry(KGlobalIssuedTimestamp, lastBlock.timestamp)] | |
261 | + | } | |
262 | + | else throw("Strict value is not equal to itself.") | |
263 | + | } | |
264 | + | } | |
265 | + | } | |
266 | + | ||
267 | + | ||
268 | + | @Verifier(tx) | |
269 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
270 | + |
github/deemru/w8io/169f3d6 27.18 ms ◑