tx · BaZxw7bLZWbahEXoQFFcwySNApzY3t3msNy36935wLeF

3N935A8AAp2u1isbYYqX3Kp9prZmHF6kNps:  -0.01400000 Waves

2023.03.14 17:42 [2489852] smart account 3N935A8AAp2u1isbYYqX3Kp9prZmHF6kNps > SELF 0.00000000 Waves

{ "type": 13, "id": "BaZxw7bLZWbahEXoQFFcwySNApzY3t3msNy36935wLeF", "fee": 1400000, "feeAssetId": null, "timestamp": 1678804883277, "version": 2, "chainId": 84, "sender": "3N935A8AAp2u1isbYYqX3Kp9prZmHF6kNps", "senderPublicKey": "AV1pqMh4X8GxWM1ZonBqM9qXi5moX8jeAvDDkpaCxQq5", "proofs": [ "4WsHbjn4APkG5TAVLCPNtvjSrRU6rd3ZfnAsJ5T5tRnZRDxQWJqKcaUMa51rosDottwxh2j3NKweWBr4PTqmKyey" ], "script": "base64:BgIqCAISBQoDCAEIEgoKCAgIGAEBAQgIEgUKAwgICBIAEgASAwoBCBIDCgEIIgAJU0VQQVJBVE9SAgJfXwAIS0VZX0lOSVQCBElOSVQADEtFWV9NVUxUSVNJRwIITVVMVElTSUcACktFWV9TVEFUVVMCBlNUQVRVUwAKS0VZX1BBVVNFRAIGUEFVU0VEAApLRVlfUEFVU0VSAgZQQVVTRVIADEtFWV9DSEFJTl9JRAIIQ0hBSU5fSUQAFUtFWV9TSUdORVJfUFVCTElDX0tFWQIRU0lHTkVSX1BVQkxJQ19LRVkADUtFWV9EQVRBX0hBU0gCCURBVEFfSEFTSAAHTUFYX0lOVAD//////////38BEF92YWxpZGF0ZUFkZHJlc3MCCGFkZHJlc3NfBGVycl8EByRtYXRjaDAJAKYIAQUIYWRkcmVzc18DCQABAgUHJG1hdGNoMAIHQWRkcmVzcwQBYQUHJG1hdGNoMAYJAAIBBQRlcnJfARJfdmFsaWRhdGVQdWJsaWNLZXkCCnB1YmxpY0tleV8EZXJyXwMJAQIhPQIJAMgBAQkA2QQBBQpwdWJsaWNLZXlfACAJAAIBBQRlcnJfBgEMX3Zhb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fBANlcnIDCQERX29ubHlUaGlzQ29udHJhY3QBCAUBaQZjYWxsZXIJARBfdmFsaWRhdGVBZGRyZXNzAgUJbXVsdGlzaWdfAiVzZXRNdWx0aXNpZzogaW52YWxpZCBtdWx0aXNpZyBhZGRyZXNzBwMJAAACBQNlcnIFA2VycgkAlAoCCQENX3NhdmVNdWx0aXNpZwEJARFAZXh0ck5hdGl2ZSgxMDYyKQEFCW11bHRpc2lnXwUEdW5pdAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAEByRtYXRjaDAJAKIIAQUMS0VZX01VTFRJU0lHAwkAAQIFByRtYXRjaDACBlN0cmluZwQIbXVsdGlzaWcFByRtYXRjaDAJAQt2YWx1ZU9yRWxzZQIJAJsIAgkBEUBleHRyTmF0aXZlKDEwNjIpAQUIbXVsdGlzaWcJALkJAgkAzAgCBQpLRVlfU1RBVFVTCQDMCAIJAKUIAQUEdGhpcwkAzAgCCQDYBAEIBQJ0eAJpZAUDbmlsBQlTRVBBUkFUT1IHCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5pavHcw==", "height": 2489852, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 58YnAiCMipdPPEx2iZoHuyEpxYnzTpiFVPxMm5xtLS3t Next: none Diff:
OldNewDifferences
175175
176176 @Callable(i)
177177 func execute (contract_,functionName_,functionArgs_,callerChainId_,executionChainId_,nonce_,txHash_,signature_) = {
178- let err = if (if (if (_whenInitialized())
178+ let argsSize = size(functionArgs_)
179+ let err = if (if (if (if (_whenInitialized())
179180 then _whenNotPaused()
180181 else false)
181182 then _validateAddress(contract_, "execute: invalid contract")
183+ else false)
184+ then _validateInt(argsSize, 0, 22, "execute: invalid args size")
182185 else false)
183186 then if ((_loadChainId() != executionChainId_))
184187 then throw("execute: invalid execution chain id")
186189 else false
187190 if ((err == err))
188191 then {
189- func foldFunc (acc,elem) = (acc + toBytes(elem))
192+ func foldFunc (acc,elem) = ((acc + toBytes(size(elem))) + toBytes(elem))
190193
191194 let argsBytes = {
192195 let $l = functionArgs_
202205
203206 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($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), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22)
204207 }
205- let data = ((((((toBytes(callerChainId_) + toBytes(executionChainId_)) + toBytes(nonce_)) + toBytes(txHash_)) + fromBase58String(contract_)) + toBytes(functionName_)) + argsBytes)
208+ let data = (((((((((toBytes(callerChainId_) + toBytes(executionChainId_)) + toBytes(nonce_)) + toBytes(size(txHash_))) + toBytes(txHash_)) + fromBase58String(contract_)) + toBytes(size(functionName_))) + toBytes(functionName_)) + toBytes(argsSize)) + argsBytes)
206209 let dataHash = keccak256_32Kb(data)
207210 let err1 = if (!(sigVerify(dataHash, fromBase58String(signature_), _loadSignerPublicKey())))
208211 then throw("execute: invalid signature")
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEPARATOR = "__"
55
66 let KEY_INIT = "INIT"
77
88 let KEY_MULTISIG = "MULTISIG"
99
1010 let KEY_STATUS = "STATUS"
1111
1212 let KEY_PAUSED = "PAUSED"
1313
1414 let KEY_PAUSER = "PAUSER"
1515
1616 let KEY_CHAIN_ID = "CHAIN_ID"
1717
1818 let KEY_SIGNER_PUBLIC_KEY = "SIGNER_PUBLIC_KEY"
1919
2020 let KEY_DATA_HASH = "DATA_HASH"
2121
2222 let MAX_INT = 9223372036854775807
2323
2424 func _validateAddress (address_,err_) = match addressFromString(address_) {
2525 case a: Address =>
2626 true
2727 case _ =>
2828 throw(err_)
2929 }
3030
3131
3232 func _validatePublicKey (publicKey_,err_) = if ((size(fromBase58String(publicKey_)) != 32))
3333 then throw(err_)
3434 else true
3535
3636
3737 func _validateInt (val_,lowerBoundary_,upperBoundary_,err_) = if (if ((lowerBoundary_ > val_))
3838 then true
3939 else (val_ > upperBoundary_))
4040 then throw(err_)
4141 else true
4242
4343
4444 func _loadInit () = match getBoolean(KEY_INIT) {
4545 case a: Boolean =>
4646 a
4747 case _ =>
4848 false
4949 }
5050
5151
5252 func _saveInit (isInit_) = [BooleanEntry(KEY_INIT, isInit_)]
5353
5454
5555 func _loadPause () = match getBoolean(KEY_PAUSED) {
5656 case a: Boolean =>
5757 a
5858 case _ =>
5959 false
6060 }
6161
6262
6363 func _savePause (isPaused_) = [BooleanEntry(KEY_PAUSED, isPaused_)]
6464
6565
6666 func _loadPauser () = match getString(KEY_PAUSER) {
6767 case a: String =>
6868 addressFromStringValue(a)
6969 case _ =>
7070 Address(base58'')
7171 }
7272
7373
7474 func _savePauser (pauser_) = [StringEntry(KEY_PAUSER, toString(pauser_))]
7575
7676
7777 func _loadMultisig () = match getString(KEY_MULTISIG) {
7878 case a: String =>
7979 addressFromStringValue(a)
8080 case _ =>
8181 Address(base58'')
8282 }
8383
8484
8585 func _saveMultisig (multisig_) = [StringEntry(KEY_MULTISIG, toString(multisig_))]
8686
8787
8888 func _loadChainId () = match getInteger(KEY_CHAIN_ID) {
8989 case a: Int =>
9090 a
9191 case _ =>
9292 0
9393 }
9494
9595
9696 func _saveChainId (chainId_) = [IntegerEntry(KEY_CHAIN_ID, chainId_)]
9797
9898
9999 func _loadSignerPublicKey () = match getString(KEY_SIGNER_PUBLIC_KEY) {
100100 case a: String =>
101101 fromBase58String(a)
102102 case _ =>
103103 base58''
104104 }
105105
106106
107107 func _saveSignerPublicKey (signerPublicKey_) = [StringEntry(KEY_SIGNER_PUBLIC_KEY, toBase58String(signerPublicKey_))]
108108
109109
110110 func _loadDataHash (dataHash_) = match getInteger(makeString([KEY_DATA_HASH, toBase58String(dataHash_)], SEPARATOR)) {
111111 case a: Int =>
112112 a
113113 case _ =>
114114 0
115115 }
116116
117117
118118 func _saveDataHash (dataHash_,height_) = [IntegerEntry(makeString([KEY_DATA_HASH, toBase58String(dataHash_)], SEPARATOR), height_)]
119119
120120
121121 func _onlyThisContract (caller_) = if ((caller_ != this))
122122 then throw("_onlyThisContract: revert")
123123 else true
124124
125125
126126 func _whenMultisigSet () = if ((_loadMultisig() == Address(base58'')))
127127 then throw("_whenMultisigSet: revert")
128128 else true
129129
130130
131131 func _whenNotInitialized () = if (_loadInit())
132132 then throw("_whenNotInitialized: revert")
133133 else true
134134
135135
136136 func _whenInitialized () = if (!(_loadInit()))
137137 then throw("_whenInitialized: revert")
138138 else true
139139
140140
141141 func _whenNotPaused () = if (_loadPause())
142142 then throw("_whenNotPaused: revert")
143143 else true
144144
145145
146146 func _whenPaused () = if (!(_loadPause()))
147147 then throw("_whenPaused: revert")
148148 else true
149149
150150
151151 func _onlyPauser (caller_) = if ((caller_ != _loadPauser()))
152152 then throw("_onlyPauser: revert")
153153 else true
154154
155155
156156 @Callable(i)
157157 func init (pauser_,chainId_,signerPublicKey_) = {
158158 let err = if (if (if (if (if (_onlyThisContract(i.caller))
159159 then _whenNotInitialized()
160160 else false)
161161 then _whenMultisigSet()
162162 else false)
163163 then _validateAddress(pauser_, "init: invalid pauser")
164164 else false)
165165 then _validateInt(chainId_, 0, MAX_INT, "init: invalid chain id")
166166 else false)
167167 then _validatePublicKey(signerPublicKey_, "init: invalid signer public key")
168168 else false
169169 if ((err == err))
170170 then $Tuple2((((_saveInit(true) ++ _savePauser(addressFromStringValue(pauser_))) ++ _saveChainId(chainId_)) ++ _saveSignerPublicKey(fromBase58String(signerPublicKey_))), unit)
171171 else throw("Strict value is not equal to itself.")
172172 }
173173
174174
175175
176176 @Callable(i)
177177 func execute (contract_,functionName_,functionArgs_,callerChainId_,executionChainId_,nonce_,txHash_,signature_) = {
178- let err = if (if (if (_whenInitialized())
178+ let argsSize = size(functionArgs_)
179+ let err = if (if (if (if (_whenInitialized())
179180 then _whenNotPaused()
180181 else false)
181182 then _validateAddress(contract_, "execute: invalid contract")
183+ else false)
184+ then _validateInt(argsSize, 0, 22, "execute: invalid args size")
182185 else false)
183186 then if ((_loadChainId() != executionChainId_))
184187 then throw("execute: invalid execution chain id")
185188 else true
186189 else false
187190 if ((err == err))
188191 then {
189- func foldFunc (acc,elem) = (acc + toBytes(elem))
192+ func foldFunc (acc,elem) = ((acc + toBytes(size(elem))) + toBytes(elem))
190193
191194 let argsBytes = {
192195 let $l = functionArgs_
193196 let $s = size($l)
194197 let $acc0 = base58''
195198 func $f0_1 ($a,$i) = if (($i >= $s))
196199 then $a
197200 else foldFunc($a, $l[$i])
198201
199202 func $f0_2 ($a,$i) = if (($i >= $s))
200203 then $a
201204 else throw("List size exceeds 22")
202205
203206 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($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), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22)
204207 }
205- let data = ((((((toBytes(callerChainId_) + toBytes(executionChainId_)) + toBytes(nonce_)) + toBytes(txHash_)) + fromBase58String(contract_)) + toBytes(functionName_)) + argsBytes)
208+ let data = (((((((((toBytes(callerChainId_) + toBytes(executionChainId_)) + toBytes(nonce_)) + toBytes(size(txHash_))) + toBytes(txHash_)) + fromBase58String(contract_)) + toBytes(size(functionName_))) + toBytes(functionName_)) + toBytes(argsSize)) + argsBytes)
206209 let dataHash = keccak256_32Kb(data)
207210 let err1 = if (!(sigVerify(dataHash, fromBase58String(signature_), _loadSignerPublicKey())))
208211 then throw("execute: invalid signature")
209212 else if ((_loadDataHash(dataHash) > 0))
210213 then throw("execute: duplicate data")
211214 else unit
212215 if ((err1 == err1))
213216 then {
214217 let invocation = invoke(addressFromStringValue(contract_), functionName_, functionArgs_, nil)
215218 if ((invocation == invocation))
216219 then $Tuple2(_saveDataHash(dataHash, height), unit)
217220 else throw("Strict value is not equal to itself.")
218221 }
219222 else throw("Strict value is not equal to itself.")
220223 }
221224 else throw("Strict value is not equal to itself.")
222225 }
223226
224227
225228
226229 @Callable(i)
227230 func updateSigner (newSignerPublicKey_,oldSignature_,newSignature_) = {
228231 let err = if (if (_onlyThisContract(i.caller))
229232 then _whenInitialized()
230233 else false)
231234 then _validatePublicKey(newSignerPublicKey_, "updateSigner: invalid signer public key")
232235 else false
233236 if ((err == err))
234237 then {
235238 let oldSignerPublicKey = _loadSignerPublicKey()
236239 let oldData = ((toBytes("<<<PUBLIC--KEY--MIGRATION--ALLOWED>>>") + oldSignerPublicKey) + fromBase58String(newSignerPublicKey_))
237240 let newSignerPublicKey = fromBase58String(newSignerPublicKey_)
238241 let newData = ((toBytes("<<<PUBLIC--KEY--MIGRATION--CONFIRMED>>>") + oldSignerPublicKey) + fromBase58String(newSignerPublicKey_))
239242 let err1 = if (!(sigVerify_8Kb(oldData, fromBase58String(oldSignature_), oldSignerPublicKey)))
240243 then throw("updateSigner: invalid old signature")
241244 else if (!(sigVerify_8Kb(newData, fromBase58String(newSignature_), newSignerPublicKey)))
242245 then throw("updateSigner: invalid new signature")
243246 else unit
244247 if ((err1 == err1))
245248 then $Tuple2(_saveSignerPublicKey(newSignerPublicKey), unit)
246249 else throw("Strict value is not equal to itself.")
247250 }
248251 else throw("Strict value is not equal to itself.")
249252 }
250253
251254
252255
253256 @Callable(i)
254257 func pause () = {
255258 let err = if (if (_onlyPauser(i.caller))
256259 then _whenInitialized()
257260 else false)
258261 then _whenNotPaused()
259262 else false
260263 if ((err == err))
261264 then $Tuple2(_savePause(true), unit)
262265 else throw("Strict value is not equal to itself.")
263266 }
264267
265268
266269
267270 @Callable(i)
268271 func unpause () = {
269272 let err = if (if (_onlyPauser(i.caller))
270273 then _whenInitialized()
271274 else false)
272275 then _whenPaused()
273276 else false
274277 if ((err == err))
275278 then $Tuple2(_savePause(false), unit)
276279 else throw("Strict value is not equal to itself.")
277280 }
278281
279282
280283
281284 @Callable(i)
282285 func updatePauser (pauser_) = {
283286 let err = if (if (_onlyThisContract(i.caller))
284287 then _whenInitialized()
285288 else false)
286289 then _validateAddress(pauser_, "init: invalid pauser")
287290 else false
288291 if ((err == err))
289292 then $Tuple2(_savePauser(addressFromStringValue(pauser_)), unit)
290293 else throw("Strict value is not equal to itself.")
291294 }
292295
293296
294297
295298 @Callable(i)
296299 func setMultisig (multisig_) = {
297300 let err = if (_onlyThisContract(i.caller))
298301 then _validateAddress(multisig_, "setMultisig: invalid multisig address")
299302 else false
300303 if ((err == err))
301304 then $Tuple2(_saveMultisig(addressFromStringValue(multisig_)), unit)
302305 else throw("Strict value is not equal to itself.")
303306 }
304307
305308
306309 @Verifier(tx)
307310 func verify () = match getString(KEY_MULTISIG) {
308311 case multisig: String =>
309312 valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false)
310313 case _ =>
311314 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
312315 }
313316

github/deemru/w8io/026f985 
36.74 ms