tx · 4mFAxxpK6o4iQkYA4cwxpsGjaFrcvHZafFFcjaN6jJ66

3N3y7nQfqDc7rBUExjKQi5ZbspWRh9q8PYH:  -0.00100000 Waves

2023.12.11 12:46 [2881841] smart account 3N3y7nQfqDc7rBUExjKQi5ZbspWRh9q8PYH > SELF 0.00000000 Waves

{ "type": 13, "id": "4mFAxxpK6o4iQkYA4cwxpsGjaFrcvHZafFFcjaN6jJ66", "fee": 100000, "feeAssetId": null, "timestamp": 1702288039533, "version": 2, "chainId": 84, "sender": "3N3y7nQfqDc7rBUExjKQi5ZbspWRh9q8PYH", "senderPublicKey": "9ggtmbyecVRfUY2zeZhNaoLBp2iymhnQhffXQhemTJaG", "proofs": [ "5psnvCwBV7Zwo9zEZgSW5EhVThcTxXH5FfJoH3b9Mr4AcPUHgertpNVynqbPMppxdQzX3yimeaTpUBvt4w1F3Z4q" ], "script": "base64:BgICCAIAAACM2Hc5", "height": 2881841, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4Qk29EjaFknf76HfGfAs1QaER2Wkn7HMZmSNewb3LmWS Next: A4tZN79hDtFCfFjeqjJoTnf2iLpWT1z7VzCWYJAuF4Nz Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-func tryGetInteger (address,key) = match getInteger(address, key) {
5- case b: Int =>
6- b
7- case _ =>
8- 0
9-}
104
115
12-func tryGetString (address,key) = match getString(address, key) {
13- case b: String =>
14- b
15- case _ =>
16- ""
17-}
18-
19-
20-let d8 = 100000000
21-
22-let unlockBlock = (30 * 1440)
23-
24-let heirPubKey = base58'2kpmuzw1ZbrtgAN3BrR7vbEW1XrJoJKCstL7mf7XNf2P'
25-
26-let unlockBlock2 = (90 * 1440)
27-
28-let PuzzleMasterPubKey = base58'4z8CKSYQBKkzx7PBb5uBP1YPa6YAHRNTApW1sQVHT5eU'
29-
30-let keyActivated = "Activated blockheight"
31-
32-let keySurplusReceived = "surplus received in wavelets"
33-
34-let keyWaveletsReceived = "total WAVES received in wavelets"
35-
36-let keyWaveletsReceivedBT = "total wavelets received for base treasury"
37-
38-let keyWaveletsPaidOut = "total WAVES paid out in wavelets"
39-
40-let keyROI = "ROI basis points"
41-
42-let keyWhirlpoolIssuePrice = "WHIRLPOOL issue price in wavelets"
43-
44-let burnxtnPPTpoolId = base58'3PQHndCUVrv3wBuQjbvVP9SnGmfbfitGxfx'
45-
46-let projectOwner = base58'3PEtLVxDT8mxAh1SDAn8m7JTGNkdpkaFxBk'
47-
48-let whirlpoolPoolId = base58'3P2myTbd5zpEHcYmNpdWTp5gXS5B8tL1RCY'
49-
50-let whirlpool = base58'73tY3E6Gd5AWYmsuq8m8Kek7KnJNAYyS3GoveTbc6jCi'
51-
52-let whirlpoolString = toBase58String(base58'73tY3E6Gd5AWYmsuq8m8Kek7KnJNAYyS3GoveTbc6jCi')
53-
54-let waves = base58'WAVES'
55-
56-let eth = base58'3VuV5WTmDz47Dmdn3QpcYjzbSdipjQE4JMdNe1xZpX13'
57-
58-let swaves = base58'YiNbofFzC17jEHHCMwrRcpy9MrrjabMMLZxg8g5xmf7'
59-
60-let poolboostSC = base58'3P8eeDzUnoDNbQjW617pAe76cEUDQsP1m1V'
61-
62-let SWAVES_stake = Address(base58'3PDPzZVLhN1EuzGy4xAxjjTVkawKDLEaHiV')
63-
64-let WX_ETH_WAVES = Address(base58'3P2yiVnK48evTLr8MAZWavpE4WA4fw1weQg')
65-
66-let wavesInPool = tryGetInteger(Address(burnxtnPPTpoolId), (("global_" + toBase58String(waves)) + "_balance"))
67-
68-let projectStake = tryGetInteger(Address(burnxtnPPTpoolId), (toString(this) + "_indexStaked"))
69-
70-let totalStake = tryGetInteger(Address(burnxtnPPTpoolId), "global_poolToken_amount")
71-
72-func _loadInt (key_,default_) = match getInteger(SWAVES_stake, key_) {
73- case a: Int =>
74- a
75- case _ =>
76- default_
77-}
78-
79-
80-func _loadBigInt (key_,default_) = match getBinary(SWAVES_stake, key_) {
81- case a: ByteVector =>
82- toBigInt(a)
83- case _ =>
84- default_
85-}
86-
87-
88-let lastRate = _loadBigInt("LAST_RATE", toBigInt(1000000000000))
89-
90-let currentRate = _loadBigInt("CURRENT_RATE", toBigInt(0))
91-
92-let lastHeight = _loadInt("LAST_HEIGHT", 0)
93-
94-let targetHeight = min([_loadInt("TARGET_HEIGHT", 0), height])
95-
96-let lastRateUpdated = (lastRate + (currentRate * toBigInt((targetHeight - lastHeight))))
97-
98-let baseAmount2 = toInt(fraction(toBigInt(assetBalance(WX_ETH_WAVES, swaves)), lastRateUpdated, toBigInt(1000000000000), FLOOR))
99-
100-let waves2InWX = (wavesBalance(WX_ETH_WAVES).regular + baseAmount2)
101-
102-let ethInWX = assetBalance(WX_ETH_WAVES, eth)
103-
104-let ethWaves = fraction(d8, waves2InWX, ethInWX)
105-
106-let wavesInWhirlpool = tryGetInteger(Address(whirlpoolPoolId), (("global_" + toBase58String(waves)) + "_balance"))
107-
108-let whirlInWhirlpool = tryGetInteger(Address(whirlpoolPoolId), (("global_" + whirlpoolString) + "_balance"))
109-
110-let projectStakeWhirl = tryGetInteger(Address(whirlpoolPoolId), (toString(this) + "_indexStaked"))
111-
112-let totalStakeWhirl = tryGetInteger(Address(whirlpoolPoolId), "global_poolToken_amount")
113-
114-let keyVaultAsset = tryGetString(Address(base58'3PMtGnf3LXiEG6isDQLq1xMDKUqjQGqNHLb'), (("%s%s%s__vault__" + toString(this)) + "__WAVES"))
115-
116-let WAVESinEAST = parseIntValue(split(keyVaultAsset, "__")[2])
117-
118-let dAppaddress = Address(base58'3PHxubMUtynEY2AeHq3K1kUizRPN9HUC2rt')
119-
120-let ETHatoken = tryGetInteger(dAppaddress, (toString(this) + "_aTokenBalance"))
121-
122-let ETHatokenTotal = tryGetInteger(dAppaddress, "aTokenCirculation")
123-
124-let ETHtotalReserve = parseIntValue(split(tryGetString(dAppaddress, "reserveGlobalData"), "|")[1])
125-
126-let ETHinVires = fraction(ETHatoken, ETHtotalReserve, ETHatokenTotal)
127-
128-let ETHinViresWavelets = fraction(ETHinVires, ethWaves, d8)
129-
130-let tvlInWaves = ((fraction((wavesInPool * 10), projectStake, totalStake) + fraction((wavesInWhirlpool * 10), projectStakeWhirl, totalStakeWhirl)) + ETHinViresWavelets)
131-
132-let totalBT = WAVESinEAST
133-
134-let totalTreasury = (totalBT + tvlInWaves)
135-
136-let whirlpoolSupply = match assetInfo(whirlpool) {
137- case asset: Asset =>
138- asset.quantity
139- case _ =>
140- throw("Can't find asset")
141-}
142-
143-let price = if (((fraction((tvlInWaves + tryGetInteger(this, keySurplusReceived)), d8, whirlpoolSupply) + d8) >= tryGetInteger(this, keyWhirlpoolIssuePrice)))
144- then (fraction((tvlInWaves + tryGetInteger(this, keySurplusReceived)), d8, whirlpoolSupply) + d8)
145- else tryGetInteger(this, keyWhirlpoolIssuePrice)
146-
147-@Callable(i)
148-func buyWHIRLPOOLwithWAVES () = {
149- let WhirlpoolBalanceBefore = assetBalance(this, whirlpool)
150- if ((WhirlpoolBalanceBefore == WhirlpoolBalanceBefore))
151- then {
152- let pmt = value(i.payments[0])
153- let surplus = fraction((price - d8), pmt.amount, d8)
154- let IssueAmount = if ((pmt.amount >= fraction(pmt.amount, d8, price)))
155- then fraction(pmt.amount, d8, price)
156- else throw("please contact project owner: issue amount error")
157- let cleanAmountIn = (pmt.amount - fraction(pmt.amount, 200, 10000))
158- let AmountOut = fraction(whirlInWhirlpool, ((d8 * d8) - toInt(pow(fraction(toBigInt(wavesInWhirlpool), toBigInt((d8 * d8)), toBigInt((wavesInWhirlpool + cleanAmountIn)), HALFUP), 16, toBigInt(fraction(100000, 10000, 900000)), 4, 16, CEILING))), (d8 * d8), DOWN)
159- if (((d8 / 20) > pmt.amount))
160- then throw("minimum payment 0.05 WAVES")
161- else if ((pmt.assetId != unit))
162- then throw("attach WAVES token only")
163- else {
164- let buy = if ((AmountOut > IssueAmount))
165- then invoke(Address(whirlpoolPoolId), "swap", [whirlpoolString, (IssueAmount + 1)], [AttachedPayment(unit, pmt.amount)])
166- else unit
167- if ((buy == buy))
168- then {
169- let WhirlpoolBalanceAfter = assetBalance(this, whirlpool)
170- let WhirlpoolFromSwap = (WhirlpoolBalanceAfter - WhirlpoolBalanceBefore)
171-[Reissue(whirlpool, if ((IssueAmount >= AmountOut))
172- then IssueAmount
173- else 0, true), if ((AmountOut > IssueAmount))
174- then ScriptTransfer(i.caller, WhirlpoolFromSwap, whirlpool)
175- else ScriptTransfer(i.caller, IssueAmount, whirlpool), IntegerEntry(keyWhirlpoolIssuePrice, price), IntegerEntry(if ((AmountOut > IssueAmount))
176- then "price WHIRLPOOL/WAVES"
177- else "WHIRLPOOL/WAVES mid market price", if ((AmountOut > IssueAmount))
178- then fraction(d8, pmt.amount, WhirlpoolFromSwap)
179- else fraction(d8, (wavesInWhirlpool * 9), whirlInWhirlpool)), IntegerEntry(keyWaveletsReceived, if ((IssueAmount >= AmountOut))
180- then (pmt.amount + tryGetInteger(this, keyWaveletsReceived))
181- else tryGetInteger(this, keyWaveletsReceived)), IntegerEntry(keyWaveletsReceivedBT, if ((IssueAmount >= AmountOut))
182- then ((pmt.amount - surplus) + tryGetInteger(this, keyWaveletsReceivedBT))
183- else tryGetInteger(this, keyWaveletsReceivedBT)), IntegerEntry(keySurplusReceived, if ((AmountOut > IssueAmount))
184- then getIntegerValue(this, keySurplusReceived)
185- else (surplus + getIntegerValue(this, keySurplusReceived)))]
186- }
187- else throw("Strict value is not equal to itself.")
188- }
189- }
190- else throw("Strict value is not equal to itself.")
191- }
192-
193-
194-
195-@Callable(i)
196-func priceAndTreasuryStats () = [IntegerEntry("BT WAVES in EAST vault", WAVESinEAST), IntegerEntry("ST BURN-XTN x PepeTeam in wavelets", fraction((wavesInPool * 10), projectStake, totalStake)), IntegerEntry("ST WHIRLPOOL AMM in wavelets", fraction((wavesInWhirlpool * 10), projectStakeWhirl, totalStakeWhirl)), IntegerEntry("ST vETH", ETHinVires), IntegerEntry("ST vETH in wavelets", ETHinViresWavelets), IntegerEntry("Total ST in wavelets", tvlInWaves), IntegerEntry(keyWhirlpoolIssuePrice, price), IntegerEntry("WHIRLPOOL/WAVES mid market price", fraction(d8, (wavesInWhirlpool * 9), whirlInWhirlpool)), IntegerEntry("WHIRLPOOL total supply", whirlpoolSupply), IntegerEntry("Total treasury", totalTreasury), IntegerEntry("NAV WHIRLPOOL", fraction(d8, totalTreasury, whirlpoolSupply)), IntegerEntry(keyWaveletsReceived, tryGetInteger(this, keyWaveletsReceived)), IntegerEntry(keySurplusReceived, tryGetInteger(this, keySurplusReceived)), IntegerEntry(keyWaveletsReceivedBT, tryGetInteger(this, keyWaveletsReceivedBT)), IntegerEntry(keyWaveletsPaidOut, tryGetInteger(this, keyWaveletsPaidOut)), IntegerEntry("total WAVES received", (tryGetInteger(this, keyWaveletsReceived) / d8)), IntegerEntry("Total treasury in WAVES", (totalTreasury / d8)), IntegerEntry("surplus received in WAVES", (tryGetInteger(this, keySurplusReceived) / d8)), IntegerEntry("total WAVES received for base treasury", (tryGetInteger(this, keyWaveletsReceivedBT) / d8)), IntegerEntry("total WAVES paid out in WAVES", (tryGetInteger(this, keyWaveletsPaidOut) / d8)), IntegerEntry(keyROI, fraction(tryGetInteger(this, keyWaveletsPaidOut), 10000, tryGetInteger(this, keyWaveletsReceived)))]
197-
198-
199-
200-@Callable(i)
201-func boostPoolAPY (amount) = if ((i.caller != this))
202- then throw("access only by project owner")
203- else {
204- let amountBoost = fraction(amount, 80, 100)
205- if ((amountBoost == amountBoost))
206- then {
207- let amountOwner = fraction(amount, 20, 100)
208- if ((amountOwner == amountOwner))
209- then {
210- let boost = invoke(Address(poolboostSC), "addBoosting", [toBase58String(whirlpoolPoolId), 7], [AttachedPayment(unit, amountBoost)])
211- if ((boost == boost))
212- then [ScriptTransfer(Address(projectOwner), amountOwner, unit), IntegerEntry(keyWaveletsPaidOut, (amountBoost + tryGetInteger(this, keyWaveletsPaidOut))), IntegerEntry(keyROI, fraction(tryGetInteger(this, keyWaveletsPaidOut), 10000, tryGetInteger(this, keyWaveletsReceived))), IntegerEntry(keyActivated, height)]
213- else throw("Strict value is not equal to itself.")
214- }
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 transferPoolAPY (amount) = if ((i.caller != this))
224- then throw("access only by project owner")
225- else {
226- let amountBoost = fraction(amount, 80, 100)
227- if ((amountBoost == amountBoost))
228- then {
229- let amountOwner = fraction(amount, 20, 100)
230- if ((amountOwner == amountOwner))
231- then [ScriptTransfer(Address(whirlpoolPoolId), amountBoost, unit), ScriptTransfer(Address(projectOwner), amountOwner, unit), IntegerEntry(keyWaveletsPaidOut, (amountBoost + tryGetInteger(this, keyWaveletsPaidOut))), IntegerEntry(keyROI, fraction(tryGetInteger(this, keyWaveletsPaidOut), 10000, tryGetInteger(this, keyWaveletsReceived))), IntegerEntry(keyActivated, height)]
232- else throw("Strict value is not equal to itself.")
233- }
234- else throw("Strict value is not equal to itself.")
235- }
236-
237-
238-
239-@Callable(i)
240-func poolOneTokenSurplus () = if ((i.caller != this))
241- then throw("access only by project owner")
242- else {
243- let surplusAmount = tryGetInteger(this, keySurplusReceived)
244- let PoolOneTokenSurplus = invoke(Address(base58'3PR1Qvi9mHT35SwWEkLSqqE2L8thiPLdVWU'), "generateIndexWithOneTokenAndStake", [toBase58String(burnxtnPPTpoolId)], [AttachedPayment(unit, surplusAmount)])
245- if ((PoolOneTokenSurplus == PoolOneTokenSurplus))
246- then [IntegerEntry(keySurplusReceived, (tryGetInteger(this, keySurplusReceived) - surplusAmount))]
247- else throw("Strict value is not equal to itself.")
248- }
249-
250-
251-
252-@Callable(i)
253-func surplusInvested (amountWAVES) = if ((i.caller != this))
254- then throw("access only by project owner")
255- else {
256- let investedAmount = (amountWAVES * d8)
257-[IntegerEntry(keySurplusReceived, (tryGetInteger(this, keySurplusReceived) - investedAmount))]
258- }
259-
260-
261-
262-@Callable(i)
263-func changeIntegerEntry (keyString,integer) = if ((i.caller != this))
264- then throw("access only by project owner")
265- else [IntegerEntry(keyString, integer)]
266-
267-
268-
269-@Callable(i)
270-func activated () = if ((i.caller != this))
271- then throw("you are not allowed")
272- else [IntegerEntry(keyActivated, height)]
273-
274-
275-@Verifier(tx)
276-func verify () = if (sigVerify_8Kb(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey))
277- then true
278- else if (((getIntegerValue(this, keyActivated) + unlockBlock) > height))
279- then false
280- else if (sigVerify_8Kb(tx.bodyBytes, tx.proofs[0], heirPubKey))
281- then true
282- else if (((getIntegerValue(this, keyActivated) + unlockBlock2) > height))
283- then false
284- else sigVerify_8Kb(tx.bodyBytes, tx.proofs[0], PuzzleMasterPubKey)
2856

github/deemru/w8io/3ef1775 
41.61 ms