tx · 58YnAiCMipdPPEx2iZoHuyEpxYnzTpiFVPxMm5xtLS3t 3N935A8AAp2u1isbYYqX3Kp9prZmHF6kNps: -0.01400000 Waves 2023.03.09 18:51 [2482762] smart account 3N935A8AAp2u1isbYYqX3Kp9prZmHF6kNps > SELF 0.00000000 Waves
{ "type": 13, "id": "58YnAiCMipdPPEx2iZoHuyEpxYnzTpiFVPxMm5xtLS3t", "fee": 1400000, "feeAssetId": null, "timestamp": 1678377103688, "version": 2, "chainId": 84, "sender": "3N935A8AAp2u1isbYYqX3Kp9prZmHF6kNps", "senderPublicKey": "AV1pqMh4X8GxWM1ZonBqM9qXi5moX8jeAvDDkpaCxQq5", "proofs": [ "66nPMgrBpAcVJxcwPNEtuF8Y5fXMFMJgiTbsGaYWy3HGBaVViLPugk9zNwzkrdbW1LXKobj5cVh7fSm2FXoYxRe3" ], "script": "base64:BgIqCAISBQoDCAEIEgoKCAgIGAEBAQgIEgUKAwgICBIAEgASAwoBCBIDCgEIIgAJU0VQQVJBVE9SAgJfXwAIS0VZX0lOSVQCBElOSVQADEtFWV9NVUxUSVNJRwIITVVMVElTSUcACktFWV9TVEFUVVMCBlNUQVRVUwAKS0VZX1BBVVNFRAIGUEFVU0VEAApLRVlfUEFVU0VSAgZQQVVTRVIADEtFWV9DSEFJTl9JRAIIQ0hBSU5fSUQAFUtFWV9TSUdORVJfUFVCTElDX0tFWQIRU0lHTkVSX1BVQkxJQ19LRVkADUtFWV9EQVRBX0hBU0gCCURBVEFfSEFTSAAHTUFYX0lOVAD//////////38BEF92YWxpZGF0ZUFkZHJlc3MCCGFkZHJlc3NfBGVycl8EByRtYXRjaDAJAKYIAQUIYWRkcmVzc18DCQABAgUHJG1hdGNoMAIHQWRkcmVzcwQBYQUHJG1hdGNoMAYJAAIBBQRlcnJfARJfdmFsaWRhdGVQdWJsaWNLZXkCCnB1YmxpY0tleV8EZXJyXwMJAQIhPQIJAMgBAQkA2QQBBQpwdWJsaWNLZXlfACAJAAIBBQRlcn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0aXNpZ18FBHVuaXQJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BAnR4AQZ2ZXJpZnkABAckbWF0Y2gwCQCiCAEFDEtFWV9NVUxUSVNJRwMJAAECBQckbWF0Y2gwAgZTdHJpbmcECG11bHRpc2lnBQckbWF0Y2gwCQELdmFsdWVPckVsc2UCCQCbCAIJARFAZXh0ck5hdGl2ZSgxMDYyKQEFCG11bHRpc2lnCQC5CQIJAMwIAgUKS0VZX1NUQVRVUwkAzAgCCQClCAEFBHRoaXMJAMwIAgkA2AQBCAUCdHgCaWQFA25pbAUJU0VQQVJBVE9SBwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleYESaAQ=", "height": 2482762, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: BaZxw7bLZWbahEXoQFFcwySNApzY3t3msNy36935wLeF Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let SEPARATOR = "__" | |
5 | + | ||
6 | + | let KEY_INIT = "INIT" | |
7 | + | ||
8 | + | let KEY_MULTISIG = "MULTISIG" | |
9 | + | ||
10 | + | let KEY_STATUS = "STATUS" | |
11 | + | ||
12 | + | let KEY_PAUSED = "PAUSED" | |
13 | + | ||
14 | + | let KEY_PAUSER = "PAUSER" | |
15 | + | ||
16 | + | let KEY_CHAIN_ID = "CHAIN_ID" | |
17 | + | ||
18 | + | let KEY_SIGNER_PUBLIC_KEY = "SIGNER_PUBLIC_KEY" | |
19 | + | ||
20 | + | let KEY_DATA_HASH = "DATA_HASH" | |
21 | + | ||
22 | + | let MAX_INT = 9223372036854775807 | |
23 | + | ||
24 | + | func _validateAddress (address_,err_) = match addressFromString(address_) { | |
25 | + | case a: Address => | |
26 | + | true | |
27 | + | case _ => | |
28 | + | throw(err_) | |
29 | + | } | |
30 | + | ||
31 | + | ||
32 | + | func _validatePublicKey (publicKey_,err_) = if ((size(fromBase58String(publicKey_)) != 32)) | |
33 | + | then throw(err_) | |
34 | + | else true | |
35 | + | ||
36 | + | ||
37 | + | func _validateInt (val_,lowerBoundary_,upperBoundary_,err_) = if (if ((lowerBoundary_ > val_)) | |
38 | + | then true | |
39 | + | else (val_ > upperBoundary_)) | |
40 | + | then throw(err_) | |
41 | + | else true | |
42 | + | ||
43 | + | ||
44 | + | func _loadInit () = match getBoolean(KEY_INIT) { | |
45 | + | case a: Boolean => | |
46 | + | a | |
47 | + | case _ => | |
48 | + | false | |
49 | + | } | |
50 | + | ||
51 | + | ||
52 | + | func _saveInit (isInit_) = [BooleanEntry(KEY_INIT, isInit_)] | |
53 | + | ||
54 | + | ||
55 | + | func _loadPause () = match getBoolean(KEY_PAUSED) { | |
56 | + | case a: Boolean => | |
57 | + | a | |
58 | + | case _ => | |
59 | + | false | |
60 | + | } | |
61 | + | ||
62 | + | ||
63 | + | func _savePause (isPaused_) = [BooleanEntry(KEY_PAUSED, isPaused_)] | |
64 | + | ||
65 | + | ||
66 | + | func _loadPauser () = match getString(KEY_PAUSER) { | |
67 | + | case a: String => | |
68 | + | addressFromStringValue(a) | |
69 | + | case _ => | |
70 | + | Address(base58'') | |
71 | + | } | |
72 | + | ||
73 | + | ||
74 | + | func _savePauser (pauser_) = [StringEntry(KEY_PAUSER, toString(pauser_))] | |
75 | + | ||
76 | + | ||
77 | + | func _loadMultisig () = match getString(KEY_MULTISIG) { | |
78 | + | case a: String => | |
79 | + | addressFromStringValue(a) | |
80 | + | case _ => | |
81 | + | Address(base58'') | |
82 | + | } | |
83 | + | ||
84 | + | ||
85 | + | func _saveMultisig (multisig_) = [StringEntry(KEY_MULTISIG, toString(multisig_))] | |
86 | + | ||
87 | + | ||
88 | + | func _loadChainId () = match getInteger(KEY_CHAIN_ID) { | |
89 | + | case a: Int => | |
90 | + | a | |
91 | + | case _ => | |
92 | + | 0 | |
93 | + | } | |
94 | + | ||
95 | + | ||
96 | + | func _saveChainId (chainId_) = [IntegerEntry(KEY_CHAIN_ID, chainId_)] | |
97 | + | ||
98 | + | ||
99 | + | func _loadSignerPublicKey () = match getString(KEY_SIGNER_PUBLIC_KEY) { | |
100 | + | case a: String => | |
101 | + | fromBase58String(a) | |
102 | + | case _ => | |
103 | + | base58'' | |
104 | + | } | |
105 | + | ||
106 | + | ||
107 | + | func _saveSignerPublicKey (signerPublicKey_) = [StringEntry(KEY_SIGNER_PUBLIC_KEY, toBase58String(signerPublicKey_))] | |
108 | + | ||
109 | + | ||
110 | + | func _loadDataHash (dataHash_) = match getInteger(makeString([KEY_DATA_HASH, toBase58String(dataHash_)], SEPARATOR)) { | |
111 | + | case a: Int => | |
112 | + | a | |
113 | + | case _ => | |
114 | + | 0 | |
115 | + | } | |
116 | + | ||
117 | + | ||
118 | + | func _saveDataHash (dataHash_,height_) = [IntegerEntry(makeString([KEY_DATA_HASH, toBase58String(dataHash_)], SEPARATOR), height_)] | |
119 | + | ||
120 | + | ||
121 | + | func _onlyThisContract (caller_) = if ((caller_ != this)) | |
122 | + | then throw("_onlyThisContract: revert") | |
123 | + | else true | |
124 | + | ||
125 | + | ||
126 | + | func _whenMultisigSet () = if ((_loadMultisig() == Address(base58''))) | |
127 | + | then throw("_whenMultisigSet: revert") | |
128 | + | else true | |
129 | + | ||
130 | + | ||
131 | + | func _whenNotInitialized () = if (_loadInit()) | |
132 | + | then throw("_whenNotInitialized: revert") | |
133 | + | else true | |
134 | + | ||
135 | + | ||
136 | + | func _whenInitialized () = if (!(_loadInit())) | |
137 | + | then throw("_whenInitialized: revert") | |
138 | + | else true | |
139 | + | ||
140 | + | ||
141 | + | func _whenNotPaused () = if (_loadPause()) | |
142 | + | then throw("_whenNotPaused: revert") | |
143 | + | else true | |
144 | + | ||
145 | + | ||
146 | + | func _whenPaused () = if (!(_loadPause())) | |
147 | + | then throw("_whenPaused: revert") | |
148 | + | else true | |
149 | + | ||
150 | + | ||
151 | + | func _onlyPauser (caller_) = if ((caller_ != _loadPauser())) | |
152 | + | then throw("_onlyPauser: revert") | |
153 | + | else true | |
154 | + | ||
155 | + | ||
156 | + | @Callable(i) | |
157 | + | func init (pauser_,chainId_,signerPublicKey_) = { | |
158 | + | let err = if (if (if (if (if (_onlyThisContract(i.caller)) | |
159 | + | then _whenNotInitialized() | |
160 | + | else false) | |
161 | + | then _whenMultisigSet() | |
162 | + | else false) | |
163 | + | then _validateAddress(pauser_, "init: invalid pauser") | |
164 | + | else false) | |
165 | + | then _validateInt(chainId_, 0, MAX_INT, "init: invalid chain id") | |
166 | + | else false) | |
167 | + | then _validatePublicKey(signerPublicKey_, "init: invalid signer public key") | |
168 | + | else false | |
169 | + | if ((err == err)) | |
170 | + | then $Tuple2((((_saveInit(true) ++ _savePauser(addressFromStringValue(pauser_))) ++ _saveChainId(chainId_)) ++ _saveSignerPublicKey(fromBase58String(signerPublicKey_))), unit) | |
171 | + | else throw("Strict value is not equal to itself.") | |
172 | + | } | |
173 | + | ||
174 | + | ||
175 | + | ||
176 | + | @Callable(i) | |
177 | + | func execute (contract_,functionName_,functionArgs_,callerChainId_,executionChainId_,nonce_,txHash_,signature_) = { | |
178 | + | let err = if (if (if (_whenInitialized()) | |
179 | + | then _whenNotPaused() | |
180 | + | else false) | |
181 | + | then _validateAddress(contract_, "execute: invalid contract") | |
182 | + | else false) | |
183 | + | then if ((_loadChainId() != executionChainId_)) | |
184 | + | then throw("execute: invalid execution chain id") | |
185 | + | else true | |
186 | + | else false | |
187 | + | if ((err == err)) | |
188 | + | then { | |
189 | + | func foldFunc (acc,elem) = (acc + toBytes(elem)) | |
190 | + | ||
191 | + | let argsBytes = { | |
192 | + | let $l = functionArgs_ | |
193 | + | let $s = size($l) | |
194 | + | let $acc0 = base58'' | |
195 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
196 | + | then $a | |
197 | + | else foldFunc($a, $l[$i]) | |
198 | + | ||
199 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
200 | + | then $a | |
201 | + | else throw("List size exceeds 22") | |
202 | + | ||
203 | + | $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) | |
204 | + | } | |
205 | + | let data = ((((((toBytes(callerChainId_) + toBytes(executionChainId_)) + toBytes(nonce_)) + toBytes(txHash_)) + fromBase58String(contract_)) + toBytes(functionName_)) + argsBytes) | |
206 | + | let dataHash = keccak256_32Kb(data) | |
207 | + | let err1 = if (!(sigVerify(dataHash, fromBase58String(signature_), _loadSignerPublicKey()))) | |
208 | + | then throw("execute: invalid signature") | |
209 | + | else if ((_loadDataHash(dataHash) > 0)) | |
210 | + | then throw("execute: duplicate data") | |
211 | + | else unit | |
212 | + | if ((err1 == err1)) | |
213 | + | then { | |
214 | + | let invocation = invoke(addressFromStringValue(contract_), functionName_, functionArgs_, nil) | |
215 | + | if ((invocation == invocation)) | |
216 | + | then $Tuple2(_saveDataHash(dataHash, height), unit) | |
217 | + | else throw("Strict value is not equal to itself.") | |
218 | + | } | |
219 | + | else throw("Strict value is not equal to itself.") | |
220 | + | } | |
221 | + | else throw("Strict value is not equal to itself.") | |
222 | + | } | |
223 | + | ||
224 | + | ||
225 | + | ||
226 | + | @Callable(i) | |
227 | + | func updateSigner (newSignerPublicKey_,oldSignature_,newSignature_) = { | |
228 | + | let err = if (if (_onlyThisContract(i.caller)) | |
229 | + | then _whenInitialized() | |
230 | + | else false) | |
231 | + | then _validatePublicKey(newSignerPublicKey_, "updateSigner: invalid signer public key") | |
232 | + | else false | |
233 | + | if ((err == err)) | |
234 | + | then { | |
235 | + | let oldSignerPublicKey = _loadSignerPublicKey() | |
236 | + | let oldData = ((toBytes("<<<PUBLIC--KEY--MIGRATION--ALLOWED>>>") + oldSignerPublicKey) + fromBase58String(newSignerPublicKey_)) | |
237 | + | let newSignerPublicKey = fromBase58String(newSignerPublicKey_) | |
238 | + | let newData = ((toBytes("<<<PUBLIC--KEY--MIGRATION--CONFIRMED>>>") + oldSignerPublicKey) + fromBase58String(newSignerPublicKey_)) | |
239 | + | let err1 = if (!(sigVerify_8Kb(oldData, fromBase58String(oldSignature_), oldSignerPublicKey))) | |
240 | + | then throw("updateSigner: invalid old signature") | |
241 | + | else if (!(sigVerify_8Kb(newData, fromBase58String(newSignature_), newSignerPublicKey))) | |
242 | + | then throw("updateSigner: invalid new signature") | |
243 | + | else unit | |
244 | + | if ((err1 == err1)) | |
245 | + | then $Tuple2(_saveSignerPublicKey(newSignerPublicKey), unit) | |
246 | + | else throw("Strict value is not equal to itself.") | |
247 | + | } | |
248 | + | else throw("Strict value is not equal to itself.") | |
249 | + | } | |
250 | + | ||
251 | + | ||
252 | + | ||
253 | + | @Callable(i) | |
254 | + | func pause () = { | |
255 | + | let err = if (if (_onlyPauser(i.caller)) | |
256 | + | then _whenInitialized() | |
257 | + | else false) | |
258 | + | then _whenNotPaused() | |
259 | + | else false | |
260 | + | if ((err == err)) | |
261 | + | then $Tuple2(_savePause(true), unit) | |
262 | + | else throw("Strict value is not equal to itself.") | |
263 | + | } | |
264 | + | ||
265 | + | ||
266 | + | ||
267 | + | @Callable(i) | |
268 | + | func unpause () = { | |
269 | + | let err = if (if (_onlyPauser(i.caller)) | |
270 | + | then _whenInitialized() | |
271 | + | else false) | |
272 | + | then _whenPaused() | |
273 | + | else false | |
274 | + | if ((err == err)) | |
275 | + | then $Tuple2(_savePause(false), unit) | |
276 | + | else throw("Strict value is not equal to itself.") | |
277 | + | } | |
278 | + | ||
279 | + | ||
280 | + | ||
281 | + | @Callable(i) | |
282 | + | func updatePauser (pauser_) = { | |
283 | + | let err = if (if (_onlyThisContract(i.caller)) | |
284 | + | then _whenInitialized() | |
285 | + | else false) | |
286 | + | then _validateAddress(pauser_, "init: invalid pauser") | |
287 | + | else false | |
288 | + | if ((err == err)) | |
289 | + | then $Tuple2(_savePauser(addressFromStringValue(pauser_)), unit) | |
290 | + | else throw("Strict value is not equal to itself.") | |
291 | + | } | |
292 | + | ||
293 | + | ||
294 | + | ||
295 | + | @Callable(i) | |
296 | + | func setMultisig (multisig_) = { | |
297 | + | let err = if (_onlyThisContract(i.caller)) | |
298 | + | then _validateAddress(multisig_, "setMultisig: invalid multisig address") | |
299 | + | else false | |
300 | + | if ((err == err)) | |
301 | + | then $Tuple2(_saveMultisig(addressFromStringValue(multisig_)), unit) | |
302 | + | else throw("Strict value is not equal to itself.") | |
303 | + | } | |
304 | + | ||
305 | + | ||
306 | + | @Verifier(tx) | |
307 | + | func verify () = match getString(KEY_MULTISIG) { | |
308 | + | case multisig: String => | |
309 | + | valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false) | |
310 | + | case _ => | |
311 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
312 | + | } | |
313 | + |
github/deemru/w8io/026f985 21.17 ms ◑