1 | | - | {-# STDLIB_VERSION 6 #-} |
---|
2 | | - | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | | - | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | func tryGetInteger (address,key) = match getInteger(address, key) { |
---|
5 | | - | case b: Int => |
---|
6 | | - | b |
---|
7 | | - | case _ => |
---|
8 | | - | 0 |
---|
9 | | - | } |
---|
10 | | - | |
---|
11 | | - | |
---|
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 d16 = (d8 * d8) |
---|
23 | | - | |
---|
24 | | - | let unlockBlock = (30 * 1440) |
---|
25 | | - | |
---|
26 | | - | let heirPubKey = base58'2kpmuzw1ZbrtgAN3BrR7vbEW1XrJoJKCstL7mf7XNf2P' |
---|
27 | | - | |
---|
28 | | - | let unlockBlock2 = (90 * 1440) |
---|
29 | | - | |
---|
30 | | - | let PuzzleMasterPubKey = base58'4z8CKSYQBKkzx7PBb5uBP1YPa6YAHRNTApW1sQVHT5eU' |
---|
31 | | - | |
---|
32 | | - | let keyActivated = "Activated blockheight" |
---|
33 | | - | |
---|
34 | | - | let keySurplusReceived = "surplus received in wavelets" |
---|
35 | | - | |
---|
36 | | - | let keyWaveletsReceived = "total WAVES received in wavelets" |
---|
37 | | - | |
---|
38 | | - | let keyWaveletsReceivedBT = "total wavelets received for base treasury" |
---|
39 | | - | |
---|
40 | | - | let keyWaveletsPaidOut = "total WAVES paid out in wavelets" |
---|
41 | | - | |
---|
42 | | - | let keyROI = "ROI basis points" |
---|
43 | | - | |
---|
44 | | - | let keyWhirlpoolIssuePrice = "WHIRLPOOL issue price in wavelets" |
---|
45 | | - | |
---|
46 | | - | let burnxtnPPTpoolId = base58'3PQHndCUVrv3wBuQjbvVP9SnGmfbfitGxfx' |
---|
47 | | - | |
---|
48 | | - | let projectOwner = base58'3PEtLVxDT8mxAh1SDAn8m7JTGNkdpkaFxBk' |
---|
49 | | - | |
---|
50 | | - | let whirlpoolPoolId = base58'3P2myTbd5zpEHcYmNpdWTp5gXS5B8tL1RCY' |
---|
51 | | - | |
---|
52 | | - | let whirlpool = base58'fHJWWsh2hZAc4Atv8VRhKy3jNbHLeMwQMsLpdaBY51Y' |
---|
53 | | - | |
---|
54 | | - | let whirlpoolString = toBase58String(base58'73tY3E6Gd5AWYmsuq8m8Kek7KnJNAYyS3GoveTbc6jCi') |
---|
55 | | - | |
---|
56 | | - | let waves = base58'WAVES' |
---|
57 | | - | |
---|
58 | | - | let usdterc = base58'9wc3LXNA4TEBsXyKtoLE9mrbDD7WMHXvXrCjZvabLAsi' |
---|
59 | | - | |
---|
60 | | - | let usdcerc = base58'HGgabTqUS8WtVFUJzfmrTDMgEccJuZLBPhFgQFxvnsoW' |
---|
61 | | - | |
---|
62 | | - | let usdtbsc = base58'A81p1LTRyoq2rDR2TNxB2dWYxsiNwCSSi8sXef2SEkwb' |
---|
63 | | - | |
---|
64 | | - | let usdcbsc = base58'4BKKSp6NoNcrFHyorZogDyctq1fq6w7114Ym1pw6HUtC' |
---|
65 | | - | |
---|
66 | | - | let burnxtn = base58'3SjxA2YLdfF9fTRbzLm9xFn27C6MW34W1YsdJ6Axefns' |
---|
67 | | - | |
---|
68 | | - | let eth = base58'3VuV5WTmDz47Dmdn3QpcYjzbSdipjQE4JMdNe1xZpX13' |
---|
69 | | - | |
---|
70 | | - | let bnb = base58'66a1br3BrkoaJgP7yEar9hJcSTvJPoH6PYBLqscXcMGo' |
---|
71 | | - | |
---|
72 | | - | let wbtc = base58'2Fge5HEBRD3XTeg7Xg3FW5yiB9HVJFQtMXiWMQo72Up6' |
---|
73 | | - | |
---|
74 | | - | let btcb = base58'EW1uGLVo21Wd9i2Rhq8o4VKDTCQTGCGXE8DqayHGrLg8' |
---|
75 | | - | |
---|
76 | | - | let east = base58'6phK22ztGBW127gUFmdMEHKB3CVd6ZhWox2WtwJkbqTq' |
---|
77 | | - | |
---|
78 | | - | let steast = base58'GAB8JowY9UANZ4TQy2TzJyhxjPqXX3DUrb2cdMWrrJus' |
---|
79 | | - | |
---|
80 | | - | let swaves = base58'YiNbofFzC17jEHHCMwrRcpy9MrrjabMMLZxg8g5xmf7' |
---|
81 | | - | |
---|
82 | | - | let surf = base58'At8D6NFFpheCbvKVnjVoeLL84Eo8NZn6ovManxfLaFWL' |
---|
83 | | - | |
---|
84 | | - | let poolboostSC = base58'3P8eeDzUnoDNbQjW617pAe76cEUDQsP1m1V' |
---|
85 | | - | |
---|
86 | | - | let PL_Main = Address(base58'3P4uA5etnZi4AmBabKinq2bMiWU8KcnHZdH') |
---|
87 | | - | |
---|
88 | | - | let PL_Defi = Address(base58'3P4DK5VzDwL3vfc5ahUEhtoe5ByZNyacJ3X') |
---|
89 | | - | |
---|
90 | | - | let PL_Low = Address(base58'3PHpuQUPVUoR3AYzFeJzeWJfYLsLTmWssVH') |
---|
91 | | - | |
---|
92 | | - | let EAST_stake = Address(base58'3P2hbtheN5apNppqqUK7L7qAwmRFXy91CNa') |
---|
93 | | - | |
---|
94 | | - | let WX_WAVES_EAST = Address(base58'3PJVwjfi2fF5Jv9AauayU6xLxrYBn8bpGH1') |
---|
95 | | - | |
---|
96 | | - | let SWAVES_stake = Address(base58'3PDPzZVLhN1EuzGy4xAxjjTVkawKDLEaHiV') |
---|
97 | | - | |
---|
98 | | - | let WX_ETH_WAVES = Address(base58'3P2yiVnK48evTLr8MAZWavpE4WA4fw1weQg') |
---|
99 | | - | |
---|
100 | | - | let wavesInPool = tryGetInteger(Address(burnxtnPPTpoolId), (("global_" + toBase58String(waves)) + "_balance")) |
---|
101 | | - | |
---|
102 | | - | let projectStake = tryGetInteger(Address(burnxtnPPTpoolId), (toString(this) + "_indexStaked")) |
---|
103 | | - | |
---|
104 | | - | let totalStake = tryGetInteger(Address(burnxtnPPTpoolId), "global_poolToken_amount") |
---|
105 | | - | |
---|
106 | | - | func PL_value (dAppAddress,asset) = fraction(tryGetInteger(dAppAddress, ((toString(this) + "_supplied_") + toBase58String(asset))), tryGetInteger(dAppAddress, (toBase58String(asset) + "_sRate")), d16) |
---|
107 | | - | |
---|
108 | | - | |
---|
109 | | - | func _loadInt (key_,default_) = match getInteger(SWAVES_stake, key_) { |
---|
110 | | - | case a: Int => |
---|
111 | | - | a |
---|
112 | | - | case _ => |
---|
113 | | - | default_ |
---|
114 | | - | } |
---|
115 | | - | |
---|
116 | | - | |
---|
117 | | - | func _loadBigInt (key_,default_) = match getBinary(SWAVES_stake, key_) { |
---|
118 | | - | case a: ByteVector => |
---|
119 | | - | toBigInt(a) |
---|
120 | | - | case _ => |
---|
121 | | - | default_ |
---|
122 | | - | } |
---|
123 | | - | |
---|
124 | | - | |
---|
125 | | - | let lastRate = _loadBigInt("LAST_RATE", toBigInt(1000000000000)) |
---|
126 | | - | |
---|
127 | | - | let currentRate = _loadBigInt("CURRENT_RATE", toBigInt(0)) |
---|
128 | | - | |
---|
129 | | - | let lastHeight = _loadInt("LAST_HEIGHT", 0) |
---|
130 | | - | |
---|
131 | | - | let targetHeight = min([_loadInt("TARGET_HEIGHT", 0), height]) |
---|
132 | | - | |
---|
133 | | - | let lastRateUpdated = (lastRate + (currentRate * toBigInt((targetHeight - lastHeight)))) |
---|
134 | | - | |
---|
135 | | - | let baseAmount = toInt(fraction(toBigInt(assetBalance(WX_WAVES_EAST, swaves)), lastRateUpdated, toBigInt(1000000000000), FLOOR)) |
---|
136 | | - | |
---|
137 | | - | let wavesInWX = (wavesBalance(WX_WAVES_EAST).regular + baseAmount) |
---|
138 | | - | |
---|
139 | | - | let eastInWX = assetBalance(WX_WAVES_EAST, east) |
---|
140 | | - | |
---|
141 | | - | let wavesEast = fraction((d8 * 100), eastInWX, wavesInWX) |
---|
142 | | - | |
---|
143 | | - | let waves2InWX = (wavesBalance(WX_ETH_WAVES).regular + baseAmount) |
---|
144 | | - | |
---|
145 | | - | let ethInWX = assetBalance(WX_ETH_WAVES, eth) |
---|
146 | | - | |
---|
147 | | - | let ethWaves = fraction((d8 * 100), waves2InWX, ethInWX) |
---|
148 | | - | |
---|
149 | | - | let wavesInWhirlpool = tryGetInteger(Address(whirlpoolPoolId), (("global_" + toBase58String(waves)) + "_balance")) |
---|
150 | | - | |
---|
151 | | - | let whirlInWhirlpool = tryGetInteger(Address(whirlpoolPoolId), (("global_" + whirlpoolString) + "_balance")) |
---|
152 | | - | |
---|
153 | | - | let projectStakeWhirl = tryGetInteger(Address(whirlpoolPoolId), (toString(this) + "_indexStaked")) |
---|
154 | | - | |
---|
155 | | - | let totalStakeWhirl = tryGetInteger(Address(whirlpoolPoolId), "global_poolToken_amount") |
---|
156 | | - | |
---|
157 | | - | let stEastInWaves = (fraction((fraction(assetBalance(this, steast), tryGetInteger(EAST_stake, "%s__rate"), 1000000000000, HALFEVEN) / 100), d8, wavesEast) * 100) |
---|
158 | | - | |
---|
159 | | - | let eastInStaking = (fraction(assetBalance(this, steast), tryGetInteger(EAST_stake, "%s__rate"), 1000000000000, HALFEVEN) / 100) |
---|
160 | | - | |
---|
161 | | - | let keyVaultAsset = tryGetString(Address(base58'3PMtGnf3LXiEG6isDQLq1xMDKUqjQGqNHLb'), "%s%s%s__vault__3PAkmJniMgnnAej5pYf2jFYkCbZow5pt9tr__WAVES") |
---|
162 | | - | |
---|
163 | | - | let WAVESinEAST = parseIntValue(split(keyVaultAsset, "__")[2]) |
---|
164 | | - | |
---|
165 | | - | let dAppaddress = Address(base58'3PHxubMUtynEY2AeHq3K1kUizRPN9HUC2rt') |
---|
166 | | - | |
---|
167 | | - | let ETHatoken = tryGetInteger(dAppaddress, "3PAkmJniMgnnAej5pYf2jFYkCbZow5pt9tr_aTokenBalance") |
---|
168 | | - | |
---|
169 | | - | let ETHatokenTotal = tryGetInteger(dAppaddress, "aTokenCirculation") |
---|
170 | | - | |
---|
171 | | - | let reserveStr = tryGetString(dAppaddress, "reserveGlobalData") |
---|
172 | | - | |
---|
173 | | - | let get1Str = split(reserveStr, "|")[1] |
---|
174 | | - | |
---|
175 | | - | let strToInt = parseIntValue(get1Str) |
---|
176 | | - | |
---|
177 | | - | let ETHtotalReserve = parseIntValue(split(tryGetString(dAppaddress, "reserveGlobalData"), "|")[1]) |
---|
178 | | - | |
---|
179 | | - | let ETHinVires = fraction(ETHatoken, ETHtotalReserve, ETHatokenTotal) |
---|
180 | | - | |
---|
181 | | - | let ETHinViresWavelets = fraction(ETHinVires, ethWaves, d8) |
---|
182 | | - | |
---|
183 | | - | let tvlInWaves = ((fraction((wavesInPool * 10), projectStake, totalStake) + fraction((wavesInWhirlpool * 10), projectStakeWhirl, totalStakeWhirl)) + ETHinViresWavelets) |
---|
184 | | - | |
---|
185 | | - | let totalBT = WAVESinEAST |
---|
186 | | - | |
---|
187 | | - | let totalTreasury = (totalBT + tvlInWaves) |
---|
188 | | - | |
---|
189 | | - | let whirlpoolSupply = match assetInfo(whirlpool) { |
---|
190 | | - | case asset: Asset => |
---|
191 | | - | asset.quantity |
---|
192 | | - | case _ => |
---|
193 | | - | throw("Can't find asset") |
---|
194 | | - | } |
---|
195 | | - | |
---|
196 | | - | let price = if (((fraction((tvlInWaves + tryGetInteger(this, keySurplusReceived)), d8, whirlpoolSupply) + d8) >= tryGetInteger(this, keyWhirlpoolIssuePrice))) |
---|
197 | | - | then (fraction((tvlInWaves + tryGetInteger(this, keySurplusReceived)), d8, whirlpoolSupply) + d8) |
---|
198 | | - | else tryGetInteger(this, keyWhirlpoolIssuePrice) |
---|
199 | | - | |
---|
200 | | - | @Callable(i) |
---|
201 | | - | func buyWHIRLPOOLwithWAVES () = { |
---|
202 | | - | let WhirlpoolBalanceBefore = assetBalance(this, whirlpool) |
---|
203 | | - | if ((WhirlpoolBalanceBefore == WhirlpoolBalanceBefore)) |
---|
204 | | - | then { |
---|
205 | | - | let pmt = value(i.payments[0]) |
---|
206 | | - | let surplus = fraction((price - d8), pmt.amount, d8) |
---|
207 | | - | let IssueAmount = if ((pmt.amount >= fraction(pmt.amount, d8, price))) |
---|
208 | | - | then fraction(pmt.amount, d8, price) |
---|
209 | | - | else throw("please contact project owner: issue amount error") |
---|
210 | | - | let supplyAmount = ((pmt.amount - surplus) / 3) |
---|
211 | | - | let cleanAmountIn = (pmt.amount - fraction(pmt.amount, 200, 10000)) |
---|
212 | | - | 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) |
---|
213 | | - | if ((pmt.assetId != unit)) |
---|
214 | | - | then throw("attach WAVES token only") |
---|
215 | | - | else { |
---|
216 | | - | let buy = if ((AmountOut > IssueAmount)) |
---|
217 | | - | then invoke(Address(whirlpoolPoolId), "swap", [whirlpoolString, (IssueAmount + 1)], [AttachedPayment(unit, pmt.amount)]) |
---|
218 | | - | else unit |
---|
219 | | - | if ((buy == buy)) |
---|
220 | | - | then { |
---|
221 | | - | let WhirlpoolBalanceAfter = assetBalance(this, whirlpool) |
---|
222 | | - | let WhirlpoolFromSwap = (WhirlpoolBalanceAfter - WhirlpoolBalanceBefore) |
---|
223 | | - | [Reissue(whirlpool, if ((IssueAmount >= AmountOut)) |
---|
224 | | - | then IssueAmount |
---|
225 | | - | else 0, true), if ((AmountOut > IssueAmount)) |
---|
226 | | - | then ScriptTransfer(i.caller, WhirlpoolFromSwap, whirlpool) |
---|
227 | | - | else ScriptTransfer(i.caller, IssueAmount, whirlpool), IntegerEntry(keyWhirlpoolIssuePrice, price), IntegerEntry(if ((AmountOut > IssueAmount)) |
---|
228 | | - | then "price WHIRLPOOL/WAVES" |
---|
229 | | - | else "WHIRLPOOL/WAVES mid market price", if ((AmountOut > IssueAmount)) |
---|
230 | | - | then fraction(d8, pmt.amount, WhirlpoolFromSwap) |
---|
231 | | - | else fraction(d8, (wavesInWhirlpool * 9), whirlInWhirlpool)), IntegerEntry(keyWaveletsReceived, if ((IssueAmount >= AmountOut)) |
---|
232 | | - | then (pmt.amount + tryGetInteger(this, keyWaveletsReceived)) |
---|
233 | | - | else tryGetInteger(this, keyWaveletsReceived)), IntegerEntry(keyWaveletsReceived, if ((IssueAmount >= AmountOut)) |
---|
234 | | - | then ((pmt.amount - surplus) + tryGetInteger(this, keyWaveletsReceived)) |
---|
235 | | - | else tryGetInteger(this, keyWaveletsReceived)), IntegerEntry(keySurplusReceived, if ((AmountOut > IssueAmount)) |
---|
236 | | - | then getIntegerValue(this, keySurplusReceived) |
---|
237 | | - | else (surplus + getIntegerValue(this, keySurplusReceived)))] |
---|
238 | | - | } |
---|
239 | | - | else throw("Strict value is not equal to itself.") |
---|
240 | | - | } |
---|
241 | | - | } |
---|
242 | | - | else throw("Strict value is not equal to itself.") |
---|
243 | | - | } |
---|
244 | | - | |
---|
245 | | - | |
---|
246 | | - | |
---|
247 | | - | @Callable(i) |
---|
248 | | - | func priceSurplusSupply () = [IntegerEntry("ETH/WAVES price", ethWaves), 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(keyWaveletsReceived, tryGetInteger(this, keyWaveletsReceived)), 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, keyWaveletsReceived) / d8)), IntegerEntry("total WAVES paid out in WAVES", (tryGetInteger(this, keyWaveletsPaidOut) / d8)), IntegerEntry(keyROI, tryGetInteger(this, keyROI))] |
---|
249 | | - | |
---|
250 | | - | |
---|
251 | | - | |
---|
252 | | - | @Callable(i) |
---|
253 | | - | func boostPoolAPY () = if ((i.caller != this)) |
---|
254 | | - | then throw("access only by project owner") |
---|
255 | | - | else { |
---|
256 | | - | let balance = if ((d8 > wavesBalance(this).available)) |
---|
257 | | - | then throw("not enough WAVES") |
---|
258 | | - | else (wavesBalance(this).available - d8) |
---|
259 | | - | let boost80 = fraction(balance, 80, 100) |
---|
260 | | - | if ((boost80 == boost80)) |
---|
261 | | - | then { |
---|
262 | | - | let amountBoost = fraction(boost80, 80, 100) |
---|
263 | | - | if ((amountBoost == amountBoost)) |
---|
264 | | - | then { |
---|
265 | | - | let amountOwner = fraction(boost80, 20, 100) |
---|
266 | | - | if ((amountOwner == amountOwner)) |
---|
267 | | - | then { |
---|
268 | | - | let boost = invoke(Address(poolboostSC), "addBoosting", [toBase58String(whirlpoolPoolId), 7], [AttachedPayment(unit, amountBoost)]) |
---|
269 | | - | if ((boost == boost)) |
---|
270 | | - | 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)] |
---|
271 | | - | else throw("Strict value is not equal to itself.") |
---|
272 | | - | } |
---|
273 | | - | else throw("Strict value is not equal to itself.") |
---|
274 | | - | } |
---|
275 | | - | else throw("Strict value is not equal to itself.") |
---|
276 | | - | } |
---|
277 | | - | else throw("Strict value is not equal to itself.") |
---|
278 | | - | } |
---|
279 | | - | |
---|
280 | | - | |
---|
281 | | - | |
---|
282 | | - | @Callable(i) |
---|
283 | | - | func boostPoolAPY_all () = if ((i.caller != this)) |
---|
284 | | - | then throw("access only by project owner") |
---|
285 | | - | else { |
---|
286 | | - | let balance = if ((d8 > wavesBalance(this).available)) |
---|
287 | | - | then throw("not enough WAVES") |
---|
288 | | - | else (wavesBalance(this).available - d8) |
---|
289 | | - | let amountBoost = fraction(balance, 80, 100) |
---|
290 | | - | if ((amountBoost == amountBoost)) |
---|
291 | | - | then { |
---|
292 | | - | let amountOwner = fraction(balance, 20, 100) |
---|
293 | | - | if ((amountOwner == amountOwner)) |
---|
294 | | - | then { |
---|
295 | | - | let boost = invoke(Address(poolboostSC), "addBoosting", [toBase58String(whirlpoolPoolId), 7], [AttachedPayment(unit, amountBoost)]) |
---|
296 | | - | if ((boost == boost)) |
---|
297 | | - | 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)] |
---|
298 | | - | else throw("Strict value is not equal to itself.") |
---|
299 | | - | } |
---|
300 | | - | else throw("Strict value is not equal to itself.") |
---|
301 | | - | } |
---|
302 | | - | else throw("Strict value is not equal to itself.") |
---|
303 | | - | } |
---|
304 | | - | |
---|
305 | | - | |
---|
306 | | - | |
---|
307 | | - | @Callable(i) |
---|
308 | | - | func transferPoolAPY () = if ((i.caller != this)) |
---|
309 | | - | then throw("access only by project owner") |
---|
310 | | - | else { |
---|
311 | | - | let balance = if ((d8 > wavesBalance(this).available)) |
---|
312 | | - | then throw("not enough WAVES") |
---|
313 | | - | else (wavesBalance(this).available - d8) |
---|
314 | | - | let boost80 = fraction(balance, 80, 100) |
---|
315 | | - | if ((boost80 == boost80)) |
---|
316 | | - | then { |
---|
317 | | - | let amountBoost = fraction(boost80, 80, 100) |
---|
318 | | - | if ((amountBoost == amountBoost)) |
---|
319 | | - | then { |
---|
320 | | - | let amountOwner = fraction(boost80, 20, 100) |
---|
321 | | - | if ((amountOwner == amountOwner)) |
---|
322 | | - | 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)] |
---|
323 | | - | else throw("Strict value is not equal to itself.") |
---|
324 | | - | } |
---|
325 | | - | else throw("Strict value is not equal to itself.") |
---|
326 | | - | } |
---|
327 | | - | else throw("Strict value is not equal to itself.") |
---|
328 | | - | } |
---|
329 | | - | |
---|
330 | | - | |
---|
331 | | - | |
---|
332 | | - | @Callable(i) |
---|
333 | | - | func transferPoolAPY_all () = if ((i.caller != this)) |
---|
334 | | - | then throw("access only by project owner") |
---|
335 | | - | else { |
---|
336 | | - | let balance = if ((d8 > wavesBalance(this).available)) |
---|
337 | | - | then throw("not enough WAVES") |
---|
338 | | - | else (wavesBalance(this).available - d8) |
---|
339 | | - | let amountBoost = fraction(balance, 80, 100) |
---|
340 | | - | if ((amountBoost == amountBoost)) |
---|
341 | | - | then { |
---|
342 | | - | let amountOwner = fraction(balance, 20, 100) |
---|
343 | | - | if ((amountOwner == amountOwner)) |
---|
344 | | - | 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)] |
---|
345 | | - | else throw("Strict value is not equal to itself.") |
---|
346 | | - | } |
---|
347 | | - | else throw("Strict value is not equal to itself.") |
---|
348 | | - | } |
---|
349 | | - | |
---|
350 | | - | |
---|
351 | | - | |
---|
352 | | - | @Callable(i) |
---|
353 | | - | func poolOneTokenSurplus () = if ((i.caller != this)) |
---|
354 | | - | then throw("access only by project owner") |
---|
355 | | - | else { |
---|
356 | | - | let surplusAmount = tryGetInteger(this, keySurplusReceived) |
---|
357 | | - | let PoolOneTokenSurplus = invoke(Address(base58'3PR1Qvi9mHT35SwWEkLSqqE2L8thiPLdVWU'), "generateIndexWithOneTokenAndStake", [toBase58String(burnxtnPPTpoolId)], [AttachedPayment(unit, surplusAmount)]) |
---|
358 | | - | if ((PoolOneTokenSurplus == PoolOneTokenSurplus)) |
---|
359 | | - | then [IntegerEntry(keySurplusReceived, (tryGetInteger(this, keySurplusReceived) - surplusAmount))] |
---|
360 | | - | else throw("Strict value is not equal to itself.") |
---|
361 | | - | } |
---|
362 | | - | |
---|
363 | | - | |
---|
364 | | - | |
---|
365 | | - | @Callable(i) |
---|
366 | | - | func changeIntegerEntry (keyString,integer) = if ((i.caller != this)) |
---|
367 | | - | then throw("access only by project owner") |
---|
368 | | - | else [IntegerEntry(keyString, integer)] |
---|
369 | | - | |
---|
370 | | - | |
---|
371 | | - | |
---|
372 | | - | @Callable(i) |
---|
373 | | - | func activated () = if ((i.caller != this)) |
---|
374 | | - | then throw("you are not allowed") |
---|
375 | | - | else [IntegerEntry(keyActivated, height)] |
---|
376 | | - | |
---|
377 | | - | |
---|
378 | | - | @Verifier(tx) |
---|
379 | | - | func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) |
---|
380 | | - | then true |
---|
381 | | - | else if (((tryGetInteger(this, keyActivated) + unlockBlock) > height)) |
---|
382 | | - | then false |
---|
383 | | - | else if (sigVerify(tx.bodyBytes, tx.proofs[0], heirPubKey)) |
---|
384 | | - | then true |
---|
385 | | - | else if (((tryGetInteger(this, keyActivated) + unlockBlock2) > height)) |
---|
386 | | - | then false |
---|
387 | | - | else sigVerify(tx.bodyBytes, tx.proofs[0], PuzzleMasterPubKey) |
---|
388 | | - | |
---|
| 1 | + | # no script |
---|