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