tx · FbDETRYBnqtwDBgMfHFTqC8X5KYN78FgkMYFfJa3QNor

3N65ziw5oaWWQHthPW5jzsh9VxjYxHwpv33:  -0.01300000 Waves

2023.03.22 22:26 [2501639] smart account 3N65ziw5oaWWQHthPW5jzsh9VxjYxHwpv33 > SELF 0.00000000 Waves

{ "type": 13, "id": "FbDETRYBnqtwDBgMfHFTqC8X5KYN78FgkMYFfJa3QNor", "fee": 1300000, "feeAssetId": null, "timestamp": 1679513199685, "version": 2, "chainId": 84, "sender": "3N65ziw5oaWWQHthPW5jzsh9VxjYxHwpv33", "senderPublicKey": "5yoY2Atq5TS6YzXkDHGig1DJdaYnWskuGToqK61rQWQd", "proofs": [ "5s7zi59Qn9MALftXSjzDTm8F4WELp27iS8jirB3mL3nzVipy6bJjdvF9XiCWCWfVgq84J1gqurncM6ewwDfFi2J8" ], "script": "base64:BgILCAISABIDCgEIEgANARNrZXlJbnZlc3RXeFh0bkRlbGF5AAITJV9faW52ZXN0V3hYdG5EZWxheQEXa2V5SW52ZXN0V3hYdG5BbW91bnRYdG4AAhclX19pbnZlc3RXeFh0bkFtb3VudFh0bgEMa2V5V3hYdG5Qb29sAAIMJV9fd3hYdG5Qb29sAQ1rZXlYdG5Bc3NldElkAAINJV9feHRuQXNzZXRJZAEKa2V5V3hYdG5McAACCiVfX3d4WHRuTHABDmtleUxwVG9BZGRyZXNzAAIOJV9fbHBUb0FkZHJlc3MBE2tleU1hbmFnZXJQdWJsaWNLZXkAAhQlc19fbWFuYWdlclB1YmxpY0tleQEaa2V5UGVuZGluZ01hbmFnZXJQdWJsaWNLZXkAAhslc19fcGVuZGluZ01hbmFnZXJQdWJsaWNLZXkBGGtleUludmVzdFd4WHRuTGFzdEhlaWdodAACGCVfX2ludmVzdFd4WHRuTGFzdEhlaWdodAEWbWFuYWdlclB1YmxpY0tleU9yVW5pdAAEByRtYXRjaDAJAKIIAQkBE2tleU1hbmFnZXJQdWJsaWNLZXkAAwkAAQIFByRtYXRjaDACBlN0cmlu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ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAED3RhcmdldFB1YmxpY0tleQQHJG1hdGNoMAkBFm1hbmFnZXJQdWJsaWNLZXlPclVuaXQAAwkAAQIFByRtYXRjaDACCkJ5dGVWZWN0b3IEAnBrBQckbWF0Y2gwBQJwawMJAAECBQckbWF0Y2gwAgRVbml0CAUCdHgPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFD3RhcmdldFB1YmxpY0tlefMjKbM=", "height": 2501639, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4CytMZxhPesoTXAfYRzapDMBnEXLhX4agEVD5e82fYUC Next: 6wRM5vehNqyUqgQ2gVcQSKTgMW3bJymqw4xiyiuh49w2 Diff:
OldNewDifferences
7070
7171 @Callable(i)
7272 func investWxXtn () = {
73- let checkCaller = mustManager(i)
74- if ((checkCaller == checkCaller))
73+ let lastCall = valueOrElse(getInteger(keyInvestWxXtnLastHeight()), 0)
74+ let delay = getIntegerValue(keyInvestWxXtnDelay())
75+ let checks = [if ((height > (lastCall + delay)))
76+ then true
77+ else throwErr("wait to invest")]
78+ if ((checks == checks))
7579 then {
76- let lastCall = valueOrElse(getInteger(keyInvestWxXtnLastHeight()), 0)
77- let delay = getIntegerValue(keyInvestWxXtnDelay())
78- let checks = [if ((height > (lastCall + delay)))
79- then true
80- else throwErr("wait to invest")]
81- if ((checks == checks))
80+ let lpAssetId = fromBase58String(getStringValue(keyWxXtnLp()))
81+ let lpBefore = assetBalance(this, lpAssetId)
82+ if ((lpBefore == lpBefore))
8283 then {
83- let lpAssetId = fromBase58String(getStringValue(keyWxXtnLp()))
84- let lpBefore = assetBalance(this, lpAssetId)
85- if ((lpBefore == lpBefore))
84+ let inv = invoke(addressFromStringValue(getStringValue(keyWxXtnPool())), "putOneTkn", [0, false], [AttachedPayment(fromBase58String(getStringValue(keyXtnAssetId())), getIntegerValue(keyInvestWxXtnAmountXtn()))])
85+ if ((inv == inv))
8686 then {
87- let inv = invoke(addressFromStringValue(getStringValue(keyWxXtnPool())), "putOneTkn", [0, false], [AttachedPayment(fromBase58String(getStringValue(keyXtnAssetId())), getIntegerValue(keyInvestWxXtnAmountXtn()))])
88- if ((inv == inv))
87+ let lpAfter = assetBalance(this, lpAssetId)
88+ if ((lpAfter == lpAfter))
8989 then {
90- let lpAfter = assetBalance(this, lpAssetId)
91- if ((lpAfter == lpAfter))
92- then {
93- let lpGot = (lpAfter - lpBefore)
94- let notZeroLp = if ((lpGot == 0))
95- then throwErr("lp to get is zero")
96- else unit
97- if ((notZeroLp == notZeroLp))
98- then [IntegerEntry(keyInvestWxXtnLastHeight(), height), ScriptTransfer(addressFromStringValue(getStringValue(keyLpToAddress())), lpGot, lpAssetId)]
99- else throw("Strict value is not equal to itself.")
100- }
90+ let lpGot = (lpAfter - lpBefore)
91+ let notZeroLp = if ((lpGot == 0))
92+ then throwErr("lp to get is zero")
93+ else unit
94+ if ((notZeroLp == notZeroLp))
95+ then [IntegerEntry(keyInvestWxXtnLastHeight(), height), ScriptTransfer(addressFromStringValue(getStringValue(keyLpToAddress())), lpGot, lpAssetId)]
10196 else throw("Strict value is not equal to itself.")
10297 }
10398 else throw("Strict value is not equal to itself.")
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func keyInvestWxXtnDelay () = "%__investWxXtnDelay"
55
66
77 func keyInvestWxXtnAmountXtn () = "%__investWxXtnAmountXtn"
88
99
1010 func keyWxXtnPool () = "%__wxXtnPool"
1111
1212
1313 func keyXtnAssetId () = "%__xtnAssetId"
1414
1515
1616 func keyWxXtnLp () = "%__wxXtnLp"
1717
1818
1919 func keyLpToAddress () = "%__lpToAddress"
2020
2121
2222 func keyManagerPublicKey () = "%s__managerPublicKey"
2323
2424
2525 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
2626
2727
2828 func keyInvestWxXtnLastHeight () = "%__investWxXtnLastHeight"
2929
3030
3131 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
3232 case s: String =>
3333 fromBase58String(s)
3434 case _: Unit =>
3535 unit
3636 case _ =>
3737 throw("Match error")
3838 }
3939
4040
4141 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
4242 case s: String =>
4343 fromBase58String(s)
4444 case _: Unit =>
4545 unit
4646 case _ =>
4747 throw("Match error")
4848 }
4949
5050
5151 func throwErr (msg) = throw(makeString(["investor.ride:", msg], " "))
5252
5353
5454 func mustManager (i) = {
5555 let pd = throwErr("permission denied")
5656 match managerPublicKeyOrUnit() {
5757 case pk: ByteVector =>
5858 if ((i.callerPublicKey == pk))
5959 then true
6060 else pd
6161 case _: Unit =>
6262 if ((i.caller == this))
6363 then true
6464 else pd
6565 case _ =>
6666 throw("Match error")
6767 }
6868 }
6969
7070
7171 @Callable(i)
7272 func investWxXtn () = {
73- let checkCaller = mustManager(i)
74- if ((checkCaller == checkCaller))
73+ let lastCall = valueOrElse(getInteger(keyInvestWxXtnLastHeight()), 0)
74+ let delay = getIntegerValue(keyInvestWxXtnDelay())
75+ let checks = [if ((height > (lastCall + delay)))
76+ then true
77+ else throwErr("wait to invest")]
78+ if ((checks == checks))
7579 then {
76- let lastCall = valueOrElse(getInteger(keyInvestWxXtnLastHeight()), 0)
77- let delay = getIntegerValue(keyInvestWxXtnDelay())
78- let checks = [if ((height > (lastCall + delay)))
79- then true
80- else throwErr("wait to invest")]
81- if ((checks == checks))
80+ let lpAssetId = fromBase58String(getStringValue(keyWxXtnLp()))
81+ let lpBefore = assetBalance(this, lpAssetId)
82+ if ((lpBefore == lpBefore))
8283 then {
83- let lpAssetId = fromBase58String(getStringValue(keyWxXtnLp()))
84- let lpBefore = assetBalance(this, lpAssetId)
85- if ((lpBefore == lpBefore))
84+ let inv = invoke(addressFromStringValue(getStringValue(keyWxXtnPool())), "putOneTkn", [0, false], [AttachedPayment(fromBase58String(getStringValue(keyXtnAssetId())), getIntegerValue(keyInvestWxXtnAmountXtn()))])
85+ if ((inv == inv))
8686 then {
87- let inv = invoke(addressFromStringValue(getStringValue(keyWxXtnPool())), "putOneTkn", [0, false], [AttachedPayment(fromBase58String(getStringValue(keyXtnAssetId())), getIntegerValue(keyInvestWxXtnAmountXtn()))])
88- if ((inv == inv))
87+ let lpAfter = assetBalance(this, lpAssetId)
88+ if ((lpAfter == lpAfter))
8989 then {
90- let lpAfter = assetBalance(this, lpAssetId)
91- if ((lpAfter == lpAfter))
92- then {
93- let lpGot = (lpAfter - lpBefore)
94- let notZeroLp = if ((lpGot == 0))
95- then throwErr("lp to get is zero")
96- else unit
97- if ((notZeroLp == notZeroLp))
98- then [IntegerEntry(keyInvestWxXtnLastHeight(), height), ScriptTransfer(addressFromStringValue(getStringValue(keyLpToAddress())), lpGot, lpAssetId)]
99- else throw("Strict value is not equal to itself.")
100- }
90+ let lpGot = (lpAfter - lpBefore)
91+ let notZeroLp = if ((lpGot == 0))
92+ then throwErr("lp to get is zero")
93+ else unit
94+ if ((notZeroLp == notZeroLp))
95+ then [IntegerEntry(keyInvestWxXtnLastHeight(), height), ScriptTransfer(addressFromStringValue(getStringValue(keyLpToAddress())), lpGot, lpAssetId)]
10196 else throw("Strict value is not equal to itself.")
10297 }
10398 else throw("Strict value is not equal to itself.")
10499 }
105100 else throw("Strict value is not equal to itself.")
106101 }
107102 else throw("Strict value is not equal to itself.")
108103 }
109104 else throw("Strict value is not equal to itself.")
110105 }
111106
112107
113108
114109 @Callable(i)
115110 func setManager (pendingManagerPublicKey) = {
116111 let checkCaller = mustManager(i)
117112 if ((checkCaller == checkCaller))
118113 then {
119114 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
120115 if ((checkManagerPublicKey == checkManagerPublicKey))
121116 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
122117 else throw("Strict value is not equal to itself.")
123118 }
124119 else throw("Strict value is not equal to itself.")
125120 }
126121
127122
128123
129124 @Callable(i)
130125 func confirmManager () = {
131126 let pm = pendingManagerPublicKeyOrUnit()
132127 let hasPM = if (isDefined(pm))
133128 then true
134129 else throw("No pending manager")
135130 if ((hasPM == hasPM))
136131 then {
137132 let checkPM = if ((i.callerPublicKey == value(pm)))
138133 then true
139134 else throw("You are not pending manager")
140135 if ((checkPM == checkPM))
141136 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
142137 else throw("Strict value is not equal to itself.")
143138 }
144139 else throw("Strict value is not equal to itself.")
145140 }
146141
147142
148143 @Verifier(tx)
149144 func verify () = {
150145 let targetPublicKey = match managerPublicKeyOrUnit() {
151146 case pk: ByteVector =>
152147 pk
153148 case _: Unit =>
154149 tx.senderPublicKey
155150 case _ =>
156151 throw("Match error")
157152 }
158153 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
159154 }
160155

github/deemru/w8io/169f3d6 
30.78 ms