tx · 33k3QHroWr5Q5qiiPzNM9E7bbKB2hmX62QS54axojaR4 3MyXFjhxofZUKbHj3p8TUgZwDEPNzq7YNo3: -0.01300000 Waves 2023.10.16 12:14 [2800980] smart account 3MyXFjhxofZUKbHj3p8TUgZwDEPNzq7YNo3 > SELF 0.00000000 Waves
{ "type": 13, "id": "33k3QHroWr5Q5qiiPzNM9E7bbKB2hmX62QS54axojaR4", "fee": 1300000, "feeAssetId": null, "timestamp": 1697447676392, "version": 2, "chainId": 84, "sender": "3MyXFjhxofZUKbHj3p8TUgZwDEPNzq7YNo3", "senderPublicKey": "GMSDsb2uuChLYT3PeuzaUNyxyxCVWUKaV6Y5dP7xWxUV", "proofs": [ "rrnPgcsaatW53ktKpGGh2g4RgvPeKXS56eYBMqUEtm6FrprXCar9dFfyYzqhQYns6P5uGkhAXaB74sutUYVSzFP" ], "script": "base64:BgIOCAISAwoBBBIAEgMKAQgtAAxjb250cmFjdEZpbGUCDmwybXBfc3dhcC5yaWRlAANTRVACAl9fAAZzY2FsZTgAgMLXLwAHc2NhbGUxOACAgJC7utat8A0AEkFERFJFU1NfQllURVNfU0laRQAaAA1CTE9DS1NfSU5fREFZAKALAQd3cmFwRXJyAQNtc2cJAKwCAgkArAICBQxjb250cmFjdEZpbGUCAjogBQNtc2cBCHRocm93RXJyAQNtc2cJAAIBCQEHd3JhcEVycgEFA21zZwAMa2V5QXNzZXRJbklkCQC5CQIJAMwIAgICJXMJAMwIAgIJYXNzZXRJbklkBQNuaWwFA1NFUAANa2V5QXNzZXRPdXRJZAkAuQkCCQDMCAICAiVzCQDMCAICCmFzc2V0T3V0SWQFA25pbAUDU0VQABBrZXlBc3NldE91dFByaWNlCQC5CQIJAMwIAgICJXMJAMwIAgINYXNzZXRPdXRQcmljZQUDbmlsBQNTRVAAEWtleVN0YWtpbmdBZGRyZXNzCQC5CQIJAMwIAgICJXMJAMwIAgIOc3Rha2luZ0FkZHJlc3MFA25pbAUDU0VQAA9rZXlTdGF0c1RvdGF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QQBCQELdmFsdWVPckVsc2UCCQCdCAIFBHRoaXMJAQ5rZXlBbGxvd2VkVHhJZAACAAQHYnlPd25lcgMJAGcCCQCQAwEJAQ1nZXRBZG1pbnNMaXN0AAUGUVVPUlVNBwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleQMFCGJ5QWRtaW5zBgUHYnlPd25lcg2ICdY=", "height": 2800980, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HSjeiAp3BCHdYTNDypzBxkBmBgbPxoYGe53b9uZmR7e5 Next: GdH4e7EB2vMEqHGY6Lp9E7RyUF1d8MsQ37HCQaXn3vCw Diff:
Old | New | Differences | |
---|---|---|---|
31 | 31 | ||
32 | 32 | let keyStatsTotalOut = makeString(["%s%s", "stats", "totalOut"], SEP) | |
33 | 33 | ||
34 | + | let keyAllowedAddress = makeString(["%s", "allowedAddress"], SEP) | |
35 | + | ||
34 | 36 | func keyStatsTotalInByAddress (address) = makeString(["%s%s%s", "stats", "totalIn", toString(address)], SEP) | |
35 | 37 | ||
36 | 38 | ||
63 | 65 | } | |
64 | 66 | ||
65 | 67 | let stakingAddress = valueOrErrorMessage(stakingAddressOption, wrapErr("invalid stakingAddress")) | |
68 | + | ||
69 | + | let allowedAddressOption = match getString(this, keyAllowedAddress) { | |
70 | + | case s: String => | |
71 | + | addressFromString(s) | |
72 | + | case _: Unit => | |
73 | + | unit | |
74 | + | case _ => | |
75 | + | throw("Match error") | |
76 | + | } | |
77 | + | ||
78 | + | let allowedAddress = valueOrErrorMessage(allowedAddressOption, wrapErr("invalid allowedAddress")) | |
66 | 79 | ||
67 | 80 | let ADMIN_LIST_SIZE = 5 | |
68 | 81 | ||
100 | 113 | ||
101 | 114 | ||
102 | 115 | func genVotesKeysHelper (a,adminAddress) = { | |
103 | - | let $ | |
104 | - | let result = $ | |
105 | - | let prefix = $ | |
116 | + | let $t033223346 = a | |
117 | + | let result = $t033223346._1 | |
118 | + | let prefix = $t033223346._2 | |
106 | 119 | $Tuple2((result :+ keyFullAdminVote(prefix, adminAddress)), prefix) | |
107 | 120 | } | |
108 | 121 | ||
109 | 122 | ||
110 | 123 | func genVotesKeys (keyPrefix) = { | |
111 | 124 | let adminList = keyAdminAddressList() | |
112 | - | let $ | |
125 | + | let $t034933577 = { | |
113 | 126 | let $l = getAdminsList() | |
114 | 127 | let $s = size($l) | |
115 | 128 | let $acc0 = $Tuple2(nil, keyPrefix) | |
123 | 136 | ||
124 | 137 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
125 | 138 | } | |
126 | - | let result = $ | |
127 | - | let prefix = $ | |
139 | + | let result = $t034933577._1 | |
140 | + | let prefix = $t034933577._2 | |
128 | 141 | result | |
129 | 142 | } | |
130 | 143 | ||
225 | 238 | ||
226 | 239 | ||
227 | 240 | @Callable(i) | |
241 | + | func claim () = { | |
242 | + | let checkCaller = if ((i.caller == allowedAddress)) | |
243 | + | then true | |
244 | + | else throwErr("permission denied") | |
245 | + | if ((checkCaller == checkCaller)) | |
246 | + | then $Tuple2([ScriptTransfer(allowedAddress, assetBalance(this, assetInId), assetInId)], unit) | |
247 | + | else throw("Strict value is not equal to itself.") | |
248 | + | } | |
249 | + | ||
250 | + | ||
251 | + | ||
252 | + | @Callable(i) | |
228 | 253 | func voteForTxId (txId) = { | |
229 | 254 | let callerAddressString = toBase58String(i.caller.bytes) | |
230 | 255 | let keyPrefix = keyAllowedTxIdVotePrefix(txId) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let contractFile = "l2mp_swap.ride" | |
5 | 5 | ||
6 | 6 | let SEP = "__" | |
7 | 7 | ||
8 | 8 | let scale8 = 100000000 | |
9 | 9 | ||
10 | 10 | let scale18 = 1000000000000000000 | |
11 | 11 | ||
12 | 12 | let ADDRESS_BYTES_SIZE = 26 | |
13 | 13 | ||
14 | 14 | let BLOCKS_IN_DAY = 1440 | |
15 | 15 | ||
16 | 16 | func wrapErr (msg) = ((contractFile + ": ") + msg) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func throwErr (msg) = throw(wrapErr(msg)) | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | let keyAssetInId = makeString(["%s", "assetInId"], SEP) | |
23 | 23 | ||
24 | 24 | let keyAssetOutId = makeString(["%s", "assetOutId"], SEP) | |
25 | 25 | ||
26 | 26 | let keyAssetOutPrice = makeString(["%s", "assetOutPrice"], SEP) | |
27 | 27 | ||
28 | 28 | let keyStakingAddress = makeString(["%s", "stakingAddress"], SEP) | |
29 | 29 | ||
30 | 30 | let keyStatsTotalIn = makeString(["%s%s", "stats", "totalIn"], SEP) | |
31 | 31 | ||
32 | 32 | let keyStatsTotalOut = makeString(["%s%s", "stats", "totalOut"], SEP) | |
33 | 33 | ||
34 | + | let keyAllowedAddress = makeString(["%s", "allowedAddress"], SEP) | |
35 | + | ||
34 | 36 | func keyStatsTotalInByAddress (address) = makeString(["%s%s%s", "stats", "totalIn", toString(address)], SEP) | |
35 | 37 | ||
36 | 38 | ||
37 | 39 | func keyStatsTotalOutByAddress (address) = makeString(["%s%s%s", "stats", "totalOut", toString(address)], SEP) | |
38 | 40 | ||
39 | 41 | ||
40 | 42 | func keyHistory (address,txId) = makeString(["%s%s%s", "history", toString(address), toBase58String(txId)], SEP) | |
41 | 43 | ||
42 | 44 | ||
43 | 45 | func formatHistory (amountIn,amountOut,stake) = makeString(["%d%d%d", toString(amountIn), toString(amountOut), toString(stake)], SEP) | |
44 | 46 | ||
45 | 47 | ||
46 | 48 | let assetInId = fromBase58String(valueOrErrorMessage(getString(this, keyAssetInId), wrapErr("invalid assetInId"))) | |
47 | 49 | ||
48 | 50 | let assetInInfo = valueOrErrorMessage(assetInfo(assetInId), wrapErr("invalid assetInInfo")) | |
49 | 51 | ||
50 | 52 | let assetOutId = fromBase58String(valueOrErrorMessage(getString(this, keyAssetOutId), wrapErr("invalid assetInId"))) | |
51 | 53 | ||
52 | 54 | let assetOutInfo = valueOrErrorMessage(assetInfo(assetOutId), wrapErr("invalid assetOutInfo")) | |
53 | 55 | ||
54 | 56 | let assetOutPrice = valueOrErrorMessage(getInteger(this, keyAssetOutPrice), wrapErr("invalid assetOutPrice")) | |
55 | 57 | ||
56 | 58 | let stakingAddressOption = match getString(this, keyStakingAddress) { | |
57 | 59 | case s: String => | |
58 | 60 | addressFromString(s) | |
59 | 61 | case _: Unit => | |
60 | 62 | unit | |
61 | 63 | case _ => | |
62 | 64 | throw("Match error") | |
63 | 65 | } | |
64 | 66 | ||
65 | 67 | let stakingAddress = valueOrErrorMessage(stakingAddressOption, wrapErr("invalid stakingAddress")) | |
68 | + | ||
69 | + | let allowedAddressOption = match getString(this, keyAllowedAddress) { | |
70 | + | case s: String => | |
71 | + | addressFromString(s) | |
72 | + | case _: Unit => | |
73 | + | unit | |
74 | + | case _ => | |
75 | + | throw("Match error") | |
76 | + | } | |
77 | + | ||
78 | + | let allowedAddress = valueOrErrorMessage(allowedAddressOption, wrapErr("invalid allowedAddress")) | |
66 | 79 | ||
67 | 80 | let ADMIN_LIST_SIZE = 5 | |
68 | 81 | ||
69 | 82 | let QUORUM = 3 | |
70 | 83 | ||
71 | 84 | let TXID_BYTES_LENGTH = 32 | |
72 | 85 | ||
73 | 86 | func keyAllowedTxIdVotePrefix (txId) = makeString(["%s%s%s", "allowTxId", txId], SEP) | |
74 | 87 | ||
75 | 88 | ||
76 | 89 | func keyFullAdminVote (prefix,adminAddress) = makeString([prefix, adminAddress], SEP) | |
77 | 90 | ||
78 | 91 | ||
79 | 92 | func keyAdminAddressList () = makeString(["%s", "adminAddressList"], SEP) | |
80 | 93 | ||
81 | 94 | ||
82 | 95 | func keyAllowedTxId () = makeString(["%s", "txId"], SEP) | |
83 | 96 | ||
84 | 97 | ||
85 | 98 | func getAdminVote (prefix,admin) = { | |
86 | 99 | let voteKey = keyFullAdminVote(prefix, admin) | |
87 | 100 | valueOrElse(getInteger(voteKey), 0) | |
88 | 101 | } | |
89 | 102 | ||
90 | 103 | ||
91 | 104 | func getAdminsList () = match getString(this, keyAdminAddressList()) { | |
92 | 105 | case s: String => | |
93 | 106 | split(s, SEP) | |
94 | 107 | case _ => | |
95 | 108 | nil | |
96 | 109 | } | |
97 | 110 | ||
98 | 111 | ||
99 | 112 | func isInAdminList (address) = containsElement(getAdminsList(), address) | |
100 | 113 | ||
101 | 114 | ||
102 | 115 | func genVotesKeysHelper (a,adminAddress) = { | |
103 | - | let $ | |
104 | - | let result = $ | |
105 | - | let prefix = $ | |
116 | + | let $t033223346 = a | |
117 | + | let result = $t033223346._1 | |
118 | + | let prefix = $t033223346._2 | |
106 | 119 | $Tuple2((result :+ keyFullAdminVote(prefix, adminAddress)), prefix) | |
107 | 120 | } | |
108 | 121 | ||
109 | 122 | ||
110 | 123 | func genVotesKeys (keyPrefix) = { | |
111 | 124 | let adminList = keyAdminAddressList() | |
112 | - | let $ | |
125 | + | let $t034933577 = { | |
113 | 126 | let $l = getAdminsList() | |
114 | 127 | let $s = size($l) | |
115 | 128 | let $acc0 = $Tuple2(nil, keyPrefix) | |
116 | 129 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
117 | 130 | then $a | |
118 | 131 | else genVotesKeysHelper($a, $l[$i]) | |
119 | 132 | ||
120 | 133 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
121 | 134 | then $a | |
122 | 135 | else throw("List size exceeds 5") | |
123 | 136 | ||
124 | 137 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
125 | 138 | } | |
126 | - | let result = $ | |
127 | - | let prefix = $ | |
139 | + | let result = $t034933577._1 | |
140 | + | let prefix = $t034933577._2 | |
128 | 141 | result | |
129 | 142 | } | |
130 | 143 | ||
131 | 144 | ||
132 | 145 | func countVotesHelper (result,voteKey) = (result + valueOrElse(getInteger(voteKey), 0)) | |
133 | 146 | ||
134 | 147 | ||
135 | 148 | func countVotes (prefix) = { | |
136 | 149 | let votes = genVotesKeys(prefix) | |
137 | 150 | let $l = votes | |
138 | 151 | let $s = size($l) | |
139 | 152 | let $acc0 = 0 | |
140 | 153 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
141 | 154 | then $a | |
142 | 155 | else countVotesHelper($a, $l[$i]) | |
143 | 156 | ||
144 | 157 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
145 | 158 | then $a | |
146 | 159 | else throw("List size exceeds 5") | |
147 | 160 | ||
148 | 161 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
149 | 162 | } | |
150 | 163 | ||
151 | 164 | ||
152 | 165 | func clearVotesHelper (result,key) = (result :+ DeleteEntry(key)) | |
153 | 166 | ||
154 | 167 | ||
155 | 168 | func getClearVoteEntries (prefix) = { | |
156 | 169 | let votes = genVotesKeys(prefix) | |
157 | 170 | let $l = votes | |
158 | 171 | let $s = size($l) | |
159 | 172 | let $acc0 = nil | |
160 | 173 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
161 | 174 | then $a | |
162 | 175 | else clearVotesHelper($a, $l[$i]) | |
163 | 176 | ||
164 | 177 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
165 | 178 | then $a | |
166 | 179 | else throw("List size exceeds 5") | |
167 | 180 | ||
168 | 181 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
169 | 182 | } | |
170 | 183 | ||
171 | 184 | ||
172 | 185 | func voteINTERNAL (callerAddressString,keyPrefix,minVotes,voteResult) = { | |
173 | 186 | let voteKey = keyFullAdminVote(keyPrefix, callerAddressString) | |
174 | 187 | let adminCurrentVote = getAdminVote(keyPrefix, callerAddressString) | |
175 | 188 | let err = if (!(isInAdminList(callerAddressString))) | |
176 | 189 | then throwErr((("Address: " + callerAddressString) + " not in Admin list")) | |
177 | 190 | else if ((adminCurrentVote == 1)) | |
178 | 191 | then throwErr((voteKey + " you already voted")) | |
179 | 192 | else unit | |
180 | 193 | if ((err == err)) | |
181 | 194 | then { | |
182 | 195 | let votes = countVotes(keyPrefix) | |
183 | 196 | if (((votes + 1) >= minVotes)) | |
184 | 197 | then { | |
185 | 198 | let clearVoteEntries = getClearVoteEntries(keyPrefix) | |
186 | 199 | (clearVoteEntries ++ voteResult) | |
187 | 200 | } | |
188 | 201 | else [IntegerEntry(voteKey, 1)] | |
189 | 202 | } | |
190 | 203 | else throw("Strict value is not equal to itself.") | |
191 | 204 | } | |
192 | 205 | ||
193 | 206 | ||
194 | 207 | @Callable(i) | |
195 | 208 | func swap (stake) = { | |
196 | 209 | let userAddress = i.caller | |
197 | 210 | let paymentSizeExpected = 1 | |
198 | 211 | if ((size(i.payments) != paymentSizeExpected)) | |
199 | 212 | then throwErr("invalid payments") | |
200 | 213 | else { | |
201 | 214 | let payment = i.payments[0] | |
202 | 215 | if ((payment.assetId != assetInId)) | |
203 | 216 | then throwErr("invalid payment assetId") | |
204 | 217 | else if ((assetOutPrice == 0)) | |
205 | 218 | then throwErr("invalid assetOutPrice") | |
206 | 219 | else { | |
207 | 220 | let assetInAmount = payment.amount | |
208 | 221 | let assetOutAmount = fraction(assetInAmount, scale8, assetOutPrice) | |
209 | 222 | if ((assetOutAmount == 0)) | |
210 | 223 | then throwErr("invalid assetOutAmount") | |
211 | 224 | else { | |
212 | 225 | let stakeInv = if (stake) | |
213 | 226 | then invoke(stakingAddress, "stakeFor", [toString(userAddress)], [AttachedPayment(assetOutId, assetOutAmount)]) | |
214 | 227 | else unit | |
215 | 228 | if ((stakeInv == stakeInv)) | |
216 | 229 | then $Tuple2(([IntegerEntry(keyStatsTotalIn, (valueOrElse(getInteger(this, keyStatsTotalIn), 0) + assetInAmount)), IntegerEntry(keyStatsTotalOut, (valueOrElse(getInteger(this, keyStatsTotalOut), 0) + assetOutAmount)), IntegerEntry(keyStatsTotalInByAddress(userAddress), (valueOrElse(getInteger(this, keyStatsTotalInByAddress(userAddress)), 0) + assetInAmount)), IntegerEntry(keyStatsTotalOutByAddress(userAddress), (valueOrElse(getInteger(this, keyStatsTotalOutByAddress(userAddress)), 0) + assetOutAmount)), StringEntry(keyHistory(userAddress, i.transactionId), formatHistory(assetInAmount, assetOutAmount, stake))] ++ (if (stake) | |
217 | 230 | then nil | |
218 | 231 | else [ScriptTransfer(userAddress, assetOutAmount, assetOutId)])), assetOutAmount) | |
219 | 232 | else throw("Strict value is not equal to itself.") | |
220 | 233 | } | |
221 | 234 | } | |
222 | 235 | } | |
223 | 236 | } | |
224 | 237 | ||
225 | 238 | ||
226 | 239 | ||
227 | 240 | @Callable(i) | |
241 | + | func claim () = { | |
242 | + | let checkCaller = if ((i.caller == allowedAddress)) | |
243 | + | then true | |
244 | + | else throwErr("permission denied") | |
245 | + | if ((checkCaller == checkCaller)) | |
246 | + | then $Tuple2([ScriptTransfer(allowedAddress, assetBalance(this, assetInId), assetInId)], unit) | |
247 | + | else throw("Strict value is not equal to itself.") | |
248 | + | } | |
249 | + | ||
250 | + | ||
251 | + | ||
252 | + | @Callable(i) | |
228 | 253 | func voteForTxId (txId) = { | |
229 | 254 | let callerAddressString = toBase58String(i.caller.bytes) | |
230 | 255 | let keyPrefix = keyAllowedTxIdVotePrefix(txId) | |
231 | 256 | let result = [StringEntry(keyAllowedTxId(), txId)] | |
232 | 257 | let allowedTxIdOption = getString(this, keyAllowedTxId()) | |
233 | 258 | let err = [if ((size(fromBase58String(txId)) == TXID_BYTES_LENGTH)) | |
234 | 259 | then true | |
235 | 260 | else throwErr((txId + " is not valid txId")), if (if ((allowedTxIdOption == unit)) | |
236 | 261 | then true | |
237 | 262 | else (value(allowedTxIdOption) != txId)) | |
238 | 263 | then true | |
239 | 264 | else throwErr((txId + " is already allowed"))] | |
240 | 265 | if ((err == err)) | |
241 | 266 | then voteINTERNAL(callerAddressString, keyPrefix, QUORUM, result) | |
242 | 267 | else throw("Strict value is not equal to itself.") | |
243 | 268 | } | |
244 | 269 | ||
245 | 270 | ||
246 | 271 | @Verifier(tx) | |
247 | 272 | func verify () = { | |
248 | 273 | let byAdmins = (tx.id == fromBase58String(valueOrElse(getString(this, keyAllowedTxId()), ""))) | |
249 | 274 | let byOwner = if ((size(getAdminsList()) >= QUORUM)) | |
250 | 275 | then false | |
251 | 276 | else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
252 | 277 | if (byAdmins) | |
253 | 278 | then true | |
254 | 279 | else byOwner | |
255 | 280 | } | |
256 | 281 |
github/deemru/w8io/169f3d6 44.52 ms ◑