tx · 2MeQMcZRet4yaVP3U5kuKxSoYL9tqCimJzpgNRmKzx4g 3MsPYUm9723jTqtBwkhTaPZam3cmZKipw1k: -0.01000000 Waves 2024.10.07 20:27 [3316721] smart account 3MsPYUm9723jTqtBwkhTaPZam3cmZKipw1k > SELF 0.00000000 Waves
{ "type": 13, "id": "2MeQMcZRet4yaVP3U5kuKxSoYL9tqCimJzpgNRmKzx4g", "fee": 1000000, "feeAssetId": null, "timestamp": 1728322041065, "version": 2, "chainId": 84, "sender": "3MsPYUm9723jTqtBwkhTaPZam3cmZKipw1k", "senderPublicKey": "7dnHR7YjY1ki4PgPiRqzkkSgSPapC3yD1dC5jkDJq2wx", "proofs": [ "5n5A2ELPGR422rRFfEJ2HZsr78YBxcfSB38YLcvqsgwV6HnCTR6g3k8v5C7EuNn2qvrLYtUX9df7sju2Ufr6bFUw" ], "script": "base64:BgIZCAISAwoBCBIGCgQIAQEIEgASBgoECAEBCBsBF3N0YXRpY0tleV9vcmFjbGVBZGRyZXNzAAIUc3RhdGljX29yYWNsZUFkZHJlc3MBF3N0YXRpY0tleV9mZWVBZ2dyZWdhdG9yAAIUc3RhdGljX2ZlZUFnZ3JlZ2F0b3IBFHN0YXRpY0tleV9lZ2dBc3NldElkAAIRc3RhdGljX2VnZ0Fzc2V0SWQBF3N0YXRpY0tleV9iYWNrZW5kUHViS2V5AAIUc3RhdGljX2JhY2tlbmRQdWJLZXkBHHN0YXRpY0tleV9yZWZDb250cmFjdEFkZHJlc3MAAhlzdGF0aWNfcmVmQ29udHJhY3RBZGRyZXNzARVzdGF0aWNLZXlfYnVybkFkZHJlc3MAAhJzdGF0aWNfYnVybkFkZHJlc3MBGHN0YXRpY0tleV9jb3Vwb25zQWRkcmVzcwACFXN0YXRpY19jb3Vwb25zQWRkcmVzcwEWc3RhdGljS2V5X2l0ZW1zQWRkcmVzcwACE3N0YXRpY19pdGVtc0FkZHJlc3MBEnN0YXRpY0tleV9leHRyYUZlZQACD3N0YXRpY19leHRyYUZ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lyZFVzZXJTaWduZWQEByRtYXRjaDAFAnR4CQBnAgUPc2lnbmF0dXJlc0NvdW50AAK4XZeZ", "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 | + | func staticKey_oracleAddress () = "static_oracleAddress" | |
5 | + | ||
6 | + | ||
7 | + | func staticKey_feeAggregator () = "static_feeAggregator" | |
8 | + | ||
9 | + | ||
10 | + | func staticKey_eggAssetId () = "static_eggAssetId" | |
11 | + | ||
12 | + | ||
13 | + | func staticKey_backendPubKey () = "static_backendPubKey" | |
14 | + | ||
15 | + | ||
16 | + | func staticKey_refContractAddress () = "static_refContractAddress" | |
17 | + | ||
18 | + | ||
19 | + | func staticKey_burnAddress () = "static_burnAddress" | |
20 | + | ||
21 | + | ||
22 | + | func staticKey_couponsAddress () = "static_couponsAddress" | |
23 | + | ||
24 | + | ||
25 | + | func staticKey_itemsAddress () = "static_itemsAddress" | |
26 | + | ||
27 | + | ||
28 | + | func staticKey_extraFee () = "static_extraFee" | |
29 | + | ||
30 | + | ||
31 | + | func isTestEnv () = { | |
32 | + | let testenv = match getBoolean(this, "TESTENV") { | |
33 | + | case x: Boolean => | |
34 | + | x | |
35 | + | case _ => | |
36 | + | false | |
37 | + | } | |
38 | + | testenv | |
39 | + | } | |
40 | + | ||
41 | + | ||
42 | + | func eggIdKey (eggId,user) = ((("eggId_" + eggId) + "_") + user) | |
43 | + | ||
44 | + | ||
45 | + | func boosterIdKey (type,user,height) = ((((("booster_" + type) + "_") + user) + "_") + toString(height)) | |
46 | + | ||
47 | + | ||
48 | + | func tryGetStringExternal (address,key) = match getString(address, key) { | |
49 | + | case a: String => | |
50 | + | a | |
51 | + | case _ => | |
52 | + | "" | |
53 | + | } | |
54 | + | ||
55 | + | ||
56 | + | func tryGetString (key) = tryGetStringExternal(this, key) | |
57 | + | ||
58 | + | ||
59 | + | func getOracle () = Address(fromBase58String(tryGetString(staticKey_oracleAddress()))) | |
60 | + | ||
61 | + | ||
62 | + | func getEggAssetId () = fromBase58String(tryGetStringExternal(getOracle(), staticKey_eggAssetId())) | |
63 | + | ||
64 | + | ||
65 | + | func getBackendPubKey () = fromBase58String(getStringValue(getOracle(), staticKey_backendPubKey())) | |
66 | + | ||
67 | + | ||
68 | + | func getFeeAggregator () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_feeAggregator()))) | |
69 | + | ||
70 | + | ||
71 | + | func getRefContractAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_refContractAddress()))) | |
72 | + | ||
73 | + | ||
74 | + | func getBurnAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_burnAddress()))) | |
75 | + | ||
76 | + | ||
77 | + | func getCouponsAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_couponsAddress()))) | |
78 | + | ||
79 | + | ||
80 | + | func getItemsAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_itemsAddress()))) | |
81 | + | ||
82 | + | ||
83 | + | func getBackendProof (eggId,price,distance) = makeString([eggId, toString(price), toString(distance)], ";") | |
84 | + | ||
85 | + | ||
86 | + | func checkAdditionalPayment (payment,amount) = if (isDefined(payment.assetId)) | |
87 | + | then throw("RCAP: Please attach waves") | |
88 | + | else if ((payment.amount != amount)) | |
89 | + | then throw((("RCAP: Please attach exactly " + toString(amount)) + " amount of wavelets")) | |
90 | + | else [ScriptTransfer(getFeeAggregator(), amount, unit)] | |
91 | + | ||
92 | + | ||
93 | + | func asBoolean (value) = match value { | |
94 | + | case boolean: Boolean => | |
95 | + | boolean | |
96 | + | case _ => | |
97 | + | throw("TI: wrong type, expected: Boolean") | |
98 | + | } | |
99 | + | ||
100 | + | ||
101 | + | func asInt (value) = match value { | |
102 | + | case int: Int => | |
103 | + | int | |
104 | + | case _ => | |
105 | + | throw("FAI: wrong type, expected: Int") | |
106 | + | } | |
107 | + | ||
108 | + | ||
109 | + | func asString (value) = match value { | |
110 | + | case string: String => | |
111 | + | string | |
112 | + | case _ => | |
113 | + | throw("wrong type, expected: String") | |
114 | + | } | |
115 | + | ||
116 | + | ||
117 | + | @Callable(i) | |
118 | + | func configureOracle (oracle) = if ((i.caller != this)) | |
119 | + | then throw("RCO: admin only") | |
120 | + | else [StringEntry(staticKey_oracleAddress(), oracle)] | |
121 | + | ||
122 | + | ||
123 | + | ||
124 | + | @Callable(i) | |
125 | + | func buyRope (eggId,price,distance,backendSignature) = throw("Deprecated method! Please use buyRopeInverted") | |
126 | + | ||
127 | + | ||
128 | + | ||
129 | + | @Callable(i) | |
130 | + | func useBooster () = { | |
131 | + | let validPayment = checkAdditionalPayment(i.payments[0], getIntegerValue(getOracle(), staticKey_extraFee())) | |
132 | + | if ((validPayment == validPayment)) | |
133 | + | then if (!(if ((size(i.payments) == 2)) | |
134 | + | then (i.payments[1].amount == 1) | |
135 | + | else false)) | |
136 | + | then throw("Invalid payment") | |
137 | + | else { | |
138 | + | let assetId = value(i.payments[1].assetId) | |
139 | + | let boosterType = asString(invoke(getItemsAddress(), "checkArtefactDetails", [toBase58String(assetId)], nil)) | |
140 | + | if ((boosterType == boosterType)) | |
141 | + | then ([Burn(assetId, 1), StringEntry(boosterIdKey(boosterType, toString(i.caller), height), toBase58String(assetId))] ++ validPayment) | |
142 | + | else throw("Strict value is not equal to itself.") | |
143 | + | } | |
144 | + | else throw("Strict value is not equal to itself.") | |
145 | + | } | |
146 | + | ||
147 | + | ||
148 | + | ||
149 | + | @Callable(i) | |
150 | + | func buyRopeInverted (eggId,price,distance,backendSignature) = { | |
151 | + | let addressString = toString(i.caller) | |
152 | + | let backendProof = getBackendProof(eggId, price, distance) | |
153 | + | let exists = tryGetString(eggIdKey(eggId, toString(i.originCaller))) | |
154 | + | let halfPrice = (price / 2) | |
155 | + | let validPayment = checkAdditionalPayment(i.payments[0], price) | |
156 | + | if ((validPayment == validPayment)) | |
157 | + | then if (!(sigVerify_8Kb(toBytes(backendProof), fromBase58String(backendSignature), getBackendPubKey()))) | |
158 | + | then throw("RBR: Invalid proof from backend") | |
159 | + | else if ((distance > 1200)) | |
160 | + | then throw("RBR: You can only maximum boost 1200 meters distance!") | |
161 | + | else { | |
162 | + | let leftToPay = if ((i.originCaller == i.caller)) | |
163 | + | then { | |
164 | + | let amountPaidByCoupons = asInt(invoke(getCouponsAddress(), "useCoupons", [halfPrice], nil)) | |
165 | + | if ((amountPaidByCoupons == amountPaidByCoupons)) | |
166 | + | then (halfPrice - amountPaidByCoupons) | |
167 | + | else throw("Strict value is not equal to itself.") | |
168 | + | } | |
169 | + | else halfPrice | |
170 | + | let refund = if ((leftToPay != 0)) | |
171 | + | then { | |
172 | + | let firstPayment = value(i.payments[1]) | |
173 | + | if ((firstPayment.assetId != getEggAssetId())) | |
174 | + | then throw(("RBR: You can attach only EGG tokens with the following asset id: " + toBase58String(getEggAssetId()))) | |
175 | + | else if ((leftToPay > firstPayment.amount)) | |
176 | + | then throw(((("RBR: To rope a egg you currently need the following amount of EGGlets: " + toString(leftToPay)) + " ") + toString(i.caller))) | |
177 | + | else { | |
178 | + | let refererRewardForbeach = 0 | |
179 | + | let toBurn = leftToPay | |
180 | + | let burnCall = invoke(getBurnAddress(), "burnAttachedPayments", nil, [AttachedPayment(getEggAssetId(), toBurn)]) | |
181 | + | if ((burnCall == burnCall)) | |
182 | + | then [ScriptTransfer(i.caller, (i.payments[1].amount - leftToPay), getEggAssetId())] | |
183 | + | else throw("Strict value is not equal to itself.") | |
184 | + | } | |
185 | + | } | |
186 | + | else nil | |
187 | + | if ((refund == refund)) | |
188 | + | then { | |
189 | + | let recordAction = invoke(getCouponsAddress(), "recordAction", ["ROPE"], nil) | |
190 | + | if ((recordAction == recordAction)) | |
191 | + | then if ((exists != "")) | |
192 | + | then throw("RBR: Rope was already bought for this egg by this user!") | |
193 | + | else (([StringEntry(eggIdKey(eggId, toString(i.originCaller)), ((toString(price) + ";") + toString(distance)))] ++ validPayment) ++ refund) | |
194 | + | else throw("Strict value is not equal to itself.") | |
195 | + | } | |
196 | + | else throw("Strict value is not equal to itself.") | |
197 | + | } | |
198 | + | else throw("Strict value is not equal to itself.") | |
199 | + | } | |
200 | + | ||
201 | + | ||
202 | + | @Verifier(tx) | |
203 | + | func verify () = if (isTestEnv()) | |
204 | + | then sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
205 | + | else { | |
206 | + | let firstUser = base58'6TdaXEfhnjYquvPf3yV7MFxt2CbgFmaqsvGwkKfXtKi4' | |
207 | + | let secondUser = base58'7DsP2WaMLocbHuUxux7pbXRjTrrZ1TFQPsi5QumS3gr8' | |
208 | + | let thirdUser = base58'BpFWP3p3JgYrrP45xfrKzeMcWMEXoinj4FVPPkUiA8D3' | |
209 | + | let firstUserSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], firstUser)) | |
210 | + | then 1 | |
211 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[1], firstUser)) | |
212 | + | then 1 | |
213 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[2], firstUser)) | |
214 | + | then 1 | |
215 | + | else 0 | |
216 | + | let secondUserSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], secondUser)) | |
217 | + | then 1 | |
218 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[1], secondUser)) | |
219 | + | then 1 | |
220 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[2], secondUser)) | |
221 | + | then 1 | |
222 | + | else 0 | |
223 | + | let thirdUserSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], thirdUser)) | |
224 | + | then 1 | |
225 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[1], thirdUser)) | |
226 | + | then 1 | |
227 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[2], thirdUser)) | |
228 | + | then 1 | |
229 | + | else 0 | |
230 | + | let signaturesCount = ((firstUserSigned + secondUserSigned) + thirdUserSigned) | |
231 | + | match tx { | |
232 | + | case _ => | |
233 | + | (signaturesCount >= 2) | |
234 | + | } | |
235 | + | } | |
236 | + |
github/deemru/w8io/026f985 23.85 ms ◑