tx · 4WwtiPZxCfMdN9jmMZWWeAPwrRL6THgRTa5Hg83v7uyE 3N181WizgkxpWSFQoCnSbhRu2j1cwBadDYY: -0.01400000 Waves 2023.02.21 16:31 [2459476] smart account 3N181WizgkxpWSFQoCnSbhRu2j1cwBadDYY > SELF 0.00000000 Waves
{ "type": 13, "id": "4WwtiPZxCfMdN9jmMZWWeAPwrRL6THgRTa5Hg83v7uyE", "fee": 1400000, "feeAssetId": null, "timestamp": 1676986250267, "version": 2, "chainId": 84, "sender": "3N181WizgkxpWSFQoCnSbhRu2j1cwBadDYY", "senderPublicKey": "9Hom3CnVGCVZiB6V5j3mEeAuquZytXpj99sSEdnAFy52", "proofs": [ "RA6wy5MGsArQ5dbnLHXdLRamo5gh3JyHHrifFbyCipWg7GhcsWvYyKhDQTK5NQu6fjU1XbeTcMfXWsTTqyRiJ8i" ], "script": "base64:BgInCAISBAoCCAESBQoDAQgIEgMKAQgSAwoBCBIAEgASAwoBCBIDCgEIJwAJU0VQQVJBVE9SAgJfXwAIS0VZX0lOSVQCBElOSVQADEtFWV9NVUxUSVNJRwIITVVMVElTSUcACktFWV9TVEFUVVMCBlNUQVRVUwAKS0VZX1BBVVNFRAIGUEFVU0VEAApLRVlfUEFVU0VSAgZQQVVTRVIADUtFWV9BTExPV0FOQ0UCCUFMTE9XQU5DRQARS0VZX0NBTExfQ0hBSU5fSUQCDUNBTExfQ0hBSU5fSUQADktFWV9FVkVOVF9TSVpFAgpFVkVOVF9TSVpFAAlLRVlfRVZFTlQCBUVWRU5UAAlLRVlfTk9OQ0UCBU5PTkNFAAdNQVhfSU5UAP//////////fwEQX3ZhbGlkYXRlQWRkcmVzcwIIYWRkcmVzc18EZXJyXwQHJG1hdGNoMAkApggBBQhhZGRyZXNzXwMJAAECBQckbWF0Y2gwAgdBZGRyZXNzBAFhBQckbWF0Y2gwBgkAAgEFBGVycl8BDF92YWxpZGF0ZUludAQEdmFsXw5sb3dlckJvdW5kYXJ5Xw51cHBlckJvdW5kYX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kZXJQdWJsaWNLZXnamkHH", "height": 2459476, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: pXfvdhSPXXDRHNgbyJxh51hmSqcNBPAq1VJjRnvz9t5 Next: Bf6AMLaxuPxK9NjoHingLV5nroWfKMspYPeV32Edt9JF Diff:
Old | New | Differences | |
---|---|---|---|
17 | 17 | ||
18 | 18 | let KEY_CALL_CHAIN_ID = "CALL_CHAIN_ID" | |
19 | 19 | ||
20 | - | let KEY_EVENT_ | |
20 | + | let KEY_EVENT_SIZE = "EVENT_SIZE" | |
21 | 21 | ||
22 | 22 | let KEY_EVENT = "EVENT" | |
23 | 23 | ||
106 | 106 | func _saveCallChainId (callChainId_) = [IntegerEntry(KEY_CALL_CHAIN_ID, callChainId_)] | |
107 | 107 | ||
108 | 108 | ||
109 | - | func _ | |
109 | + | func _loadEventSize () = match getInteger(KEY_EVENT_SIZE) { | |
110 | 110 | case a: Int => | |
111 | 111 | a | |
112 | 112 | case _ => | |
114 | 114 | } | |
115 | 115 | ||
116 | 116 | ||
117 | - | func _ | |
117 | + | func _saveEventSize (index_) = [IntegerEntry(KEY_EVENT_SIZE, index_)] | |
118 | 118 | ||
119 | 119 | ||
120 | 120 | func _saveEvent (index_,event_) = [StringEntry(makeString([KEY_EVENT, toString(index_)], SEPARATOR), makeString([toString(event_._1), toString(event_._2), toString(event_._3), event_._4, event_._5, toString(event_._6)], SEPARATOR))] | |
199 | 199 | if ((err == err)) | |
200 | 200 | then { | |
201 | 201 | let nonce = _loadNonce() | |
202 | - | let | |
202 | + | let eventSize = _loadEventSize() | |
203 | 203 | let event = $Tuple6(_loadCallChainId(), executionChainId_, i.caller, executionContract_, calldata_, nonce) | |
204 | - | $Tuple2(((_ | |
204 | + | $Tuple2(((_saveEventSize((eventSize + 1)) ++ _saveEvent(eventSize, event)) ++ _saveNonce((nonce + 1))), unit) | |
205 | 205 | } | |
206 | 206 | else throw("Strict value is not equal to itself.") | |
207 | 207 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEPARATOR = "__" | |
5 | 5 | ||
6 | 6 | let KEY_INIT = "INIT" | |
7 | 7 | ||
8 | 8 | let KEY_MULTISIG = "MULTISIG" | |
9 | 9 | ||
10 | 10 | let KEY_STATUS = "STATUS" | |
11 | 11 | ||
12 | 12 | let KEY_PAUSED = "PAUSED" | |
13 | 13 | ||
14 | 14 | let KEY_PAUSER = "PAUSER" | |
15 | 15 | ||
16 | 16 | let KEY_ALLOWANCE = "ALLOWANCE" | |
17 | 17 | ||
18 | 18 | let KEY_CALL_CHAIN_ID = "CALL_CHAIN_ID" | |
19 | 19 | ||
20 | - | let KEY_EVENT_ | |
20 | + | let KEY_EVENT_SIZE = "EVENT_SIZE" | |
21 | 21 | ||
22 | 22 | let KEY_EVENT = "EVENT" | |
23 | 23 | ||
24 | 24 | let KEY_NONCE = "NONCE" | |
25 | 25 | ||
26 | 26 | let MAX_INT = 9223372036854775807 | |
27 | 27 | ||
28 | 28 | func _validateAddress (address_,err_) = match addressFromString(address_) { | |
29 | 29 | case a: Address => | |
30 | 30 | true | |
31 | 31 | case _ => | |
32 | 32 | throw(err_) | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func _validateInt (val_,lowerBoundary_,upperBoundary_,err_) = if (if ((lowerBoundary_ > val_)) | |
37 | 37 | then true | |
38 | 38 | else (val_ > upperBoundary_)) | |
39 | 39 | then throw(err_) | |
40 | 40 | else true | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func _loadInit () = match getBoolean(KEY_INIT) { | |
44 | 44 | case a: Boolean => | |
45 | 45 | a | |
46 | 46 | case _ => | |
47 | 47 | false | |
48 | 48 | } | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func _saveInit (isInit_) = [BooleanEntry(KEY_INIT, isInit_)] | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func _loadPause () = match getBoolean(KEY_PAUSED) { | |
55 | 55 | case a: Boolean => | |
56 | 56 | a | |
57 | 57 | case _ => | |
58 | 58 | false | |
59 | 59 | } | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func _savePause (isPaused_) = [BooleanEntry(KEY_PAUSED, isPaused_)] | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func _loadPauser () = match getString(KEY_PAUSER) { | |
66 | 66 | case a: String => | |
67 | 67 | addressFromStringValue(a) | |
68 | 68 | case _ => | |
69 | 69 | Address(base58'') | |
70 | 70 | } | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func _savePauser (pauser_) = [StringEntry(KEY_PAUSER, toString(pauser_))] | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func _loadAllowance (caller_) = match getBoolean(makeString([KEY_ALLOWANCE, toString(caller_)], SEPARATOR)) { | |
77 | 77 | case a: Boolean => | |
78 | 78 | a | |
79 | 79 | case _ => | |
80 | 80 | false | |
81 | 81 | } | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func _saveAllowance (caller_,val_) = [BooleanEntry(makeString([KEY_ALLOWANCE, toString(caller_)], SEPARATOR), val_)] | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func _loadMultisig () = match getString(KEY_MULTISIG) { | |
88 | 88 | case a: String => | |
89 | 89 | addressFromStringValue(a) | |
90 | 90 | case _ => | |
91 | 91 | Address(base58'') | |
92 | 92 | } | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func _saveMultisig (multisig_) = [StringEntry(KEY_MULTISIG, toString(multisig_))] | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | func _loadCallChainId () = match getInteger(KEY_CALL_CHAIN_ID) { | |
99 | 99 | case a: Int => | |
100 | 100 | a | |
101 | 101 | case _ => | |
102 | 102 | 0 | |
103 | 103 | } | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | func _saveCallChainId (callChainId_) = [IntegerEntry(KEY_CALL_CHAIN_ID, callChainId_)] | |
107 | 107 | ||
108 | 108 | ||
109 | - | func _ | |
109 | + | func _loadEventSize () = match getInteger(KEY_EVENT_SIZE) { | |
110 | 110 | case a: Int => | |
111 | 111 | a | |
112 | 112 | case _ => | |
113 | 113 | 0 | |
114 | 114 | } | |
115 | 115 | ||
116 | 116 | ||
117 | - | func _ | |
117 | + | func _saveEventSize (index_) = [IntegerEntry(KEY_EVENT_SIZE, index_)] | |
118 | 118 | ||
119 | 119 | ||
120 | 120 | func _saveEvent (index_,event_) = [StringEntry(makeString([KEY_EVENT, toString(index_)], SEPARATOR), makeString([toString(event_._1), toString(event_._2), toString(event_._3), event_._4, event_._5, toString(event_._6)], SEPARATOR))] | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | func _loadNonce () = match getInteger(KEY_NONCE) { | |
124 | 124 | case a: Int => | |
125 | 125 | a | |
126 | 126 | case _ => | |
127 | 127 | 0 | |
128 | 128 | } | |
129 | 129 | ||
130 | 130 | ||
131 | 131 | func _saveNonce (val_) = [IntegerEntry(KEY_NONCE, val_)] | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | func _onlyThisContract (caller_) = if ((caller_ != this)) | |
135 | 135 | then throw("_onlyThisContract: revert") | |
136 | 136 | else true | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | func _whenMultisigSet () = if ((_loadMultisig() == Address(base58''))) | |
140 | 140 | then throw("_whenMultisigSet: revert") | |
141 | 141 | else true | |
142 | 142 | ||
143 | 143 | ||
144 | 144 | func _whenNotInitialized () = if (_loadInit()) | |
145 | 145 | then throw("_whenNotInitialized: revert") | |
146 | 146 | else true | |
147 | 147 | ||
148 | 148 | ||
149 | 149 | func _whenInitialized () = if (!(_loadInit())) | |
150 | 150 | then throw("_whenInitialized: revert") | |
151 | 151 | else true | |
152 | 152 | ||
153 | 153 | ||
154 | 154 | func _whenNotPaused () = if (_loadPause()) | |
155 | 155 | then throw("_whenNotPaused: revert") | |
156 | 156 | else true | |
157 | 157 | ||
158 | 158 | ||
159 | 159 | func _whenPaused () = if (!(_loadPause())) | |
160 | 160 | then throw("_whenPaused: revert") | |
161 | 161 | else true | |
162 | 162 | ||
163 | 163 | ||
164 | 164 | func _onlyPauser (caller_) = if ((caller_ != _loadPauser())) | |
165 | 165 | then throw("_onlyPauser: revert") | |
166 | 166 | else true | |
167 | 167 | ||
168 | 168 | ||
169 | 169 | func _whenAllowed (caller_) = if (!(_loadAllowance(caller_))) | |
170 | 170 | then throw("_whenAllowed: revert") | |
171 | 171 | else true | |
172 | 172 | ||
173 | 173 | ||
174 | 174 | @Callable(i) | |
175 | 175 | func init (pauser_,callChainId_) = { | |
176 | 176 | let err = if (if (if (if (_onlyThisContract(i.caller)) | |
177 | 177 | then _whenNotInitialized() | |
178 | 178 | else false) | |
179 | 179 | then _whenMultisigSet() | |
180 | 180 | else false) | |
181 | 181 | then _validateAddress(pauser_, "init: invalid pauser") | |
182 | 182 | else false) | |
183 | 183 | then _validateInt(callChainId_, 0, MAX_INT, "init: invalid call chain id") | |
184 | 184 | else false | |
185 | 185 | if ((err == err)) | |
186 | 186 | then $Tuple2(((_saveInit(true) ++ _savePauser(addressFromStringValue(pauser_))) ++ _saveCallChainId(callChainId_)), unit) | |
187 | 187 | else throw("Strict value is not equal to itself.") | |
188 | 188 | } | |
189 | 189 | ||
190 | 190 | ||
191 | 191 | ||
192 | 192 | @Callable(i) | |
193 | 193 | func call (executionChainId_,executionContract_,calldata_) = { | |
194 | 194 | let err = if (if (_whenInitialized()) | |
195 | 195 | then _whenAllowed(i.caller) | |
196 | 196 | else false) | |
197 | 197 | then _whenNotPaused() | |
198 | 198 | else false | |
199 | 199 | if ((err == err)) | |
200 | 200 | then { | |
201 | 201 | let nonce = _loadNonce() | |
202 | - | let | |
202 | + | let eventSize = _loadEventSize() | |
203 | 203 | let event = $Tuple6(_loadCallChainId(), executionChainId_, i.caller, executionContract_, calldata_, nonce) | |
204 | - | $Tuple2(((_ | |
204 | + | $Tuple2(((_saveEventSize((eventSize + 1)) ++ _saveEvent(eventSize, event)) ++ _saveNonce((nonce + 1))), unit) | |
205 | 205 | } | |
206 | 206 | else throw("Strict value is not equal to itself.") | |
207 | 207 | } | |
208 | 208 | ||
209 | 209 | ||
210 | 210 | ||
211 | 211 | @Callable(i) | |
212 | 212 | func allow (caller_) = { | |
213 | 213 | let err = if (if (_onlyThisContract(i.caller)) | |
214 | 214 | then _whenInitialized() | |
215 | 215 | else false) | |
216 | 216 | then _validateAddress(caller_, "allow: invalid caller arg") | |
217 | 217 | else false | |
218 | 218 | if ((err == err)) | |
219 | 219 | then $Tuple2(_saveAllowance(addressFromStringValue(caller_), true), unit) | |
220 | 220 | else throw("Strict value is not equal to itself.") | |
221 | 221 | } | |
222 | 222 | ||
223 | 223 | ||
224 | 224 | ||
225 | 225 | @Callable(i) | |
226 | 226 | func disallow (caller_) = { | |
227 | 227 | let err = if (if (_onlyThisContract(i.caller)) | |
228 | 228 | then _whenInitialized() | |
229 | 229 | else false) | |
230 | 230 | then _validateAddress(caller_, "disallow: invalid caller arg") | |
231 | 231 | else false | |
232 | 232 | if ((err == err)) | |
233 | 233 | then $Tuple2(_saveAllowance(addressFromStringValue(caller_), false), unit) | |
234 | 234 | else throw("Strict value is not equal to itself.") | |
235 | 235 | } | |
236 | 236 | ||
237 | 237 | ||
238 | 238 | ||
239 | 239 | @Callable(i) | |
240 | 240 | func pause () = { | |
241 | 241 | let err = if (if (_onlyPauser(i.caller)) | |
242 | 242 | then _whenInitialized() | |
243 | 243 | else false) | |
244 | 244 | then _whenNotPaused() | |
245 | 245 | else false | |
246 | 246 | if ((err == err)) | |
247 | 247 | then $Tuple2(_savePause(true), unit) | |
248 | 248 | else throw("Strict value is not equal to itself.") | |
249 | 249 | } | |
250 | 250 | ||
251 | 251 | ||
252 | 252 | ||
253 | 253 | @Callable(i) | |
254 | 254 | func unpause () = { | |
255 | 255 | let err = if (if (_onlyPauser(i.caller)) | |
256 | 256 | then _whenInitialized() | |
257 | 257 | else false) | |
258 | 258 | then _whenPaused() | |
259 | 259 | else false | |
260 | 260 | if ((err == err)) | |
261 | 261 | then $Tuple2(_savePause(false), unit) | |
262 | 262 | else throw("Strict value is not equal to itself.") | |
263 | 263 | } | |
264 | 264 | ||
265 | 265 | ||
266 | 266 | ||
267 | 267 | @Callable(i) | |
268 | 268 | func updatePauser (pauser_) = { | |
269 | 269 | let err = if (if (_onlyThisContract(i.caller)) | |
270 | 270 | then _whenInitialized() | |
271 | 271 | else false) | |
272 | 272 | then _validateAddress(pauser_, "init: invalid pauser") | |
273 | 273 | else false | |
274 | 274 | if ((err == err)) | |
275 | 275 | then $Tuple2(_savePauser(addressFromStringValue(pauser_)), unit) | |
276 | 276 | else throw("Strict value is not equal to itself.") | |
277 | 277 | } | |
278 | 278 | ||
279 | 279 | ||
280 | 280 | ||
281 | 281 | @Callable(i) | |
282 | 282 | func setMultisig (multisig_) = { | |
283 | 283 | let err = if (_onlyThisContract(i.caller)) | |
284 | 284 | then _validateAddress(multisig_, "setMultisig: invalid multisig address") | |
285 | 285 | else false | |
286 | 286 | if ((err == err)) | |
287 | 287 | then $Tuple2(_saveMultisig(addressFromStringValue(multisig_)), unit) | |
288 | 288 | else throw("Strict value is not equal to itself.") | |
289 | 289 | } | |
290 | 290 | ||
291 | 291 | ||
292 | 292 | @Verifier(tx) | |
293 | 293 | func verify () = match getString(KEY_MULTISIG) { | |
294 | 294 | case multisig: String => | |
295 | 295 | valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false) | |
296 | 296 | case _ => | |
297 | 297 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
298 | 298 | } | |
299 | 299 |
github/deemru/w8io/169f3d6 45.12 ms ◑