tx · 92ZvaNfqKk6jm1wn8KqRxUre58aNt4y2EBUNQ9PWArpA 3MwgDbpnUQcr7MiFVQ1NcNgTBvkRytdGd2R: -0.01400000 Waves 2025.01.15 15:17 [3460210] smart account 3MwgDbpnUQcr7MiFVQ1NcNgTBvkRytdGd2R > SELF 0.00000000 Waves
{ "type": 13, "id": "92ZvaNfqKk6jm1wn8KqRxUre58aNt4y2EBUNQ9PWArpA", "fee": 1400000, "feeAssetId": null, "timestamp": 1736943454216, "version": 2, "chainId": 84, "sender": "3MwgDbpnUQcr7MiFVQ1NcNgTBvkRytdGd2R", "senderPublicKey": "6kGDUcAPHWXGnMU89GNpRLQT8qawCijYhNB4zF8EV6kK", "proofs": [ "4faxQpdn43zGguZ8Dz1pjB3osAJtnWjswFtwppfJkj5h2SepJtf8yaGfB7YSt8b4e5uKcx9yb6NQkUxVkeCVZAVJ" ], "script": "base64:BgI0CAISAwoBCBIDCgEIEgMKAQgSAwoBARIAEgASAwoBCBIDCgEIEgMKAQgSBAoCCAESAwoBCB0ACVNFUEFSQVRPUgICX18ACEtFWV9JTklUAgRJTklUAAxLRVlfTVVMVElTSUcCCE1VTFRJU0lHAApLRVlfU1RBVFVTAgZTVEFUVVMAC0tFWV9DTEFJTUVSAgdDTEFJTUVSABBLRVlfTEFTVF9TV0FQX0FUAgxMQVNUX1NXQVBfQVQAFktFWV9XQVZFU19EQU9fQ09OVFJBQ1QCEldBVkVTX0RBT19DT05UUkFDVAARS0VZX1NXQVBfQ09OVFJBQ1QCDVNXQVBfQ09OVFJBQ1QADktFWV9TV0FQX0xJTUlUAgpTV0FQX0xJTUlUABhLRVlfVU5JVFNfQ0hBSU5fQ09OVFJBQ1QCFFVOSVRTX0NIQUlOX0NPTlRSQUNUAA1GVU5DX0NMQUlNX0xQAgdjbGFpbUxQAAlGVU5DX1NXQVACBHN3YXAAEk9ORV9IT1VSX0lOX0JMT0NLUwA8AAxDT01QRU5TQVRJT04AoMIeARBfdmFsaWRhdGVBZGRyZXN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wQIbXVsdGlzaWcFByRtYXRjaDAEByRtYXRjaDEFAnR4AwkAAQIFByRtYXRjaDECF0ludm9rZVNjcmlwdFRyYW5zYWN0aW9uBAJ0eAUHJG1hdGNoMQMJAAACCAUCdHgEZEFwcAkBF19sb2FkVW5pdHNDaGFpbkNvbnRyYWN0AAkAyBMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleQkBC3ZhbHVlT3JFbHNlAgkAmwgCCQERQGV4dHJOYXRpdmUoMTA2MikBBQhtdWx0aXNpZwkAuQkCCQDMCAIFCktFWV9TVEFUVVMJAMwIAgkApQgBBQR0aGlzCQDMCAIJANgEAQgFAnR4AmlkBQNuaWwFCVNFUEFSQVRPUgcJAQt2YWx1ZU9yRWxzZQIJAJsIAgkBEUBleHRyTmF0aXZlKDEwNjIpAQUIbXVsdGlzaWcJALkJAgkAzAgCBQpLRVlfU1RBVFVTCQDMCAIJAKUIAQUEdGhpcwkAzAgCCQDYBAEIBQJ0eAJpZAUDbmlsBQlTRVBBUkFUT1IHCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5nPeY9Q==", "height": 3460210, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: F7xwzz2MDq1ZmHRnQcSVhfm56NA9znQiaXMSGJzCPPXx Next: none Diff:
Old | New | Differences | |
---|---|---|---|
11 | 11 | ||
12 | 12 | let KEY_CLAIMER = "CLAIMER" | |
13 | 13 | ||
14 | + | let KEY_LAST_SWAP_AT = "LAST_SWAP_AT" | |
15 | + | ||
16 | + | let KEY_WAVES_DAO_CONTRACT = "WAVES_DAO_CONTRACT" | |
17 | + | ||
18 | + | let KEY_SWAP_CONTRACT = "SWAP_CONTRACT" | |
19 | + | ||
20 | + | let KEY_SWAP_LIMIT = "SWAP_LIMIT" | |
21 | + | ||
22 | + | let KEY_UNITS_CHAIN_CONTRACT = "UNITS_CHAIN_CONTRACT" | |
23 | + | ||
24 | + | let FUNC_CLAIM_LP = "claimLP" | |
25 | + | ||
26 | + | let FUNC_SWAP = "swap" | |
27 | + | ||
28 | + | let ONE_HOUR_IN_BLOCKS = 60 | |
29 | + | ||
30 | + | let COMPENSATION = 500000 | |
31 | + | ||
14 | 32 | func _validateAddress (address_) = match addressFromString(address_) { | |
15 | 33 | case a: Address => | |
16 | 34 | true | |
19 | 37 | } | |
20 | 38 | ||
21 | 39 | ||
40 | + | func _validateAsset (assetId_,err_) = match assetInfo(fromBase58String(assetId_)) { | |
41 | + | case _: Asset => | |
42 | + | true | |
43 | + | case _: Unit => | |
44 | + | throw(err_) | |
45 | + | case _ => | |
46 | + | throw("Match error") | |
47 | + | } | |
48 | + | ||
49 | + | ||
50 | + | func _validateInt (val_,lowerBoundary_,upperBoundary_,err_) = if (if ((lowerBoundary_ > val_)) | |
51 | + | then true | |
52 | + | else (val_ > upperBoundary_)) | |
53 | + | then throw(err_) | |
54 | + | else true | |
55 | + | ||
56 | + | ||
57 | + | func _loadWavesDAOContract () = match getString(KEY_WAVES_DAO_CONTRACT) { | |
58 | + | case a: String => | |
59 | + | addressFromStringValue(a) | |
60 | + | case _ => | |
61 | + | Address(base58'') | |
62 | + | } | |
63 | + | ||
64 | + | ||
65 | + | func _saveWavesDAOContract (val_) = [StringEntry(KEY_WAVES_DAO_CONTRACT, toString(val_))] | |
66 | + | ||
67 | + | ||
68 | + | func _loadSwapContract () = match getString(KEY_SWAP_CONTRACT) { | |
69 | + | case a: String => | |
70 | + | addressFromStringValue(a) | |
71 | + | case _ => | |
72 | + | Address(base58'') | |
73 | + | } | |
74 | + | ||
75 | + | ||
76 | + | func _saveSwapContract (val_) = [StringEntry(KEY_SWAP_CONTRACT, toString(val_))] | |
77 | + | ||
78 | + | ||
79 | + | func _loadLastSwapAt (asset_) = match getInteger(makeString([KEY_LAST_SWAP_AT, asset_], SEPARATOR)) { | |
80 | + | case a: Int => | |
81 | + | a | |
82 | + | case _ => | |
83 | + | 0 | |
84 | + | } | |
85 | + | ||
86 | + | ||
87 | + | func _saveLastSwapAt (asset_,val_) = [IntegerEntry(makeString([KEY_LAST_SWAP_AT, asset_], SEPARATOR), val_)] | |
88 | + | ||
89 | + | ||
90 | + | func _loadSwapLimit (asset_) = match getInteger(makeString([KEY_SWAP_LIMIT, asset_], SEPARATOR)) { | |
91 | + | case a: Int => | |
92 | + | a | |
93 | + | case _ => | |
94 | + | 0 | |
95 | + | } | |
96 | + | ||
97 | + | ||
98 | + | func _saveSwapLimit (asset_,val_) = [IntegerEntry(makeString([KEY_SWAP_LIMIT, asset_], SEPARATOR), val_)] | |
99 | + | ||
100 | + | ||
101 | + | func _loadUnitsChainContract () = match getString(KEY_UNITS_CHAIN_CONTRACT) { | |
102 | + | case a: String => | |
103 | + | addressFromStringValue(a) | |
104 | + | case _ => | |
105 | + | Address(base58'') | |
106 | + | } | |
107 | + | ||
108 | + | ||
109 | + | func _saveUnitsChainContract (val_) = [StringEntry(KEY_UNITS_CHAIN_CONTRACT, toString(val_))] | |
110 | + | ||
111 | + | ||
112 | + | func _getWAVESDLPAsset () = match getString(_loadWavesDAOContract(), "%s__lpAssetId") { | |
113 | + | case a: String => | |
114 | + | fromBase58String(a) | |
115 | + | case _ => | |
116 | + | throw("_getWAVESDLPAsset: revert") | |
117 | + | } | |
118 | + | ||
119 | + | ||
120 | + | func _getAvailableWAVESDLP () = match getInteger(_loadWavesDAOContract(), ("%s%s__available__" + toString(this))) { | |
121 | + | case a: Int => | |
122 | + | a | |
123 | + | case _ => | |
124 | + | 0 | |
125 | + | } | |
126 | + | ||
127 | + | ||
22 | 128 | @Callable(i) | |
23 | 129 | func init (claimer_) = { | |
24 | 130 | let multisig = valueOrErrorMessage(getString(KEY_MULTISIG), "init: no multisig set") | |
25 | - | let init = valueOrElse(getBoolean(KEY_INIT), false) | |
26 | - | let err = if ((i.caller != this)) | |
27 | - | then throw("init: permission denied") | |
28 | - | else if (init) | |
29 | - | then throw("init: already initialized") | |
30 | - | else if (!(_validateAddress(claimer_))) | |
31 | - | then throw("init: invalid claimer address") | |
32 | - | else unit | |
33 | - | if ((err == err)) | |
34 | - | then $Tuple2([BooleanEntry(KEY_INIT, true), StringEntry(KEY_CLAIMER, claimer_)], unit) | |
131 | + | if ((multisig == multisig)) | |
132 | + | then { | |
133 | + | let init = valueOrElse(getBoolean(KEY_INIT), false) | |
134 | + | let err = if ((i.caller != this)) | |
135 | + | then throw("init: permission denied") | |
136 | + | else if (init) | |
137 | + | then throw("init: already initialized") | |
138 | + | else if (!(_validateAddress(claimer_))) | |
139 | + | then throw("init: invalid claimer address") | |
140 | + | else unit | |
141 | + | if ((err == err)) | |
142 | + | then $Tuple2([BooleanEntry(KEY_INIT, true), StringEntry(KEY_CLAIMER, claimer_)], unit) | |
143 | + | else throw("Strict value is not equal to itself.") | |
144 | + | } | |
35 | 145 | else throw("Strict value is not equal to itself.") | |
36 | 146 | } | |
37 | 147 | ||
75 | 185 | else $Tuple2([ScriptTransfer(i.caller, amount_, unit)], unit) | |
76 | 186 | ||
77 | 187 | ||
188 | + | ||
189 | + | @Callable(i) | |
190 | + | func getAvailableWAVESDLP () = $Tuple2(nil, _getAvailableWAVESDLP()) | |
191 | + | ||
192 | + | ||
193 | + | ||
194 | + | @Callable(i) | |
195 | + | func claimAndSwapWAVESDLP () = { | |
196 | + | let asset = _getWAVESDLPAsset() | |
197 | + | let assetStr = toBase58String(asset) | |
198 | + | let invocation = invoke(_loadWavesDAOContract(), FUNC_CLAIM_LP, nil, nil) | |
199 | + | if ((invocation == invocation)) | |
200 | + | then { | |
201 | + | let totalAmount = assetBalance(this, asset) | |
202 | + | if ((totalAmount == totalAmount)) | |
203 | + | then { | |
204 | + | let swapLimit = _loadSwapLimit(assetStr) | |
205 | + | let amountToSwap = if ((totalAmount > swapLimit)) | |
206 | + | then swapLimit | |
207 | + | else totalAmount | |
208 | + | let result = if ((height > (_loadLastSwapAt(assetStr) + ONE_HOUR_IN_BLOCKS))) | |
209 | + | then invoke(_loadSwapContract(), FUNC_SWAP, [1, "", toString(this)], [AttachedPayment(asset, amountToSwap)]) | |
210 | + | else throw("claimAndSwapWAVESDLP: too often") | |
211 | + | if ((result == result)) | |
212 | + | then match result { | |
213 | + | case a: Int => | |
214 | + | if ((a > COMPENSATION)) | |
215 | + | then $Tuple2((_saveLastSwapAt(assetStr, height) ++ [ScriptTransfer(i.caller, COMPENSATION, unit)]), unit) | |
216 | + | else throw("claimAndSwapWAVESDLP: too little amount got") | |
217 | + | case _ => | |
218 | + | throw("claimAndSwapWAVESDLP: swap revert") | |
219 | + | } | |
220 | + | else throw("Strict value is not equal to itself.") | |
221 | + | } | |
222 | + | else throw("Strict value is not equal to itself.") | |
223 | + | } | |
224 | + | else throw("Strict value is not equal to itself.") | |
225 | + | } | |
226 | + | ||
227 | + | ||
228 | + | ||
229 | + | @Callable(i) | |
230 | + | func swapAsset (assetId_) = { | |
231 | + | let err = _validateAsset(assetId_, "swapAsset: invalid asset") | |
232 | + | if ((err == err)) | |
233 | + | then { | |
234 | + | let asset = fromBase58String(assetId_) | |
235 | + | let totalAmount = assetBalance(this, asset) | |
236 | + | if ((totalAmount == totalAmount)) | |
237 | + | then { | |
238 | + | let swapLimit = _loadSwapLimit(assetId_) | |
239 | + | let amountToSwap = if ((totalAmount > swapLimit)) | |
240 | + | then swapLimit | |
241 | + | else totalAmount | |
242 | + | let result = if ((height > (_loadLastSwapAt(assetId_) + ONE_HOUR_IN_BLOCKS))) | |
243 | + | then invoke(_loadSwapContract(), FUNC_SWAP, [1, "", toString(this)], [AttachedPayment(asset, amountToSwap)]) | |
244 | + | else throw("swapAsset: too often") | |
245 | + | if ((result == result)) | |
246 | + | then match result { | |
247 | + | case a: Int => | |
248 | + | if ((a > COMPENSATION)) | |
249 | + | then $Tuple2((_saveLastSwapAt(assetId_, height) ++ [ScriptTransfer(i.caller, COMPENSATION, unit)]), unit) | |
250 | + | else throw("swapAsset: too little amount got") | |
251 | + | case _ => | |
252 | + | throw("swapAsset: swap revert") | |
253 | + | } | |
254 | + | else throw("Strict value is not equal to itself.") | |
255 | + | } | |
256 | + | else throw("Strict value is not equal to itself.") | |
257 | + | } | |
258 | + | else throw("Strict value is not equal to itself.") | |
259 | + | } | |
260 | + | ||
261 | + | ||
262 | + | ||
263 | + | @Callable(i) | |
264 | + | func setWavesDAOContract (address_) = { | |
265 | + | let err = if ((i.caller != this)) | |
266 | + | then throw("setWavesDAOContract: permission denied") | |
267 | + | else if (!(_validateAddress(address_))) | |
268 | + | then throw("setWavesDAOContract: invalid address") | |
269 | + | else unit | |
270 | + | if ((err == err)) | |
271 | + | then $Tuple2(_saveWavesDAOContract(addressFromStringValue(address_)), unit) | |
272 | + | else throw("Strict value is not equal to itself.") | |
273 | + | } | |
274 | + | ||
275 | + | ||
276 | + | ||
277 | + | @Callable(i) | |
278 | + | func setSwapContract (address_) = { | |
279 | + | let err = if ((i.caller != this)) | |
280 | + | then throw("setSwapContract: permission denied") | |
281 | + | else if (!(_validateAddress(address_))) | |
282 | + | then throw("setSwapContract: invalid address") | |
283 | + | else unit | |
284 | + | if ((err == err)) | |
285 | + | then $Tuple2(_saveSwapContract(addressFromStringValue(address_)), unit) | |
286 | + | else throw("Strict value is not equal to itself.") | |
287 | + | } | |
288 | + | ||
289 | + | ||
290 | + | ||
291 | + | @Callable(i) | |
292 | + | func setSwapLimit (assetId_,limit_) = { | |
293 | + | let err = if (_validateAsset(assetId_, "setSwapLimit: invalid asset")) | |
294 | + | then if ((i.caller != this)) | |
295 | + | then throw("setSwapLimit: permission denied") | |
296 | + | else if ((0 >= limit_)) | |
297 | + | then throw("setSwapLimit: invalid limit") | |
298 | + | else unit | |
299 | + | else false | |
300 | + | if ((err == err)) | |
301 | + | then $Tuple2(_saveSwapLimit(assetId_, limit_), unit) | |
302 | + | else throw("Strict value is not equal to itself.") | |
303 | + | } | |
304 | + | ||
305 | + | ||
306 | + | ||
307 | + | @Callable(i) | |
308 | + | func setUnitsChainContract (address_) = { | |
309 | + | let err = if ((i.caller != this)) | |
310 | + | then throw("setUnitsChainContract: permission denied") | |
311 | + | else if (!(_validateAddress(address_))) | |
312 | + | then throw("setUnitsChainContract: invalid address") | |
313 | + | else unit | |
314 | + | if ((err == err)) | |
315 | + | then $Tuple2(_saveUnitsChainContract(addressFromStringValue(address_)), unit) | |
316 | + | else throw("Strict value is not equal to itself.") | |
317 | + | } | |
318 | + | ||
319 | + | ||
78 | 320 | @Verifier(tx) | |
79 | 321 | func verify () = match getString(KEY_MULTISIG) { | |
80 | 322 | case multisig: String => | |
81 | - | valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false) | |
323 | + | match tx { | |
324 | + | case tx: InvokeScriptTransaction => | |
325 | + | if ((tx.dApp == _loadUnitsChainContract())) | |
326 | + | then sigVerify_128Kb(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
327 | + | else valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false) | |
328 | + | case _ => | |
329 | + | valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false) | |
330 | + | } | |
82 | 331 | case _ => | |
83 | 332 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
84 | 333 | } |
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_CLAIMER = "CLAIMER" | |
13 | 13 | ||
14 | + | let KEY_LAST_SWAP_AT = "LAST_SWAP_AT" | |
15 | + | ||
16 | + | let KEY_WAVES_DAO_CONTRACT = "WAVES_DAO_CONTRACT" | |
17 | + | ||
18 | + | let KEY_SWAP_CONTRACT = "SWAP_CONTRACT" | |
19 | + | ||
20 | + | let KEY_SWAP_LIMIT = "SWAP_LIMIT" | |
21 | + | ||
22 | + | let KEY_UNITS_CHAIN_CONTRACT = "UNITS_CHAIN_CONTRACT" | |
23 | + | ||
24 | + | let FUNC_CLAIM_LP = "claimLP" | |
25 | + | ||
26 | + | let FUNC_SWAP = "swap" | |
27 | + | ||
28 | + | let ONE_HOUR_IN_BLOCKS = 60 | |
29 | + | ||
30 | + | let COMPENSATION = 500000 | |
31 | + | ||
14 | 32 | func _validateAddress (address_) = match addressFromString(address_) { | |
15 | 33 | case a: Address => | |
16 | 34 | true | |
17 | 35 | case _ => | |
18 | 36 | false | |
19 | 37 | } | |
20 | 38 | ||
21 | 39 | ||
40 | + | func _validateAsset (assetId_,err_) = match assetInfo(fromBase58String(assetId_)) { | |
41 | + | case _: Asset => | |
42 | + | true | |
43 | + | case _: Unit => | |
44 | + | throw(err_) | |
45 | + | case _ => | |
46 | + | throw("Match error") | |
47 | + | } | |
48 | + | ||
49 | + | ||
50 | + | func _validateInt (val_,lowerBoundary_,upperBoundary_,err_) = if (if ((lowerBoundary_ > val_)) | |
51 | + | then true | |
52 | + | else (val_ > upperBoundary_)) | |
53 | + | then throw(err_) | |
54 | + | else true | |
55 | + | ||
56 | + | ||
57 | + | func _loadWavesDAOContract () = match getString(KEY_WAVES_DAO_CONTRACT) { | |
58 | + | case a: String => | |
59 | + | addressFromStringValue(a) | |
60 | + | case _ => | |
61 | + | Address(base58'') | |
62 | + | } | |
63 | + | ||
64 | + | ||
65 | + | func _saveWavesDAOContract (val_) = [StringEntry(KEY_WAVES_DAO_CONTRACT, toString(val_))] | |
66 | + | ||
67 | + | ||
68 | + | func _loadSwapContract () = match getString(KEY_SWAP_CONTRACT) { | |
69 | + | case a: String => | |
70 | + | addressFromStringValue(a) | |
71 | + | case _ => | |
72 | + | Address(base58'') | |
73 | + | } | |
74 | + | ||
75 | + | ||
76 | + | func _saveSwapContract (val_) = [StringEntry(KEY_SWAP_CONTRACT, toString(val_))] | |
77 | + | ||
78 | + | ||
79 | + | func _loadLastSwapAt (asset_) = match getInteger(makeString([KEY_LAST_SWAP_AT, asset_], SEPARATOR)) { | |
80 | + | case a: Int => | |
81 | + | a | |
82 | + | case _ => | |
83 | + | 0 | |
84 | + | } | |
85 | + | ||
86 | + | ||
87 | + | func _saveLastSwapAt (asset_,val_) = [IntegerEntry(makeString([KEY_LAST_SWAP_AT, asset_], SEPARATOR), val_)] | |
88 | + | ||
89 | + | ||
90 | + | func _loadSwapLimit (asset_) = match getInteger(makeString([KEY_SWAP_LIMIT, asset_], SEPARATOR)) { | |
91 | + | case a: Int => | |
92 | + | a | |
93 | + | case _ => | |
94 | + | 0 | |
95 | + | } | |
96 | + | ||
97 | + | ||
98 | + | func _saveSwapLimit (asset_,val_) = [IntegerEntry(makeString([KEY_SWAP_LIMIT, asset_], SEPARATOR), val_)] | |
99 | + | ||
100 | + | ||
101 | + | func _loadUnitsChainContract () = match getString(KEY_UNITS_CHAIN_CONTRACT) { | |
102 | + | case a: String => | |
103 | + | addressFromStringValue(a) | |
104 | + | case _ => | |
105 | + | Address(base58'') | |
106 | + | } | |
107 | + | ||
108 | + | ||
109 | + | func _saveUnitsChainContract (val_) = [StringEntry(KEY_UNITS_CHAIN_CONTRACT, toString(val_))] | |
110 | + | ||
111 | + | ||
112 | + | func _getWAVESDLPAsset () = match getString(_loadWavesDAOContract(), "%s__lpAssetId") { | |
113 | + | case a: String => | |
114 | + | fromBase58String(a) | |
115 | + | case _ => | |
116 | + | throw("_getWAVESDLPAsset: revert") | |
117 | + | } | |
118 | + | ||
119 | + | ||
120 | + | func _getAvailableWAVESDLP () = match getInteger(_loadWavesDAOContract(), ("%s%s__available__" + toString(this))) { | |
121 | + | case a: Int => | |
122 | + | a | |
123 | + | case _ => | |
124 | + | 0 | |
125 | + | } | |
126 | + | ||
127 | + | ||
22 | 128 | @Callable(i) | |
23 | 129 | func init (claimer_) = { | |
24 | 130 | let multisig = valueOrErrorMessage(getString(KEY_MULTISIG), "init: no multisig set") | |
25 | - | let init = valueOrElse(getBoolean(KEY_INIT), false) | |
26 | - | let err = if ((i.caller != this)) | |
27 | - | then throw("init: permission denied") | |
28 | - | else if (init) | |
29 | - | then throw("init: already initialized") | |
30 | - | else if (!(_validateAddress(claimer_))) | |
31 | - | then throw("init: invalid claimer address") | |
32 | - | else unit | |
33 | - | if ((err == err)) | |
34 | - | then $Tuple2([BooleanEntry(KEY_INIT, true), StringEntry(KEY_CLAIMER, claimer_)], unit) | |
131 | + | if ((multisig == multisig)) | |
132 | + | then { | |
133 | + | let init = valueOrElse(getBoolean(KEY_INIT), false) | |
134 | + | let err = if ((i.caller != this)) | |
135 | + | then throw("init: permission denied") | |
136 | + | else if (init) | |
137 | + | then throw("init: already initialized") | |
138 | + | else if (!(_validateAddress(claimer_))) | |
139 | + | then throw("init: invalid claimer address") | |
140 | + | else unit | |
141 | + | if ((err == err)) | |
142 | + | then $Tuple2([BooleanEntry(KEY_INIT, true), StringEntry(KEY_CLAIMER, claimer_)], unit) | |
143 | + | else throw("Strict value is not equal to itself.") | |
144 | + | } | |
35 | 145 | else throw("Strict value is not equal to itself.") | |
36 | 146 | } | |
37 | 147 | ||
38 | 148 | ||
39 | 149 | ||
40 | 150 | @Callable(i) | |
41 | 151 | func setMultisig (multisig_) = { | |
42 | 152 | let err = if ((i.caller != this)) | |
43 | 153 | then throw("setMultisig: permission denied") | |
44 | 154 | else if (!(_validateAddress(multisig_))) | |
45 | 155 | then throw("setMultisig: invalid multisig address") | |
46 | 156 | else unit | |
47 | 157 | if ((err == err)) | |
48 | 158 | then $Tuple2([StringEntry(KEY_MULTISIG, multisig_)], unit) | |
49 | 159 | else throw("Strict value is not equal to itself.") | |
50 | 160 | } | |
51 | 161 | ||
52 | 162 | ||
53 | 163 | ||
54 | 164 | @Callable(i) | |
55 | 165 | func setClaimer (claimer_) = { | |
56 | 166 | let err = if ((i.caller != this)) | |
57 | 167 | then throw("setClaimer: permission denied") | |
58 | 168 | else if (!(_validateAddress(claimer_))) | |
59 | 169 | then throw("setClaimer: invalid claimer address") | |
60 | 170 | else unit | |
61 | 171 | if ((err == err)) | |
62 | 172 | then $Tuple2([StringEntry(KEY_CLAIMER, claimer_)], unit) | |
63 | 173 | else throw("Strict value is not equal to itself.") | |
64 | 174 | } | |
65 | 175 | ||
66 | 176 | ||
67 | 177 | ||
68 | 178 | @Callable(i) | |
69 | 179 | func claim (amount_) = if ((i.caller != addressFromStringValue(getStringValue(KEY_CLAIMER)))) | |
70 | 180 | then throw("claim: permission denied") | |
71 | 181 | else if (if ((0 >= amount_)) | |
72 | 182 | then true | |
73 | 183 | else (amount_ > wavesBalance(this).regular)) | |
74 | 184 | then throw("claim: invalid amount") | |
75 | 185 | else $Tuple2([ScriptTransfer(i.caller, amount_, unit)], unit) | |
76 | 186 | ||
77 | 187 | ||
188 | + | ||
189 | + | @Callable(i) | |
190 | + | func getAvailableWAVESDLP () = $Tuple2(nil, _getAvailableWAVESDLP()) | |
191 | + | ||
192 | + | ||
193 | + | ||
194 | + | @Callable(i) | |
195 | + | func claimAndSwapWAVESDLP () = { | |
196 | + | let asset = _getWAVESDLPAsset() | |
197 | + | let assetStr = toBase58String(asset) | |
198 | + | let invocation = invoke(_loadWavesDAOContract(), FUNC_CLAIM_LP, nil, nil) | |
199 | + | if ((invocation == invocation)) | |
200 | + | then { | |
201 | + | let totalAmount = assetBalance(this, asset) | |
202 | + | if ((totalAmount == totalAmount)) | |
203 | + | then { | |
204 | + | let swapLimit = _loadSwapLimit(assetStr) | |
205 | + | let amountToSwap = if ((totalAmount > swapLimit)) | |
206 | + | then swapLimit | |
207 | + | else totalAmount | |
208 | + | let result = if ((height > (_loadLastSwapAt(assetStr) + ONE_HOUR_IN_BLOCKS))) | |
209 | + | then invoke(_loadSwapContract(), FUNC_SWAP, [1, "", toString(this)], [AttachedPayment(asset, amountToSwap)]) | |
210 | + | else throw("claimAndSwapWAVESDLP: too often") | |
211 | + | if ((result == result)) | |
212 | + | then match result { | |
213 | + | case a: Int => | |
214 | + | if ((a > COMPENSATION)) | |
215 | + | then $Tuple2((_saveLastSwapAt(assetStr, height) ++ [ScriptTransfer(i.caller, COMPENSATION, unit)]), unit) | |
216 | + | else throw("claimAndSwapWAVESDLP: too little amount got") | |
217 | + | case _ => | |
218 | + | throw("claimAndSwapWAVESDLP: swap revert") | |
219 | + | } | |
220 | + | else throw("Strict value is not equal to itself.") | |
221 | + | } | |
222 | + | else throw("Strict value is not equal to itself.") | |
223 | + | } | |
224 | + | else throw("Strict value is not equal to itself.") | |
225 | + | } | |
226 | + | ||
227 | + | ||
228 | + | ||
229 | + | @Callable(i) | |
230 | + | func swapAsset (assetId_) = { | |
231 | + | let err = _validateAsset(assetId_, "swapAsset: invalid asset") | |
232 | + | if ((err == err)) | |
233 | + | then { | |
234 | + | let asset = fromBase58String(assetId_) | |
235 | + | let totalAmount = assetBalance(this, asset) | |
236 | + | if ((totalAmount == totalAmount)) | |
237 | + | then { | |
238 | + | let swapLimit = _loadSwapLimit(assetId_) | |
239 | + | let amountToSwap = if ((totalAmount > swapLimit)) | |
240 | + | then swapLimit | |
241 | + | else totalAmount | |
242 | + | let result = if ((height > (_loadLastSwapAt(assetId_) + ONE_HOUR_IN_BLOCKS))) | |
243 | + | then invoke(_loadSwapContract(), FUNC_SWAP, [1, "", toString(this)], [AttachedPayment(asset, amountToSwap)]) | |
244 | + | else throw("swapAsset: too often") | |
245 | + | if ((result == result)) | |
246 | + | then match result { | |
247 | + | case a: Int => | |
248 | + | if ((a > COMPENSATION)) | |
249 | + | then $Tuple2((_saveLastSwapAt(assetId_, height) ++ [ScriptTransfer(i.caller, COMPENSATION, unit)]), unit) | |
250 | + | else throw("swapAsset: too little amount got") | |
251 | + | case _ => | |
252 | + | throw("swapAsset: swap revert") | |
253 | + | } | |
254 | + | else throw("Strict value is not equal to itself.") | |
255 | + | } | |
256 | + | else throw("Strict value is not equal to itself.") | |
257 | + | } | |
258 | + | else throw("Strict value is not equal to itself.") | |
259 | + | } | |
260 | + | ||
261 | + | ||
262 | + | ||
263 | + | @Callable(i) | |
264 | + | func setWavesDAOContract (address_) = { | |
265 | + | let err = if ((i.caller != this)) | |
266 | + | then throw("setWavesDAOContract: permission denied") | |
267 | + | else if (!(_validateAddress(address_))) | |
268 | + | then throw("setWavesDAOContract: invalid address") | |
269 | + | else unit | |
270 | + | if ((err == err)) | |
271 | + | then $Tuple2(_saveWavesDAOContract(addressFromStringValue(address_)), unit) | |
272 | + | else throw("Strict value is not equal to itself.") | |
273 | + | } | |
274 | + | ||
275 | + | ||
276 | + | ||
277 | + | @Callable(i) | |
278 | + | func setSwapContract (address_) = { | |
279 | + | let err = if ((i.caller != this)) | |
280 | + | then throw("setSwapContract: permission denied") | |
281 | + | else if (!(_validateAddress(address_))) | |
282 | + | then throw("setSwapContract: invalid address") | |
283 | + | else unit | |
284 | + | if ((err == err)) | |
285 | + | then $Tuple2(_saveSwapContract(addressFromStringValue(address_)), unit) | |
286 | + | else throw("Strict value is not equal to itself.") | |
287 | + | } | |
288 | + | ||
289 | + | ||
290 | + | ||
291 | + | @Callable(i) | |
292 | + | func setSwapLimit (assetId_,limit_) = { | |
293 | + | let err = if (_validateAsset(assetId_, "setSwapLimit: invalid asset")) | |
294 | + | then if ((i.caller != this)) | |
295 | + | then throw("setSwapLimit: permission denied") | |
296 | + | else if ((0 >= limit_)) | |
297 | + | then throw("setSwapLimit: invalid limit") | |
298 | + | else unit | |
299 | + | else false | |
300 | + | if ((err == err)) | |
301 | + | then $Tuple2(_saveSwapLimit(assetId_, limit_), unit) | |
302 | + | else throw("Strict value is not equal to itself.") | |
303 | + | } | |
304 | + | ||
305 | + | ||
306 | + | ||
307 | + | @Callable(i) | |
308 | + | func setUnitsChainContract (address_) = { | |
309 | + | let err = if ((i.caller != this)) | |
310 | + | then throw("setUnitsChainContract: permission denied") | |
311 | + | else if (!(_validateAddress(address_))) | |
312 | + | then throw("setUnitsChainContract: invalid address") | |
313 | + | else unit | |
314 | + | if ((err == err)) | |
315 | + | then $Tuple2(_saveUnitsChainContract(addressFromStringValue(address_)), unit) | |
316 | + | else throw("Strict value is not equal to itself.") | |
317 | + | } | |
318 | + | ||
319 | + | ||
78 | 320 | @Verifier(tx) | |
79 | 321 | func verify () = match getString(KEY_MULTISIG) { | |
80 | 322 | case multisig: String => | |
81 | - | valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false) | |
323 | + | match tx { | |
324 | + | case tx: InvokeScriptTransaction => | |
325 | + | if ((tx.dApp == _loadUnitsChainContract())) | |
326 | + | then sigVerify_128Kb(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
327 | + | else valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false) | |
328 | + | case _ => | |
329 | + | valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false) | |
330 | + | } | |
82 | 331 | case _ => | |
83 | 332 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
84 | 333 | } | |
85 | 334 |
github/deemru/w8io/169f3d6 51.50 ms ◑