tx · Azp733djjyp4fqLyUQYeHSrJ33CbnW4SDQ1SpM4KfEXp 3MxVJox4gUBhTYKrzK458PLEwbnhsijAihN: -0.01200000 Waves 2024.10.07 20:27 [3316721] smart account 3MxVJox4gUBhTYKrzK458PLEwbnhsijAihN > SELF 0.00000000 Waves
{ "type": 13, "id": "Azp733djjyp4fqLyUQYeHSrJ33CbnW4SDQ1SpM4KfEXp", "fee": 1200000, "feeAssetId": null, "timestamp": 1728322064424, "version": 2, "chainId": 84, "sender": "3MxVJox4gUBhTYKrzK458PLEwbnhsijAihN", "senderPublicKey": "6aKE4Qk85jkJi2fPfWV4HG1XuygMnFL6uw2YZC6uvTJU", "proofs": [ "RDywJ478VSToeWpbWxfDeD2gugipboi5iYLnjEuaGL6vgkbwn3zwPnG1H3vEAGGkQ57a3svp5UiKhDD3WxTGDQA" ], "script": "base64:BgIfCAISAwoBCBIDCgEBEgQKAgEBEgQKAgEIEgUKAwgBCB8ACWJhc2VQcmljZQCAiXoACGluY3JlYXNlAAEAEGluY3JlYXNlRGVjaW1hbHMAAwEJaXNUZXN0RW52AAQHdGVzdGVudgQHJG1hdGNoMAkAmwgCBQR0aGlzAgdURVNURU5WAwkAAQIFByRtYXRjaDACB0Jvb2xlYW4EAXgFByRtYXRjaDAFAXgHBQd0ZXN0ZW52AQ9kdWNrQ2FwYWNpdHlLZXkBBmR1Y2tJZAkArAICAg9hZGRlZF9jYXBhY2l0eV8FBmR1Y2tJZAEUdHJ5R2V0U3RyaW5nRXh0ZXJuYWwCB2FkZHJlc3MDa2V5BAckbWF0Y2gwCQCdCAIFB2FkZHJlc3MFA2tleQMJAAECBQckbWF0Y2gwAgZTdHJpbmcEAWEFByRtYXRjaDAFAWECAAEMdHJ5R2V0U3RyaW5nAQNrZXkJARR0cnlHZXRTdHJpbmdFeHRlcm5hbAIFBHRoaXMFA2tleQENdHJ5R2V0SW50ZWdlcgEDa2V5BAckbWF0Y2gwCQCaCAIFBHRoaXMFA2tleQMJAAECBQckbWF0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VyU2lnbmVkAwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAUKc2Vjb25kVXNlcgABAwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAQUKc2Vjb25kVXNlcgABAwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAgUKc2Vjb25kVXNlcgABAAAED3RoaXJkVXNlclNpZ25lZAMJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFCXRoaXJkVXNlcgABAwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAQUJdGhpcmRVc2VyAAEDCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwACBQl0aGlyZFVzZXIAAQAABA9zaWduYXR1cmVzQ291bnQJAGQCCQBkAgUPZmlyc3RVc2VyU2lnbmVkBRBzZWNvbmRVc2VyU2lnbmVkBQ90aGlyZFVzZXJTaWduZWQEByRtYXRjaDAFAnR4CQBnAgUPc2lnbmF0dXJlc0NvdW50AAJhC62i", "height": 3316721, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let basePrice = 2000000 | |
5 | + | ||
6 | + | let increase = 1 | |
7 | + | ||
8 | + | let increaseDecimals = 3 | |
9 | + | ||
10 | + | func isTestEnv () = { | |
11 | + | let testenv = match getBoolean(this, "TESTENV") { | |
12 | + | case x: Boolean => | |
13 | + | x | |
14 | + | case _ => | |
15 | + | false | |
16 | + | } | |
17 | + | testenv | |
18 | + | } | |
19 | + | ||
20 | + | ||
21 | + | func duckCapacityKey (duckId) = ("added_capacity_" + duckId) | |
22 | + | ||
23 | + | ||
24 | + | func tryGetStringExternal (address,key) = match getString(address, key) { | |
25 | + | case a: String => | |
26 | + | a | |
27 | + | case _ => | |
28 | + | "" | |
29 | + | } | |
30 | + | ||
31 | + | ||
32 | + | func tryGetString (key) = tryGetStringExternal(this, key) | |
33 | + | ||
34 | + | ||
35 | + | func tryGetInteger (key) = match getInteger(this, key) { | |
36 | + | case b: Int => | |
37 | + | b | |
38 | + | case _ => | |
39 | + | 0 | |
40 | + | } | |
41 | + | ||
42 | + | ||
43 | + | func asInt (value) = match value { | |
44 | + | case int: Int => | |
45 | + | int | |
46 | + | case _ => | |
47 | + | throw("wrong type, expected: Int") | |
48 | + | } | |
49 | + | ||
50 | + | ||
51 | + | func asBoolean (value) = match value { | |
52 | + | case boolean: Boolean => | |
53 | + | boolean | |
54 | + | case _ => | |
55 | + | throw("CAB: wrong type, expected: Boolean") | |
56 | + | } | |
57 | + | ||
58 | + | ||
59 | + | func staticKey_oracleAddress () = "static_oracleAddress" | |
60 | + | ||
61 | + | ||
62 | + | func staticKey_extraFee () = "static_extraFee" | |
63 | + | ||
64 | + | ||
65 | + | func staticKey_breederAddress () = "static_breederAddress" | |
66 | + | ||
67 | + | ||
68 | + | func staticKey_huntAddress () = "static_huntAddress" | |
69 | + | ||
70 | + | ||
71 | + | func staticKey_eggAssetId () = "static_eggAssetId" | |
72 | + | ||
73 | + | ||
74 | + | func staticKey_feeAggregator () = "static_feeAggregator" | |
75 | + | ||
76 | + | ||
77 | + | func staticKey_couponsAddress () = "static_couponsAddress" | |
78 | + | ||
79 | + | ||
80 | + | func staticKey_refContractAddress () = "static_refContractAddress" | |
81 | + | ||
82 | + | ||
83 | + | func staticKey_burnAddress () = "static_burnAddress" | |
84 | + | ||
85 | + | ||
86 | + | func getOracle () = Address(fromBase58String(tryGetString(staticKey_oracleAddress()))) | |
87 | + | ||
88 | + | ||
89 | + | func getCouponsAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_couponsAddress()))) | |
90 | + | ||
91 | + | ||
92 | + | func getEggAssetId () = fromBase58String(tryGetStringExternal(getOracle(), staticKey_eggAssetId())) | |
93 | + | ||
94 | + | ||
95 | + | func getDuckCapacity (duckId) = tryGetInteger(duckCapacityKey(duckId)) | |
96 | + | ||
97 | + | ||
98 | + | func getBreederAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_breederAddress()))) | |
99 | + | ||
100 | + | ||
101 | + | func getHuntAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_huntAddress()))) | |
102 | + | ||
103 | + | ||
104 | + | func getFeeAggregator () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_feeAggregator()))) | |
105 | + | ||
106 | + | ||
107 | + | func getRefContractAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_refContractAddress()))) | |
108 | + | ||
109 | + | ||
110 | + | func getBurnAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_burnAddress()))) | |
111 | + | ||
112 | + | ||
113 | + | func keyDuckOwner (assetId) = (("duck_" + assetId) + "_owner") | |
114 | + | ||
115 | + | ||
116 | + | func common (nftId,payments,addedCapacity,refererAddress) = { | |
117 | + | let children = asInt(invoke(getBreederAddress(), "validateAndGetChildren", [nftId], nil)) | |
118 | + | if ((children == children)) | |
119 | + | then { | |
120 | + | let capacity = getDuckCapacity(nftId) | |
121 | + | let totalCapacity = (capacity + addedCapacity) | |
122 | + | let diff = asInt(invoke(this, "calculateDiffEggs", [capacity, totalCapacity], nil)) | |
123 | + | if ((diff == diff)) | |
124 | + | then { | |
125 | + | let amountPaidByCoupons = asInt(invoke(getCouponsAddress(), "useCoupons", [diff], nil)) | |
126 | + | if ((amountPaidByCoupons == amountPaidByCoupons)) | |
127 | + | then { | |
128 | + | let leftToPay = (diff - amountPaidByCoupons) | |
129 | + | let paymentLeft = if ((leftToPay != 0)) | |
130 | + | then { | |
131 | + | let eggPayment = value(payments[(size(payments) - 1)]) | |
132 | + | if ((eggPayment.assetId != getEggAssetId())) | |
133 | + | then throw(("CBR: You can attach only EGG tokens with the following asset id: " + toBase58String(getEggAssetId()))) | |
134 | + | else if ((eggPayment.amount != leftToPay)) | |
135 | + | then throw(("CBR: To breed you currently need the following amount of EGGlets: " + toString(leftToPay))) | |
136 | + | else { | |
137 | + | let refererRewardForPerch = fraction(leftToPay, 5, 100) | |
138 | + | let refCall = asBoolean(invoke(getRefContractAddress(), "refPayment", [refererAddress], [AttachedPayment(getEggAssetId(), refererRewardForPerch)])) | |
139 | + | if ((refCall == refCall)) | |
140 | + | then { | |
141 | + | let toBurn = if (refCall) | |
142 | + | then (leftToPay - refererRewardForPerch) | |
143 | + | else leftToPay | |
144 | + | let burnCall = invoke(getBurnAddress(), "burnAttachedPayments", nil, [AttachedPayment(getEggAssetId(), toBurn)]) | |
145 | + | if ((burnCall == burnCall)) | |
146 | + | then leftToPay | |
147 | + | else throw("Strict value is not equal to itself.") | |
148 | + | } | |
149 | + | else throw("Strict value is not equal to itself.") | |
150 | + | } | |
151 | + | } | |
152 | + | else 0 | |
153 | + | if ((paymentLeft == paymentLeft)) | |
154 | + | then { | |
155 | + | let debug = makeString([("oldCapacity=" + toString(capacity)), ("newCapacity=" + toString(totalCapacity)), ("diffCapacity=" + toString(addedCapacity)), ("diffPaid=" + toString(diff))], ";") | |
156 | + | [IntegerEntry(duckCapacityKey(nftId), totalCapacity), StringEntry(((duckCapacityKey(nftId) + "_debug_") + toString(height)), debug)] | |
157 | + | } | |
158 | + | else throw("Strict value is not equal to itself.") | |
159 | + | } | |
160 | + | else throw("Strict value is not equal to itself.") | |
161 | + | } | |
162 | + | else throw("Strict value is not equal to itself.") | |
163 | + | } | |
164 | + | else throw("Strict value is not equal to itself.") | |
165 | + | } | |
166 | + | ||
167 | + | ||
168 | + | func checkAdditionalPayment (payment) = if (isDefined(payment.assetId)) | |
169 | + | then throw("CCAP: Please attach waves") | |
170 | + | else { | |
171 | + | let feeAmount = getIntegerValue(getOracle(), staticKey_extraFee()) | |
172 | + | if ((payment.amount != feeAmount)) | |
173 | + | then throw((("CCAP: Please attach exactly " + toString(feeAmount)) + " amount of wavelets")) | |
174 | + | else [ScriptTransfer(getFeeAggregator(), feeAmount, unit)] | |
175 | + | } | |
176 | + | ||
177 | + | ||
178 | + | @Callable(i) | |
179 | + | func configureOracle (oracle) = if ((i.caller != this)) | |
180 | + | then throw("CCO: admin only") | |
181 | + | else [StringEntry(staticKey_oracleAddress(), oracle)] | |
182 | + | ||
183 | + | ||
184 | + | ||
185 | + | @Callable(i) | |
186 | + | func calculateTotalPriceEggs (eggs) = { | |
187 | + | let powPart = (pow((1000 + increase), increaseDecimals, (eggs + 1), 0, 8, HALFUP) - 100000000) | |
188 | + | let price = (((basePrice * powPart) / increase) / 100000) | |
189 | + | $Tuple2([IntegerEntry(("PRICE_CALCULATION_POW_" + toString(eggs)), powPart), IntegerEntry(("PRICE_CALCULATION_" + toString(eggs)), price)], price) | |
190 | + | } | |
191 | + | ||
192 | + | ||
193 | + | ||
194 | + | @Callable(i) | |
195 | + | func calculateDiffEggs (oldEggs,newEggs) = { | |
196 | + | let alreadyPaid = asInt(invoke(this, "calculateTotalPriceEggs", [oldEggs], nil)) | |
197 | + | if ((alreadyPaid == alreadyPaid)) | |
198 | + | then { | |
199 | + | let totalToPay = asInt(invoke(this, "calculateTotalPriceEggs", [newEggs], nil)) | |
200 | + | if ((totalToPay == totalToPay)) | |
201 | + | then { | |
202 | + | let diff = (totalToPay - alreadyPaid) | |
203 | + | let debug = makeString([("oldPaid=" + toString(alreadyPaid)), ("newPaid=" + toString(totalToPay))], ";") | |
204 | + | $Tuple2([StringEntry("DEBUG_CALCULATIONS", debug)], diff) | |
205 | + | } | |
206 | + | else throw("Strict value is not equal to itself.") | |
207 | + | } | |
208 | + | else throw("Strict value is not equal to itself.") | |
209 | + | } | |
210 | + | ||
211 | + | ||
212 | + | ||
213 | + | @Callable(i) | |
214 | + | func addCapacityToDuck (addedCapacity,refererAddress) = { | |
215 | + | let nftPayment = value(i.payments[0]) | |
216 | + | let validPayment = checkAdditionalPayment(i.payments[1]) | |
217 | + | let duckAssetId = toBase58String(value(nftPayment.assetId)) | |
218 | + | let recordAction = invoke(getCouponsAddress(), "recordAction", ["RECHARGE"], nil) | |
219 | + | if ((recordAction == recordAction)) | |
220 | + | then if ((nftPayment.amount != 1)) | |
221 | + | then throw("NFT is not attached") | |
222 | + | else ((common(duckAssetId, i.payments, addedCapacity, refererAddress) ++ [ScriptTransfer(i.caller, 1, value(nftPayment.assetId))]) ++ validPayment) | |
223 | + | else throw("Strict value is not equal to itself.") | |
224 | + | } | |
225 | + | ||
226 | + | ||
227 | + | ||
228 | + | @Callable(i) | |
229 | + | func addCapacityToDuckInHunt (nftId,addedCapacity,refererAddress) = { | |
230 | + | let ownerInHunt = tryGetStringExternal(getHuntAddress(), keyDuckOwner(nftId)) | |
231 | + | let validPayment = checkAdditionalPayment(i.payments[0]) | |
232 | + | let recordAction = invoke(getCouponsAddress(), "recordAction", ["RECHARGE"], nil) | |
233 | + | if ((recordAction == recordAction)) | |
234 | + | then if ((ownerInHunt != toString(i.caller))) | |
235 | + | then throw("CBR: You can only add capacity to own ducks!") | |
236 | + | else (common(nftId, i.payments, addedCapacity, refererAddress) ++ validPayment) | |
237 | + | else throw("Strict value is not equal to itself.") | |
238 | + | } | |
239 | + | ||
240 | + | ||
241 | + | @Verifier(tx) | |
242 | + | func verify () = if (isTestEnv()) | |
243 | + | then sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
244 | + | else { | |
245 | + | let firstUser = base58'6TdaXEfhnjYquvPf3yV7MFxt2CbgFmaqsvGwkKfXtKi4' | |
246 | + | let secondUser = base58'7DsP2WaMLocbHuUxux7pbXRjTrrZ1TFQPsi5QumS3gr8' | |
247 | + | let thirdUser = base58'BpFWP3p3JgYrrP45xfrKzeMcWMEXoinj4FVPPkUiA8D3' | |
248 | + | let firstUserSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], firstUser)) | |
249 | + | then 1 | |
250 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[1], firstUser)) | |
251 | + | then 1 | |
252 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[2], firstUser)) | |
253 | + | then 1 | |
254 | + | else 0 | |
255 | + | let secondUserSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], secondUser)) | |
256 | + | then 1 | |
257 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[1], secondUser)) | |
258 | + | then 1 | |
259 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[2], secondUser)) | |
260 | + | then 1 | |
261 | + | else 0 | |
262 | + | let thirdUserSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], thirdUser)) | |
263 | + | then 1 | |
264 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[1], thirdUser)) | |
265 | + | then 1 | |
266 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[2], thirdUser)) | |
267 | + | then 1 | |
268 | + | else 0 | |
269 | + | let signaturesCount = ((firstUserSigned + secondUserSigned) + thirdUserSigned) | |
270 | + | match tx { | |
271 | + | case _ => | |
272 | + | (signaturesCount >= 2) | |
273 | + | } | |
274 | + | } | |
275 | + |
github/deemru/w8io/026f985 17.48 ms ◑