tx · FLmu9AAdpsEPykecoWP1TzWHaJBwuPGVBo7yUvnbMdHZ 3N5Xd7QVQZWntaJwha9Kg42is626GUPjtUW: -0.01400000 Waves 2022.03.04 17:29 [1949350] smart account 3N5Xd7QVQZWntaJwha9Kg42is626GUPjtUW > SELF 0.00000000 Waves
{ "type": 13, "id": "FLmu9AAdpsEPykecoWP1TzWHaJBwuPGVBo7yUvnbMdHZ", "fee": 1400000, "feeAssetId": null, "timestamp": 1646404219523, "version": 2, "chainId": 84, "sender": "3N5Xd7QVQZWntaJwha9Kg42is626GUPjtUW", "senderPublicKey": "DfbjpZJBbZwnUKysUkxCbWTE1ZWuoUb6Y6BZdu5iAE8j", "proofs": [ "iTpESaMHH7gkLDcHm8zzjNTApSrfw6tbfg8mtEXGiZjR7ErkFwGZgYGFq2cMRSsf9FTe34vT5hoSNskF5zkhMvj", "Tzei6YmL6AZTAoJEzPW2G6YK9d7RnFM5fanX7PoifU17GZm1by4nHHQ2hFZytc31YmxCGhWXG8FcvhBANcjwe69" ], "script": "base64:AAIFAAAAAAAAACEIAhIAEgASBAoCAQESABIECgIBARIAEgASABIFCgMEAQgAAABSAAAAAAd2ZXJzaW9uAgAAAAUyLjAuMAAAAAAIa1ZlcnNpb24CAAAAB3ZlcnNpb24AAAAAB2tBY3RpdmUCAAAABmFjdGl2ZQAAAAAJa0Fzc2V0SWRBAgAAAApBX2Fzc2V0X2lkAAAAAAlrQXNzZXRJZEICAAAACkJfYXNzZXRfaWQAAAAACWtCYWxhbmNlQQIAAAAPQV9hc3NldF9iYWxhbmNlAAAAAAlrQmFsYW5jZUICAAAAD0JfYXNzZXRfYmFsYW5jZQAAAAANa1NoYXJlQXNzZXRJZAIAAAAOc2hhcmVfYXNzZXRfaWQAAAAAEWtTaGFyZUFzc2V0U3VwcGx5AgAAABJzaGFyZV9hc3NldF9zdXBwbHkAAAAABGtGZWUCAAAACmNvbW1pc3Npb24AAAAAEmtGZWVTY2FsZURlbGltaXRlcgIAAAAaY29tbWl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AAAAIIBQAAAANpbnYAAAAIZnVuY3Rpb24CAAAAGXRha2VJbnRvQWNjb3VudEV4dHJhRnVuZHMHBAAAAA1zaWduZWRCeUFkbWluAwMDCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAMYWRtaW5QdWJLZXkxBgkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAADGFkbWluUHViS2V5MgYJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAAxhZG1pblB1YktleTMGCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAKYWRtU3Rha2luZwMDBQAAABNjYWxsVGFrZUludG9BY2NvdW50BQAAAA1zaWduZWRCeUFkbWluBwYFAAAAE211bHRpU2lnbmVkQnlBZG1pbnMFAAAAE211bHRpU2lnbmVkQnlBZG1pbnNEFBpX", "height": 1949350, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6QnjJjju7RfGB8wdbdNbJbiiGQuzpWLKNzrZxUoZZ27x Next: G7LYSbhrEcqsFwWV3yGWYNTLVN53ZSvpxXTauQKpoLnv Diff:
Old | New | Differences | |
---|---|---|---|
27 | 27 | ||
28 | 28 | let kCause = "shutdown_cause" | |
29 | 29 | ||
30 | - | let | |
30 | + | let keyUSDNNSBTAddress = "staking_usdnnsbt_address" | |
31 | 31 | ||
32 | - | let kFirstHarvestHeight = "first_harvest_height" | |
33 | - | ||
34 | - | let kShareLimit = "share_limit_on_first_harvest" | |
35 | - | ||
36 | - | let kBasePeriod = "base_period" | |
37 | - | ||
38 | - | let kPeriodLength = "period_length" | |
39 | - | ||
40 | - | let kStartHeight = "start_height" | |
41 | - | ||
42 | - | let kOracleAssetPriority = "asset_priority_" | |
43 | - | ||
44 | - | let kOracleScriptHash = "script_hash_flat" | |
45 | - | ||
46 | - | let kInitPoolHeight = "init_pool_height_" | |
32 | + | let keyEURNAddress = "staking_eurn_address" | |
47 | 33 | ||
48 | 34 | let keyAdminPubKey1 = "admin_pub_1" | |
49 | 35 | ||
54 | 40 | let USDNToWavesExchanger = Address(base58'3N77kfPbQyjXWpDALX3xjKw3iEGMWEctV37') | |
55 | 41 | ||
56 | 42 | let oracle = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
57 | - | ||
58 | - | let walletAddress = Address(base58'3NAGTtZz6WpupSN89NZD5rMZwwziZEg4Kx4') | |
59 | - | ||
60 | - | let votingAddress = Address(base58'3MrJgdL1GniipErHy44YF9idzLaUL2iX5DQ') | |
61 | 43 | ||
62 | 44 | func getAdminPub (keyAdminPub) = match getString(oracle, keyAdminPub) { | |
63 | 45 | case string: String => | |
77 | 59 | ||
78 | 60 | let admStaking = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
79 | 61 | ||
80 | - | let basePeriod = valueOrErrorMessage(getInteger(votingAddress, kBasePeriod), "Empty kBasePeriod") | |
81 | - | ||
82 | - | let startHeight = valueOrErrorMessage(getInteger(votingAddress, kStartHeight), "Empty kStartHeight") | |
83 | - | ||
84 | - | let periodLength = valueOrErrorMessage(getInteger(votingAddress, kPeriodLength), "Empty kPeriodLength") | |
85 | - | ||
86 | - | let firstHarvestEndPeriod = ((basePeriod + ((height - startHeight) / periodLength)) + 1) | |
87 | - | ||
88 | - | let stakingAddress = Address(base58'3N6q7sCGSSLBUXDdjBdYGTJbZGZfhhh8cNg') | |
62 | + | let walletAddress = Address(base58'3NAGTtZz6WpupSN89NZD5rMZwwziZEg4Kx4') | |
89 | 63 | ||
90 | 64 | let USDN = base58'8UrfDVd5GreeUwm7uPk7eYz1eMv376kzR52C6sANPkwS' | |
91 | 65 | ||
92 | - | let | |
66 | + | let EURN = base58'ECBCkHS68DckpBrzLeoRgYbFg7sCVqR176mPqbXsj9pA' | |
93 | 67 | ||
94 | - | let | |
68 | + | let stakingAssets = [toBase58String(USDN), toBase58String(EURN)] | |
95 | 69 | ||
96 | - | let isActive = getBooleanValue(this, kActive) | |
70 | + | let stakingUSDNNSBTAddress = Address(fromBase58String(valueOrErrorMessage(getString(oracle, keyUSDNNSBTAddress), "no usdn staking address"))) | |
71 | + | ||
72 | + | let stakingEURNAddress = Address(fromBase58String(valueOrErrorMessage(getString(oracle, keyEURNAddress), "no usdn staking address"))) | |
73 | + | ||
74 | + | let active = getBooleanValue(this, kActive) | |
97 | 75 | ||
98 | 76 | let strAssetIdA = getStringValue(this, kAssetIdA) | |
99 | 77 | ||
141 | 119 | ||
142 | 120 | let feeScale6 = 1000000 | |
143 | 121 | ||
144 | - | let comissionForInitalization = 1000000000 | |
145 | - | ||
146 | 122 | let scale3 = 1000 | |
147 | 123 | ||
148 | 124 | let scale8 = 100000000 | |
149 | 125 | ||
150 | - | let | |
126 | + | let scale16 = 10000000000000000 | |
151 | 127 | ||
152 | 128 | let slippageScale3 = 1000 | |
153 | 129 | ||
165 | 141 | ||
166 | 142 | let alphaDigits = 2 | |
167 | 143 | ||
168 | - | let beta = | |
144 | + | let beta = 4600000000000000 | |
169 | 145 | ||
170 | 146 | func accountBalance (assetId) = match assetId { | |
171 | 147 | case id: ByteVector => | |
177 | 153 | } | |
178 | 154 | ||
179 | 155 | ||
180 | - | let stakedAmountUSDN = match getInteger(stakingAddress, ((("rpd_balance_" + toBase58String(USDN)) + "_") + toString(this))) { | |
181 | - | case staked: Int => | |
182 | - | staked | |
183 | - | case nothing: Unit => | |
184 | - | 0 | |
185 | - | case _ => | |
186 | - | throw("Match error") | |
187 | - | } | |
188 | - | ||
189 | - | func isAllowedAsset (assetId) = match assetId { | |
190 | - | case id: ByteVector => | |
191 | - | if ((id == USDN)) | |
192 | - | then true | |
193 | - | else false | |
194 | - | case waves: Unit => | |
195 | - | false | |
196 | - | case _ => | |
197 | - | throw("Match error") | |
198 | - | } | |
156 | + | func stakedAmount (assetId) = { | |
157 | + | let stakedAmountCalculated = match assetId { | |
158 | + | case aId: ByteVector => | |
159 | + | if ((aId == USDN)) | |
160 | + | then getInteger(stakingUSDNNSBTAddress, ((("rpd_balance_" + toBase58String(aId)) + "_") + toString(this))) | |
161 | + | else if ((aId == EURN)) | |
162 | + | then getInteger(stakingEURNAddress, ((("%s%s%s__stakingBalance__" + toBase58String(aId)) + "__") + toString(this))) | |
163 | + | else 0 | |
164 | + | case _: Unit => | |
165 | + | 0 | |
166 | + | case _ => | |
167 | + | throw("Match error") | |
168 | + | } | |
169 | + | match stakedAmountCalculated { | |
170 | + | case i: Int => | |
171 | + | i | |
172 | + | case _ => | |
173 | + | 0 | |
174 | + | } | |
175 | + | } | |
199 | 176 | ||
200 | 177 | ||
201 | - | let availableBalanceA = (balanceA - (if ((assetIdA == USDN)) | |
202 | - | then stakedAmountUSDN | |
203 | - | else 0)) | |
178 | + | let stakedAmountA = stakedAmount(assetIdA) | |
204 | 179 | ||
205 | - | let availableBalanceB = (balanceB - (if ((assetIdB == USDN)) | |
206 | - | then stakedAmountUSDN | |
207 | - | else 0)) | |
180 | + | let stakedAmountB = stakedAmount(assetIdB) | |
208 | 181 | ||
209 | - | let accountBalanceWithStakedA = (accountBalance(assetIdA) + (if ((assetIdA == USDN)) | |
210 | - | then stakedAmountUSDN | |
211 | - | else 0)) | |
182 | + | let availableBalanceA = (balanceA - stakedAmountA) | |
212 | 183 | ||
213 | - | let accountBalanceWithStakedB = (accountBalance(assetIdB) + (if ((assetIdB == USDN)) | |
214 | - | then stakedAmountUSDN | |
215 | - | else 0)) | |
184 | + | let availableBalanceB = (balanceB - stakedAmountB) | |
185 | + | ||
186 | + | let accountBalanceWithStakedA = (accountBalance(assetIdA) + stakedAmountA) | |
187 | + | ||
188 | + | let accountBalanceWithStakedB = (accountBalance(assetIdB) + stakedAmountB) | |
216 | 189 | ||
217 | 190 | let hasEnoughBalance = if ((accountBalanceWithStakedA >= balanceA)) | |
218 | 191 | then (accountBalanceWithStakedB >= balanceB) | |
219 | 192 | else false | |
220 | 193 | ||
221 | - | func skewness (x,y) = (( | |
194 | + | func skewness (x,y) = ((fraction(scale16, x, y) + fraction(scale16, y, x)) / 2) | |
222 | 195 | ||
223 | 196 | ||
224 | 197 | func invariantCalc (x,y) = { | |
225 | 198 | let sk = skewness(x, y) | |
226 | - | (fraction((x + y), | |
199 | + | (fraction((x + y), scale16, pow(sk, digits8, alpha, alphaDigits, digits8, CEILING)) + (2 * fraction(toInt(pow(fraction(toBigInt(x), toBigInt(y), toBigInt(scale8)), 0, toBigInt(5), 1, (digits8 / 2), DOWN)), pow((sk - beta), digits8, alpha, alphaDigits, digits8, DOWN), scale8))) | |
227 | 200 | } | |
228 | 201 | ||
229 | 202 | ||
230 | 203 | func calculateSendAmount (amountToSendEstimated,minTokenReceiveAmount,tokenReceiveAmount,tokenId) = { | |
231 | - | let | |
204 | + | let worstAllowedNewInvariantRatio = (scale8 - ((scale8 * 1) / 10000000)) | |
232 | 205 | let deltaBetweenMaxAndMinSendValue = (amountToSendEstimated - minTokenReceiveAmount) | |
233 | 206 | let x = (balanceA + tokenReceiveAmount) | |
234 | 207 | let y = (balanceB + tokenReceiveAmount) | |
235 | - | let invariantNew = if ((tokenId == assetIdA)) | |
236 | - | then invariantCalc(x, (balanceB - amountToSendEstimated)) | |
237 | - | else if ((tokenId == assetIdB)) | |
238 | - | then invariantCalc((balanceA - amountToSendEstimated), y) | |
239 | - | else throw("Wrong asset in payment") | |
240 | - | let invariantEstimatedRatio = fraction(scale8, invariant, invariantNew) | |
241 | - | func getStepAmount (acc,step) = if ((acc == -1)) | |
208 | + | func getStepAmount (acc,step) = if ((acc._1 == -1)) | |
242 | 209 | then { | |
243 | - | let amountToSend = (amountToSendEstimated - ((step * deltaBetweenMaxAndMinSendValue) / | |
210 | + | let amountToSend = (amountToSendEstimated - (((step * deltaBetweenMaxAndMinSendValue) / 3) / scale3)) | |
244 | 211 | let stepInvariant = if ((tokenId == assetIdA)) | |
245 | 212 | then invariantCalc(x, (balanceB - amountToSend)) | |
246 | 213 | else invariantCalc((balanceA - amountToSend), y) | |
247 | 214 | if ((stepInvariant > invariant)) | |
248 | - | then amountToSend | |
249 | - | else -1 | |
215 | + | then $Tuple2(amountToSend, stepInvariant) | |
216 | + | else $Tuple2(-1, 0) | |
250 | 217 | } | |
251 | 218 | else acc | |
252 | 219 | ||
253 | - | let stepAmount = { | |
254 | - | let $list71887231 = [1, 2, 3, 4, 5] | |
255 | - | let $size71887231 = size($list71887231) | |
256 | - | let $acc071887231 = -1 | |
257 | - | if (($size71887231 == 0)) | |
258 | - | then $acc071887231 | |
259 | - | else { | |
260 | - | let $acc171887231 = getStepAmount($acc071887231, $list71887231[0]) | |
261 | - | if (($size71887231 == 1)) | |
262 | - | then $acc171887231 | |
220 | + | let amountToSendMin = getStepAmount($Tuple2(-1, 0), 3000) | |
221 | + | if ((0 > amountToSendMin._1)) | |
222 | + | then throw("Price is worse than minReceived") | |
223 | + | else { | |
224 | + | let invEstimated = if ((tokenId == assetIdA)) | |
225 | + | then invariantCalc(x, (balanceB - amountToSendEstimated)) | |
226 | + | else if ((tokenId == assetIdB)) | |
227 | + | then invariantCalc((balanceA - amountToSendEstimated), y) | |
228 | + | else throw("Wrong asset in payment") | |
229 | + | let amountToSendBest = if ((invariant > invEstimated)) | |
230 | + | then if ((worstAllowedNewInvariantRatio >= fraction(scale8, invariant, invEstimated))) | |
231 | + | then throw("Bad estimation provided 1") | |
263 | 232 | else { | |
264 | - | let $acc271887231 = getStepAmount($acc171887231, $list71887231[1]) | |
265 | - | if (($size71887231 == 2)) | |
266 | - | then $acc271887231 | |
267 | - | else { | |
268 | - | let $acc371887231 = getStepAmount($acc271887231, $list71887231[2]) | |
269 | - | if (($size71887231 == 3)) | |
270 | - | then $acc371887231 | |
271 | - | else { | |
272 | - | let $acc471887231 = getStepAmount($acc371887231, $list71887231[3]) | |
273 | - | if (($size71887231 == 4)) | |
274 | - | then $acc471887231 | |
275 | - | else { | |
276 | - | let $acc571887231 = getStepAmount($acc471887231, $list71887231[4]) | |
277 | - | if (($size71887231 == 5)) | |
278 | - | then $acc571887231 | |
279 | - | else { | |
280 | - | let $acc671887231 = getStepAmount($acc571887231, $list71887231[5]) | |
281 | - | throw("List size exceed 5") | |
282 | - | } | |
283 | - | } | |
284 | - | } | |
285 | - | } | |
233 | + | let a = { | |
234 | + | let $l = [25, 200, 500] | |
235 | + | let $s = size($l) | |
236 | + | let $acc0 = $Tuple2(-1, 0) | |
237 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
238 | + | then $a | |
239 | + | else getStepAmount($a, $l[$i]) | |
240 | + | ||
241 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
242 | + | then $a | |
243 | + | else throw("List size exceeds 3") | |
244 | + | ||
245 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
246 | + | } | |
247 | + | if ((0 > a._1)) | |
248 | + | then amountToSendMin | |
249 | + | else a | |
286 | 250 | } | |
287 | - | } | |
288 | - | } | |
289 | - | if ((0 > stepAmount)) | |
290 | - | then throw("something went wrong while working with amountToSend") | |
291 | - | else if (if ((invariantEstimatedRatio > slippageValue)) | |
292 | - | then (invariantNew > invariant) | |
293 | - | else false) | |
294 | - | then amountToSendEstimated | |
295 | - | else stepAmount | |
251 | + | else { | |
252 | + | let a = { | |
253 | + | let $l = [-500, -200, -25] | |
254 | + | let $s = size($l) | |
255 | + | let $acc0 = $Tuple2(-1, 0) | |
256 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
257 | + | then $a | |
258 | + | else getStepAmount($a, $l[$i]) | |
259 | + | ||
260 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
261 | + | then $a | |
262 | + | else throw("List size exceeds 3") | |
263 | + | ||
264 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
265 | + | } | |
266 | + | let tupleSendBetter = if ((0 > a._1)) | |
267 | + | then $Tuple2(amountToSendEstimated, invEstimated) | |
268 | + | else a | |
269 | + | if ((worstAllowedNewInvariantRatio >= fraction(scale8, invariant, tupleSendBetter._2))) | |
270 | + | then throw("Bad estimation provided 2") | |
271 | + | else tupleSendBetter | |
272 | + | } | |
273 | + | amountToSendBest | |
274 | + | } | |
296 | 275 | } | |
297 | 276 | ||
298 | 277 | ||
311 | 290 | func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)] | |
312 | 291 | ||
313 | 292 | ||
314 | - | func deductStakingFee (amount,assetId) = if ((assetId == USDN)) | |
315 | - | then { | |
316 | - | let result = (amount - stakingFeeInUSDN) | |
317 | - | if ((0 >= result)) | |
318 | - | then throw((((("Insufficient amount " + toString(amount)) + " to deduct staking fee ") + toString(stakingFeeInUSDN)) + " USD-N")) | |
319 | - | else result | |
320 | - | } | |
321 | - | else amount | |
322 | - | ||
323 | - | ||
324 | 293 | func throwIsActive () = throw("DApp is already active") | |
325 | 294 | ||
326 | 295 | ||
327 | - | func throwIsInactive () = throw("DApp is inactive at this moment") | |
296 | + | func isActive () = if (active) | |
297 | + | then unit | |
298 | + | else throw("DApp is inactive at this moment") | |
328 | 299 | ||
329 | 300 | ||
330 | - | func throwOnlyAdmin () = throw("Only admin can call this function") | |
301 | + | func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
302 | + | then unit | |
303 | + | else throw("Only admin can call this function") | |
331 | 304 | ||
332 | 305 | ||
333 | 306 | func throwAssets () = throw(((("Incorrect assets attached. Expected: " + strAssetIdA) + " and ") + strAssetIdB)) | |
334 | 307 | ||
335 | 308 | ||
336 | - | func | |
309 | + | func throwOnePayment () = throw("One attached payment expected") | |
337 | 310 | ||
338 | 311 | ||
339 | - | func throwInsufficientAvailableBalance (amount,available,assetName) = throw((((((((("Insufficient DApp balance to pay " + toString(amount)) + " ") + assetName) + " due to staking. Available: ") + toString(available)) + " ") + assetName) + ". Please contact support in Telegram: https://t.me/swopfisupport")) | |
340 | - | ||
341 | - | ||
342 | - | func throwInsufficientAvailableBalances (amountA,amountB) = throw((((((((((((((((("Insufficient DApp balance to pay " + toString(amountA)) + " ") + assetNameA) + " and ") + toString(amountB)) + " ") + assetNameB) + " due to staking. Available: ") + toString(availableBalanceA)) + " ") + assetNameA) + " and ") + toString(availableBalanceB)) + " ") + assetNameB) + ". Please contact support in Telegram: https://t.me/swopfisupport")) | |
312 | + | func throwThreshold (threshold,amountA,amountB) = throw(((((((((("New balance in assets of the DApp is less than threshold " + toString(threshold)) + ": ") + toString(amountA)) + " ") + assetNameA) + ", ") + toString(amountB)) + " ") + assetNameB)) | |
343 | 313 | ||
344 | 314 | ||
345 | 315 | func suspendSuspicious () = suspend(((((((((((((((("Suspicious state. Actual balances: " + toString(balanceA)) + " ") + assetNameA) + ", ") + toString(balanceB)) + " ") + assetNameB) + ". State: ") + toString(accountBalance(assetIdA))) + " ") + assetNameA) + ", ") + toString(accountBalance(assetIdB))) + " ") + assetNameB)) | |
346 | 316 | ||
347 | 317 | ||
318 | + | func calcStakingFuncAndAddres (stake,assetId) = if (stake) | |
319 | + | then if ((assetId == USDN)) | |
320 | + | then $Tuple2("lockNeutrino", stakingUSDNNSBTAddress) | |
321 | + | else $Tuple2("startStaking", stakingEURNAddress) | |
322 | + | else if ((assetId == USDN)) | |
323 | + | then $Tuple2("unlockNeutrino", stakingUSDNNSBTAddress) | |
324 | + | else $Tuple2("stopStaking", stakingEURNAddress) | |
325 | + | ||
326 | + | ||
327 | + | func calcStakingParams (stake,amount,assetId) = if (stake) | |
328 | + | then { | |
329 | + | let $t097119777 = calcStakingFuncAndAddres(stake, assetId) | |
330 | + | let call = $t097119777._1 | |
331 | + | let stakingAddr = $t097119777._2 | |
332 | + | $Tuple4(call, stakingAddr, nil, [AttachedPayment(assetId, amount)]) | |
333 | + | } | |
334 | + | else { | |
335 | + | let $t098639929 = calcStakingFuncAndAddres(stake, assetId) | |
336 | + | let call = $t098639929._1 | |
337 | + | let stakingAddr = $t098639929._2 | |
338 | + | $Tuple4(call, stakingAddr, [amount, toBase58String(assetId)], nil) | |
339 | + | } | |
340 | + | ||
341 | + | ||
348 | 342 | @Callable(i) | |
349 | - | func init (userAddressStr) = { | |
350 | - | let $t0992910006 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
351 | - | let pmtAmount1 = $t0992910006._1 | |
352 | - | let pmtAssetId1 = $t0992910006._2 | |
353 | - | let $t01001110088 = $Tuple2(i.payments[1].amount, i.payments[1].assetId) | |
354 | - | let pmtAmount2 = $t01001110088._1 | |
355 | - | let pmtAssetId2 = $t01001110088._2 | |
356 | - | let $t01009310176 = $Tuple2(i.payments[2].amount, i.payments[2].assetId) | |
357 | - | let pmtAmountSWOP = $t01009310176._1 | |
358 | - | let pmtAssetIdSWOP = $t01009310176._2 | |
359 | - | let check = isDataStorageUntouched(this) | |
360 | - | let userScriptHash = scriptHash(this) | |
361 | - | let userAddress = addressFromStringValue(userAddressStr) | |
362 | - | if ((i.caller == this)) | |
363 | - | then throw("You can't call yourself") | |
364 | - | else if (if ((pmtAssetIdSWOP != SWOP)) | |
365 | - | then true | |
366 | - | else (pmtAmountSWOP != comissionForInitalization)) | |
367 | - | then throw("You need to attach 10 SWOP tokens") | |
368 | - | else if (if (!(isAllowedAsset(pmtAssetId1))) | |
369 | - | then !(isAllowedAsset(pmtAssetId2)) | |
370 | - | else false) | |
371 | - | then throw("One of assets must be USDN, WAVES or SWOP") | |
372 | - | else if (if ((userScriptHash != value(getBinary(oracle, kOracleScriptHash)))) | |
373 | - | then true | |
374 | - | else !(check)) | |
375 | - | then throw("Unexpected script was found.") | |
376 | - | else if (isDefined(getBoolean(this, kActive))) | |
377 | - | then throwIsActive() | |
378 | - | else if ((pmtAssetId1 == pmtAssetId2)) | |
379 | - | then throw("Assets must be different") | |
380 | - | else { | |
381 | - | let pmtStrAssetId1 = match pmtAssetId1 { | |
382 | - | case id: ByteVector => | |
383 | - | toBase58String(id) | |
384 | - | case waves: Unit => | |
385 | - | "WAVES" | |
386 | - | case _ => | |
387 | - | throw("Match error") | |
388 | - | } | |
389 | - | let pmtStrAssetId2 = match pmtAssetId2 { | |
390 | - | case id: ByteVector => | |
391 | - | toBase58String(id) | |
392 | - | case waves: Unit => | |
393 | - | "WAVES" | |
394 | - | case _ => | |
395 | - | throw("Match error") | |
396 | - | } | |
397 | - | let asset1Priority = valueOrElse(getInteger(oracle, (kOracleAssetPriority + pmtStrAssetId1)), 999999) | |
398 | - | let asset2Priority = valueOrElse(getInteger(oracle, (kOracleAssetPriority + pmtStrAssetId2)), 999999) | |
399 | - | let $t01151111738 = if ((asset2Priority > asset1Priority)) | |
400 | - | then $Tuple4(pmtAmount2, pmtAssetId2, pmtAmount1, pmtAssetId1) | |
401 | - | else $Tuple4(pmtAmount1, pmtAssetId1, pmtAmount2, pmtAssetId2) | |
402 | - | let pmtAmountA = $t01151111738._1 | |
403 | - | let pmtAssetIdA = $t01151111738._2 | |
404 | - | let pmtAmountB = $t01151111738._3 | |
405 | - | let pmtAssetIdB = $t01151111738._4 | |
406 | - | let $t01174711824 = getAssetInfo(pmtAssetIdA) | |
407 | - | let pmtStrAssetIdA = $t01174711824._1 | |
408 | - | let pmtAssetNameA = $t01174711824._2 | |
409 | - | let pmtDecimalsA = $t01174711824._3 | |
410 | - | let $t01183311910 = getAssetInfo(pmtAssetIdB) | |
411 | - | let pmtStrAssetIdB = $t01183311910._1 | |
412 | - | let pmtAssetNameB = $t01183311910._2 | |
413 | - | let pmtDecimalsB = $t01183311910._3 | |
414 | - | let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7)) | |
415 | - | let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this)) | |
416 | - | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
417 | - | let shareInitialSupply = fraction(pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, DOWN), pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, DOWN), pow(10, 0, shareDecimals, 0, 0, DOWN)) | |
418 | - | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
419 | - | let shareIssueId = calculateAssetId(shareIssue) | |
420 | - | let invariantCalculated = invariantCalc(pmtAmountA, pmtAmountB) | |
421 | - | [StringEntry(kVersion, version), BooleanEntry(kActive, true), StringEntry(kAssetIdA, pmtStrAssetIdA), StringEntry(kAssetIdB, pmtStrAssetIdB), IntegerEntry(kBalanceA, pmtAmountA), IntegerEntry(kBalanceB, pmtAmountB), IntegerEntry(kInvariant, invariantCalculated), IntegerEntry(kFee, fee), IntegerEntry(kFeeScaleDelimiter, feeScale6), IntegerEntry(kInitPoolHeight, height), shareIssue, StringEntry(kShareAssetId, toBase58String(shareIssueId)), IntegerEntry(kShareAssetSupply, shareInitialSupply), ScriptTransfer(userAddress, shareInitialSupply, shareIssueId), ScriptTransfer(walletAddress, comissionForInitalization, SWOP)] | |
422 | - | } | |
343 | + | func init () = { | |
344 | + | let $t01003410111 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
345 | + | let pmtAmountA = $t01003410111._1 | |
346 | + | let pmtAssetIdA = $t01003410111._2 | |
347 | + | let $t01011610193 = $Tuple2(i.payments[1].amount, i.payments[1].assetId) | |
348 | + | let pmtAmountB = $t01011610193._1 | |
349 | + | let pmtAssetIdB = $t01011610193._2 | |
350 | + | let $t01019810275 = getAssetInfo(pmtAssetIdA) | |
351 | + | let pmtStrAssetIdA = $t01019810275._1 | |
352 | + | let pmtAssetNameA = $t01019810275._2 | |
353 | + | let pmtDecimalsA = $t01019810275._3 | |
354 | + | let $t01028010357 = getAssetInfo(pmtAssetIdB) | |
355 | + | let pmtStrAssetIdB = $t01028010357._1 | |
356 | + | let pmtAssetNameB = $t01028010357._2 | |
357 | + | let pmtDecimalsB = $t01028010357._3 | |
358 | + | if (isDefined(getBoolean(this, kActive))) | |
359 | + | then throwIsActive() | |
360 | + | else if ((pmtAssetIdA == pmtAssetIdB)) | |
361 | + | then throw("Assets must be different") | |
362 | + | else { | |
363 | + | let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7)) | |
364 | + | let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this)) | |
365 | + | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
366 | + | let shareInitialSupply = fraction(pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, DOWN), pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, DOWN), pow(10, 0, shareDecimals, 0, 0, DOWN)) | |
367 | + | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
368 | + | let shareIssueId = calculateAssetId(shareIssue) | |
369 | + | let invariantCalculated = invariantCalc(pmtAmountA, pmtAmountB) | |
370 | + | let stake1 = if (containsElement(stakingAssets, pmtStrAssetIdA)) | |
371 | + | then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
372 | + | else 0 | |
373 | + | if ((stake1 == stake1)) | |
374 | + | then { | |
375 | + | let stake2 = if (containsElement(stakingAssets, pmtStrAssetIdB)) | |
376 | + | then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
377 | + | else 0 | |
378 | + | if ((stake2 == stake2)) | |
379 | + | then [StringEntry(kVersion, version), BooleanEntry(kActive, true), StringEntry(kAssetIdA, pmtStrAssetIdA), StringEntry(kAssetIdB, pmtStrAssetIdB), IntegerEntry(kBalanceA, pmtAmountA), IntegerEntry(kBalanceB, pmtAmountB), IntegerEntry(kInvariant, invariantCalculated), IntegerEntry(kFee, fee), IntegerEntry(kFeeScaleDelimiter, feeScale6), shareIssue, StringEntry(kShareAssetId, toBase58String(shareIssueId)), IntegerEntry(kShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareIssueId)] | |
380 | + | else throw("Strict value is not equal to itself.") | |
381 | + | } | |
382 | + | else throw("Strict value is not equal to itself.") | |
383 | + | } | |
423 | 384 | } | |
424 | 385 | ||
425 | 386 | ||
426 | 387 | ||
427 | 388 | @Callable(i) | |
428 | - | func keepLimitForFirstHarvest (shareLimit) = if (!(isActive)) | |
429 | - | then throw("DApp is inactive at this moment") | |
430 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, admStaking], i.callerPublicKey))) | |
431 | - | then throw("Only admin can call this function") | |
432 | - | else [IntegerEntry(kShareLimit, shareLimit)] | |
389 | + | func replenishWithTwoTokens () = valueOrElse(isActive(), { | |
390 | + | let pmtAssetIdA = i.payments[0].assetId | |
391 | + | let pmtAssetIdB = i.payments[1].assetId | |
392 | + | let ratioShareTokensInA = fraction(scale8, i.payments[0].amount, balanceA) | |
393 | + | let ratioShareTokensInB = fraction(scale8, i.payments[1].amount, balanceB) | |
394 | + | let $t01293813015 = getAssetInfo(pmtAssetIdA) | |
395 | + | let pmtStrAssetIdA = $t01293813015._1 | |
396 | + | let pmtAssetNameA = $t01293813015._2 | |
397 | + | let pmtDecimalsA = $t01293813015._3 | |
398 | + | let $t01302013137 = getAssetInfo(pmtAssetIdB) | |
399 | + | let pmtStrAssetIdB = $t01302013137._1 | |
400 | + | let pmtAssetNameB = $t01302013137._2 | |
401 | + | let pmtDecimalsB = $t01302013137._3 | |
402 | + | let $t01314213646 = if ((ratioShareTokensInB > ratioShareTokensInA)) | |
403 | + | then { | |
404 | + | let pmt = fraction(balanceB, ratioShareTokensInA, scale8, CEILING) | |
405 | + | $Tuple5(i.payments[0].amount, pmt, (i.payments[1].amount - pmt), pmtAssetIdB, ratioShareTokensInA) | |
406 | + | } | |
407 | + | else { | |
408 | + | let pmt = fraction(balanceB, ratioShareTokensInA, scale8, CEILING) | |
409 | + | $Tuple5(pmt, i.payments[1].amount, (i.payments[0].amount - pmt), pmtAssetIdA, ratioShareTokensInB) | |
410 | + | } | |
411 | + | let pmtAmountA = $t01314213646._1 | |
412 | + | let pmtAmountB = $t01314213646._2 | |
413 | + | let change = $t01314213646._3 | |
414 | + | let changeAssetId = $t01314213646._4 | |
415 | + | let shareTokenRatio = $t01314213646._5 | |
416 | + | let shareTokenToPayAmount = fraction(shareTokenRatio, shareAssetSupply, scale8) | |
417 | + | if ((size(i.payments) != 2)) | |
418 | + | then throw("Two attached assets expected") | |
419 | + | else if (if ((pmtAssetIdA != assetIdA)) | |
420 | + | then true | |
421 | + | else (pmtAssetIdB != assetIdB)) | |
422 | + | then throwAssets() | |
423 | + | else if ((shareTokenToPayAmount == 0)) | |
424 | + | then throw("Too small amount to replenish") | |
425 | + | else if ((0 > change)) | |
426 | + | then throw("Change < 0") | |
427 | + | else if (!(hasEnoughBalance)) | |
428 | + | then ([ScriptTransfer(i.caller, pmtAmountA, pmtAssetIdA), ScriptTransfer(i.caller, pmtAmountB, pmtAssetIdB)] ++ suspendSuspicious()) | |
429 | + | else { | |
430 | + | let stake1 = if (containsElement(stakingAssets, pmtStrAssetIdA)) | |
431 | + | then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
432 | + | else 0 | |
433 | + | if ((stake1 == stake1)) | |
434 | + | then { | |
435 | + | let stake2 = if (containsElement(stakingAssets, pmtStrAssetIdB)) | |
436 | + | then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
437 | + | else 0 | |
438 | + | if ((stake2 == stake2)) | |
439 | + | then [IntegerEntry(kBalanceA, (balanceA + pmtAmountA)), IntegerEntry(kBalanceB, (balanceB + pmtAmountB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(kInvariant, invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB))), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), ScriptTransfer(i.caller, change, changeAssetId)] | |
440 | + | else throw("Strict value is not equal to itself.") | |
441 | + | } | |
442 | + | else throw("Strict value is not equal to itself.") | |
443 | + | } | |
444 | + | }) | |
433 | 445 | ||
434 | 446 | ||
435 | 447 | ||
436 | 448 | @Callable(i) | |
437 | - | func replenishWithTwoTokens (slippageTolerance) = { | |
438 | - | let pmtAssetIdA = i.payments[0].assetId | |
439 | - | let pmtAssetIdB = i.payments[1].assetId | |
440 | - | let pmtAmountA = deductStakingFee(i.payments[0].amount, pmtAssetIdA) | |
441 | - | let pmtAmountB = deductStakingFee(i.payments[1].amount, pmtAssetIdB) | |
442 | - | let tokenRatio = fraction(fraction(scale8, balanceA, pmtAmountA), scale3, fraction(scale8, balanceB, pmtAmountB)) | |
443 | - | let ratioShareTokensInA = fraction(scale8, pmtAmountA, balanceA) | |
444 | - | let ratioShareTokensInB = fraction(scale8, pmtAmountB, balanceB) | |
445 | - | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8) | |
446 | - | let invariantCalculated = invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB)) | |
447 | - | if (!(isActive)) | |
448 | - | then throwIsInactive() | |
449 | - | else if (if ((0 > slippageTolerance)) | |
450 | - | then true | |
451 | - | else (slippageTolerance > 10)) | |
452 | - | then throw("Slippage tolerance must be <= 1%") | |
453 | - | else if ((size(i.payments) != 2)) | |
454 | - | then throw("Two attached assets expected") | |
455 | - | else if (if ((pmtAssetIdA != assetIdA)) | |
456 | - | then true | |
457 | - | else (pmtAssetIdB != assetIdB)) | |
458 | - | then throwAssets() | |
459 | - | else if (if ((((scale3 * (slippageScale3 - slippageTolerance)) / slippageScale3) > tokenRatio)) | |
460 | - | then true | |
461 | - | else (tokenRatio > ((scale3 * (slippageScale3 + slippageTolerance)) / slippageScale3))) | |
462 | - | then throw("Incorrect assets amount: amounts must have the contract ratio") | |
463 | - | else if ((shareTokenToPayAmount == 0)) | |
464 | - | then throw("Too small amount to replenish") | |
465 | - | else if (!(hasEnoughBalance)) | |
466 | - | then ([ScriptTransfer(i.caller, pmtAmountA, pmtAssetIdA), ScriptTransfer(i.caller, pmtAmountB, pmtAssetIdB)] ++ suspendSuspicious()) | |
467 | - | else [IntegerEntry(kBalanceA, (balanceA + pmtAmountA)), IntegerEntry(kBalanceB, (balanceB + pmtAmountB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(kInvariant, invariantCalculated), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)] | |
468 | - | } | |
469 | - | ||
470 | - | ||
471 | - | ||
472 | - | @Callable(i) | |
473 | - | func replenishWithOneToken (virtualSwapTokenPay,virtualSwapTokenGet) = { | |
474 | - | let $t01658816663 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
475 | - | let pmtAmount = $t01658816663._1 | |
476 | - | let pmtAssetId = $t01658816663._2 | |
449 | + | func replenishWithOneToken (virtualSwapTokenPay,virtualSwapTokenGet) = valueOrElse(isActive(), { | |
450 | + | let $t01529515370 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
451 | + | let pmtAmount = $t01529515370._1 | |
452 | + | let pmtAssetId = $t01529515370._2 | |
453 | + | let $t01537515448 = getAssetInfo(pmtAssetId) | |
454 | + | let pmtStrAssetId = $t01537515448._1 | |
455 | + | let pmtAssetName = $t01537515448._2 | |
456 | + | let pmtDecimals = $t01537515448._3 | |
477 | 457 | let pmtMinThreshold = 5000000 | |
478 | 458 | let thresholdValueForMinTolerance = 50000000 | |
479 | 459 | let tolerance = if ((thresholdValueForMinTolerance > pmtAmount)) | |
482 | 462 | let slippageValueMinForReplenish = (scale8 - ((scale8 * tolerance) / 10000000)) | |
483 | 463 | let slippageValueMaxForReplenish = (scale8 + ((scale8 * tolerance) / 10000000)) | |
484 | 464 | let slippageValueMinForSwap = (scale8 - ((scale8 * 1) / 10000000)) | |
485 | - | if (!(isActive)) | |
486 | - | then throwIsInactive() | |
487 | - | else if ((pmtMinThreshold > pmtAmount)) | |
488 | - | then throw((((("Payment amount " + toString(pmtAmount)) + " does not exceed the minimum amount of ") + toString(pmtMinThreshold)) + " tokens")) | |
465 | + | if ((pmtMinThreshold > pmtAmount)) | |
466 | + | then throw((((("Payment amount " + toString(pmtAmount)) + " does not exceed the minimum amount of ") + toString(pmtMinThreshold)) + " tokens")) | |
467 | + | else if ((size(i.payments) != 1)) | |
468 | + | then throwOnePayment() | |
469 | + | else if (!(hasEnoughBalance)) | |
470 | + | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
471 | + | else if (if ((pmtAssetId != assetIdA)) | |
472 | + | then (pmtAssetId != assetIdB) | |
473 | + | else false) | |
474 | + | then throwAssets() | |
475 | + | else { | |
476 | + | let $t01638617151 = if ((pmtAssetId == assetIdA)) | |
477 | + | then $Tuple7((pmtAmount - virtualSwapTokenPay), virtualSwapTokenGet, (balanceA + virtualSwapTokenPay), (balanceB - virtualSwapTokenGet), invariantCalc((balanceA + pmtAmount), balanceB), (balanceA + pmtAmount), balanceB) | |
478 | + | else $Tuple7(virtualSwapTokenGet, (pmtAmount - virtualSwapTokenPay), (balanceA - virtualSwapTokenGet), (balanceB + virtualSwapTokenPay), invariantCalc(balanceA, (balanceB + pmtAmount)), balanceA, (balanceB + pmtAmount)) | |
479 | + | let virtualReplenishA = $t01638617151._1 | |
480 | + | let virtualReplenishB = $t01638617151._2 | |
481 | + | let balanceAfterSwapA = $t01638617151._3 | |
482 | + | let balanceAfterSwapB = $t01638617151._4 | |
483 | + | let invariantCalculated = $t01638617151._5 | |
484 | + | let newBalanceA = $t01638617151._6 | |
485 | + | let newBalanceB = $t01638617151._7 | |
486 | + | let newBalanceEntry = if ((pmtAssetId == assetIdA)) | |
487 | + | then IntegerEntry(kBalanceA, newBalanceA) | |
488 | + | else IntegerEntry(kBalanceB, newBalanceB) | |
489 | + | let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB) | |
490 | + | let invariantEstimatedRatio = fraction(scale8, invariant, invariantNew) | |
491 | + | let ratioVirtualBalanceToVirtualReplenish = (fraction((scale8 * scale8), balanceAfterSwapA, balanceAfterSwapB) / fraction(scale8, virtualReplenishA, virtualReplenishB)) | |
492 | + | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2)) | |
493 | + | if (if ((slippageValueMinForSwap >= invariantEstimatedRatio)) | |
494 | + | then true | |
495 | + | else (invariant > invariantNew)) | |
496 | + | then throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value") | |
497 | + | else if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish)) | |
498 | + | then true | |
499 | + | else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish)) | |
500 | + | then throw("Swap with virtualSwapTokenPay and virtualSwapTokenGet is possible, but ratio after virtual swap is incorrect") | |
501 | + | else if (if ((dAppThresholdAmount > newBalanceA)) | |
502 | + | then true | |
503 | + | else (dAppThresholdAmount > newBalanceB)) | |
504 | + | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
505 | + | else { | |
506 | + | let stake1 = if (containsElement(stakingAssets, pmtStrAssetId)) | |
507 | + | then invoke(this, "stakeUnstake", [true, pmtAmount, pmtStrAssetId], nil) | |
508 | + | else 0 | |
509 | + | if ((stake1 == stake1)) | |
510 | + | then { | |
511 | + | let ratioShareTokensInA = fraction(virtualReplenishA, scale8, balanceAfterSwapA) | |
512 | + | let ratioShareTokensInB = fraction(virtualReplenishB, scale8, balanceAfterSwapB) | |
513 | + | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8) | |
514 | + | [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), newBalanceEntry, IntegerEntry(kInvariant, invariantCalculated)] | |
515 | + | } | |
516 | + | else throw("Strict value is not equal to itself.") | |
517 | + | } | |
518 | + | } | |
519 | + | }) | |
520 | + | ||
521 | + | ||
522 | + | ||
523 | + | @Callable(i) | |
524 | + | func withdraw () = valueOrElse(isActive(), { | |
525 | + | let $t01940119544 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
526 | + | let pmtAmount = $t01940119544._1 | |
527 | + | let pmtAssetId = $t01940119544._2 | |
528 | + | let amountToPayA = fraction(pmtAmount, balanceA, shareAssetSupply) | |
529 | + | let amountToPayB = fraction(pmtAmount, balanceB, shareAssetSupply) | |
530 | + | let invariantCalculated = invariantCalc((balanceA - amountToPayA), (balanceB - amountToPayB)) | |
531 | + | if ((size(i.payments) != 1)) | |
532 | + | then throwOnePayment() | |
533 | + | else if ((pmtAssetId != shareAssetId)) | |
534 | + | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
535 | + | else if (!(hasEnoughBalance)) | |
536 | + | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
537 | + | else { | |
538 | + | let stake1 = if (containsElement(stakingAssets, strAssetIdA)) | |
539 | + | then invoke(this, "stakeUnstake", [false, amountToPayA, strAssetIdA], nil) | |
540 | + | else 0 | |
541 | + | if ((stake1 == stake1)) | |
542 | + | then { | |
543 | + | let stake2 = if (containsElement(stakingAssets, strAssetIdB)) | |
544 | + | then invoke(this, "stakeUnstake", [false, amountToPayB, strAssetIdB], nil) | |
545 | + | else 0 | |
546 | + | if ((stake2 == stake2)) | |
547 | + | then [IntegerEntry(kBalanceA, (balanceA - amountToPayA)), IntegerEntry(kBalanceB, (balanceB - amountToPayB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply - pmtAmount)), IntegerEntry(kInvariant, invariantCalculated), Burn(shareAssetId, pmtAmount), ScriptTransfer(i.caller, amountToPayA, assetIdA), ScriptTransfer(i.caller, amountToPayB, assetIdB)] | |
548 | + | else throw("Strict value is not equal to itself.") | |
549 | + | } | |
550 | + | else throw("Strict value is not equal to itself.") | |
551 | + | } | |
552 | + | }) | |
553 | + | ||
554 | + | ||
555 | + | ||
556 | + | @Callable(i) | |
557 | + | func exchange (estimatedAmountToReceive,minAmountToReceive) = valueOrElse(isActive(), { | |
558 | + | let $t02100721082 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
559 | + | let pmtAmount = $t02100721082._1 | |
560 | + | let pmtAssetId = $t02100721082._2 | |
561 | + | if ((0 >= estimatedAmountToReceive)) | |
562 | + | then throw(("Estimated amount must be positive. Actual: " + toString(estimatedAmountToReceive))) | |
563 | + | else if ((minAmountToReceive > estimatedAmountToReceive)) | |
564 | + | then throw(((("Minimal amount can't be greater than estimated. Estimated: " + toString(estimatedAmountToReceive)) + ". Minimal: ") + toString(minAmountToReceive))) | |
489 | 565 | else if ((size(i.payments) != 1)) | |
490 | - | then | |
566 | + | then throwOnePayment() | |
491 | 567 | else if (!(hasEnoughBalance)) | |
492 | 568 | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
493 | 569 | else if (if ((pmtAssetId != assetIdA)) | |
494 | 570 | then (pmtAssetId != assetIdB) | |
495 | 571 | else false) | |
496 | 572 | then throwAssets() | |
497 | - | else { | |
498 | - | let $t01767518440 = if ((pmtAssetId == assetIdA)) | |
499 | - | then $Tuple7((pmtAmount - virtualSwapTokenPay), virtualSwapTokenGet, (balanceA + virtualSwapTokenPay), (balanceB - virtualSwapTokenGet), invariantCalc((balanceA + pmtAmount), balanceB), (balanceA + pmtAmount), balanceB) | |
500 | - | else $Tuple7(virtualSwapTokenGet, (pmtAmount - virtualSwapTokenPay), (balanceA - virtualSwapTokenGet), (balanceB + virtualSwapTokenPay), invariantCalc(balanceA, (balanceB + pmtAmount)), balanceA, (balanceB + pmtAmount)) | |
501 | - | let virtualReplenishA = $t01767518440._1 | |
502 | - | let virtualReplenishB = $t01767518440._2 | |
503 | - | let balanceAfterSwapA = $t01767518440._3 | |
504 | - | let balanceAfterSwapB = $t01767518440._4 | |
505 | - | let invariantCalculated = $t01767518440._5 | |
506 | - | let newBalanceA = $t01767518440._6 | |
507 | - | let newBalanceB = $t01767518440._7 | |
508 | - | let newBalanceEntry = if ((pmtAssetId == assetIdA)) | |
509 | - | then IntegerEntry(kBalanceA, newBalanceA) | |
510 | - | else IntegerEntry(kBalanceB, newBalanceB) | |
511 | - | let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB) | |
512 | - | let invariantEstimatedRatio = fraction(scale8, invariant, invariantNew) | |
513 | - | let ratioVirtualBalanceToVirtualReplenish = (fraction((scale8 * scale8), balanceAfterSwapA, balanceAfterSwapB) / fraction(scale8, virtualReplenishA, virtualReplenishB)) | |
514 | - | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2)) | |
515 | - | if (if ((slippageValueMinForSwap >= invariantEstimatedRatio)) | |
573 | + | else if ((10000000 > pmtAmount)) | |
574 | + | then throw("Only swap of 10.000000 or more tokens is allowed") | |
575 | + | else if (if ((exchangeRatioLimitMin > fraction(scale8, minAmountToReceive, pmtAmount))) | |
516 | 576 | then true | |
517 | - | else (invariant > invariantNew)) | |
518 | - | then throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value") | |
519 | - | else if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish)) | |
520 | - | then true | |
521 | - | else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish)) | |
522 | - | then throw("Swap with virtualSwapTokenPay and virtualSwapTokenGet is possible, but ratio after virtual swap is incorrect") | |
523 | - | else if (if ((dAppThresholdAmount > newBalanceA)) | |
577 | + | else (fraction(scale8, estimatedAmountToReceive, pmtAmount) > exchangeRatioLimitMax)) | |
578 | + | then throw("Incorrect args and pmt ratio") | |
579 | + | else { | |
580 | + | let sendAssetId = if ((pmtAssetId == assetIdA)) | |
581 | + | then assetIdB | |
582 | + | else assetIdA | |
583 | + | let $t02217322292 = calculateSendAmount(estimatedAmountToReceive, minAmountToReceive, pmtAmount, pmtAssetId) | |
584 | + | let amount = $t02217322292._1 | |
585 | + | let amountInvarian = $t02217322292._2 | |
586 | + | let governanceReward = fraction(amount, feeGovernance, feeScale6) | |
587 | + | let amountMinusFee = fraction(amount, (feeScale6 - fee), feeScale6) | |
588 | + | let $t02244822710 = if ((pmtAssetId == assetIdA)) | |
589 | + | then $Tuple2((balanceA + pmtAmount), ((balanceB - amountMinusFee) - governanceReward)) | |
590 | + | else $Tuple2(((balanceA - amountMinusFee) - governanceReward), (balanceB + pmtAmount)) | |
591 | + | let newBalanceA = $t02244822710._1 | |
592 | + | let newBalanceB = $t02244822710._2 | |
593 | + | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2)) | |
594 | + | if (if ((dAppThresholdAmount > newBalanceA)) | |
524 | 595 | then true | |
525 | 596 | else (dAppThresholdAmount > newBalanceB)) | |
526 | 597 | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
527 | 598 | else { | |
528 | - | let ratioShareTokensInA = fraction(deductStakingFee(virtualReplenishA, assetIdA), scale8, balanceAfterSwapA) | |
529 | - | let ratioShareTokensInB = fraction(deductStakingFee(virtualReplenishB, assetIdB), scale8, balanceAfterSwapB) | |
530 | - | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8) | |
531 | - | [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), newBalanceEntry, IntegerEntry(kInvariant, invariantCalculated)] | |
599 | + | let $t02300823081 = getAssetInfo(pmtAssetId) | |
600 | + | let pmtStrAssetId = $t02300823081._1 | |
601 | + | let pmtAssetName = $t02300823081._2 | |
602 | + | let pmtDecimals = $t02300823081._3 | |
603 | + | let $t02309423171 = getAssetInfo(sendAssetId) | |
604 | + | let sendStrAssetId = $t02309423171._1 | |
605 | + | let sendAssetName = $t02309423171._2 | |
606 | + | let sendDecimals = $t02309423171._3 | |
607 | + | let stake1 = if (containsElement(stakingAssets, pmtStrAssetId)) | |
608 | + | then invoke(this, "stakeUnstake", [true, pmtAmount, pmtStrAssetId], nil) | |
609 | + | else 0 | |
610 | + | if ((stake1 == stake1)) | |
611 | + | then { | |
612 | + | let stake2 = if (containsElement(stakingAssets, sendStrAssetId)) | |
613 | + | then invoke(this, "stakeUnstake", [false, (amountMinusFee + governanceReward), sendStrAssetId], nil) | |
614 | + | else 0 | |
615 | + | if ((stake2 == stake2)) | |
616 | + | then [IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, amountInvarian), ScriptTransfer(i.caller, amountMinusFee, sendAssetId), ScriptTransfer(walletAddress, governanceReward, sendAssetId)] | |
617 | + | else throw("Strict value is not equal to itself.") | |
618 | + | } | |
619 | + | else throw("Strict value is not equal to itself.") | |
532 | 620 | } | |
533 | - | } | |
534 | - | } | |
621 | + | } | |
622 | + | }) | |
535 | 623 | ||
536 | 624 | ||
537 | 625 | ||
538 | 626 | @Callable(i) | |
539 | - | func withdraw () = { | |
540 | - | let $t02058520728 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
541 | - | let pmtAmount = $t02058520728._1 | |
542 | - | let pmtAssetId = $t02058520728._2 | |
543 | - | let amountToPayA = deductStakingFee(fraction(pmtAmount, balanceA, shareAssetSupply), assetIdA) | |
544 | - | let amountToPayB = deductStakingFee(fraction(pmtAmount, balanceB, shareAssetSupply), assetIdB) | |
545 | - | let invariantCalculated = invariantCalc((balanceA - amountToPayA), (balanceB - amountToPayB)) | |
546 | - | if (!(isActive)) | |
547 | - | then throwIsInactive() | |
548 | - | else if ((size(i.payments) != 1)) | |
549 | - | then throw("One attached payment expected") | |
550 | - | else if ((pmtAssetId != shareAssetId)) | |
551 | - | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
552 | - | else if (!(hasEnoughBalance)) | |
553 | - | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
554 | - | else if (if ((amountToPayA > availableBalanceA)) | |
555 | - | then true | |
556 | - | else (amountToPayB > availableBalanceB)) | |
557 | - | then throwInsufficientAvailableBalances(amountToPayA, amountToPayB) | |
558 | - | else [IntegerEntry(kBalanceA, (balanceA - amountToPayA)), IntegerEntry(kBalanceB, (balanceB - amountToPayB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply - pmtAmount)), IntegerEntry(kInvariant, invariantCalculated), Burn(shareAssetId, pmtAmount), ScriptTransfer(i.caller, amountToPayA, assetIdA), ScriptTransfer(i.caller, amountToPayB, assetIdB)] | |
559 | - | } | |
627 | + | func shutdown () = valueOrElse(isAdminCall(i), if (!(active)) | |
628 | + | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
629 | + | else suspend("Paused by admin")) | |
560 | 630 | ||
561 | 631 | ||
562 | 632 | ||
563 | 633 | @Callable(i) | |
564 | - | func exchange (estimatedAmountToReceive,minAmountToReceive) = { | |
565 | - | let $t02208622161 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
566 | - | let pmtAmount = $t02208622161._1 | |
567 | - | let pmtAssetId = $t02208622161._2 | |
568 | - | if (!(isActive)) | |
569 | - | then throwIsInactive() | |
570 | - | else if ((0 >= estimatedAmountToReceive)) | |
571 | - | then throw(("Estimated amount must be positive. Actual: " + toString(estimatedAmountToReceive))) | |
572 | - | else if ((minAmountToReceive > estimatedAmountToReceive)) | |
573 | - | then throw(((("Minimal amount can't be greater than estimated. Estimated: " + toString(estimatedAmountToReceive)) + ". Minimal: ") + toString(minAmountToReceive))) | |
574 | - | else if ((size(i.payments) != 1)) | |
575 | - | then throw("One attached payment expected") | |
576 | - | else if (!(hasEnoughBalance)) | |
577 | - | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
578 | - | else if (if ((pmtAssetId != assetIdA)) | |
579 | - | then (pmtAssetId != assetIdB) | |
580 | - | else false) | |
581 | - | then throwAssets() | |
582 | - | else if ((10000000 > pmtAmount)) | |
583 | - | then throw("Only swap of 10.000000 or more tokens is allowed") | |
584 | - | else if (if ((exchangeRatioLimitMin > fraction(scale8, minAmountToReceive, pmtAmount))) | |
585 | - | then true | |
586 | - | else (fraction(scale8, estimatedAmountToReceive, pmtAmount) > exchangeRatioLimitMax)) | |
587 | - | then throw("Incorrect args and pmt ratio") | |
588 | - | else { | |
589 | - | let sendAssetId = if ((pmtAssetId == assetIdA)) | |
590 | - | then assetIdB | |
591 | - | else assetIdA | |
592 | - | let amount = calculateSendAmount(estimatedAmountToReceive, minAmountToReceive, pmtAmount, pmtAssetId) | |
593 | - | let governanceReward = fraction(amount, feeGovernance, feeScale6) | |
594 | - | let amountMinusFee = fraction(amount, (feeScale6 - fee), feeScale6) | |
595 | - | let $t02358323845 = if ((pmtAssetId == assetIdA)) | |
596 | - | then $Tuple2((balanceA + pmtAmount), ((balanceB - amountMinusFee) - governanceReward)) | |
597 | - | else $Tuple2(((balanceA - amountMinusFee) - governanceReward), (balanceB + pmtAmount)) | |
598 | - | let newBalanceA = $t02358323845._1 | |
599 | - | let newBalanceB = $t02358323845._2 | |
600 | - | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2)) | |
601 | - | if (if ((dAppThresholdAmount > newBalanceA)) | |
602 | - | then true | |
603 | - | else (dAppThresholdAmount > newBalanceB)) | |
604 | - | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
605 | - | else if (if (if ((assetIdA == USDN)) | |
606 | - | then (sendAssetId == assetIdA) | |
607 | - | else false) | |
608 | - | then (stakedAmountUSDN >= newBalanceA) | |
609 | - | else false) | |
610 | - | then throwInsufficientAvailableBalance(amountMinusFee, availableBalanceA, assetNameA) | |
611 | - | else if (if (if ((assetIdB == USDN)) | |
612 | - | then (sendAssetId == assetIdB) | |
613 | - | else false) | |
614 | - | then (stakedAmountUSDN >= newBalanceB) | |
615 | - | else false) | |
616 | - | then throwInsufficientAvailableBalance(amountMinusFee, availableBalanceB, assetNameB) | |
617 | - | else [IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, invariantCalc(newBalanceA, newBalanceB)), ScriptTransfer(i.caller, amountMinusFee, sendAssetId), ScriptTransfer(walletAddress, governanceReward, sendAssetId)] | |
618 | - | } | |
619 | - | } | |
634 | + | func activate () = valueOrElse(isAdminCall(i), if (active) | |
635 | + | then throwIsActive() | |
636 | + | else [BooleanEntry(kActive, true), DeleteEntry(kCause)]) | |
620 | 637 | ||
621 | 638 | ||
622 | 639 | ||
623 | 640 | @Callable(i) | |
624 | - | func shutdown () = if (!(isActive)) | |
625 | - | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
626 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, admStartStop], i.callerPublicKey))) | |
627 | - | then throwOnlyAdmin() | |
628 | - | else suspend("Paused by admin") | |
641 | + | func takeIntoAccountExtraFunds () = valueOrElse(isActive(), { | |
642 | + | let amountEnrollA = (accountBalanceWithStakedA - balanceA) | |
643 | + | let amountEnrollB = (accountBalanceWithStakedB - balanceB) | |
644 | + | let invariantNew = invariantCalc((balanceA + amountEnrollA), (balanceB + amountEnrollB)) | |
645 | + | if ((i.caller != walletAddress)) | |
646 | + | then throw("Only the wallet can call this function") | |
647 | + | else if (if ((0 > amountEnrollA)) | |
648 | + | then true | |
649 | + | else (0 > amountEnrollB)) | |
650 | + | then suspend("Enroll amount negative") | |
651 | + | else if (if ((amountEnrollA == 0)) | |
652 | + | then (amountEnrollB == 0) | |
653 | + | else false) | |
654 | + | then throw("No money to take") | |
655 | + | else { | |
656 | + | let stake1 = if (if (containsElement(stakingAssets, strAssetIdA)) | |
657 | + | then (amountEnrollA > 0) | |
658 | + | else false) | |
659 | + | then invoke(this, "stakeUnstake", [true, amountEnrollA, strAssetIdA], nil) | |
660 | + | else 0 | |
661 | + | if ((stake1 == stake1)) | |
662 | + | then { | |
663 | + | let stake2 = if (if (containsElement(stakingAssets, strAssetIdB)) | |
664 | + | then (amountEnrollB > 0) | |
665 | + | else false) | |
666 | + | then invoke(this, "stakeUnstake", [true, amountEnrollB, strAssetIdB], nil) | |
667 | + | else 0 | |
668 | + | if ((stake2 == stake2)) | |
669 | + | then [IntegerEntry(kInvariant, invariantNew), IntegerEntry(kBalanceA, (balanceA + amountEnrollA)), IntegerEntry(kBalanceB, (balanceB + amountEnrollB)), IntegerEntry(("last_income_" + strAssetIdA), amountEnrollA), IntegerEntry(("last_income_" + strAssetIdB), amountEnrollB)] | |
670 | + | else throw("Strict value is not equal to itself.") | |
671 | + | } | |
672 | + | else throw("Strict value is not equal to itself.") | |
673 | + | } | |
674 | + | }) | |
629 | 675 | ||
630 | 676 | ||
631 | 677 | ||
632 | 678 | @Callable(i) | |
633 | - | func activate () = if (isActive) | |
634 | - | then throwIsActive() | |
635 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, admStartStop], i.callerPublicKey))) | |
636 | - | then throwOnlyAdmin() | |
637 | - | else [BooleanEntry(kActive, true), DeleteEntry(kCause)] | |
638 | - | ||
639 | - | ||
640 | - | ||
641 | - | @Callable(i) | |
642 | - | func enableFirstHarvest () = [BooleanEntry(kFirstHarvest, true), IntegerEntry(kFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))] | |
643 | - | ||
644 | - | ||
645 | - | ||
646 | - | @Callable(i) | |
647 | - | func takeIntoAccountExtraFunds (amountLeave) = { | |
648 | - | let uncountableA = (accountBalanceWithStakedA - balanceA) | |
649 | - | let uncountableB = (accountBalanceWithStakedB - balanceB) | |
650 | - | let amountEnrollA = (uncountableA - (if ((assetIdA == unit)) | |
651 | - | then amountLeave | |
652 | - | else 0)) | |
653 | - | let amountEnrollB = (uncountableB - (if ((assetIdB == unit)) | |
654 | - | then amountLeave | |
655 | - | else 0)) | |
656 | - | let invariantNew = invariantCalc((balanceA + amountEnrollA), (balanceB + amountEnrollB)) | |
657 | - | if (!(isActive)) | |
658 | - | then throwIsInactive() | |
659 | - | else if ((i.caller != this)) | |
660 | - | then throwOnlyAdmin() | |
661 | - | else if ((0 > amountLeave)) | |
662 | - | then throw(("Argument 'amountLeave' cannot be negative. Actual: " + toString(amountLeave))) | |
663 | - | else if (if ((0 > uncountableA)) | |
664 | - | then true | |
665 | - | else (0 > uncountableB)) | |
666 | - | then suspend("Enroll amount negative") | |
667 | - | else if (if ((0 > amountEnrollA)) | |
668 | - | then true | |
669 | - | else (0 > amountEnrollB)) | |
670 | - | then throw("Too large amountLeave") | |
671 | - | else [IntegerEntry(kInvariant, invariantNew), IntegerEntry(kBalanceA, (balanceA + amountEnrollA)), IntegerEntry(kBalanceB, (balanceB + amountEnrollB)), IntegerEntry(("last_income_" + strAssetIdA), amountEnrollA), IntegerEntry(("last_income_" + strAssetIdB), amountEnrollB)] | |
672 | - | } | |
679 | + | func stakeUnstake (stake,amount,assetIdString) = if ((i.caller != this)) | |
680 | + | then throw("Only contract itself can invoke this function") | |
681 | + | else { | |
682 | + | let $t02595826061 = calcStakingParams(stake, amount, fromBase58String(assetIdString)) | |
683 | + | let call = $t02595826061._1 | |
684 | + | let addr = $t02595826061._2 | |
685 | + | let params = $t02595826061._3 | |
686 | + | let payments = $t02595826061._4 | |
687 | + | let inv = invoke(addr, call, params, payments) | |
688 | + | if ((inv == inv)) | |
689 | + | then nil | |
690 | + | else throw("Strict value is not equal to itself.") | |
691 | + | } | |
673 | 692 | ||
674 | 693 | ||
675 | 694 | @Verifier(tx) | |
691 | 710 | let callTakeIntoAccount = if ((inv.dApp == this)) | |
692 | 711 | then (inv.function == "takeIntoAccountExtraFunds") | |
693 | 712 | else false | |
694 | - | let callEnableFirstHarvest = if ((inv.dApp == this)) | |
695 | - | then (inv.function == "enableFirstHarvest") | |
696 | - | else false | |
697 | - | let callStaking = if ((inv.dApp == stakingAddress)) | |
698 | - | then if (if (if ((inv.function == "lockNeutrino")) | |
699 | - | then (size(inv.payments) == 1) | |
700 | - | else false) | |
701 | - | then (inv.payments[0].assetId == USDN) | |
702 | - | else false) | |
703 | - | then true | |
704 | - | else if ((inv.function == "unlockNeutrino")) | |
705 | - | then (size(inv.payments) == 0) | |
706 | - | else false | |
707 | - | else false | |
708 | - | let exchangeToWaves = if (if (if ((inv.dApp == USDNToWavesExchanger)) | |
709 | - | then (inv.function == "exchange") | |
710 | - | else false) | |
711 | - | then (assetIdA == USDN) | |
712 | - | else false) | |
713 | - | then true | |
714 | - | else if (if ((assetIdB == USDN)) | |
715 | - | then (size(inv.payments) == 1) | |
716 | - | else false) | |
717 | - | then (inv.payments[0].assetId == USDN) | |
718 | - | else false | |
719 | 713 | let signedByAdmin = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
720 | 714 | then true | |
721 | 715 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey2)) | |
723 | 717 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey3)) | |
724 | 718 | then true | |
725 | 719 | else sigVerify(tx.bodyBytes, tx.proofs[0], admStaking) | |
726 | - | if (if (if (if (if (callTakeIntoAccount) | |
727 | - | then true | |
728 | - | else callEnableFirstHarvest) | |
729 | - | then true | |
730 | - | else callStaking) | |
731 | - | then true | |
732 | - | else exchangeToWaves) | |
720 | + | if (if (callTakeIntoAccount) | |
733 | 721 | then signedByAdmin | |
734 | 722 | else false) | |
735 | 723 | then true |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let version = "2.0.0" | |
5 | 5 | ||
6 | 6 | let kVersion = "version" | |
7 | 7 | ||
8 | 8 | let kActive = "active" | |
9 | 9 | ||
10 | 10 | let kAssetIdA = "A_asset_id" | |
11 | 11 | ||
12 | 12 | let kAssetIdB = "B_asset_id" | |
13 | 13 | ||
14 | 14 | let kBalanceA = "A_asset_balance" | |
15 | 15 | ||
16 | 16 | let kBalanceB = "B_asset_balance" | |
17 | 17 | ||
18 | 18 | let kShareAssetId = "share_asset_id" | |
19 | 19 | ||
20 | 20 | let kShareAssetSupply = "share_asset_supply" | |
21 | 21 | ||
22 | 22 | let kFee = "commission" | |
23 | 23 | ||
24 | 24 | let kFeeScaleDelimiter = "commission_scale_delimiter" | |
25 | 25 | ||
26 | 26 | let kInvariant = "invariant" | |
27 | 27 | ||
28 | 28 | let kCause = "shutdown_cause" | |
29 | 29 | ||
30 | - | let | |
30 | + | let keyUSDNNSBTAddress = "staking_usdnnsbt_address" | |
31 | 31 | ||
32 | - | let kFirstHarvestHeight = "first_harvest_height" | |
33 | - | ||
34 | - | let kShareLimit = "share_limit_on_first_harvest" | |
35 | - | ||
36 | - | let kBasePeriod = "base_period" | |
37 | - | ||
38 | - | let kPeriodLength = "period_length" | |
39 | - | ||
40 | - | let kStartHeight = "start_height" | |
41 | - | ||
42 | - | let kOracleAssetPriority = "asset_priority_" | |
43 | - | ||
44 | - | let kOracleScriptHash = "script_hash_flat" | |
45 | - | ||
46 | - | let kInitPoolHeight = "init_pool_height_" | |
32 | + | let keyEURNAddress = "staking_eurn_address" | |
47 | 33 | ||
48 | 34 | let keyAdminPubKey1 = "admin_pub_1" | |
49 | 35 | ||
50 | 36 | let keyAdminPubKey2 = "admin_pub_2" | |
51 | 37 | ||
52 | 38 | let keyAdminPubKey3 = "admin_pub_3" | |
53 | 39 | ||
54 | 40 | let USDNToWavesExchanger = Address(base58'3N77kfPbQyjXWpDALX3xjKw3iEGMWEctV37') | |
55 | 41 | ||
56 | 42 | let oracle = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
57 | - | ||
58 | - | let walletAddress = Address(base58'3NAGTtZz6WpupSN89NZD5rMZwwziZEg4Kx4') | |
59 | - | ||
60 | - | let votingAddress = Address(base58'3MrJgdL1GniipErHy44YF9idzLaUL2iX5DQ') | |
61 | 43 | ||
62 | 44 | func getAdminPub (keyAdminPub) = match getString(oracle, keyAdminPub) { | |
63 | 45 | case string: String => | |
64 | 46 | fromBase58String(string) | |
65 | 47 | case nothing => | |
66 | 48 | throw("Admin public key is empty") | |
67 | 49 | } | |
68 | 50 | ||
69 | 51 | ||
70 | 52 | let adminPubKey1 = getAdminPub(keyAdminPubKey1) | |
71 | 53 | ||
72 | 54 | let adminPubKey2 = getAdminPub(keyAdminPubKey2) | |
73 | 55 | ||
74 | 56 | let adminPubKey3 = getAdminPub(keyAdminPubKey3) | |
75 | 57 | ||
76 | 58 | let admStartStop = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
77 | 59 | ||
78 | 60 | let admStaking = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
79 | 61 | ||
80 | - | let basePeriod = valueOrErrorMessage(getInteger(votingAddress, kBasePeriod), "Empty kBasePeriod") | |
81 | - | ||
82 | - | let startHeight = valueOrErrorMessage(getInteger(votingAddress, kStartHeight), "Empty kStartHeight") | |
83 | - | ||
84 | - | let periodLength = valueOrErrorMessage(getInteger(votingAddress, kPeriodLength), "Empty kPeriodLength") | |
85 | - | ||
86 | - | let firstHarvestEndPeriod = ((basePeriod + ((height - startHeight) / periodLength)) + 1) | |
87 | - | ||
88 | - | let stakingAddress = Address(base58'3N6q7sCGSSLBUXDdjBdYGTJbZGZfhhh8cNg') | |
62 | + | let walletAddress = Address(base58'3NAGTtZz6WpupSN89NZD5rMZwwziZEg4Kx4') | |
89 | 63 | ||
90 | 64 | let USDN = base58'8UrfDVd5GreeUwm7uPk7eYz1eMv376kzR52C6sANPkwS' | |
91 | 65 | ||
92 | - | let | |
66 | + | let EURN = base58'ECBCkHS68DckpBrzLeoRgYbFg7sCVqR176mPqbXsj9pA' | |
93 | 67 | ||
94 | - | let | |
68 | + | let stakingAssets = [toBase58String(USDN), toBase58String(EURN)] | |
95 | 69 | ||
96 | - | let isActive = getBooleanValue(this, kActive) | |
70 | + | let stakingUSDNNSBTAddress = Address(fromBase58String(valueOrErrorMessage(getString(oracle, keyUSDNNSBTAddress), "no usdn staking address"))) | |
71 | + | ||
72 | + | let stakingEURNAddress = Address(fromBase58String(valueOrErrorMessage(getString(oracle, keyEURNAddress), "no usdn staking address"))) | |
73 | + | ||
74 | + | let active = getBooleanValue(this, kActive) | |
97 | 75 | ||
98 | 76 | let strAssetIdA = getStringValue(this, kAssetIdA) | |
99 | 77 | ||
100 | 78 | let strAssetIdB = getStringValue(this, kAssetIdB) | |
101 | 79 | ||
102 | 80 | let assetIdA = if ((strAssetIdA == "WAVES")) | |
103 | 81 | then unit | |
104 | 82 | else fromBase58String(strAssetIdA) | |
105 | 83 | ||
106 | 84 | let assetIdB = if ((strAssetIdB == "WAVES")) | |
107 | 85 | then unit | |
108 | 86 | else fromBase58String(strAssetIdB) | |
109 | 87 | ||
110 | 88 | let assetNameA = match assetIdA { | |
111 | 89 | case id: ByteVector => | |
112 | 90 | value(assetInfo(id)).name | |
113 | 91 | case waves: Unit => | |
114 | 92 | "WAVES" | |
115 | 93 | case _ => | |
116 | 94 | throw("Match error") | |
117 | 95 | } | |
118 | 96 | ||
119 | 97 | let assetNameB = match assetIdB { | |
120 | 98 | case id: ByteVector => | |
121 | 99 | value(assetInfo(id)).name | |
122 | 100 | case waves: Unit => | |
123 | 101 | "WAVES" | |
124 | 102 | case _ => | |
125 | 103 | throw("Match error") | |
126 | 104 | } | |
127 | 105 | ||
128 | 106 | let balanceA = getIntegerValue(this, kBalanceA) | |
129 | 107 | ||
130 | 108 | let balanceB = getIntegerValue(this, kBalanceB) | |
131 | 109 | ||
132 | 110 | let shareAssetId = fromBase58String(getStringValue(this, kShareAssetId)) | |
133 | 111 | ||
134 | 112 | let shareAssetSupply = getIntegerValue(this, kShareAssetSupply) | |
135 | 113 | ||
136 | 114 | let invariant = getIntegerValue(this, kInvariant) | |
137 | 115 | ||
138 | 116 | let fee = 500 | |
139 | 117 | ||
140 | 118 | let feeGovernance = 200 | |
141 | 119 | ||
142 | 120 | let feeScale6 = 1000000 | |
143 | 121 | ||
144 | - | let comissionForInitalization = 1000000000 | |
145 | - | ||
146 | 122 | let scale3 = 1000 | |
147 | 123 | ||
148 | 124 | let scale8 = 100000000 | |
149 | 125 | ||
150 | - | let | |
126 | + | let scale16 = 10000000000000000 | |
151 | 127 | ||
152 | 128 | let slippageScale3 = 1000 | |
153 | 129 | ||
154 | 130 | let digits8 = 8 | |
155 | 131 | ||
156 | 132 | let dAppThreshold = 50 | |
157 | 133 | ||
158 | 134 | let dAppThresholdScale2 = 100 | |
159 | 135 | ||
160 | 136 | let exchangeRatioLimitMin = 90000000 | |
161 | 137 | ||
162 | 138 | let exchangeRatioLimitMax = 110000000 | |
163 | 139 | ||
164 | 140 | let alpha = 50 | |
165 | 141 | ||
166 | 142 | let alphaDigits = 2 | |
167 | 143 | ||
168 | - | let beta = | |
144 | + | let beta = 4600000000000000 | |
169 | 145 | ||
170 | 146 | func accountBalance (assetId) = match assetId { | |
171 | 147 | case id: ByteVector => | |
172 | 148 | assetBalance(this, id) | |
173 | 149 | case waves: Unit => | |
174 | 150 | wavesBalance(this).available | |
175 | 151 | case _ => | |
176 | 152 | throw("Match error") | |
177 | 153 | } | |
178 | 154 | ||
179 | 155 | ||
180 | - | let stakedAmountUSDN = match getInteger(stakingAddress, ((("rpd_balance_" + toBase58String(USDN)) + "_") + toString(this))) { | |
181 | - | case staked: Int => | |
182 | - | staked | |
183 | - | case nothing: Unit => | |
184 | - | 0 | |
185 | - | case _ => | |
186 | - | throw("Match error") | |
187 | - | } | |
188 | - | ||
189 | - | func isAllowedAsset (assetId) = match assetId { | |
190 | - | case id: ByteVector => | |
191 | - | if ((id == USDN)) | |
192 | - | then true | |
193 | - | else false | |
194 | - | case waves: Unit => | |
195 | - | false | |
196 | - | case _ => | |
197 | - | throw("Match error") | |
198 | - | } | |
156 | + | func stakedAmount (assetId) = { | |
157 | + | let stakedAmountCalculated = match assetId { | |
158 | + | case aId: ByteVector => | |
159 | + | if ((aId == USDN)) | |
160 | + | then getInteger(stakingUSDNNSBTAddress, ((("rpd_balance_" + toBase58String(aId)) + "_") + toString(this))) | |
161 | + | else if ((aId == EURN)) | |
162 | + | then getInteger(stakingEURNAddress, ((("%s%s%s__stakingBalance__" + toBase58String(aId)) + "__") + toString(this))) | |
163 | + | else 0 | |
164 | + | case _: Unit => | |
165 | + | 0 | |
166 | + | case _ => | |
167 | + | throw("Match error") | |
168 | + | } | |
169 | + | match stakedAmountCalculated { | |
170 | + | case i: Int => | |
171 | + | i | |
172 | + | case _ => | |
173 | + | 0 | |
174 | + | } | |
175 | + | } | |
199 | 176 | ||
200 | 177 | ||
201 | - | let availableBalanceA = (balanceA - (if ((assetIdA == USDN)) | |
202 | - | then stakedAmountUSDN | |
203 | - | else 0)) | |
178 | + | let stakedAmountA = stakedAmount(assetIdA) | |
204 | 179 | ||
205 | - | let availableBalanceB = (balanceB - (if ((assetIdB == USDN)) | |
206 | - | then stakedAmountUSDN | |
207 | - | else 0)) | |
180 | + | let stakedAmountB = stakedAmount(assetIdB) | |
208 | 181 | ||
209 | - | let accountBalanceWithStakedA = (accountBalance(assetIdA) + (if ((assetIdA == USDN)) | |
210 | - | then stakedAmountUSDN | |
211 | - | else 0)) | |
182 | + | let availableBalanceA = (balanceA - stakedAmountA) | |
212 | 183 | ||
213 | - | let accountBalanceWithStakedB = (accountBalance(assetIdB) + (if ((assetIdB == USDN)) | |
214 | - | then stakedAmountUSDN | |
215 | - | else 0)) | |
184 | + | let availableBalanceB = (balanceB - stakedAmountB) | |
185 | + | ||
186 | + | let accountBalanceWithStakedA = (accountBalance(assetIdA) + stakedAmountA) | |
187 | + | ||
188 | + | let accountBalanceWithStakedB = (accountBalance(assetIdB) + stakedAmountB) | |
216 | 189 | ||
217 | 190 | let hasEnoughBalance = if ((accountBalanceWithStakedA >= balanceA)) | |
218 | 191 | then (accountBalanceWithStakedB >= balanceB) | |
219 | 192 | else false | |
220 | 193 | ||
221 | - | func skewness (x,y) = (( | |
194 | + | func skewness (x,y) = ((fraction(scale16, x, y) + fraction(scale16, y, x)) / 2) | |
222 | 195 | ||
223 | 196 | ||
224 | 197 | func invariantCalc (x,y) = { | |
225 | 198 | let sk = skewness(x, y) | |
226 | - | (fraction((x + y), | |
199 | + | (fraction((x + y), scale16, pow(sk, digits8, alpha, alphaDigits, digits8, CEILING)) + (2 * fraction(toInt(pow(fraction(toBigInt(x), toBigInt(y), toBigInt(scale8)), 0, toBigInt(5), 1, (digits8 / 2), DOWN)), pow((sk - beta), digits8, alpha, alphaDigits, digits8, DOWN), scale8))) | |
227 | 200 | } | |
228 | 201 | ||
229 | 202 | ||
230 | 203 | func calculateSendAmount (amountToSendEstimated,minTokenReceiveAmount,tokenReceiveAmount,tokenId) = { | |
231 | - | let | |
204 | + | let worstAllowedNewInvariantRatio = (scale8 - ((scale8 * 1) / 10000000)) | |
232 | 205 | let deltaBetweenMaxAndMinSendValue = (amountToSendEstimated - minTokenReceiveAmount) | |
233 | 206 | let x = (balanceA + tokenReceiveAmount) | |
234 | 207 | let y = (balanceB + tokenReceiveAmount) | |
235 | - | let invariantNew = if ((tokenId == assetIdA)) | |
236 | - | then invariantCalc(x, (balanceB - amountToSendEstimated)) | |
237 | - | else if ((tokenId == assetIdB)) | |
238 | - | then invariantCalc((balanceA - amountToSendEstimated), y) | |
239 | - | else throw("Wrong asset in payment") | |
240 | - | let invariantEstimatedRatio = fraction(scale8, invariant, invariantNew) | |
241 | - | func getStepAmount (acc,step) = if ((acc == -1)) | |
208 | + | func getStepAmount (acc,step) = if ((acc._1 == -1)) | |
242 | 209 | then { | |
243 | - | let amountToSend = (amountToSendEstimated - ((step * deltaBetweenMaxAndMinSendValue) / | |
210 | + | let amountToSend = (amountToSendEstimated - (((step * deltaBetweenMaxAndMinSendValue) / 3) / scale3)) | |
244 | 211 | let stepInvariant = if ((tokenId == assetIdA)) | |
245 | 212 | then invariantCalc(x, (balanceB - amountToSend)) | |
246 | 213 | else invariantCalc((balanceA - amountToSend), y) | |
247 | 214 | if ((stepInvariant > invariant)) | |
248 | - | then amountToSend | |
249 | - | else -1 | |
215 | + | then $Tuple2(amountToSend, stepInvariant) | |
216 | + | else $Tuple2(-1, 0) | |
250 | 217 | } | |
251 | 218 | else acc | |
252 | 219 | ||
253 | - | let stepAmount = { | |
254 | - | let $list71887231 = [1, 2, 3, 4, 5] | |
255 | - | let $size71887231 = size($list71887231) | |
256 | - | let $acc071887231 = -1 | |
257 | - | if (($size71887231 == 0)) | |
258 | - | then $acc071887231 | |
259 | - | else { | |
260 | - | let $acc171887231 = getStepAmount($acc071887231, $list71887231[0]) | |
261 | - | if (($size71887231 == 1)) | |
262 | - | then $acc171887231 | |
220 | + | let amountToSendMin = getStepAmount($Tuple2(-1, 0), 3000) | |
221 | + | if ((0 > amountToSendMin._1)) | |
222 | + | then throw("Price is worse than minReceived") | |
223 | + | else { | |
224 | + | let invEstimated = if ((tokenId == assetIdA)) | |
225 | + | then invariantCalc(x, (balanceB - amountToSendEstimated)) | |
226 | + | else if ((tokenId == assetIdB)) | |
227 | + | then invariantCalc((balanceA - amountToSendEstimated), y) | |
228 | + | else throw("Wrong asset in payment") | |
229 | + | let amountToSendBest = if ((invariant > invEstimated)) | |
230 | + | then if ((worstAllowedNewInvariantRatio >= fraction(scale8, invariant, invEstimated))) | |
231 | + | then throw("Bad estimation provided 1") | |
263 | 232 | else { | |
264 | - | let $acc271887231 = getStepAmount($acc171887231, $list71887231[1]) | |
265 | - | if (($size71887231 == 2)) | |
266 | - | then $acc271887231 | |
267 | - | else { | |
268 | - | let $acc371887231 = getStepAmount($acc271887231, $list71887231[2]) | |
269 | - | if (($size71887231 == 3)) | |
270 | - | then $acc371887231 | |
271 | - | else { | |
272 | - | let $acc471887231 = getStepAmount($acc371887231, $list71887231[3]) | |
273 | - | if (($size71887231 == 4)) | |
274 | - | then $acc471887231 | |
275 | - | else { | |
276 | - | let $acc571887231 = getStepAmount($acc471887231, $list71887231[4]) | |
277 | - | if (($size71887231 == 5)) | |
278 | - | then $acc571887231 | |
279 | - | else { | |
280 | - | let $acc671887231 = getStepAmount($acc571887231, $list71887231[5]) | |
281 | - | throw("List size exceed 5") | |
282 | - | } | |
283 | - | } | |
284 | - | } | |
285 | - | } | |
233 | + | let a = { | |
234 | + | let $l = [25, 200, 500] | |
235 | + | let $s = size($l) | |
236 | + | let $acc0 = $Tuple2(-1, 0) | |
237 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
238 | + | then $a | |
239 | + | else getStepAmount($a, $l[$i]) | |
240 | + | ||
241 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
242 | + | then $a | |
243 | + | else throw("List size exceeds 3") | |
244 | + | ||
245 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
246 | + | } | |
247 | + | if ((0 > a._1)) | |
248 | + | then amountToSendMin | |
249 | + | else a | |
286 | 250 | } | |
287 | - | } | |
288 | - | } | |
289 | - | if ((0 > stepAmount)) | |
290 | - | then throw("something went wrong while working with amountToSend") | |
291 | - | else if (if ((invariantEstimatedRatio > slippageValue)) | |
292 | - | then (invariantNew > invariant) | |
293 | - | else false) | |
294 | - | then amountToSendEstimated | |
295 | - | else stepAmount | |
251 | + | else { | |
252 | + | let a = { | |
253 | + | let $l = [-500, -200, -25] | |
254 | + | let $s = size($l) | |
255 | + | let $acc0 = $Tuple2(-1, 0) | |
256 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
257 | + | then $a | |
258 | + | else getStepAmount($a, $l[$i]) | |
259 | + | ||
260 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
261 | + | then $a | |
262 | + | else throw("List size exceeds 3") | |
263 | + | ||
264 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
265 | + | } | |
266 | + | let tupleSendBetter = if ((0 > a._1)) | |
267 | + | then $Tuple2(amountToSendEstimated, invEstimated) | |
268 | + | else a | |
269 | + | if ((worstAllowedNewInvariantRatio >= fraction(scale8, invariant, tupleSendBetter._2))) | |
270 | + | then throw("Bad estimation provided 2") | |
271 | + | else tupleSendBetter | |
272 | + | } | |
273 | + | amountToSendBest | |
274 | + | } | |
296 | 275 | } | |
297 | 276 | ||
298 | 277 | ||
299 | 278 | func getAssetInfo (assetId) = match assetId { | |
300 | 279 | case id: ByteVector => | |
301 | 280 | let stringId = toBase58String(id) | |
302 | 281 | let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist")) | |
303 | 282 | $Tuple3(stringId, info.name, info.decimals) | |
304 | 283 | case waves: Unit => | |
305 | 284 | $Tuple3("WAVES", "WAVES", 8) | |
306 | 285 | case _ => | |
307 | 286 | throw("Match error") | |
308 | 287 | } | |
309 | 288 | ||
310 | 289 | ||
311 | 290 | func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)] | |
312 | 291 | ||
313 | 292 | ||
314 | - | func deductStakingFee (amount,assetId) = if ((assetId == USDN)) | |
315 | - | then { | |
316 | - | let result = (amount - stakingFeeInUSDN) | |
317 | - | if ((0 >= result)) | |
318 | - | then throw((((("Insufficient amount " + toString(amount)) + " to deduct staking fee ") + toString(stakingFeeInUSDN)) + " USD-N")) | |
319 | - | else result | |
320 | - | } | |
321 | - | else amount | |
322 | - | ||
323 | - | ||
324 | 293 | func throwIsActive () = throw("DApp is already active") | |
325 | 294 | ||
326 | 295 | ||
327 | - | func throwIsInactive () = throw("DApp is inactive at this moment") | |
296 | + | func isActive () = if (active) | |
297 | + | then unit | |
298 | + | else throw("DApp is inactive at this moment") | |
328 | 299 | ||
329 | 300 | ||
330 | - | func throwOnlyAdmin () = throw("Only admin can call this function") | |
301 | + | func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
302 | + | then unit | |
303 | + | else throw("Only admin can call this function") | |
331 | 304 | ||
332 | 305 | ||
333 | 306 | func throwAssets () = throw(((("Incorrect assets attached. Expected: " + strAssetIdA) + " and ") + strAssetIdB)) | |
334 | 307 | ||
335 | 308 | ||
336 | - | func | |
309 | + | func throwOnePayment () = throw("One attached payment expected") | |
337 | 310 | ||
338 | 311 | ||
339 | - | func throwInsufficientAvailableBalance (amount,available,assetName) = throw((((((((("Insufficient DApp balance to pay " + toString(amount)) + " ") + assetName) + " due to staking. Available: ") + toString(available)) + " ") + assetName) + ". Please contact support in Telegram: https://t.me/swopfisupport")) | |
340 | - | ||
341 | - | ||
342 | - | func throwInsufficientAvailableBalances (amountA,amountB) = throw((((((((((((((((("Insufficient DApp balance to pay " + toString(amountA)) + " ") + assetNameA) + " and ") + toString(amountB)) + " ") + assetNameB) + " due to staking. Available: ") + toString(availableBalanceA)) + " ") + assetNameA) + " and ") + toString(availableBalanceB)) + " ") + assetNameB) + ". Please contact support in Telegram: https://t.me/swopfisupport")) | |
312 | + | func throwThreshold (threshold,amountA,amountB) = throw(((((((((("New balance in assets of the DApp is less than threshold " + toString(threshold)) + ": ") + toString(amountA)) + " ") + assetNameA) + ", ") + toString(amountB)) + " ") + assetNameB)) | |
343 | 313 | ||
344 | 314 | ||
345 | 315 | func suspendSuspicious () = suspend(((((((((((((((("Suspicious state. Actual balances: " + toString(balanceA)) + " ") + assetNameA) + ", ") + toString(balanceB)) + " ") + assetNameB) + ". State: ") + toString(accountBalance(assetIdA))) + " ") + assetNameA) + ", ") + toString(accountBalance(assetIdB))) + " ") + assetNameB)) | |
346 | 316 | ||
347 | 317 | ||
318 | + | func calcStakingFuncAndAddres (stake,assetId) = if (stake) | |
319 | + | then if ((assetId == USDN)) | |
320 | + | then $Tuple2("lockNeutrino", stakingUSDNNSBTAddress) | |
321 | + | else $Tuple2("startStaking", stakingEURNAddress) | |
322 | + | else if ((assetId == USDN)) | |
323 | + | then $Tuple2("unlockNeutrino", stakingUSDNNSBTAddress) | |
324 | + | else $Tuple2("stopStaking", stakingEURNAddress) | |
325 | + | ||
326 | + | ||
327 | + | func calcStakingParams (stake,amount,assetId) = if (stake) | |
328 | + | then { | |
329 | + | let $t097119777 = calcStakingFuncAndAddres(stake, assetId) | |
330 | + | let call = $t097119777._1 | |
331 | + | let stakingAddr = $t097119777._2 | |
332 | + | $Tuple4(call, stakingAddr, nil, [AttachedPayment(assetId, amount)]) | |
333 | + | } | |
334 | + | else { | |
335 | + | let $t098639929 = calcStakingFuncAndAddres(stake, assetId) | |
336 | + | let call = $t098639929._1 | |
337 | + | let stakingAddr = $t098639929._2 | |
338 | + | $Tuple4(call, stakingAddr, [amount, toBase58String(assetId)], nil) | |
339 | + | } | |
340 | + | ||
341 | + | ||
348 | 342 | @Callable(i) | |
349 | - | func init (userAddressStr) = { | |
350 | - | let $t0992910006 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
351 | - | let pmtAmount1 = $t0992910006._1 | |
352 | - | let pmtAssetId1 = $t0992910006._2 | |
353 | - | let $t01001110088 = $Tuple2(i.payments[1].amount, i.payments[1].assetId) | |
354 | - | let pmtAmount2 = $t01001110088._1 | |
355 | - | let pmtAssetId2 = $t01001110088._2 | |
356 | - | let $t01009310176 = $Tuple2(i.payments[2].amount, i.payments[2].assetId) | |
357 | - | let pmtAmountSWOP = $t01009310176._1 | |
358 | - | let pmtAssetIdSWOP = $t01009310176._2 | |
359 | - | let check = isDataStorageUntouched(this) | |
360 | - | let userScriptHash = scriptHash(this) | |
361 | - | let userAddress = addressFromStringValue(userAddressStr) | |
362 | - | if ((i.caller == this)) | |
363 | - | then throw("You can't call yourself") | |
364 | - | else if (if ((pmtAssetIdSWOP != SWOP)) | |
365 | - | then true | |
366 | - | else (pmtAmountSWOP != comissionForInitalization)) | |
367 | - | then throw("You need to attach 10 SWOP tokens") | |
368 | - | else if (if (!(isAllowedAsset(pmtAssetId1))) | |
369 | - | then !(isAllowedAsset(pmtAssetId2)) | |
370 | - | else false) | |
371 | - | then throw("One of assets must be USDN, WAVES or SWOP") | |
372 | - | else if (if ((userScriptHash != value(getBinary(oracle, kOracleScriptHash)))) | |
373 | - | then true | |
374 | - | else !(check)) | |
375 | - | then throw("Unexpected script was found.") | |
376 | - | else if (isDefined(getBoolean(this, kActive))) | |
377 | - | then throwIsActive() | |
378 | - | else if ((pmtAssetId1 == pmtAssetId2)) | |
379 | - | then throw("Assets must be different") | |
380 | - | else { | |
381 | - | let pmtStrAssetId1 = match pmtAssetId1 { | |
382 | - | case id: ByteVector => | |
383 | - | toBase58String(id) | |
384 | - | case waves: Unit => | |
385 | - | "WAVES" | |
386 | - | case _ => | |
387 | - | throw("Match error") | |
388 | - | } | |
389 | - | let pmtStrAssetId2 = match pmtAssetId2 { | |
390 | - | case id: ByteVector => | |
391 | - | toBase58String(id) | |
392 | - | case waves: Unit => | |
393 | - | "WAVES" | |
394 | - | case _ => | |
395 | - | throw("Match error") | |
396 | - | } | |
397 | - | let asset1Priority = valueOrElse(getInteger(oracle, (kOracleAssetPriority + pmtStrAssetId1)), 999999) | |
398 | - | let asset2Priority = valueOrElse(getInteger(oracle, (kOracleAssetPriority + pmtStrAssetId2)), 999999) | |
399 | - | let $t01151111738 = if ((asset2Priority > asset1Priority)) | |
400 | - | then $Tuple4(pmtAmount2, pmtAssetId2, pmtAmount1, pmtAssetId1) | |
401 | - | else $Tuple4(pmtAmount1, pmtAssetId1, pmtAmount2, pmtAssetId2) | |
402 | - | let pmtAmountA = $t01151111738._1 | |
403 | - | let pmtAssetIdA = $t01151111738._2 | |
404 | - | let pmtAmountB = $t01151111738._3 | |
405 | - | let pmtAssetIdB = $t01151111738._4 | |
406 | - | let $t01174711824 = getAssetInfo(pmtAssetIdA) | |
407 | - | let pmtStrAssetIdA = $t01174711824._1 | |
408 | - | let pmtAssetNameA = $t01174711824._2 | |
409 | - | let pmtDecimalsA = $t01174711824._3 | |
410 | - | let $t01183311910 = getAssetInfo(pmtAssetIdB) | |
411 | - | let pmtStrAssetIdB = $t01183311910._1 | |
412 | - | let pmtAssetNameB = $t01183311910._2 | |
413 | - | let pmtDecimalsB = $t01183311910._3 | |
414 | - | let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7)) | |
415 | - | let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this)) | |
416 | - | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
417 | - | let shareInitialSupply = fraction(pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, DOWN), pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, DOWN), pow(10, 0, shareDecimals, 0, 0, DOWN)) | |
418 | - | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
419 | - | let shareIssueId = calculateAssetId(shareIssue) | |
420 | - | let invariantCalculated = invariantCalc(pmtAmountA, pmtAmountB) | |
421 | - | [StringEntry(kVersion, version), BooleanEntry(kActive, true), StringEntry(kAssetIdA, pmtStrAssetIdA), StringEntry(kAssetIdB, pmtStrAssetIdB), IntegerEntry(kBalanceA, pmtAmountA), IntegerEntry(kBalanceB, pmtAmountB), IntegerEntry(kInvariant, invariantCalculated), IntegerEntry(kFee, fee), IntegerEntry(kFeeScaleDelimiter, feeScale6), IntegerEntry(kInitPoolHeight, height), shareIssue, StringEntry(kShareAssetId, toBase58String(shareIssueId)), IntegerEntry(kShareAssetSupply, shareInitialSupply), ScriptTransfer(userAddress, shareInitialSupply, shareIssueId), ScriptTransfer(walletAddress, comissionForInitalization, SWOP)] | |
422 | - | } | |
343 | + | func init () = { | |
344 | + | let $t01003410111 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
345 | + | let pmtAmountA = $t01003410111._1 | |
346 | + | let pmtAssetIdA = $t01003410111._2 | |
347 | + | let $t01011610193 = $Tuple2(i.payments[1].amount, i.payments[1].assetId) | |
348 | + | let pmtAmountB = $t01011610193._1 | |
349 | + | let pmtAssetIdB = $t01011610193._2 | |
350 | + | let $t01019810275 = getAssetInfo(pmtAssetIdA) | |
351 | + | let pmtStrAssetIdA = $t01019810275._1 | |
352 | + | let pmtAssetNameA = $t01019810275._2 | |
353 | + | let pmtDecimalsA = $t01019810275._3 | |
354 | + | let $t01028010357 = getAssetInfo(pmtAssetIdB) | |
355 | + | let pmtStrAssetIdB = $t01028010357._1 | |
356 | + | let pmtAssetNameB = $t01028010357._2 | |
357 | + | let pmtDecimalsB = $t01028010357._3 | |
358 | + | if (isDefined(getBoolean(this, kActive))) | |
359 | + | then throwIsActive() | |
360 | + | else if ((pmtAssetIdA == pmtAssetIdB)) | |
361 | + | then throw("Assets must be different") | |
362 | + | else { | |
363 | + | let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7)) | |
364 | + | let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this)) | |
365 | + | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
366 | + | let shareInitialSupply = fraction(pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, DOWN), pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, DOWN), pow(10, 0, shareDecimals, 0, 0, DOWN)) | |
367 | + | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
368 | + | let shareIssueId = calculateAssetId(shareIssue) | |
369 | + | let invariantCalculated = invariantCalc(pmtAmountA, pmtAmountB) | |
370 | + | let stake1 = if (containsElement(stakingAssets, pmtStrAssetIdA)) | |
371 | + | then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
372 | + | else 0 | |
373 | + | if ((stake1 == stake1)) | |
374 | + | then { | |
375 | + | let stake2 = if (containsElement(stakingAssets, pmtStrAssetIdB)) | |
376 | + | then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
377 | + | else 0 | |
378 | + | if ((stake2 == stake2)) | |
379 | + | then [StringEntry(kVersion, version), BooleanEntry(kActive, true), StringEntry(kAssetIdA, pmtStrAssetIdA), StringEntry(kAssetIdB, pmtStrAssetIdB), IntegerEntry(kBalanceA, pmtAmountA), IntegerEntry(kBalanceB, pmtAmountB), IntegerEntry(kInvariant, invariantCalculated), IntegerEntry(kFee, fee), IntegerEntry(kFeeScaleDelimiter, feeScale6), shareIssue, StringEntry(kShareAssetId, toBase58String(shareIssueId)), IntegerEntry(kShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareIssueId)] | |
380 | + | else throw("Strict value is not equal to itself.") | |
381 | + | } | |
382 | + | else throw("Strict value is not equal to itself.") | |
383 | + | } | |
423 | 384 | } | |
424 | 385 | ||
425 | 386 | ||
426 | 387 | ||
427 | 388 | @Callable(i) | |
428 | - | func keepLimitForFirstHarvest (shareLimit) = if (!(isActive)) | |
429 | - | then throw("DApp is inactive at this moment") | |
430 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, admStaking], i.callerPublicKey))) | |
431 | - | then throw("Only admin can call this function") | |
432 | - | else [IntegerEntry(kShareLimit, shareLimit)] | |
389 | + | func replenishWithTwoTokens () = valueOrElse(isActive(), { | |
390 | + | let pmtAssetIdA = i.payments[0].assetId | |
391 | + | let pmtAssetIdB = i.payments[1].assetId | |
392 | + | let ratioShareTokensInA = fraction(scale8, i.payments[0].amount, balanceA) | |
393 | + | let ratioShareTokensInB = fraction(scale8, i.payments[1].amount, balanceB) | |
394 | + | let $t01293813015 = getAssetInfo(pmtAssetIdA) | |
395 | + | let pmtStrAssetIdA = $t01293813015._1 | |
396 | + | let pmtAssetNameA = $t01293813015._2 | |
397 | + | let pmtDecimalsA = $t01293813015._3 | |
398 | + | let $t01302013137 = getAssetInfo(pmtAssetIdB) | |
399 | + | let pmtStrAssetIdB = $t01302013137._1 | |
400 | + | let pmtAssetNameB = $t01302013137._2 | |
401 | + | let pmtDecimalsB = $t01302013137._3 | |
402 | + | let $t01314213646 = if ((ratioShareTokensInB > ratioShareTokensInA)) | |
403 | + | then { | |
404 | + | let pmt = fraction(balanceB, ratioShareTokensInA, scale8, CEILING) | |
405 | + | $Tuple5(i.payments[0].amount, pmt, (i.payments[1].amount - pmt), pmtAssetIdB, ratioShareTokensInA) | |
406 | + | } | |
407 | + | else { | |
408 | + | let pmt = fraction(balanceB, ratioShareTokensInA, scale8, CEILING) | |
409 | + | $Tuple5(pmt, i.payments[1].amount, (i.payments[0].amount - pmt), pmtAssetIdA, ratioShareTokensInB) | |
410 | + | } | |
411 | + | let pmtAmountA = $t01314213646._1 | |
412 | + | let pmtAmountB = $t01314213646._2 | |
413 | + | let change = $t01314213646._3 | |
414 | + | let changeAssetId = $t01314213646._4 | |
415 | + | let shareTokenRatio = $t01314213646._5 | |
416 | + | let shareTokenToPayAmount = fraction(shareTokenRatio, shareAssetSupply, scale8) | |
417 | + | if ((size(i.payments) != 2)) | |
418 | + | then throw("Two attached assets expected") | |
419 | + | else if (if ((pmtAssetIdA != assetIdA)) | |
420 | + | then true | |
421 | + | else (pmtAssetIdB != assetIdB)) | |
422 | + | then throwAssets() | |
423 | + | else if ((shareTokenToPayAmount == 0)) | |
424 | + | then throw("Too small amount to replenish") | |
425 | + | else if ((0 > change)) | |
426 | + | then throw("Change < 0") | |
427 | + | else if (!(hasEnoughBalance)) | |
428 | + | then ([ScriptTransfer(i.caller, pmtAmountA, pmtAssetIdA), ScriptTransfer(i.caller, pmtAmountB, pmtAssetIdB)] ++ suspendSuspicious()) | |
429 | + | else { | |
430 | + | let stake1 = if (containsElement(stakingAssets, pmtStrAssetIdA)) | |
431 | + | then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
432 | + | else 0 | |
433 | + | if ((stake1 == stake1)) | |
434 | + | then { | |
435 | + | let stake2 = if (containsElement(stakingAssets, pmtStrAssetIdB)) | |
436 | + | then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
437 | + | else 0 | |
438 | + | if ((stake2 == stake2)) | |
439 | + | then [IntegerEntry(kBalanceA, (balanceA + pmtAmountA)), IntegerEntry(kBalanceB, (balanceB + pmtAmountB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(kInvariant, invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB))), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), ScriptTransfer(i.caller, change, changeAssetId)] | |
440 | + | else throw("Strict value is not equal to itself.") | |
441 | + | } | |
442 | + | else throw("Strict value is not equal to itself.") | |
443 | + | } | |
444 | + | }) | |
433 | 445 | ||
434 | 446 | ||
435 | 447 | ||
436 | 448 | @Callable(i) | |
437 | - | func replenishWithTwoTokens (slippageTolerance) = { | |
438 | - | let pmtAssetIdA = i.payments[0].assetId | |
439 | - | let pmtAssetIdB = i.payments[1].assetId | |
440 | - | let pmtAmountA = deductStakingFee(i.payments[0].amount, pmtAssetIdA) | |
441 | - | let pmtAmountB = deductStakingFee(i.payments[1].amount, pmtAssetIdB) | |
442 | - | let tokenRatio = fraction(fraction(scale8, balanceA, pmtAmountA), scale3, fraction(scale8, balanceB, pmtAmountB)) | |
443 | - | let ratioShareTokensInA = fraction(scale8, pmtAmountA, balanceA) | |
444 | - | let ratioShareTokensInB = fraction(scale8, pmtAmountB, balanceB) | |
445 | - | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8) | |
446 | - | let invariantCalculated = invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB)) | |
447 | - | if (!(isActive)) | |
448 | - | then throwIsInactive() | |
449 | - | else if (if ((0 > slippageTolerance)) | |
450 | - | then true | |
451 | - | else (slippageTolerance > 10)) | |
452 | - | then throw("Slippage tolerance must be <= 1%") | |
453 | - | else if ((size(i.payments) != 2)) | |
454 | - | then throw("Two attached assets expected") | |
455 | - | else if (if ((pmtAssetIdA != assetIdA)) | |
456 | - | then true | |
457 | - | else (pmtAssetIdB != assetIdB)) | |
458 | - | then throwAssets() | |
459 | - | else if (if ((((scale3 * (slippageScale3 - slippageTolerance)) / slippageScale3) > tokenRatio)) | |
460 | - | then true | |
461 | - | else (tokenRatio > ((scale3 * (slippageScale3 + slippageTolerance)) / slippageScale3))) | |
462 | - | then throw("Incorrect assets amount: amounts must have the contract ratio") | |
463 | - | else if ((shareTokenToPayAmount == 0)) | |
464 | - | then throw("Too small amount to replenish") | |
465 | - | else if (!(hasEnoughBalance)) | |
466 | - | then ([ScriptTransfer(i.caller, pmtAmountA, pmtAssetIdA), ScriptTransfer(i.caller, pmtAmountB, pmtAssetIdB)] ++ suspendSuspicious()) | |
467 | - | else [IntegerEntry(kBalanceA, (balanceA + pmtAmountA)), IntegerEntry(kBalanceB, (balanceB + pmtAmountB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(kInvariant, invariantCalculated), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)] | |
468 | - | } | |
469 | - | ||
470 | - | ||
471 | - | ||
472 | - | @Callable(i) | |
473 | - | func replenishWithOneToken (virtualSwapTokenPay,virtualSwapTokenGet) = { | |
474 | - | let $t01658816663 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
475 | - | let pmtAmount = $t01658816663._1 | |
476 | - | let pmtAssetId = $t01658816663._2 | |
449 | + | func replenishWithOneToken (virtualSwapTokenPay,virtualSwapTokenGet) = valueOrElse(isActive(), { | |
450 | + | let $t01529515370 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
451 | + | let pmtAmount = $t01529515370._1 | |
452 | + | let pmtAssetId = $t01529515370._2 | |
453 | + | let $t01537515448 = getAssetInfo(pmtAssetId) | |
454 | + | let pmtStrAssetId = $t01537515448._1 | |
455 | + | let pmtAssetName = $t01537515448._2 | |
456 | + | let pmtDecimals = $t01537515448._3 | |
477 | 457 | let pmtMinThreshold = 5000000 | |
478 | 458 | let thresholdValueForMinTolerance = 50000000 | |
479 | 459 | let tolerance = if ((thresholdValueForMinTolerance > pmtAmount)) | |
480 | 460 | then 100000 | |
481 | 461 | else 1 | |
482 | 462 | let slippageValueMinForReplenish = (scale8 - ((scale8 * tolerance) / 10000000)) | |
483 | 463 | let slippageValueMaxForReplenish = (scale8 + ((scale8 * tolerance) / 10000000)) | |
484 | 464 | let slippageValueMinForSwap = (scale8 - ((scale8 * 1) / 10000000)) | |
485 | - | if (!(isActive)) | |
486 | - | then throwIsInactive() | |
487 | - | else if ((pmtMinThreshold > pmtAmount)) | |
488 | - | then throw((((("Payment amount " + toString(pmtAmount)) + " does not exceed the minimum amount of ") + toString(pmtMinThreshold)) + " tokens")) | |
465 | + | if ((pmtMinThreshold > pmtAmount)) | |
466 | + | then throw((((("Payment amount " + toString(pmtAmount)) + " does not exceed the minimum amount of ") + toString(pmtMinThreshold)) + " tokens")) | |
467 | + | else if ((size(i.payments) != 1)) | |
468 | + | then throwOnePayment() | |
469 | + | else if (!(hasEnoughBalance)) | |
470 | + | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
471 | + | else if (if ((pmtAssetId != assetIdA)) | |
472 | + | then (pmtAssetId != assetIdB) | |
473 | + | else false) | |
474 | + | then throwAssets() | |
475 | + | else { | |
476 | + | let $t01638617151 = if ((pmtAssetId == assetIdA)) | |
477 | + | then $Tuple7((pmtAmount - virtualSwapTokenPay), virtualSwapTokenGet, (balanceA + virtualSwapTokenPay), (balanceB - virtualSwapTokenGet), invariantCalc((balanceA + pmtAmount), balanceB), (balanceA + pmtAmount), balanceB) | |
478 | + | else $Tuple7(virtualSwapTokenGet, (pmtAmount - virtualSwapTokenPay), (balanceA - virtualSwapTokenGet), (balanceB + virtualSwapTokenPay), invariantCalc(balanceA, (balanceB + pmtAmount)), balanceA, (balanceB + pmtAmount)) | |
479 | + | let virtualReplenishA = $t01638617151._1 | |
480 | + | let virtualReplenishB = $t01638617151._2 | |
481 | + | let balanceAfterSwapA = $t01638617151._3 | |
482 | + | let balanceAfterSwapB = $t01638617151._4 | |
483 | + | let invariantCalculated = $t01638617151._5 | |
484 | + | let newBalanceA = $t01638617151._6 | |
485 | + | let newBalanceB = $t01638617151._7 | |
486 | + | let newBalanceEntry = if ((pmtAssetId == assetIdA)) | |
487 | + | then IntegerEntry(kBalanceA, newBalanceA) | |
488 | + | else IntegerEntry(kBalanceB, newBalanceB) | |
489 | + | let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB) | |
490 | + | let invariantEstimatedRatio = fraction(scale8, invariant, invariantNew) | |
491 | + | let ratioVirtualBalanceToVirtualReplenish = (fraction((scale8 * scale8), balanceAfterSwapA, balanceAfterSwapB) / fraction(scale8, virtualReplenishA, virtualReplenishB)) | |
492 | + | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2)) | |
493 | + | if (if ((slippageValueMinForSwap >= invariantEstimatedRatio)) | |
494 | + | then true | |
495 | + | else (invariant > invariantNew)) | |
496 | + | then throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value") | |
497 | + | else if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish)) | |
498 | + | then true | |
499 | + | else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish)) | |
500 | + | then throw("Swap with virtualSwapTokenPay and virtualSwapTokenGet is possible, but ratio after virtual swap is incorrect") | |
501 | + | else if (if ((dAppThresholdAmount > newBalanceA)) | |
502 | + | then true | |
503 | + | else (dAppThresholdAmount > newBalanceB)) | |
504 | + | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
505 | + | else { | |
506 | + | let stake1 = if (containsElement(stakingAssets, pmtStrAssetId)) | |
507 | + | then invoke(this, "stakeUnstake", [true, pmtAmount, pmtStrAssetId], nil) | |
508 | + | else 0 | |
509 | + | if ((stake1 == stake1)) | |
510 | + | then { | |
511 | + | let ratioShareTokensInA = fraction(virtualReplenishA, scale8, balanceAfterSwapA) | |
512 | + | let ratioShareTokensInB = fraction(virtualReplenishB, scale8, balanceAfterSwapB) | |
513 | + | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8) | |
514 | + | [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), newBalanceEntry, IntegerEntry(kInvariant, invariantCalculated)] | |
515 | + | } | |
516 | + | else throw("Strict value is not equal to itself.") | |
517 | + | } | |
518 | + | } | |
519 | + | }) | |
520 | + | ||
521 | + | ||
522 | + | ||
523 | + | @Callable(i) | |
524 | + | func withdraw () = valueOrElse(isActive(), { | |
525 | + | let $t01940119544 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
526 | + | let pmtAmount = $t01940119544._1 | |
527 | + | let pmtAssetId = $t01940119544._2 | |
528 | + | let amountToPayA = fraction(pmtAmount, balanceA, shareAssetSupply) | |
529 | + | let amountToPayB = fraction(pmtAmount, balanceB, shareAssetSupply) | |
530 | + | let invariantCalculated = invariantCalc((balanceA - amountToPayA), (balanceB - amountToPayB)) | |
531 | + | if ((size(i.payments) != 1)) | |
532 | + | then throwOnePayment() | |
533 | + | else if ((pmtAssetId != shareAssetId)) | |
534 | + | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
535 | + | else if (!(hasEnoughBalance)) | |
536 | + | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
537 | + | else { | |
538 | + | let stake1 = if (containsElement(stakingAssets, strAssetIdA)) | |
539 | + | then invoke(this, "stakeUnstake", [false, amountToPayA, strAssetIdA], nil) | |
540 | + | else 0 | |
541 | + | if ((stake1 == stake1)) | |
542 | + | then { | |
543 | + | let stake2 = if (containsElement(stakingAssets, strAssetIdB)) | |
544 | + | then invoke(this, "stakeUnstake", [false, amountToPayB, strAssetIdB], nil) | |
545 | + | else 0 | |
546 | + | if ((stake2 == stake2)) | |
547 | + | then [IntegerEntry(kBalanceA, (balanceA - amountToPayA)), IntegerEntry(kBalanceB, (balanceB - amountToPayB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply - pmtAmount)), IntegerEntry(kInvariant, invariantCalculated), Burn(shareAssetId, pmtAmount), ScriptTransfer(i.caller, amountToPayA, assetIdA), ScriptTransfer(i.caller, amountToPayB, assetIdB)] | |
548 | + | else throw("Strict value is not equal to itself.") | |
549 | + | } | |
550 | + | else throw("Strict value is not equal to itself.") | |
551 | + | } | |
552 | + | }) | |
553 | + | ||
554 | + | ||
555 | + | ||
556 | + | @Callable(i) | |
557 | + | func exchange (estimatedAmountToReceive,minAmountToReceive) = valueOrElse(isActive(), { | |
558 | + | let $t02100721082 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
559 | + | let pmtAmount = $t02100721082._1 | |
560 | + | let pmtAssetId = $t02100721082._2 | |
561 | + | if ((0 >= estimatedAmountToReceive)) | |
562 | + | then throw(("Estimated amount must be positive. Actual: " + toString(estimatedAmountToReceive))) | |
563 | + | else if ((minAmountToReceive > estimatedAmountToReceive)) | |
564 | + | then throw(((("Minimal amount can't be greater than estimated. Estimated: " + toString(estimatedAmountToReceive)) + ". Minimal: ") + toString(minAmountToReceive))) | |
489 | 565 | else if ((size(i.payments) != 1)) | |
490 | - | then | |
566 | + | then throwOnePayment() | |
491 | 567 | else if (!(hasEnoughBalance)) | |
492 | 568 | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
493 | 569 | else if (if ((pmtAssetId != assetIdA)) | |
494 | 570 | then (pmtAssetId != assetIdB) | |
495 | 571 | else false) | |
496 | 572 | then throwAssets() | |
497 | - | else { | |
498 | - | let $t01767518440 = if ((pmtAssetId == assetIdA)) | |
499 | - | then $Tuple7((pmtAmount - virtualSwapTokenPay), virtualSwapTokenGet, (balanceA + virtualSwapTokenPay), (balanceB - virtualSwapTokenGet), invariantCalc((balanceA + pmtAmount), balanceB), (balanceA + pmtAmount), balanceB) | |
500 | - | else $Tuple7(virtualSwapTokenGet, (pmtAmount - virtualSwapTokenPay), (balanceA - virtualSwapTokenGet), (balanceB + virtualSwapTokenPay), invariantCalc(balanceA, (balanceB + pmtAmount)), balanceA, (balanceB + pmtAmount)) | |
501 | - | let virtualReplenishA = $t01767518440._1 | |
502 | - | let virtualReplenishB = $t01767518440._2 | |
503 | - | let balanceAfterSwapA = $t01767518440._3 | |
504 | - | let balanceAfterSwapB = $t01767518440._4 | |
505 | - | let invariantCalculated = $t01767518440._5 | |
506 | - | let newBalanceA = $t01767518440._6 | |
507 | - | let newBalanceB = $t01767518440._7 | |
508 | - | let newBalanceEntry = if ((pmtAssetId == assetIdA)) | |
509 | - | then IntegerEntry(kBalanceA, newBalanceA) | |
510 | - | else IntegerEntry(kBalanceB, newBalanceB) | |
511 | - | let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB) | |
512 | - | let invariantEstimatedRatio = fraction(scale8, invariant, invariantNew) | |
513 | - | let ratioVirtualBalanceToVirtualReplenish = (fraction((scale8 * scale8), balanceAfterSwapA, balanceAfterSwapB) / fraction(scale8, virtualReplenishA, virtualReplenishB)) | |
514 | - | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2)) | |
515 | - | if (if ((slippageValueMinForSwap >= invariantEstimatedRatio)) | |
573 | + | else if ((10000000 > pmtAmount)) | |
574 | + | then throw("Only swap of 10.000000 or more tokens is allowed") | |
575 | + | else if (if ((exchangeRatioLimitMin > fraction(scale8, minAmountToReceive, pmtAmount))) | |
516 | 576 | then true | |
517 | - | else (invariant > invariantNew)) | |
518 | - | then throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value") | |
519 | - | else if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish)) | |
520 | - | then true | |
521 | - | else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish)) | |
522 | - | then throw("Swap with virtualSwapTokenPay and virtualSwapTokenGet is possible, but ratio after virtual swap is incorrect") | |
523 | - | else if (if ((dAppThresholdAmount > newBalanceA)) | |
577 | + | else (fraction(scale8, estimatedAmountToReceive, pmtAmount) > exchangeRatioLimitMax)) | |
578 | + | then throw("Incorrect args and pmt ratio") | |
579 | + | else { | |
580 | + | let sendAssetId = if ((pmtAssetId == assetIdA)) | |
581 | + | then assetIdB | |
582 | + | else assetIdA | |
583 | + | let $t02217322292 = calculateSendAmount(estimatedAmountToReceive, minAmountToReceive, pmtAmount, pmtAssetId) | |
584 | + | let amount = $t02217322292._1 | |
585 | + | let amountInvarian = $t02217322292._2 | |
586 | + | let governanceReward = fraction(amount, feeGovernance, feeScale6) | |
587 | + | let amountMinusFee = fraction(amount, (feeScale6 - fee), feeScale6) | |
588 | + | let $t02244822710 = if ((pmtAssetId == assetIdA)) | |
589 | + | then $Tuple2((balanceA + pmtAmount), ((balanceB - amountMinusFee) - governanceReward)) | |
590 | + | else $Tuple2(((balanceA - amountMinusFee) - governanceReward), (balanceB + pmtAmount)) | |
591 | + | let newBalanceA = $t02244822710._1 | |
592 | + | let newBalanceB = $t02244822710._2 | |
593 | + | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2)) | |
594 | + | if (if ((dAppThresholdAmount > newBalanceA)) | |
524 | 595 | then true | |
525 | 596 | else (dAppThresholdAmount > newBalanceB)) | |
526 | 597 | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
527 | 598 | else { | |
528 | - | let ratioShareTokensInA = fraction(deductStakingFee(virtualReplenishA, assetIdA), scale8, balanceAfterSwapA) | |
529 | - | let ratioShareTokensInB = fraction(deductStakingFee(virtualReplenishB, assetIdB), scale8, balanceAfterSwapB) | |
530 | - | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8) | |
531 | - | [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), newBalanceEntry, IntegerEntry(kInvariant, invariantCalculated)] | |
599 | + | let $t02300823081 = getAssetInfo(pmtAssetId) | |
600 | + | let pmtStrAssetId = $t02300823081._1 | |
601 | + | let pmtAssetName = $t02300823081._2 | |
602 | + | let pmtDecimals = $t02300823081._3 | |
603 | + | let $t02309423171 = getAssetInfo(sendAssetId) | |
604 | + | let sendStrAssetId = $t02309423171._1 | |
605 | + | let sendAssetName = $t02309423171._2 | |
606 | + | let sendDecimals = $t02309423171._3 | |
607 | + | let stake1 = if (containsElement(stakingAssets, pmtStrAssetId)) | |
608 | + | then invoke(this, "stakeUnstake", [true, pmtAmount, pmtStrAssetId], nil) | |
609 | + | else 0 | |
610 | + | if ((stake1 == stake1)) | |
611 | + | then { | |
612 | + | let stake2 = if (containsElement(stakingAssets, sendStrAssetId)) | |
613 | + | then invoke(this, "stakeUnstake", [false, (amountMinusFee + governanceReward), sendStrAssetId], nil) | |
614 | + | else 0 | |
615 | + | if ((stake2 == stake2)) | |
616 | + | then [IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, amountInvarian), ScriptTransfer(i.caller, amountMinusFee, sendAssetId), ScriptTransfer(walletAddress, governanceReward, sendAssetId)] | |
617 | + | else throw("Strict value is not equal to itself.") | |
618 | + | } | |
619 | + | else throw("Strict value is not equal to itself.") | |
532 | 620 | } | |
533 | - | } | |
534 | - | } | |
621 | + | } | |
622 | + | }) | |
535 | 623 | ||
536 | 624 | ||
537 | 625 | ||
538 | 626 | @Callable(i) | |
539 | - | func withdraw () = { | |
540 | - | let $t02058520728 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
541 | - | let pmtAmount = $t02058520728._1 | |
542 | - | let pmtAssetId = $t02058520728._2 | |
543 | - | let amountToPayA = deductStakingFee(fraction(pmtAmount, balanceA, shareAssetSupply), assetIdA) | |
544 | - | let amountToPayB = deductStakingFee(fraction(pmtAmount, balanceB, shareAssetSupply), assetIdB) | |
545 | - | let invariantCalculated = invariantCalc((balanceA - amountToPayA), (balanceB - amountToPayB)) | |
546 | - | if (!(isActive)) | |
547 | - | then throwIsInactive() | |
548 | - | else if ((size(i.payments) != 1)) | |
549 | - | then throw("One attached payment expected") | |
550 | - | else if ((pmtAssetId != shareAssetId)) | |
551 | - | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
552 | - | else if (!(hasEnoughBalance)) | |
553 | - | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
554 | - | else if (if ((amountToPayA > availableBalanceA)) | |
555 | - | then true | |
556 | - | else (amountToPayB > availableBalanceB)) | |
557 | - | then throwInsufficientAvailableBalances(amountToPayA, amountToPayB) | |
558 | - | else [IntegerEntry(kBalanceA, (balanceA - amountToPayA)), IntegerEntry(kBalanceB, (balanceB - amountToPayB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply - pmtAmount)), IntegerEntry(kInvariant, invariantCalculated), Burn(shareAssetId, pmtAmount), ScriptTransfer(i.caller, amountToPayA, assetIdA), ScriptTransfer(i.caller, amountToPayB, assetIdB)] | |
559 | - | } | |
627 | + | func shutdown () = valueOrElse(isAdminCall(i), if (!(active)) | |
628 | + | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
629 | + | else suspend("Paused by admin")) | |
560 | 630 | ||
561 | 631 | ||
562 | 632 | ||
563 | 633 | @Callable(i) | |
564 | - | func exchange (estimatedAmountToReceive,minAmountToReceive) = { | |
565 | - | let $t02208622161 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
566 | - | let pmtAmount = $t02208622161._1 | |
567 | - | let pmtAssetId = $t02208622161._2 | |
568 | - | if (!(isActive)) | |
569 | - | then throwIsInactive() | |
570 | - | else if ((0 >= estimatedAmountToReceive)) | |
571 | - | then throw(("Estimated amount must be positive. Actual: " + toString(estimatedAmountToReceive))) | |
572 | - | else if ((minAmountToReceive > estimatedAmountToReceive)) | |
573 | - | then throw(((("Minimal amount can't be greater than estimated. Estimated: " + toString(estimatedAmountToReceive)) + ". Minimal: ") + toString(minAmountToReceive))) | |
574 | - | else if ((size(i.payments) != 1)) | |
575 | - | then throw("One attached payment expected") | |
576 | - | else if (!(hasEnoughBalance)) | |
577 | - | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
578 | - | else if (if ((pmtAssetId != assetIdA)) | |
579 | - | then (pmtAssetId != assetIdB) | |
580 | - | else false) | |
581 | - | then throwAssets() | |
582 | - | else if ((10000000 > pmtAmount)) | |
583 | - | then throw("Only swap of 10.000000 or more tokens is allowed") | |
584 | - | else if (if ((exchangeRatioLimitMin > fraction(scale8, minAmountToReceive, pmtAmount))) | |
585 | - | then true | |
586 | - | else (fraction(scale8, estimatedAmountToReceive, pmtAmount) > exchangeRatioLimitMax)) | |
587 | - | then throw("Incorrect args and pmt ratio") | |
588 | - | else { | |
589 | - | let sendAssetId = if ((pmtAssetId == assetIdA)) | |
590 | - | then assetIdB | |
591 | - | else assetIdA | |
592 | - | let amount = calculateSendAmount(estimatedAmountToReceive, minAmountToReceive, pmtAmount, pmtAssetId) | |
593 | - | let governanceReward = fraction(amount, feeGovernance, feeScale6) | |
594 | - | let amountMinusFee = fraction(amount, (feeScale6 - fee), feeScale6) | |
595 | - | let $t02358323845 = if ((pmtAssetId == assetIdA)) | |
596 | - | then $Tuple2((balanceA + pmtAmount), ((balanceB - amountMinusFee) - governanceReward)) | |
597 | - | else $Tuple2(((balanceA - amountMinusFee) - governanceReward), (balanceB + pmtAmount)) | |
598 | - | let newBalanceA = $t02358323845._1 | |
599 | - | let newBalanceB = $t02358323845._2 | |
600 | - | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2)) | |
601 | - | if (if ((dAppThresholdAmount > newBalanceA)) | |
602 | - | then true | |
603 | - | else (dAppThresholdAmount > newBalanceB)) | |
604 | - | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
605 | - | else if (if (if ((assetIdA == USDN)) | |
606 | - | then (sendAssetId == assetIdA) | |
607 | - | else false) | |
608 | - | then (stakedAmountUSDN >= newBalanceA) | |
609 | - | else false) | |
610 | - | then throwInsufficientAvailableBalance(amountMinusFee, availableBalanceA, assetNameA) | |
611 | - | else if (if (if ((assetIdB == USDN)) | |
612 | - | then (sendAssetId == assetIdB) | |
613 | - | else false) | |
614 | - | then (stakedAmountUSDN >= newBalanceB) | |
615 | - | else false) | |
616 | - | then throwInsufficientAvailableBalance(amountMinusFee, availableBalanceB, assetNameB) | |
617 | - | else [IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, invariantCalc(newBalanceA, newBalanceB)), ScriptTransfer(i.caller, amountMinusFee, sendAssetId), ScriptTransfer(walletAddress, governanceReward, sendAssetId)] | |
618 | - | } | |
619 | - | } | |
634 | + | func activate () = valueOrElse(isAdminCall(i), if (active) | |
635 | + | then throwIsActive() | |
636 | + | else [BooleanEntry(kActive, true), DeleteEntry(kCause)]) | |
620 | 637 | ||
621 | 638 | ||
622 | 639 | ||
623 | 640 | @Callable(i) | |
624 | - | func shutdown () = if (!(isActive)) | |
625 | - | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
626 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, admStartStop], i.callerPublicKey))) | |
627 | - | then throwOnlyAdmin() | |
628 | - | else suspend("Paused by admin") | |
641 | + | func takeIntoAccountExtraFunds () = valueOrElse(isActive(), { | |
642 | + | let amountEnrollA = (accountBalanceWithStakedA - balanceA) | |
643 | + | let amountEnrollB = (accountBalanceWithStakedB - balanceB) | |
644 | + | let invariantNew = invariantCalc((balanceA + amountEnrollA), (balanceB + amountEnrollB)) | |
645 | + | if ((i.caller != walletAddress)) | |
646 | + | then throw("Only the wallet can call this function") | |
647 | + | else if (if ((0 > amountEnrollA)) | |
648 | + | then true | |
649 | + | else (0 > amountEnrollB)) | |
650 | + | then suspend("Enroll amount negative") | |
651 | + | else if (if ((amountEnrollA == 0)) | |
652 | + | then (amountEnrollB == 0) | |
653 | + | else false) | |
654 | + | then throw("No money to take") | |
655 | + | else { | |
656 | + | let stake1 = if (if (containsElement(stakingAssets, strAssetIdA)) | |
657 | + | then (amountEnrollA > 0) | |
658 | + | else false) | |
659 | + | then invoke(this, "stakeUnstake", [true, amountEnrollA, strAssetIdA], nil) | |
660 | + | else 0 | |
661 | + | if ((stake1 == stake1)) | |
662 | + | then { | |
663 | + | let stake2 = if (if (containsElement(stakingAssets, strAssetIdB)) | |
664 | + | then (amountEnrollB > 0) | |
665 | + | else false) | |
666 | + | then invoke(this, "stakeUnstake", [true, amountEnrollB, strAssetIdB], nil) | |
667 | + | else 0 | |
668 | + | if ((stake2 == stake2)) | |
669 | + | then [IntegerEntry(kInvariant, invariantNew), IntegerEntry(kBalanceA, (balanceA + amountEnrollA)), IntegerEntry(kBalanceB, (balanceB + amountEnrollB)), IntegerEntry(("last_income_" + strAssetIdA), amountEnrollA), IntegerEntry(("last_income_" + strAssetIdB), amountEnrollB)] | |
670 | + | else throw("Strict value is not equal to itself.") | |
671 | + | } | |
672 | + | else throw("Strict value is not equal to itself.") | |
673 | + | } | |
674 | + | }) | |
629 | 675 | ||
630 | 676 | ||
631 | 677 | ||
632 | 678 | @Callable(i) | |
633 | - | func activate () = if (isActive) | |
634 | - | then throwIsActive() | |
635 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, admStartStop], i.callerPublicKey))) | |
636 | - | then throwOnlyAdmin() | |
637 | - | else [BooleanEntry(kActive, true), DeleteEntry(kCause)] | |
638 | - | ||
639 | - | ||
640 | - | ||
641 | - | @Callable(i) | |
642 | - | func enableFirstHarvest () = [BooleanEntry(kFirstHarvest, true), IntegerEntry(kFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))] | |
643 | - | ||
644 | - | ||
645 | - | ||
646 | - | @Callable(i) | |
647 | - | func takeIntoAccountExtraFunds (amountLeave) = { | |
648 | - | let uncountableA = (accountBalanceWithStakedA - balanceA) | |
649 | - | let uncountableB = (accountBalanceWithStakedB - balanceB) | |
650 | - | let amountEnrollA = (uncountableA - (if ((assetIdA == unit)) | |
651 | - | then amountLeave | |
652 | - | else 0)) | |
653 | - | let amountEnrollB = (uncountableB - (if ((assetIdB == unit)) | |
654 | - | then amountLeave | |
655 | - | else 0)) | |
656 | - | let invariantNew = invariantCalc((balanceA + amountEnrollA), (balanceB + amountEnrollB)) | |
657 | - | if (!(isActive)) | |
658 | - | then throwIsInactive() | |
659 | - | else if ((i.caller != this)) | |
660 | - | then throwOnlyAdmin() | |
661 | - | else if ((0 > amountLeave)) | |
662 | - | then throw(("Argument 'amountLeave' cannot be negative. Actual: " + toString(amountLeave))) | |
663 | - | else if (if ((0 > uncountableA)) | |
664 | - | then true | |
665 | - | else (0 > uncountableB)) | |
666 | - | then suspend("Enroll amount negative") | |
667 | - | else if (if ((0 > amountEnrollA)) | |
668 | - | then true | |
669 | - | else (0 > amountEnrollB)) | |
670 | - | then throw("Too large amountLeave") | |
671 | - | else [IntegerEntry(kInvariant, invariantNew), IntegerEntry(kBalanceA, (balanceA + amountEnrollA)), IntegerEntry(kBalanceB, (balanceB + amountEnrollB)), IntegerEntry(("last_income_" + strAssetIdA), amountEnrollA), IntegerEntry(("last_income_" + strAssetIdB), amountEnrollB)] | |
672 | - | } | |
679 | + | func stakeUnstake (stake,amount,assetIdString) = if ((i.caller != this)) | |
680 | + | then throw("Only contract itself can invoke this function") | |
681 | + | else { | |
682 | + | let $t02595826061 = calcStakingParams(stake, amount, fromBase58String(assetIdString)) | |
683 | + | let call = $t02595826061._1 | |
684 | + | let addr = $t02595826061._2 | |
685 | + | let params = $t02595826061._3 | |
686 | + | let payments = $t02595826061._4 | |
687 | + | let inv = invoke(addr, call, params, payments) | |
688 | + | if ((inv == inv)) | |
689 | + | then nil | |
690 | + | else throw("Strict value is not equal to itself.") | |
691 | + | } | |
673 | 692 | ||
674 | 693 | ||
675 | 694 | @Verifier(tx) | |
676 | 695 | func verify () = { | |
677 | 696 | let multiSignedByAdmins = { | |
678 | 697 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
679 | 698 | then 1 | |
680 | 699 | else 0 | |
681 | 700 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
682 | 701 | then 1 | |
683 | 702 | else 0 | |
684 | 703 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
685 | 704 | then 1 | |
686 | 705 | else 0 | |
687 | 706 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
688 | 707 | } | |
689 | 708 | match tx { | |
690 | 709 | case inv: InvokeScriptTransaction => | |
691 | 710 | let callTakeIntoAccount = if ((inv.dApp == this)) | |
692 | 711 | then (inv.function == "takeIntoAccountExtraFunds") | |
693 | 712 | else false | |
694 | - | let callEnableFirstHarvest = if ((inv.dApp == this)) | |
695 | - | then (inv.function == "enableFirstHarvest") | |
696 | - | else false | |
697 | - | let callStaking = if ((inv.dApp == stakingAddress)) | |
698 | - | then if (if (if ((inv.function == "lockNeutrino")) | |
699 | - | then (size(inv.payments) == 1) | |
700 | - | else false) | |
701 | - | then (inv.payments[0].assetId == USDN) | |
702 | - | else false) | |
703 | - | then true | |
704 | - | else if ((inv.function == "unlockNeutrino")) | |
705 | - | then (size(inv.payments) == 0) | |
706 | - | else false | |
707 | - | else false | |
708 | - | let exchangeToWaves = if (if (if ((inv.dApp == USDNToWavesExchanger)) | |
709 | - | then (inv.function == "exchange") | |
710 | - | else false) | |
711 | - | then (assetIdA == USDN) | |
712 | - | else false) | |
713 | - | then true | |
714 | - | else if (if ((assetIdB == USDN)) | |
715 | - | then (size(inv.payments) == 1) | |
716 | - | else false) | |
717 | - | then (inv.payments[0].assetId == USDN) | |
718 | - | else false | |
719 | 713 | let signedByAdmin = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
720 | 714 | then true | |
721 | 715 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey2)) | |
722 | 716 | then true | |
723 | 717 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey3)) | |
724 | 718 | then true | |
725 | 719 | else sigVerify(tx.bodyBytes, tx.proofs[0], admStaking) | |
726 | - | if (if (if (if (if (callTakeIntoAccount) | |
727 | - | then true | |
728 | - | else callEnableFirstHarvest) | |
729 | - | then true | |
730 | - | else callStaking) | |
731 | - | then true | |
732 | - | else exchangeToWaves) | |
720 | + | if (if (callTakeIntoAccount) | |
733 | 721 | then signedByAdmin | |
734 | 722 | else false) | |
735 | 723 | then true | |
736 | 724 | else multiSignedByAdmins | |
737 | 725 | case _ => | |
738 | 726 | multiSignedByAdmins | |
739 | 727 | } | |
740 | 728 | } | |
741 | 729 |
github/deemru/w8io/169f3d6 99.27 ms ◑