tx · 2oMuWvUFBSiHHm5622KH8zKq5TvvAoxMpQiMGgV1SvCJ 3Ms7em8i7DYWb6by9VnDECFTejGwZ8guo6P: -0.01400000 Waves 2023.03.01 01:22 [2470157] smart account 3Ms7em8i7DYWb6by9VnDECFTejGwZ8guo6P > SELF 0.00000000 Waves
{ "type": 13, "id": "2oMuWvUFBSiHHm5622KH8zKq5TvvAoxMpQiMGgV1SvCJ", "fee": 1400000, "feeAssetId": null, "timestamp": 1677622741848, "version": 2, "chainId": 84, "sender": "3Ms7em8i7DYWb6by9VnDECFTejGwZ8guo6P", "senderPublicKey": "4cpUhMagzC8h4aLvvWwCdpcwfhVNRFmpeoG9zBhJZEeJ", "proofs": [ "2mMxJ7pJuoL1JDFgW1cFCtmaCtdCqJYjhzEF1CKgF65eSfaRnoshi3HhiHpXg7SfehxNfMUz8QE3gWRrFGajfgjJ" ], "script": "base64:BgIqCAISBQoDCAgIEgcKBQEIAQgBEgMKAQgSAwoBCBIAEgASAwoBCBIDCgEIKgAJU0VQQVJBVE9SAgJfXwAIS0VZX0lOSVQCBElOSVQADEtFWV9NVUxUSVNJRwIITVVMVElTSUcACktFWV9TVEFUVVMCBlNUQVRVUwAKS0VZX1BBVVNFRAIGUEFVU0VEAApLRVlfUEFVU0VSAgZQQVVTRVIAEEtFWV9ST09UX0FEQVBURVICDFJPT1RfQURBUFRFUgATS0VZX1BST1RPQ09MX0NBTExFUgIPUFJPVE9DT0xfQ0FMTEVSACBLRVlfTkFUSVZFX1RPS0VOX0JSSURHRV9DT05UUkFDVAIcTkFUSVZFX1RPS0VOX0JSSURHRV9DT05UUkFDVAAfS0VZX0VSQzIwX1RPS0VOX0JSSURHRV9DT05UUkFDVAIbRVJDMjBfVE9LRU5fQlJJREdFX0NPTlRSQUNUAAlGVU5DX0NBTEwCBGNhbGwAB01BWF9JTlQA//////////9/AAlTTE9UX1NJWkUAIAAJWkVST19TTE9UASAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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J2d394w4M2Xej6RYkWEhyteuYbRjF Next: none Diff:
Old | New | Differences | |
---|---|---|---|
207 | 207 | let amountBytes = _alignRight(toBytes(amount_)) | |
208 | 208 | let gaslessRewardBytes = _alignRight(toBytes(gaslessReward_)) | |
209 | 209 | let callArgs = if ((executionAsset_ == ZERO_ADDRESS)) | |
210 | - | then $Tuple2(_loadNativeTokenBridgeContract(), ("0x" + toBase16String(((((base58' | |
211 | - | else $Tuple2(_loadERC20TokenBridgeContract(), ("0x" + toBase16String((((((base58' | |
210 | + | then $Tuple2(_loadNativeTokenBridgeContract(), ("0x" + toBase16String(((((base58'5egLX4' + ZERO_SLOT) + recipientBytes) + amountBytes) + gaslessRewardBytes)))) | |
211 | + | else $Tuple2(_loadERC20TokenBridgeContract(), ("0x" + toBase16String((((((base58'4pGsYE' + ZERO_SLOT) + executionAssetBytes) + recipientBytes) + amountBytes) + gaslessRewardBytes)))) | |
212 | 212 | let invocation = invoke(_loadProtocolCaller(), FUNC_CALL, [executionChainId_, callArgs._1, callArgs._2], nil) | |
213 | 213 | if ((invocation == invocation)) | |
214 | 214 | then $Tuple2(nil, unit) |
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_ROOT_ADAPTER = "ROOT_ADAPTER" | |
17 | 17 | ||
18 | 18 | let KEY_PROTOCOL_CALLER = "PROTOCOL_CALLER" | |
19 | 19 | ||
20 | 20 | let KEY_NATIVE_TOKEN_BRIDGE_CONTRACT = "NATIVE_TOKEN_BRIDGE_CONTRACT" | |
21 | 21 | ||
22 | 22 | let KEY_ERC20_TOKEN_BRIDGE_CONTRACT = "ERC20_TOKEN_BRIDGE_CONTRACT" | |
23 | 23 | ||
24 | 24 | let FUNC_CALL = "call" | |
25 | 25 | ||
26 | 26 | let MAX_INT = 9223372036854775807 | |
27 | 27 | ||
28 | 28 | let SLOT_SIZE = 32 | |
29 | 29 | ||
30 | 30 | let ZERO_SLOT = base58'11111111111111111111111111111111' | |
31 | 31 | ||
32 | 32 | let ZERO_ADDRESS = "0x0000000000000000000000000000000000000000" | |
33 | 33 | ||
34 | 34 | func _validateAddress (address_,err_) = match addressFromString(address_) { | |
35 | 35 | case a: Address => | |
36 | 36 | true | |
37 | 37 | case _ => | |
38 | 38 | throw(err_) | |
39 | 39 | } | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func _loadInit () = match getBoolean(KEY_INIT) { | |
43 | 43 | case a: Boolean => | |
44 | 44 | a | |
45 | 45 | case _ => | |
46 | 46 | false | |
47 | 47 | } | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func _saveInit (isInit_) = [BooleanEntry(KEY_INIT, isInit_)] | |
51 | 51 | ||
52 | 52 | ||
53 | 53 | func _loadPause () = match getBoolean(KEY_PAUSED) { | |
54 | 54 | case a: Boolean => | |
55 | 55 | a | |
56 | 56 | case _ => | |
57 | 57 | false | |
58 | 58 | } | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func _savePause (isPaused_) = [BooleanEntry(KEY_PAUSED, isPaused_)] | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func _loadPauser () = match getString(KEY_PAUSER) { | |
65 | 65 | case a: String => | |
66 | 66 | addressFromStringValue(a) | |
67 | 67 | case _ => | |
68 | 68 | Address(base58'') | |
69 | 69 | } | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func _savePauser (pauser_) = [StringEntry(KEY_PAUSER, toString(pauser_))] | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func _loadMultisig () = match getString(KEY_MULTISIG) { | |
76 | 76 | case a: String => | |
77 | 77 | addressFromStringValue(a) | |
78 | 78 | case _ => | |
79 | 79 | Address(base58'') | |
80 | 80 | } | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func _saveMultisig (multisig_) = [StringEntry(KEY_MULTISIG, toString(multisig_))] | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | func _loadRootAdapter () = match getString(KEY_ROOT_ADAPTER) { | |
87 | 87 | case a: String => | |
88 | 88 | addressFromStringValue(a) | |
89 | 89 | case _ => | |
90 | 90 | Address(base58'') | |
91 | 91 | } | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func _saveRootAdapter (adapter_) = [StringEntry(KEY_ROOT_ADAPTER, toString(adapter_))] | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func _loadProtocolCaller () = match getString(KEY_PROTOCOL_CALLER) { | |
98 | 98 | case a: String => | |
99 | 99 | addressFromStringValue(a) | |
100 | 100 | case _ => | |
101 | 101 | Address(base58'') | |
102 | 102 | } | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func _saveProtocolCaller (caller_) = [StringEntry(KEY_PROTOCOL_CALLER, toString(caller_))] | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func _loadNativeTokenBridgeContract () = match getString(KEY_NATIVE_TOKEN_BRIDGE_CONTRACT) { | |
109 | 109 | case a: String => | |
110 | 110 | a | |
111 | 111 | case _ => | |
112 | 112 | "" | |
113 | 113 | } | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | func _saveNativeTokenBridgeContract (contract_) = [StringEntry(KEY_NATIVE_TOKEN_BRIDGE_CONTRACT, contract_)] | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | func _loadERC20TokenBridgeContract () = match getString(KEY_ERC20_TOKEN_BRIDGE_CONTRACT) { | |
120 | 120 | case a: String => | |
121 | 121 | a | |
122 | 122 | case _ => | |
123 | 123 | "" | |
124 | 124 | } | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func _saveERC20TokenBridgeContract (contract_) = [StringEntry(KEY_ERC20_TOKEN_BRIDGE_CONTRACT, contract_)] | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func _onlyThisContract (caller_) = if ((caller_ != this)) | |
131 | 131 | then throw("_onlyThisContract: revert") | |
132 | 132 | else true | |
133 | 133 | ||
134 | 134 | ||
135 | 135 | func _whenMultisigSet () = if ((_loadMultisig() == Address(base58''))) | |
136 | 136 | then throw("_whenMultisigSet: revert") | |
137 | 137 | else true | |
138 | 138 | ||
139 | 139 | ||
140 | 140 | func _whenNotInitialized () = if (_loadInit()) | |
141 | 141 | then throw("_whenNotInitialized: revert") | |
142 | 142 | else true | |
143 | 143 | ||
144 | 144 | ||
145 | 145 | func _whenInitialized () = if (!(_loadInit())) | |
146 | 146 | then throw("_whenInitialized: revert") | |
147 | 147 | else true | |
148 | 148 | ||
149 | 149 | ||
150 | 150 | func _whenNotPaused () = if (_loadPause()) | |
151 | 151 | then throw("_whenNotPaused: revert") | |
152 | 152 | else true | |
153 | 153 | ||
154 | 154 | ||
155 | 155 | func _whenPaused () = if (!(_loadPause())) | |
156 | 156 | then throw("_whenPaused: revert") | |
157 | 157 | else true | |
158 | 158 | ||
159 | 159 | ||
160 | 160 | func _onlyPauser (caller_) = if ((caller_ != _loadPauser())) | |
161 | 161 | then throw("_onlyPauser: revert") | |
162 | 162 | else true | |
163 | 163 | ||
164 | 164 | ||
165 | 165 | func _isRootAdapter (caller_) = if ((_loadRootAdapter() != caller_)) | |
166 | 166 | then throw("_isRootAdapter: revert") | |
167 | 167 | else true | |
168 | 168 | ||
169 | 169 | ||
170 | 170 | func _alignLeft (val_) = (val_ + take(ZERO_SLOT, (SLOT_SIZE - size(val_)))) | |
171 | 171 | ||
172 | 172 | ||
173 | 173 | func _alignRight (val_) = (take(ZERO_SLOT, (SLOT_SIZE - size(val_))) + val_) | |
174 | 174 | ||
175 | 175 | ||
176 | 176 | @Callable(i) | |
177 | 177 | func init (protocolCaller_,rootAdapter_,pauser_) = { | |
178 | 178 | let err = if (if (if (if (if (_onlyThisContract(i.caller)) | |
179 | 179 | then _whenNotInitialized() | |
180 | 180 | else false) | |
181 | 181 | then _whenMultisigSet() | |
182 | 182 | else false) | |
183 | 183 | then _validateAddress(protocolCaller_, "init: invalid protocolCaller") | |
184 | 184 | else false) | |
185 | 185 | then _validateAddress(rootAdapter_, "init: invalid rootAdapter") | |
186 | 186 | else false) | |
187 | 187 | then _validateAddress(pauser_, "init: invalid pauser") | |
188 | 188 | else false | |
189 | 189 | if ((err == err)) | |
190 | 190 | then $Tuple2((((_saveInit(true) ++ _saveProtocolCaller(addressFromStringValue(protocolCaller_))) ++ _saveRootAdapter(addressFromStringValue(rootAdapter_))) ++ _savePauser(addressFromStringValue(pauser_))), unit) | |
191 | 191 | else throw("Strict value is not equal to itself.") | |
192 | 192 | } | |
193 | 193 | ||
194 | 194 | ||
195 | 195 | ||
196 | 196 | @Callable(i) | |
197 | 197 | func releaseTokens (executionChainId_,executionAsset_,amount_,recipient_,gaslessReward_) = { | |
198 | 198 | let err = if (if (_whenInitialized()) | |
199 | 199 | then _whenNotPaused() | |
200 | 200 | else false) | |
201 | 201 | then _isRootAdapter(i.caller) | |
202 | 202 | else false | |
203 | 203 | if ((err == err)) | |
204 | 204 | then { | |
205 | 205 | let executionAssetBytes = _alignRight(fromBase16String(drop(executionAsset_, 2))) | |
206 | 206 | let recipientBytes = _alignRight(fromBase16String(drop(recipient_, 2))) | |
207 | 207 | let amountBytes = _alignRight(toBytes(amount_)) | |
208 | 208 | let gaslessRewardBytes = _alignRight(toBytes(gaslessReward_)) | |
209 | 209 | let callArgs = if ((executionAsset_ == ZERO_ADDRESS)) | |
210 | - | then $Tuple2(_loadNativeTokenBridgeContract(), ("0x" + toBase16String(((((base58' | |
211 | - | else $Tuple2(_loadERC20TokenBridgeContract(), ("0x" + toBase16String((((((base58' | |
210 | + | then $Tuple2(_loadNativeTokenBridgeContract(), ("0x" + toBase16String(((((base58'5egLX4' + ZERO_SLOT) + recipientBytes) + amountBytes) + gaslessRewardBytes)))) | |
211 | + | else $Tuple2(_loadERC20TokenBridgeContract(), ("0x" + toBase16String((((((base58'4pGsYE' + ZERO_SLOT) + executionAssetBytes) + recipientBytes) + amountBytes) + gaslessRewardBytes)))) | |
212 | 212 | let invocation = invoke(_loadProtocolCaller(), FUNC_CALL, [executionChainId_, callArgs._1, callArgs._2], nil) | |
213 | 213 | if ((invocation == invocation)) | |
214 | 214 | then $Tuple2(nil, unit) | |
215 | 215 | else throw("Strict value is not equal to itself.") | |
216 | 216 | } | |
217 | 217 | else throw("Strict value is not equal to itself.") | |
218 | 218 | } | |
219 | 219 | ||
220 | 220 | ||
221 | 221 | ||
222 | 222 | @Callable(i) | |
223 | 223 | func setNativeTokenBridgeContract (contract_) = { | |
224 | 224 | let err = if (_onlyThisContract(i.caller)) | |
225 | 225 | then _whenInitialized() | |
226 | 226 | else false | |
227 | 227 | if ((err == err)) | |
228 | 228 | then $Tuple2(_saveNativeTokenBridgeContract(contract_), unit) | |
229 | 229 | else throw("Strict value is not equal to itself.") | |
230 | 230 | } | |
231 | 231 | ||
232 | 232 | ||
233 | 233 | ||
234 | 234 | @Callable(i) | |
235 | 235 | func setERC20TokenBridgeContract (contract_) = { | |
236 | 236 | let err = if (_onlyThisContract(i.caller)) | |
237 | 237 | then _whenInitialized() | |
238 | 238 | else false | |
239 | 239 | if ((err == err)) | |
240 | 240 | then $Tuple2(_saveERC20TokenBridgeContract(contract_), unit) | |
241 | 241 | else throw("Strict value is not equal to itself.") | |
242 | 242 | } | |
243 | 243 | ||
244 | 244 | ||
245 | 245 | ||
246 | 246 | @Callable(i) | |
247 | 247 | func pause () = { | |
248 | 248 | let err = if (if (_onlyPauser(i.caller)) | |
249 | 249 | then _whenInitialized() | |
250 | 250 | else false) | |
251 | 251 | then _whenNotPaused() | |
252 | 252 | else false | |
253 | 253 | if ((err == err)) | |
254 | 254 | then $Tuple2(_savePause(true), unit) | |
255 | 255 | else throw("Strict value is not equal to itself.") | |
256 | 256 | } | |
257 | 257 | ||
258 | 258 | ||
259 | 259 | ||
260 | 260 | @Callable(i) | |
261 | 261 | func unpause () = { | |
262 | 262 | let err = if (if (_onlyPauser(i.caller)) | |
263 | 263 | then _whenInitialized() | |
264 | 264 | else false) | |
265 | 265 | then _whenPaused() | |
266 | 266 | else false | |
267 | 267 | if ((err == err)) | |
268 | 268 | then $Tuple2(_savePause(false), unit) | |
269 | 269 | else throw("Strict value is not equal to itself.") | |
270 | 270 | } | |
271 | 271 | ||
272 | 272 | ||
273 | 273 | ||
274 | 274 | @Callable(i) | |
275 | 275 | func updatePauser (pauser_) = { | |
276 | 276 | let err = if (if (_onlyThisContract(i.caller)) | |
277 | 277 | then _whenInitialized() | |
278 | 278 | else false) | |
279 | 279 | then _validateAddress(pauser_, "init: invalid pauser") | |
280 | 280 | else false | |
281 | 281 | if ((err == err)) | |
282 | 282 | then $Tuple2(_savePauser(addressFromStringValue(pauser_)), unit) | |
283 | 283 | else throw("Strict value is not equal to itself.") | |
284 | 284 | } | |
285 | 285 | ||
286 | 286 | ||
287 | 287 | ||
288 | 288 | @Callable(i) | |
289 | 289 | func setMultisig (multisig_) = { | |
290 | 290 | let err = if (_onlyThisContract(i.caller)) | |
291 | 291 | then _validateAddress(multisig_, "setMultisig: invalid multisig") | |
292 | 292 | else false | |
293 | 293 | if ((err == err)) | |
294 | 294 | then $Tuple2(_saveMultisig(addressFromStringValue(multisig_)), unit) | |
295 | 295 | else throw("Strict value is not equal to itself.") | |
296 | 296 | } | |
297 | 297 | ||
298 | 298 | ||
299 | 299 | @Verifier(tx) | |
300 | 300 | func verify () = match getString(KEY_MULTISIG) { | |
301 | 301 | case multisig: String => | |
302 | 302 | valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false) | |
303 | 303 | case _ => | |
304 | 304 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
305 | 305 | } | |
306 | 306 |
github/deemru/w8io/169f3d6 55.42 ms ◑