tx · 6ngobHYAkTkCAJFdcPCdJASh28CT8Sq4Xn5c1PEXA7vP 3N7xNWzNYeyH7Y1mVMvbewW9oo8c2MhmigU: -0.01000000 Waves 2024.11.21 12:42 [3381045] smart account 3N7xNWzNYeyH7Y1mVMvbewW9oo8c2MhmigU > SELF 0.00000000 Waves
{ "type": 13, "id": "6ngobHYAkTkCAJFdcPCdJASh28CT8Sq4Xn5c1PEXA7vP", "fee": 1000000, "feeAssetId": null, "timestamp": 1732182114400, "version": 2, "chainId": 84, "sender": "3N7xNWzNYeyH7Y1mVMvbewW9oo8c2MhmigU", "senderPublicKey": "B1qMTynh8kEm5LTPR5dmuG8ZHgVgLbUc9Qdo2TQa91Fg", "proofs": [ "2Q6iedwiyXPb7x8ERaAEdiZ3pgf2A6LZt6SESMD2s3dK1M4nRvJxHGL5jd3AYZpLqRZbxgTryQ9Z3C3AAWrvc9pW" ], "script": "base64:BwIVCAISBQoDCAgIEgUKAwgIGBIDCgEIJgAJU0VQQVJBVE9SAgJfXwAPQkFUQ0hfU0VQQVJBVE9SAgI6OgAMS0VZX01VTFRJU0lHAghNVUxUSVNJRwAKS0VZX1NUQVRVUwIGU1RBVFVTAAhLRVlfSU5JVAIESU5JVAAUS0VZX1NFUVVFTkNFUl9DQUxMRVICEFNFUVVFTkNFUl9DQUxMRVIAFEtFWV9HQVRFV0FZX0NPTlRSQUNUAhBHQVRFV0FZX0NPTlRSQUNUABFLRVlfU1BPVF9DT05UUkFDVAINU1BPVF9DT05UUkFDVAATS0VZX0xBU1RfQkFUQ0hfSEFTSAIPTEFTVF9CQVRDSF9IQVNIAA1GVU5DX1dJVEhEUkFXAgh3aXRoZHJhdwAKRlVOQ19UUkFERQIFdHJhZGUAEUZVTkNfQ0xBSU1fUkVXQVJEAgtjbGFpbVJld2FyZAAWRlVOQ19SRUpFQ1RfV0lUSERSQVdBTAIQcmVqZWN0V2l0aGRyYXdhbAAQR0FURVdBWV9XSVRIRFJBVwIQR0FURVdBWV9XSVRIRFJ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X1NUQVRVUwkAzAgCCQClCAEFBHRoaXMJAMwIAgkA2AQBCAUCdHgCaWQFA25pbAUJU0VQQVJBVE9SBwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleUcApz8=", "height": 3381045, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: J8YiM7uP4QZEBY9BP2Li2YAAHhicj9AHC3nBiJVkHRHu Next: none Diff:
Old | New | Differences | |
---|---|---|---|
25 | 25 | ||
26 | 26 | let FUNC_CLAIM_REWARD = "claimReward" | |
27 | 27 | ||
28 | + | let FUNC_REJECT_WITHDRAWAL = "rejectWithdrawal" | |
29 | + | ||
28 | 30 | let GATEWAY_WITHDRAW = "GATEWAY_WITHDRAW" | |
31 | + | ||
32 | + | let GATEWAY_REJECT_WD = "GATEWAY_REJECT_WD" | |
29 | 33 | ||
30 | 34 | let SPOT_TRADE = "SPOT_TRADE" | |
31 | 35 | ||
190 | 194 | then invoke(spotContract, FUNC_CLAIM_REWARD, functionArgs, nil) | |
191 | 195 | else if ((contractAction == GATEWAY_WITHDRAW)) | |
192 | 196 | then invoke(gatewayContract, FUNC_WITHDRAW, functionArgs, nil) | |
193 | - | else throw("processBatch: invalid operation") | |
197 | + | else if ((contractAction == GATEWAY_REJECT_WD)) | |
198 | + | then invoke(gatewayContract, FUNC_REJECT_WITHDRAWAL, functionArgs, nil) | |
199 | + | else throw("processBatch: invalid operation") | |
194 | 200 | if ((invocation == invocation)) | |
195 | 201 | then acc | |
196 | 202 | else throw("Strict value is not equal to itself.") |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 7 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEPARATOR = "__" | |
5 | 5 | ||
6 | 6 | let BATCH_SEPARATOR = "::" | |
7 | 7 | ||
8 | 8 | let KEY_MULTISIG = "MULTISIG" | |
9 | 9 | ||
10 | 10 | let KEY_STATUS = "STATUS" | |
11 | 11 | ||
12 | 12 | let KEY_INIT = "INIT" | |
13 | 13 | ||
14 | 14 | let KEY_SEQUENCER_CALLER = "SEQUENCER_CALLER" | |
15 | 15 | ||
16 | 16 | let KEY_GATEWAY_CONTRACT = "GATEWAY_CONTRACT" | |
17 | 17 | ||
18 | 18 | let KEY_SPOT_CONTRACT = "SPOT_CONTRACT" | |
19 | 19 | ||
20 | 20 | let KEY_LAST_BATCH_HASH = "LAST_BATCH_HASH" | |
21 | 21 | ||
22 | 22 | let FUNC_WITHDRAW = "withdraw" | |
23 | 23 | ||
24 | 24 | let FUNC_TRADE = "trade" | |
25 | 25 | ||
26 | 26 | let FUNC_CLAIM_REWARD = "claimReward" | |
27 | 27 | ||
28 | + | let FUNC_REJECT_WITHDRAWAL = "rejectWithdrawal" | |
29 | + | ||
28 | 30 | let GATEWAY_WITHDRAW = "GATEWAY_WITHDRAW" | |
31 | + | ||
32 | + | let GATEWAY_REJECT_WD = "GATEWAY_REJECT_WD" | |
29 | 33 | ||
30 | 34 | let SPOT_TRADE = "SPOT_TRADE" | |
31 | 35 | ||
32 | 36 | let SPOT_CLAIM_REWARD = "SPOT_CLAIM_REWARD" | |
33 | 37 | ||
34 | 38 | let MAX_INT = 9223372036854775807 | |
35 | 39 | ||
36 | 40 | func _validateAddress (address_,err_) = match addressFromString(address_) { | |
37 | 41 | case a: Address => | |
38 | 42 | true | |
39 | 43 | case _ => | |
40 | 44 | throw(err_) | |
41 | 45 | } | |
42 | 46 | ||
43 | 47 | ||
44 | 48 | func _validateInt (val_,lowerBoundary_,upperBoundary_,err_) = if (if ((lowerBoundary_ > val_)) | |
45 | 49 | then true | |
46 | 50 | else (val_ > upperBoundary_)) | |
47 | 51 | then throw(err_) | |
48 | 52 | else true | |
49 | 53 | ||
50 | 54 | ||
51 | 55 | func _loadInit () = match getBoolean(KEY_INIT) { | |
52 | 56 | case a: Boolean => | |
53 | 57 | a | |
54 | 58 | case _ => | |
55 | 59 | false | |
56 | 60 | } | |
57 | 61 | ||
58 | 62 | ||
59 | 63 | func _saveInit (isInit_) = [BooleanEntry(KEY_INIT, isInit_)] | |
60 | 64 | ||
61 | 65 | ||
62 | 66 | func _loadMultisig () = match getString(KEY_MULTISIG) { | |
63 | 67 | case a: String => | |
64 | 68 | addressFromStringValue(a) | |
65 | 69 | case _ => | |
66 | 70 | Address(base58'') | |
67 | 71 | } | |
68 | 72 | ||
69 | 73 | ||
70 | 74 | func _saveMultisig (multisig_) = [StringEntry(KEY_MULTISIG, toString(multisig_))] | |
71 | 75 | ||
72 | 76 | ||
73 | 77 | func _loadSequencerCaller () = match getString(KEY_SEQUENCER_CALLER) { | |
74 | 78 | case a: String => | |
75 | 79 | addressFromStringValue(a) | |
76 | 80 | case _ => | |
77 | 81 | Address(base58'') | |
78 | 82 | } | |
79 | 83 | ||
80 | 84 | ||
81 | 85 | func _saveSequencerCaller (sequencerCaller_) = [StringEntry(KEY_SEQUENCER_CALLER, toString(sequencerCaller_))] | |
82 | 86 | ||
83 | 87 | ||
84 | 88 | func _loadGatewayContract () = match getString(KEY_GATEWAY_CONTRACT) { | |
85 | 89 | case a: String => | |
86 | 90 | addressFromStringValue(a) | |
87 | 91 | case _ => | |
88 | 92 | Address(base58'') | |
89 | 93 | } | |
90 | 94 | ||
91 | 95 | ||
92 | 96 | func _saveGatewayContract (gatewayContract_) = [StringEntry(KEY_GATEWAY_CONTRACT, toString(gatewayContract_))] | |
93 | 97 | ||
94 | 98 | ||
95 | 99 | func _loadSpotContract () = match getString(KEY_SPOT_CONTRACT) { | |
96 | 100 | case a: String => | |
97 | 101 | addressFromStringValue(a) | |
98 | 102 | case _ => | |
99 | 103 | Address(base58'') | |
100 | 104 | } | |
101 | 105 | ||
102 | 106 | ||
103 | 107 | func _saveSpotContract (spotContract_) = [StringEntry(KEY_SPOT_CONTRACT, toString(spotContract_))] | |
104 | 108 | ||
105 | 109 | ||
106 | 110 | func _loadLastBatchHash () = match getString(KEY_LAST_BATCH_HASH) { | |
107 | 111 | case a: String => | |
108 | 112 | a | |
109 | 113 | case _ => | |
110 | 114 | "GENESIS" | |
111 | 115 | } | |
112 | 116 | ||
113 | 117 | ||
114 | 118 | func _saveLastBatchHash (lastBatchHash_) = [StringEntry(KEY_LAST_BATCH_HASH, lastBatchHash_)] | |
115 | 119 | ||
116 | 120 | ||
117 | 121 | func _onlyThisContract (caller_) = if ((caller_ != this)) | |
118 | 122 | then throw("_onlyThisContract: revert") | |
119 | 123 | else true | |
120 | 124 | ||
121 | 125 | ||
122 | 126 | func _whenMultisigSet () = if ((_loadMultisig() == Address(base58''))) | |
123 | 127 | then throw("_whenMultisigSet: revert") | |
124 | 128 | else true | |
125 | 129 | ||
126 | 130 | ||
127 | 131 | func _whenNotInitialized () = if (_loadInit()) | |
128 | 132 | then throw("_whenNotInitialized: revert") | |
129 | 133 | else true | |
130 | 134 | ||
131 | 135 | ||
132 | 136 | func _whenInitialized () = if (!(_loadInit())) | |
133 | 137 | then throw("_whenInitialized: revert") | |
134 | 138 | else true | |
135 | 139 | ||
136 | 140 | ||
137 | 141 | func _validateSequencerCaller (caller,err_) = if ((_loadSequencerCaller() != caller)) | |
138 | 142 | then throw(err_) | |
139 | 143 | else true | |
140 | 144 | ||
141 | 145 | ||
142 | 146 | func _validateBatchHash (lastBatchHash_,err_) = if ((_loadLastBatchHash() != lastBatchHash_)) | |
143 | 147 | then throw(err_) | |
144 | 148 | else true | |
145 | 149 | ||
146 | 150 | ||
147 | 151 | @Callable(i) | |
148 | 152 | func init (sequencerCaller_,gatewayContract_,spotContract_) = { | |
149 | 153 | let err = if (if (if (if (if (_onlyThisContract(i.caller)) | |
150 | 154 | then _whenNotInitialized() | |
151 | 155 | else false) | |
152 | 156 | then _whenMultisigSet() | |
153 | 157 | else false) | |
154 | 158 | then _validateAddress(sequencerCaller_, "init: invalid sequencerCaller") | |
155 | 159 | else false) | |
156 | 160 | then _validateAddress(gatewayContract_, "init: invalid gatewayContract") | |
157 | 161 | else false) | |
158 | 162 | then _validateAddress(spotContract_, "init: invalid spotContract") | |
159 | 163 | else false | |
160 | 164 | if ((err == err)) | |
161 | 165 | then $Tuple2((((_saveInit(true) ++ _saveSequencerCaller(addressFromStringValue(sequencerCaller_))) ++ _saveGatewayContract(addressFromStringValue(gatewayContract_))) ++ _saveSpotContract(addressFromStringValue(spotContract_))), unit) | |
162 | 166 | else throw("Strict value is not equal to itself.") | |
163 | 167 | } | |
164 | 168 | ||
165 | 169 | ||
166 | 170 | ||
167 | 171 | @Callable(i) | |
168 | 172 | func processBatch (currentBatchHash_,lastBatchHash_,batch_) = { | |
169 | 173 | let err = if (if (if (_validateSequencerCaller(i.caller, "processBatch: invalid sequencer caller")) | |
170 | 174 | then _validateInt(size(currentBatchHash_), 1, MAX_INT, "processBatch: invalid currentBatchHash") | |
171 | 175 | else false) | |
172 | 176 | then _validateBatchHash(lastBatchHash_, "processBatch: invalid lastBatchHash") | |
173 | 177 | else false) | |
174 | 178 | then _validateInt(size(batch_), 1, 10, "processBatch: invalid batch size") | |
175 | 179 | else false | |
176 | 180 | if ((err == err)) | |
177 | 181 | then { | |
178 | 182 | let spotContract = _loadSpotContract() | |
179 | 183 | let gatewayContract = _loadGatewayContract() | |
180 | 184 | func foldFunc (acc,elem) = { | |
181 | 185 | let fields = split_4C(elem, BATCH_SEPARATOR) | |
182 | 186 | let err1 = _validateInt(size(fields), 1, 23, "processBatch: invalid elem size") | |
183 | 187 | if ((err1 == err1)) | |
184 | 188 | then { | |
185 | 189 | let contractAction = fields[0] | |
186 | 190 | let functionArgs = removeByIndex(fields, 0) | |
187 | 191 | let invocation = if ((contractAction == SPOT_TRADE)) | |
188 | 192 | then invoke(spotContract, FUNC_TRADE, functionArgs, nil) | |
189 | 193 | else if ((contractAction == SPOT_CLAIM_REWARD)) | |
190 | 194 | then invoke(spotContract, FUNC_CLAIM_REWARD, functionArgs, nil) | |
191 | 195 | else if ((contractAction == GATEWAY_WITHDRAW)) | |
192 | 196 | then invoke(gatewayContract, FUNC_WITHDRAW, functionArgs, nil) | |
193 | - | else throw("processBatch: invalid operation") | |
197 | + | else if ((contractAction == GATEWAY_REJECT_WD)) | |
198 | + | then invoke(gatewayContract, FUNC_REJECT_WITHDRAWAL, functionArgs, nil) | |
199 | + | else throw("processBatch: invalid operation") | |
194 | 200 | if ((invocation == invocation)) | |
195 | 201 | then acc | |
196 | 202 | else throw("Strict value is not equal to itself.") | |
197 | 203 | } | |
198 | 204 | else throw("Strict value is not equal to itself.") | |
199 | 205 | } | |
200 | 206 | ||
201 | 207 | let result = { | |
202 | 208 | let $l = batch_ | |
203 | 209 | let $s = size($l) | |
204 | 210 | let $acc0 = true | |
205 | 211 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
206 | 212 | then $a | |
207 | 213 | else foldFunc($a, $l[$i]) | |
208 | 214 | ||
209 | 215 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
210 | 216 | then $a | |
211 | 217 | else throw("List size exceeds 10") | |
212 | 218 | ||
213 | 219 | $f0_2($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) | |
214 | 220 | } | |
215 | 221 | if ((result == result)) | |
216 | 222 | then $Tuple2(_saveLastBatchHash(currentBatchHash_), unit) | |
217 | 223 | else throw("Strict value is not equal to itself.") | |
218 | 224 | } | |
219 | 225 | else throw("Strict value is not equal to itself.") | |
220 | 226 | } | |
221 | 227 | ||
222 | 228 | ||
223 | 229 | ||
224 | 230 | @Callable(i) | |
225 | 231 | func setMultisig (multisig_) = { | |
226 | 232 | let err = if (_onlyThisContract(i.caller)) | |
227 | 233 | then _validateAddress(multisig_, "setMultisig: invalid multisig") | |
228 | 234 | else false | |
229 | 235 | if ((err == err)) | |
230 | 236 | then $Tuple2(_saveMultisig(addressFromStringValue(multisig_)), unit) | |
231 | 237 | else throw("Strict value is not equal to itself.") | |
232 | 238 | } | |
233 | 239 | ||
234 | 240 | ||
235 | 241 | @Verifier(tx) | |
236 | 242 | func verify () = match getString(KEY_MULTISIG) { | |
237 | 243 | case multisig: String => | |
238 | 244 | valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false) | |
239 | 245 | case _ => | |
240 | 246 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
241 | 247 | } | |
242 | 248 |
github/deemru/w8io/169f3d6 74.10 ms ◑