tx · A8cJVJWaQKwAxd4vujfAewoobad9cUH9QD22x2YBGzyV 3Mr1kq2Xf6MTBbXFoxF2giBr5DWjc1RZm9S: -0.01600000 Waves 2024.10.03 15:19 [3310662] smart account 3Mr1kq2Xf6MTBbXFoxF2giBr5DWjc1RZm9S > SELF 0.00000000 Waves
{ "type": 13, "id": "A8cJVJWaQKwAxd4vujfAewoobad9cUH9QD22x2YBGzyV", "fee": 1600000, "feeAssetId": null, "timestamp": 1727958006639, "version": 2, "chainId": 84, "sender": "3Mr1kq2Xf6MTBbXFoxF2giBr5DWjc1RZm9S", "senderPublicKey": "6VfcgiUzfgdxbMEsGa5ZZ1vN8wDQxPGb4kUz8Kron4Pt", "proofs": [ "3gD1DKNSTX2mvF4W1PghXBi7CNx6Zk9yFE4XRJbqDdBHJJPkTENAY39NcHBvaPSz2qmQxb2sVuQDJfRH7Cxvpe9z" ], "script": "base64:BgIuCAISBAoCAQESBAoCAQESBAoCCAgSBAoCGAgSAwoBCBIDCgEIEgMKAQgSAwoBCCUBF3N0YXRpY0tleV9vcmFjbGVBZGRyZXNzAAIUc3RhdGljX29yYWNsZUFkZHJlc3MBFXN0YXRpY0tleV9odW50QWRkcmVzcwACEnN0YXRpY19odW50QWRkcmVzcwEYc3RhdGljS2V5X2JyZWVkZXJBZGRyZXNzAAIVc3RhdGljX2JyZWVkZXJBZGRyZXNzARRzdGF0aWNLZXlfZWdnQXNzZXRJZAACEXN0YXRpY19lZ2dBc3NldElkARdzdGF0aWNLZXlfbWluUGVyY2VudGFnZQACFHN0YXRpY19taW5QZXJjZW50YWdlARdzdGF0aWNLZXlfbWF4UGVyY2VudGFnZQACFHN0YXRpY19tYXhQZXJjZW50YWdlARtzdGF0aWNLZXlfYWNjZXNzSXRlbUFzc2V0SWQAAhhzdGF0aWNfYWNjZXNzSXRlbUFzc2V0SWQBGXN0YXRpY0tleV9hY2Nlc3NJdGVtUHJpY2UAAhZzdGF0aWNfYWNjZXNzSXRlbVByaWNlARZzdGF0aW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W50cnkCCQEac3RhdGljS2V5X3JlbnRTbG90c0dlbmVyYWwAAAUFA25pbABZ998O", "height": 3310662, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 1Mz7mwzezs2d338Rz2xSKHzeTQouTYDtwBNRdU2jdgP Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func staticKey_oracleAddress () = "static_oracleAddress" | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func staticKey_huntAddress () = "static_huntAddress" | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | func staticKey_breederAddress () = "static_breederAddress" | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func staticKey_eggAssetId () = "static_eggAssetId" | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func staticKey_minPercentage () = "static_minPercentage" | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func staticKey_maxPercentage () = "static_maxPercentage" | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func staticKey_accessItemAssetId () = "static_accessItemAssetId" | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func staticKey_accessItemPrice () = "static_accessItemPrice" | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func staticKey_depositSteps () = "static_depositSteps" | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func staticKey_rentSlotsGeneral () = "static_rentSlots" | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func key_getDuckOwner (duck) = (("duck_" + duck) + "_owner") | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func key_getDuckStatus (duck) = (("duck_" + duck) + "_status") | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func key_getDuckRentedBy (duck) = (("duck_" + duck) + "_rentedBy") | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func key_getDuckDuration (duck) = (("duck_" + duck) + "_duration") | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func key_getDuckRentstart (duck) = (("duck_" + duck) + "_start_ts") | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func key_getDuckPercentage (duck) = (("duck_" + duck) + "_percentage") | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func key_getDuckLastPaid (duck) = (("duck_" + duck) + "_lastPaid") | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func key_getTotalRented (user) = (("rented_" + user) + "_amount") | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func key_getTotalBoughtExtraSpots (user) = (("spots_" + user) + "_amount") | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func key_getRefundableFee (user,duck) = (((("refund_" + user) + "_") + duck) + "_amount") | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func key_gamePreFundedItemForDuck (duck) = ("access_funded_" + duck) | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | func key_spotsBought (addressStr) = (("address_" + addressStr) + "_spotsBought") | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | func key_spotsBusy (addressStr) = (("address_" + addressStr) + "_spotsBusy") | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func tryGetStringExternal (address,key) = match getString(address, key) { | |
74 | 74 | case a: String => | |
75 | 75 | a | |
76 | 76 | case _ => | |
77 | 77 | "" | |
78 | 78 | } | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func tryGetString (key) = tryGetStringExternal(this, key) | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func tryGetIntegerExternal (address,key) = match getInteger(address, key) { | |
85 | 85 | case b: Int => | |
86 | 86 | b | |
87 | 87 | case _ => | |
88 | 88 | 0 | |
89 | 89 | } | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func tryGetInteger (key) = tryGetIntegerExternal(this, key) | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func asInt (value) = match value { | |
96 | 96 | case int: Int => | |
97 | 97 | int | |
98 | 98 | case _ => | |
99 | 99 | throw("RAI: wrong type, expected: Int") | |
100 | 100 | } | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | let Generations = ["G", "H", "I", "K", "L", "M", "N", "O"] | |
104 | 104 | ||
105 | 105 | func getOracle () = Address(fromBase58String(tryGetString(staticKey_oracleAddress()))) | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func getHuntAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_huntAddress()))) | |
109 | 109 | ||
110 | 110 | ||
111 | 111 | func getBreederAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_breederAddress()))) | |
112 | 112 | ||
113 | 113 | ||
114 | 114 | func getEggAssetId () = fromBase58String(tryGetStringExternal(getOracle(), staticKey_eggAssetId())) | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | func getAccessItemAssetId () = fromBase58String(tryGetStringExternal(getHuntAddress(), staticKey_accessItemAssetId())) | |
118 | 118 | ||
119 | 119 | ||
120 | 120 | func getAccessItemPrice () = tryGetIntegerExternal(getHuntAddress(), staticKey_accessItemPrice()) | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | func putForRentInternal (i,durationInMs,percentage) = { | |
124 | 124 | let firstPayment = value(i.payments[0]) | |
125 | 125 | let duckId = toBase58String(value(firstPayment.assetId)) | |
126 | 126 | if ((firstPayment.amount != 1)) | |
127 | 127 | then throw("RPFR: NFT is not attached") | |
128 | 128 | else { | |
129 | 129 | let children = asInt(invoke(getBreederAddress(), "validateAndGetChildren", [duckId], nil)) | |
130 | 130 | if ((children == children)) | |
131 | 131 | then { | |
132 | 132 | let boughtSpots = tryGetIntegerExternal(getHuntAddress(), key_spotsBought(toString(i.caller))) | |
133 | 133 | let busySpots = tryGetIntegerExternal(getHuntAddress(), key_spotsBusy(toString(i.caller))) | |
134 | 134 | if ((busySpots >= boughtSpots)) | |
135 | 135 | then throw(((((((("RPFR: No free spots! " + toString(busySpots)) + " ") + toString(boughtSpots)) + " ") + toString(i.caller)) + " ") + toString(getHuntAddress()))) | |
136 | 136 | else if (if ((percentage > getIntegerValue(this, staticKey_maxPercentage()))) | |
137 | 137 | then true | |
138 | 138 | else (getIntegerValue(this, staticKey_minPercentage()) > percentage)) | |
139 | 139 | then throw((((("RPFR: please pick a percentage between " + staticKey_minPercentage()) + " and ") + staticKey_maxPercentage()) + "%")) | |
140 | 140 | else [IntegerEntry(key_getDuckPercentage(duckId), percentage), IntegerEntry(key_getDuckDuration(duckId), durationInMs), StringEntry(key_getDuckOwner(duckId), toString(i.caller)), StringEntry(key_getDuckStatus(duckId), "IDLE")] | |
141 | 141 | } | |
142 | 142 | else throw("Strict value is not equal to itself.") | |
143 | 143 | } | |
144 | 144 | } | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | func tryGetBoolean (key) = match getBoolean(key) { | |
148 | 148 | case b: Boolean => | |
149 | 149 | b | |
150 | 150 | case _ => | |
151 | 151 | false | |
152 | 152 | } | |
153 | 153 | ||
154 | 154 | ||
155 | 155 | @Callable(i) | |
156 | 156 | func putForRent (durationInMs,percentage) = putForRentInternal(i, durationInMs, percentage) | |
157 | 157 | ||
158 | 158 | ||
159 | 159 | ||
160 | 160 | @Callable(i) | |
161 | 161 | func buyGlassesAndPutForRent (durationInMs,percentage) = { | |
162 | 162 | let buyGlasses = invoke(getHuntAddress(), "buyAccessItem", nil, [i.payments[1]]) | |
163 | 163 | if ((buyGlasses == buyGlasses)) | |
164 | 164 | then putForRentInternal(i, durationInMs, percentage) | |
165 | 165 | else throw("Strict value is not equal to itself.") | |
166 | 166 | } | |
167 | 167 | ||
168 | 168 | ||
169 | 169 | ||
170 | 170 | @Callable(i) | |
171 | 171 | func rentDuckFromUser (duckId,game) = { | |
172 | 172 | let genes = split(value(assetInfo(fromBase58String(duckId))).name, "") | |
173 | 173 | let generation = genes[14] | |
174 | 174 | let multiplier = if ((generation == "J")) | |
175 | 175 | then 8 | |
176 | 176 | else (value(indexOf(Generations, generation)) + 1) | |
177 | 177 | let fee = (multiplier * getIntegerValue(staticKey_depositSteps())) | |
178 | 178 | let pmt = value(i.payments[0]) | |
179 | 179 | if ((value(pmt.assetId) != getEggAssetId())) | |
180 | 180 | then throw("TBT: Please attach the correct payment!") | |
181 | 181 | else if ((pmt.amount != fee)) | |
182 | 182 | then throw("RRDFU: Please attach enough refundable deposits!") | |
183 | 183 | else { | |
184 | 184 | let duckStatus = tryGetString(key_getDuckStatus(duckId)) | |
185 | 185 | if ((duckStatus != "IDLE")) | |
186 | 186 | then throw(("RRDFU: You can only rent ducks with IDLE status. Current status: " + duckStatus)) | |
187 | 187 | else { | |
188 | 188 | let duckOwner = tryGetString(key_getDuckOwner(duckId)) | |
189 | 189 | let boughtSpots = tryGetIntegerExternal(getHuntAddress(), key_spotsBought(duckOwner)) | |
190 | 190 | let busySpots = tryGetIntegerExternal(getHuntAddress(), key_spotsBusy(duckOwner)) | |
191 | 191 | let buySpotIfNeeded = if ((boughtSpots == busySpots)) | |
192 | 192 | then { | |
193 | 193 | let call = invoke(getHuntAddress(), "buyAccessItemOther", [duckOwner], [AttachedPayment(fromBase58String(tryGetStringExternal(getHuntAddress(), staticKey_accessItemAssetId())), getIntegerValue(getHuntAddress(), staticKey_accessItemPrice()))]) | |
194 | 194 | if ((call == call)) | |
195 | 195 | then [BooleanEntry(key_gamePreFundedItemForDuck(duckId), true)] | |
196 | 196 | else throw("Strict value is not equal to itself.") | |
197 | 197 | } | |
198 | 198 | else nil | |
199 | 199 | if ((buySpotIfNeeded == buySpotIfNeeded)) | |
200 | 200 | then if ((game != "HUNT")) | |
201 | 201 | then throw("RRDFU: Unsupported game!") | |
202 | 202 | else { | |
203 | 203 | let startTs = lastBlock.timestamp | |
204 | 204 | let sendToHuntData = invoke(getHuntAddress(), "lockDuckRenting", [duckOwner], [AttachedPayment(fromBase58String(duckId), 1)]) | |
205 | 205 | if ((sendToHuntData == sendToHuntData)) | |
206 | 206 | then { | |
207 | 207 | let amountRentedKey = key_getTotalRented(toString(i.caller)) | |
208 | 208 | let boughtKey = key_getTotalBoughtExtraSpots(toString(i.caller)) | |
209 | 209 | let newAmountRented = (tryGetInteger(amountRentedKey) + 1) | |
210 | 210 | let totalSpots = (tryGetInteger(boughtKey) + getIntegerValue(this, staticKey_rentSlotsGeneral())) | |
211 | 211 | if ((newAmountRented > totalSpots)) | |
212 | 212 | then throw(("RRDFU: You already rented max amount of ducks! " + toString(totalSpots))) | |
213 | 213 | else ([IntegerEntry(key_getDuckRentstart(duckId), startTs), IntegerEntry(key_getRefundableFee(toString(i.caller), duckId), fee), IntegerEntry(amountRentedKey, newAmountRented), StringEntry(key_getDuckStatus(duckId), "RENTED"), StringEntry(key_getDuckRentedBy(duckId), toString(i.caller))] ++ buySpotIfNeeded) | |
214 | 214 | } | |
215 | 215 | else throw("Strict value is not equal to itself.") | |
216 | 216 | } | |
217 | 217 | else throw("Strict value is not equal to itself.") | |
218 | 218 | } | |
219 | 219 | } | |
220 | 220 | } | |
221 | 221 | ||
222 | 222 | ||
223 | 223 | ||
224 | 224 | @Callable(i) | |
225 | 225 | func topUpRewards (duckIdAndAmountsList,assetId) = { | |
226 | 226 | func handleTopUp (acc,userAndAmount) = { | |
227 | 227 | let splitArray = split(userAndAmount, ":") | |
228 | 228 | let user = splitArray[0] | |
229 | 229 | let amount = parseIntValue(splitArray[1]) | |
230 | 230 | let duckId = splitArray[2] | |
231 | 231 | [ScriptTransfer(addressFromStringValue(user), (amount * 100000), fromBase58String(assetId)), IntegerEntry(key_getDuckLastPaid(duckId), lastBlock.timestamp)] | |
232 | 232 | } | |
233 | 233 | ||
234 | 234 | let $l = duckIdAndAmountsList | |
235 | 235 | let $s = size($l) | |
236 | 236 | let $acc0 = nil | |
237 | 237 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
238 | 238 | then $a | |
239 | 239 | else handleTopUp($a, $l[$i]) | |
240 | 240 | ||
241 | 241 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
242 | 242 | then $a | |
243 | 243 | else throw("List size exceeds 15") | |
244 | 244 | ||
245 | 245 | $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($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
246 | 246 | } | |
247 | 247 | ||
248 | 248 | ||
249 | 249 | ||
250 | 250 | @Callable(i) | |
251 | 251 | func claimDuckBack (duckId) = { | |
252 | 252 | let duckOwner = tryGetString(key_getDuckOwner(duckId)) | |
253 | 253 | if ((duckOwner != toString(i.caller))) | |
254 | 254 | then throw("RCDB: Please don't try to steal someone else duck!") | |
255 | 255 | else if (if (tryGetBoolean(key_gamePreFundedItemForDuck(duckId))) | |
256 | 256 | then if (if ((size(i.payments) != 1)) | |
257 | 257 | then true | |
258 | 258 | else (i.payments[0].assetId != fromBase58String(tryGetStringExternal(getHuntAddress(), staticKey_accessItemAssetId())))) | |
259 | 259 | then true | |
260 | 260 | else (i.payments[0].amount != getIntegerValue(getHuntAddress(), staticKey_accessItemPrice())) | |
261 | 261 | else false) | |
262 | 262 | then throw(("Please make sure to attach enough funds to pay for your previous spot! " + toString(i.payments[0].amount))) | |
263 | 263 | else { | |
264 | 264 | let duckStatus = tryGetString(key_getDuckStatus(duckId)) | |
265 | 265 | if ((duckStatus == "IDLE")) | |
266 | 266 | then [ScriptTransfer(i.caller, 1, fromBase58String(duckId)), DeleteEntry(key_getDuckStatus(duckId)), DeleteEntry(key_gamePreFundedItemForDuck(duckId))] | |
267 | 267 | else { | |
268 | 268 | let startTs = tryGetInteger(key_getDuckRentstart(duckId)) | |
269 | 269 | if ((lastBlock.timestamp > (startTs + tryGetInteger(key_getDuckDuration(duckId))))) | |
270 | 270 | then { | |
271 | 271 | let player = tryGetString(key_getDuckRentedBy(duckId)) | |
272 | 272 | let removeFromHunt = invoke(getHuntAddress(), "unlockDuckRenting", [duckId, duckOwner], nil) | |
273 | 273 | if ((removeFromHunt == removeFromHunt)) | |
274 | 274 | then { | |
275 | 275 | let amountRentedKey = key_getTotalRented(player) | |
276 | 276 | let newAmountRented = (getIntegerValue(this, amountRentedKey) - 1) | |
277 | 277 | let refundFeeKey = key_getRefundableFee(player, duckId) | |
278 | 278 | [IntegerEntry(amountRentedKey, newAmountRented), ScriptTransfer(addressFromStringValue(player), tryGetInteger(refundFeeKey), getEggAssetId()), DeleteEntry(refundFeeKey), ScriptTransfer(addressFromStringValue(duckOwner), 1, fromBase58String(duckId)), DeleteEntry(key_getDuckStatus(duckId)), DeleteEntry(key_getDuckRentedBy(duckId)), DeleteEntry(key_gamePreFundedItemForDuck(duckId))] | |
279 | 279 | } | |
280 | 280 | else throw("Strict value is not equal to itself.") | |
281 | 281 | } | |
282 | 282 | else { | |
283 | 283 | let lastPayment = tryGetInteger(key_getDuckLastPaid(duckId)) | |
284 | 284 | let threeDaysInMs = (((3 * 24) * 60) * 1000) | |
285 | 285 | if ((lastBlock.height > (lastPayment + threeDaysInMs))) | |
286 | 286 | then { | |
287 | 287 | let player = tryGetString(key_getDuckRentedBy(duckId)) | |
288 | 288 | let unstake = invoke(getHuntAddress(), "unlockDuckRenting", [duckId, duckOwner], nil) | |
289 | 289 | if ((unstake == unstake)) | |
290 | 290 | then { | |
291 | 291 | let amountRentedKey = key_getTotalRented(player) | |
292 | 292 | let newAmountRented = (getIntegerValue(this, amountRentedKey) - 1) | |
293 | 293 | [IntegerEntry(amountRentedKey, newAmountRented), ScriptTransfer(addressFromStringValue(duckOwner), 1, fromBase58String(duckId)), DeleteEntry(key_getDuckStatus(duckId)), DeleteEntry(key_getDuckRentedBy(duckId)), DeleteEntry(key_gamePreFundedItemForDuck(duckId))] | |
294 | 294 | } | |
295 | 295 | else throw("Strict value is not equal to itself.") | |
296 | 296 | } | |
297 | 297 | else throw("RCDB: Renting period is not over and player is active!") | |
298 | 298 | } | |
299 | 299 | } | |
300 | 300 | } | |
301 | 301 | } | |
302 | 302 | ||
303 | 303 | ||
304 | 304 | ||
305 | 305 | @Callable(i) | |
306 | 306 | func sendDuckBack (duckId) = { | |
307 | 307 | let rentedBy = tryGetString(key_getDuckRentedBy(duckId)) | |
308 | 308 | if ((rentedBy != toString(i.caller))) | |
309 | 309 | then throw("RSDB: You didn't rent this duck!") | |
310 | 310 | else { | |
311 | 311 | let duckOwner = tryGetString(key_getDuckOwner(duckId)) | |
312 | 312 | let refundFeeKey = key_getRefundableFee(toString(i.caller), duckId) | |
313 | 313 | let amountRentedKey = key_getTotalRented(toString(i.caller)) | |
314 | 314 | let newAmountRented = (getIntegerValue(this, amountRentedKey) - 1) | |
315 | 315 | let removeFromHunt = invoke(getHuntAddress(), "unlockDuckRenting", [duckId, duckOwner], nil) | |
316 | 316 | if ((removeFromHunt == removeFromHunt)) | |
317 | 317 | then [ScriptTransfer(i.caller, tryGetInteger(refundFeeKey), getEggAssetId()), DeleteEntry(refundFeeKey), StringEntry(key_getDuckStatus(duckId), "IDLE"), DeleteEntry(key_getDuckRentedBy(duckId)), IntegerEntry(amountRentedKey, newAmountRented)] | |
318 | 318 | else throw("Strict value is not equal to itself.") | |
319 | 319 | } | |
320 | 320 | } | |
321 | 321 | ||
322 | 322 | ||
323 | 323 | ||
324 | 324 | @Callable(i) | |
325 | 325 | func sendDuckBackOther (duckId) = if ((i.caller != this)) | |
326 | 326 | then throw("RUO: admin only") | |
327 | 327 | else { | |
328 | 328 | let rentedBy = tryGetString(key_getDuckRentedBy(duckId)) | |
329 | 329 | let duckOwner = tryGetString(key_getDuckOwner(duckId)) | |
330 | 330 | let refundFeeKey = key_getRefundableFee(rentedBy, duckId) | |
331 | 331 | let amountRentedKey = key_getTotalRented(rentedBy) | |
332 | 332 | let newAmountRented = (getIntegerValue(this, amountRentedKey) - 1) | |
333 | 333 | [ScriptTransfer(addressFromStringValue(rentedBy), tryGetInteger(refundFeeKey), getEggAssetId()), DeleteEntry(refundFeeKey), StringEntry(key_getDuckStatus(duckId), "IDLE"), DeleteEntry(key_getDuckRentedBy(duckId)), IntegerEntry(amountRentedKey, newAmountRented)] | |
334 | 334 | } | |
335 | 335 | ||
336 | 336 | ||
337 | 337 | ||
338 | 338 | @Callable(i) | |
339 | 339 | func configureOracle (oracle) = if ((i.caller != this)) | |
340 | 340 | then throw("RCO: admin only") | |
341 | 341 | else [StringEntry(staticKey_oracleAddress(), oracle), IntegerEntry(staticKey_minPercentage(), 5), IntegerEntry(staticKey_maxPercentage(), 80), IntegerEntry(staticKey_depositSteps(), 50000000), IntegerEntry(staticKey_rentSlotsGeneral(), 5)] | |
342 | 342 | ||
343 | 343 |
github/deemru/w8io/026f985 38.28 ms ◑