tx · Fs4qvkysxUydbTCRxkB9BKMxVVTdvntbfxSxJAadPzLT 3Mz5bJNWmVMXNeYXYBhm4DX4p4M3yD6UMid: -0.01300000 Waves 2023.05.04 11:14 [2562762] smart account 3Mz5bJNWmVMXNeYXYBhm4DX4p4M3yD6UMid > SELF 0.00000000 Waves
{ "type": 13, "id": "Fs4qvkysxUydbTCRxkB9BKMxVVTdvntbfxSxJAadPzLT", "fee": 1300000, "feeAssetId": null, "timestamp": 1683188043851, "version": 2, "chainId": 84, "sender": "3Mz5bJNWmVMXNeYXYBhm4DX4p4M3yD6UMid", "senderPublicKey": "5Y8hBfFe2MvFTH48SctYEcCZro5tYp4cKhJpeG9E31fw", "proofs": [ "2WjXgEUMrvbms4C8FgjmvjkJmDP6GQfVZqAQAXa741v1W8D18zUy13Pg7mHx9ECZJA1K2fwETsoXYKwQUchEHM1h" ], "script": "base64:BgIECAISAA0BE2tleUludmVzdFd4WHRuRGVsYXkAAhMlX19pbnZlc3RXeFh0bkRlbGF5ARdrZXlJbnZlc3RXeFh0bkFtb3VudFh0bgACFyVfX2ludmVzdFd4WHRuQW1vdW50WHRuAQxrZXlXeFh0blBvb2wAAgwlX193eFh0blBvb2wBDWtleVh0bkFzc2V0SWQAAg0lX194dG5Bc3NldElkAQprZXlXeFh0bkxwAAIKJV9fd3hYdG5McAEOa2V5THBUb0FkZHJlc3MAAg4lX19scFRvQWRkcmVzcwETa2V5TWFuYWdlclB1YmxpY0tleQACFCVzX19tYW5hZ2VyUHVibGljS2V5ARZrZXlNYW5hZ2VyVmF1bHRBZGRyZXNzAAIXJXNfX21hbmFnZXJWYXVsdEFkZHJlc3MBGGtleUludmVzdFd4WHRuTGFzdEhlaWdodAACGCVfX2ludmVzdFd4WHRuTGFzdEhlaWdodAEXZ2V0TWFuYWdlckFkZHJlc3NPckZhaWwACQERQGV4dHJOYXRpdmUoMTA2MikBCQERQGV4dHJOYXRpdmUoMTA1OCkBCQEWa2V5TWFuYWdlclZhdWx0QWRkcmV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dHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BAnR4AQZ2ZXJpZnkABA90YXJnZXRQdWJsaWNLZXkEByRtYXRjaDAJARZtYW5hZ2VyUHVibGljS2V5T3JVbml0AAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAJwawUHJG1hdGNoMAUCcGsDCQABAgUHJG1hdGNoMAIEVW5pdAgFAnR4D3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAABQ90YXJnZXRQdWJsaWNLZXkoqmr3", "height": 2562762, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func keyInvestWxXtnDelay () = "%__investWxXtnDelay" | |
5 | + | ||
6 | + | ||
7 | + | func keyInvestWxXtnAmountXtn () = "%__investWxXtnAmountXtn" | |
8 | + | ||
9 | + | ||
10 | + | func keyWxXtnPool () = "%__wxXtnPool" | |
11 | + | ||
12 | + | ||
13 | + | func keyXtnAssetId () = "%__xtnAssetId" | |
14 | + | ||
15 | + | ||
16 | + | func keyWxXtnLp () = "%__wxXtnLp" | |
17 | + | ||
18 | + | ||
19 | + | func keyLpToAddress () = "%__lpToAddress" | |
20 | + | ||
21 | + | ||
22 | + | func keyManagerPublicKey () = "%s__managerPublicKey" | |
23 | + | ||
24 | + | ||
25 | + | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
26 | + | ||
27 | + | ||
28 | + | func keyInvestWxXtnLastHeight () = "%__investWxXtnLastHeight" | |
29 | + | ||
30 | + | ||
31 | + | func getManagerAddressOrFail () = addressFromStringValue(getStringValue(keyManagerVaultAddress())) | |
32 | + | ||
33 | + | ||
34 | + | func managerPublicKeyOrUnit () = { | |
35 | + | let managerVaultAddress = getManagerAddressOrFail() | |
36 | + | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
37 | + | case s: String => | |
38 | + | fromBase58String(s) | |
39 | + | case _: Unit => | |
40 | + | unit | |
41 | + | case _ => | |
42 | + | throw("Match error") | |
43 | + | } | |
44 | + | } | |
45 | + | ||
46 | + | ||
47 | + | func throwErr (msg) = throw(makeString(["investor.ride:", msg], " ")) | |
48 | + | ||
49 | + | ||
50 | + | func mustManager (i) = { | |
51 | + | let pd = throwErr("permission denied") | |
52 | + | match managerPublicKeyOrUnit() { | |
53 | + | case pk: ByteVector => | |
54 | + | if ((i.callerPublicKey == pk)) | |
55 | + | then true | |
56 | + | else pd | |
57 | + | case _: Unit => | |
58 | + | if ((i.caller == this)) | |
59 | + | then true | |
60 | + | else pd | |
61 | + | case _ => | |
62 | + | throw("Match error") | |
63 | + | } | |
64 | + | } | |
65 | + | ||
66 | + | ||
67 | + | @Callable(i) | |
68 | + | func investWxXtn () = { | |
69 | + | let checkCaller = mustManager(i) | |
70 | + | if ((checkCaller == checkCaller)) | |
71 | + | then { | |
72 | + | let lastCall = valueOrElse(getInteger(keyInvestWxXtnLastHeight()), 0) | |
73 | + | let delay = getIntegerValue(keyInvestWxXtnDelay()) | |
74 | + | let checks = [if ((height > (lastCall + delay))) | |
75 | + | then true | |
76 | + | else throwErr("wait to invest")] | |
77 | + | if ((checks == checks)) | |
78 | + | then { | |
79 | + | let lpAssetId = fromBase58String(getStringValue(keyWxXtnLp())) | |
80 | + | let lpBefore = assetBalance(this, lpAssetId) | |
81 | + | if ((lpBefore == lpBefore)) | |
82 | + | then { | |
83 | + | let inv = invoke(addressFromStringValue(getStringValue(keyWxXtnPool())), "putOneTkn", [0, false], [AttachedPayment(fromBase58String(getStringValue(keyXtnAssetId())), getIntegerValue(keyInvestWxXtnAmountXtn()))]) | |
84 | + | if ((inv == inv)) | |
85 | + | then { | |
86 | + | let lpAfter = assetBalance(this, lpAssetId) | |
87 | + | if ((lpAfter == lpAfter)) | |
88 | + | then { | |
89 | + | let lpGot = (lpAfter - lpBefore) | |
90 | + | let notZeroLp = if ((lpGot == 0)) | |
91 | + | then throwErr("lp to get is zero") | |
92 | + | else unit | |
93 | + | if ((notZeroLp == notZeroLp)) | |
94 | + | then [IntegerEntry(keyInvestWxXtnLastHeight(), height), ScriptTransfer(addressFromStringValue(getStringValue(keyLpToAddress())), lpGot, lpAssetId)] | |
95 | + | else throw("Strict value is not equal to itself.") | |
96 | + | } | |
97 | + | else throw("Strict value is not equal to itself.") | |
98 | + | } | |
99 | + | else throw("Strict value is not equal to itself.") | |
100 | + | } | |
101 | + | else throw("Strict value is not equal to itself.") | |
102 | + | } | |
103 | + | else throw("Strict value is not equal to itself.") | |
104 | + | } | |
105 | + | else throw("Strict value is not equal to itself.") | |
106 | + | } | |
107 | + | ||
108 | + | ||
109 | + | @Verifier(tx) | |
110 | + | func verify () = { | |
111 | + | let targetPublicKey = match managerPublicKeyOrUnit() { | |
112 | + | case pk: ByteVector => | |
113 | + | pk | |
114 | + | case _: Unit => | |
115 | + | tx.senderPublicKey | |
116 | + | case _ => | |
117 | + | throw("Match error") | |
118 | + | } | |
119 | + | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
120 | + | } | |
121 | + |
github/deemru/w8io/026f985 15.64 ms ◑