tx · 7V9d2tXZQ4Y46uGNbSJ4wJi6vVg1ZAgYHa9HU9Epfuj5 3MovkGrnmfcdTa6zakUxafYanewq633ZnZq: -0.01400000 Waves 2021.07.19 18:54 [1620695] smart account 3MovkGrnmfcdTa6zakUxafYanewq633ZnZq > SELF 0.00000000 Waves
{ "type": 13, "id": "7V9d2tXZQ4Y46uGNbSJ4wJi6vVg1ZAgYHa9HU9Epfuj5", "fee": 1400000, "feeAssetId": null, "timestamp": 1626710064453, "version": 2, "chainId": 84, "sender": "3MovkGrnmfcdTa6zakUxafYanewq633ZnZq", "senderPublicKey": "c4si3qB7jQgmRK6JwBXpm4DqXeqttrkq5m6gmRtFppY", "proofs": [ "3YuDmqpjPMyVQYYtpUpAiGyDLH7busv3kqtPuPep6XG83TVHDYx3zSXQpB6Jg5vXUG3mj2eczHUszoC54eTZh9ox" ], "script": "base64:AAIFAAAAAAAAACoIAhIDCgEEEgcKBQEBCAgEEgMKAQESAwoBARIAEgMKAQESABIAEgMKAQEAAABLAAAAAAd2ZXJzaW9uAgAAAAUxLjAuMAAAAAAKa2V5VmVyc2lvbgIAAAAHdmVyc2lvbgAAAAAJa2V5QWN0aXZlAgAAAAZhY3RpdmUAAAAAC2tleUFzc2V0SWRBAgAAAApBX2Fzc2V0X2lkAAAAAAtrZXlBc3NldElkQgIAAAAKQl9hc3NldF9pZAAAAAALa2V5QmFsYW5jZUECAAAAD0FfYXNzZXRfYmFsYW5jZQAAAAALa2V5QmFsYW5jZUICAAAAD0JfYXNzZXRfYmFsYW5jZQAAAAAPa2V5QmFsYW5jZUluaXRBAgAAAAxBX2Fzc2V0X2luaXQAAAAAD2tleUJhbGFuY2VJbml0QgIAAAAMQl9hc3NldF9pbml0AAAAAA9rZXlTaGFyZUFzc2V0SWQCAAAADnNoYXJlX2Fzc2V0X2lkAAAAABNrZXlTaGFyZUFzc2V0U3VwcGx5AgAAABJzaGFyZV9hc3NldF9zdXBwbHkAAAAADWtleUNvbW1pc3Npb24CAAAACmNv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AAAAAAAAUAAAASYWRtaW5QdWJLZXlTdGFraW5nAwMDBQAAABNjYWxsVGFrZUludG9BY2NvdW50BgUAAAALY2FsbFN0YWtpbmcGBQAAAA9leGNoYW5nZVRvV2F2ZXMFAAAADXNpZ25lZEJ5QWRtaW4HBAAAABJhZG1pblB1YktleTFTaWduZWQDCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAMYWRtaW5QdWJLZXkxAAAAAAAAAAABAAAAAAAAAAAABAAAABJhZG1pblB1YktleTJTaWduZWQDCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAQUAAAAMYWRtaW5QdWJLZXkyAAAAAAAAAAABAAAAAAAAAAAABAAAABJhZG1pblB1YktleTNTaWduZWQDCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAgUAAAAMYWRtaW5QdWJLZXkzAAAAAAAAAAABAAAAAAAAAAAACQAAZwAAAAIJAABkAAAAAgkAAGQAAAACBQAAABJhZG1pblB1YktleTFTaWduZWQFAAAAEmFkbWluUHViS2V5MlNpZ25lZAUAAAASYWRtaW5QdWJLZXkzU2lnbmVkAAAAAAAAAAAC2Roq5g==", "height": 1620695, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6Ms21Y48o9AgWtU1iYHR82L8v2eQDSyffYkkSaPHy6MC Next: none Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let version = "1.0.0" | |
15 | 15 | ||
16 | 16 | let keyBalanceB = "B_asset_balance" | |
17 | 17 | ||
18 | + | let keyBalanceInitA = "A_asset_init" | |
19 | + | ||
20 | + | let keyBalanceInitB = "B_asset_init" | |
21 | + | ||
18 | 22 | let keyShareAssetId = "share_asset_id" | |
19 | 23 | ||
20 | 24 | let keyShareAssetSupply = "share_asset_supply" | |
25 | 29 | ||
26 | 30 | let keyCause = "shutdown_cause" | |
27 | 31 | ||
28 | - | let | |
32 | + | let keyFirstHarvest = "first_harvest" | |
29 | 33 | ||
30 | - | let | |
34 | + | let keyFirstHarvestHeight = "first_harvest_height" | |
31 | 35 | ||
32 | - | let adminPubKey3 = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
36 | + | let kShareLimit = "share_limit_on_first_harvest" | |
37 | + | ||
38 | + | let kBasePeriod = "base_period" | |
39 | + | ||
40 | + | let kPeriodLength = "period_length" | |
41 | + | ||
42 | + | let kStartHeight = "start_height" | |
43 | + | ||
44 | + | let kFirstHarvestHeight = "first_harvest_height" | |
45 | + | ||
46 | + | let keyAdminPubKey1 = "admin_pub_1" | |
47 | + | ||
48 | + | let keyAdminPubKey2 = "admin_pub_2" | |
49 | + | ||
50 | + | let keyAdminPubKey3 = "admin_pub_3" | |
51 | + | ||
52 | + | let oracle = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
53 | + | ||
54 | + | func getAdminPub (keyAdminPub) = match getString(oracle, keyAdminPub) { | |
55 | + | case string: String => | |
56 | + | fromBase58String(string) | |
57 | + | case nothing => | |
58 | + | throw("Admin public key is empty") | |
59 | + | } | |
60 | + | ||
61 | + | ||
62 | + | let adminPubKey1 = getAdminPub(keyAdminPubKey1) | |
63 | + | ||
64 | + | let adminPubKey2 = getAdminPub(keyAdminPubKey2) | |
65 | + | ||
66 | + | let adminPubKey3 = getAdminPub(keyAdminPubKey3) | |
33 | 67 | ||
34 | 68 | let adminPubKeyStartStop = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
35 | 69 | ||
36 | 70 | let adminPubKeyStaking = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
37 | 71 | ||
38 | - | let governanceAddress = Address(base58'3NAGTtZz6WpupSN89NZD5rMZwwziZEg4Kx4') | |
72 | + | let walletAddress = Address(base58'3NAGTtZz6WpupSN89NZD5rMZwwziZEg4Kx4') | |
73 | + | ||
74 | + | let votingAddress = Address(base58'3MrJgdL1GniipErHy44YF9idzLaUL2iX5DQ') | |
39 | 75 | ||
40 | 76 | let stakingAddress = Address(base58'3N6q7sCGSSLBUXDdjBdYGTJbZGZfhhh8cNg') | |
41 | 77 | ||
42 | - | let | |
78 | + | let USDNToWavesExchanger = Address(base58'3N77kfPbQyjXWpDALX3xjKw3iEGMWEctV37') | |
43 | 79 | ||
44 | - | let stakingFeeInUSDN = (9 * value(value(assetInfo(USDN)).minSponsoredFee)) | |
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)) + 3) | |
87 | + | ||
88 | + | let USDN = base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p' | |
89 | + | ||
90 | + | let stakingFeeInUSDN = 270000 | |
45 | 91 | ||
46 | 92 | let isActive = getBooleanValue(this, keyActive) | |
47 | 93 | ||
116 | 162 | throw("Match error") | |
117 | 163 | } | |
118 | 164 | ||
165 | + | let assetInitA = getIntegerValue(this, keyBalanceInitA) | |
166 | + | ||
167 | + | let assetInitB = getIntegerValue(this, keyBalanceInitB) | |
168 | + | ||
119 | 169 | let availableBalanceA = (balanceA - (if ((assetIdA == USDN)) | |
120 | 170 | then stakedAmountUSDN | |
121 | 171 | else 0)) | |
148 | 198 | } | |
149 | 199 | ||
150 | 200 | ||
201 | + | func getAssetInfoFromString (assetStr) = if ((assetStr == "WAVES")) | |
202 | + | then $Tuple3("WAVES", "WAVES", 8) | |
203 | + | else { | |
204 | + | let stringId = assetStr | |
205 | + | let id = fromBase58String(assetStr) | |
206 | + | let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist")) | |
207 | + | $Tuple3(stringId, info.name, info.decimals) | |
208 | + | } | |
209 | + | ||
210 | + | ||
151 | 211 | func suspend (cause) = [BooleanEntry(keyActive, false), StringEntry(keyCause, cause)] | |
152 | 212 | ||
153 | 213 | ||
167 | 227 | 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")) | |
168 | 228 | ||
169 | 229 | ||
230 | + | func suspendSuspicious () = suspend(((((((((((((((("Suspicious state. Actual balances: " + toString(accountBalanceWithStakedA)) + " ") + assetNameA) + ", ") + toString(accountBalanceWithStakedB)) + " ") + assetNameB) + ". State: ") + toString(balanceA)) + " ") + assetNameA) + ", ") + toString(balanceB)) + " ") + assetNameB)) | |
231 | + | ||
232 | + | ||
170 | 233 | @Callable(i) | |
171 | - | func init () = { | |
172 | - | let $t047504827 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
173 | - | let pmtAmountA = $t047504827._1 | |
174 | - | let pmtAssetIdA = $t047504827._2 | |
175 | - | let $t048324909 = $Tuple2(i.payments[1].amount, i.payments[1].assetId) | |
176 | - | let pmtAmountB = $t048324909._1 | |
177 | - | let pmtAssetIdB = $t048324909._2 | |
178 | - | let $t049144991 = getAssetInfo(pmtAssetIdA) | |
179 | - | let pmtStrAssetIdA = $t049144991._1 | |
180 | - | let pmtAssetNameA = $t049144991._2 | |
181 | - | let pmtDecimalsA = $t049144991._3 | |
182 | - | let $t049965073 = getAssetInfo(pmtAssetIdB) | |
183 | - | let pmtStrAssetIdB = $t049965073._1 | |
184 | - | let pmtAssetNameB = $t049965073._2 | |
185 | - | let pmtDecimalsB = $t049965073._3 | |
186 | - | if (isDefined(getBoolean(this, keyActive))) | |
187 | - | then throw("DApp is already active") | |
188 | - | else if ((pmtAssetIdA == pmtAssetIdB)) | |
189 | - | then throw("Assets must be different") | |
190 | - | else { | |
191 | - | let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7)) | |
192 | - | let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this)) | |
193 | - | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
194 | - | let shareInitialSupply = fraction(pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, HALFDOWN), pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, HALFDOWN), pow(10, 0, shareDecimals, 0, 0, HALFDOWN)) | |
195 | - | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
196 | - | let shareIssueId = calculateAssetId(shareIssue) | |
197 | - | [StringEntry(keyVersion, version), BooleanEntry(keyActive, true), StringEntry(keyAssetIdA, pmtStrAssetIdA), StringEntry(keyAssetIdB, pmtStrAssetIdB), IntegerEntry(keyBalanceA, pmtAmountA), IntegerEntry(keyBalanceB, pmtAmountB), IntegerEntry(keyCommission, commission), IntegerEntry(keyCommissionScaleDelimiter, commissionScaleDelimiter), shareIssue, StringEntry(keyShareAssetId, toBase58String(shareIssueId)), IntegerEntry(keyShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareIssueId)] | |
198 | - | } | |
234 | + | func init (firstHarvest) = { | |
235 | + | let $t067096786 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
236 | + | let pmtAmountA = $t067096786._1 | |
237 | + | let pmtAssetIdA = $t067096786._2 | |
238 | + | let $t067916868 = $Tuple2(i.payments[1].amount, i.payments[1].assetId) | |
239 | + | let pmtAmountB = $t067916868._1 | |
240 | + | let pmtAssetIdB = $t067916868._2 | |
241 | + | let $t068736950 = getAssetInfo(pmtAssetIdA) | |
242 | + | let pmtStrAssetIdA = $t068736950._1 | |
243 | + | let pmtAssetNameA = $t068736950._2 | |
244 | + | let pmtDecimalsA = $t068736950._3 | |
245 | + | let $t069557032 = getAssetInfo(pmtAssetIdB) | |
246 | + | let pmtStrAssetIdB = $t069557032._1 | |
247 | + | let pmtAssetNameB = $t069557032._2 | |
248 | + | let pmtDecimalsB = $t069557032._3 | |
249 | + | if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStaking], i.callerPublicKey))) | |
250 | + | then throw("Only admin can call this function") | |
251 | + | else if (isDefined(getBoolean(this, keyActive))) | |
252 | + | then throw("DApp is already active") | |
253 | + | else if ((pmtAssetIdA == pmtAssetIdB)) | |
254 | + | then throw("Assets must be different") | |
255 | + | else { | |
256 | + | let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7)) | |
257 | + | let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this)) | |
258 | + | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
259 | + | let arg1 = pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, DOWN) | |
260 | + | let arg2 = pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, DOWN) | |
261 | + | let arg3 = pow(10, 0, shareDecimals, 0, 0, DOWN) | |
262 | + | let shareInitialSupply = fraction(arg1, arg2, arg3) | |
263 | + | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
264 | + | let shareIssueId = calculateAssetId(shareIssue) | |
265 | + | let baseEntry = [StringEntry(keyVersion, version), BooleanEntry(keyActive, true), StringEntry(keyAssetIdA, pmtStrAssetIdA), StringEntry(keyAssetIdB, pmtStrAssetIdB), IntegerEntry(keyBalanceA, pmtAmountA), IntegerEntry(keyBalanceB, pmtAmountB), IntegerEntry(keyCommission, commission), IntegerEntry(keyCommissionScaleDelimiter, commissionScaleDelimiter), shareIssue, StringEntry(keyShareAssetId, toBase58String(shareIssueId)), IntegerEntry(keyShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareIssueId)] | |
266 | + | if (firstHarvest) | |
267 | + | then (baseEntry ++ [BooleanEntry(keyFirstHarvest, firstHarvest), IntegerEntry(keyFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))]) | |
268 | + | else baseEntry | |
269 | + | } | |
199 | 270 | } | |
271 | + | ||
272 | + | ||
273 | + | ||
274 | + | @Callable(i) | |
275 | + | func initWithInitRatio (amtAssetA,amtAssetB,strAssetIdA,strAssetIdB,firstHarvest) = { | |
276 | + | let $t092779364 = getAssetInfoFromString(strAssetIdA) | |
277 | + | let pmtStrAssetIdA = $t092779364._1 | |
278 | + | let pmtAssetNameA = $t092779364._2 | |
279 | + | let pmtDecimalsA = $t092779364._3 | |
280 | + | let $t093699456 = getAssetInfoFromString(strAssetIdB) | |
281 | + | let pmtStrAssetIdB = $t093699456._1 | |
282 | + | let pmtAssetNameB = $t093699456._2 | |
283 | + | let pmtDecimalsB = $t093699456._3 | |
284 | + | if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStaking], i.callerPublicKey))) | |
285 | + | then throw("Only admin can call this function") | |
286 | + | else if (isDefined(getBoolean(this, keyActive))) | |
287 | + | then throw("DApp is already active") | |
288 | + | else if ((strAssetIdA == strAssetIdB)) | |
289 | + | then throw("Assets must be different") | |
290 | + | else { | |
291 | + | let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7)) | |
292 | + | let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this)) | |
293 | + | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
294 | + | let shareInitialSupply = 0 | |
295 | + | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
296 | + | let shareIssueId = calculateAssetId(shareIssue) | |
297 | + | let baseEntry = [StringEntry(keyVersion, version), BooleanEntry(keyActive, true), StringEntry(keyAssetIdA, pmtStrAssetIdA), StringEntry(keyAssetIdB, pmtStrAssetIdB), IntegerEntry(keyBalanceInitA, amtAssetA), IntegerEntry(keyBalanceInitB, amtAssetB), IntegerEntry(keyBalanceA, 0), IntegerEntry(keyBalanceB, 0), IntegerEntry(keyCommission, commission), IntegerEntry(keyCommissionScaleDelimiter, commissionScaleDelimiter), shareIssue, StringEntry(keyShareAssetId, toBase58String(shareIssueId)), IntegerEntry(keyShareAssetSupply, shareInitialSupply)] | |
298 | + | if (firstHarvest) | |
299 | + | then (baseEntry ++ [BooleanEntry(keyFirstHarvest, firstHarvest), IntegerEntry(keyFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))]) | |
300 | + | else baseEntry | |
301 | + | } | |
302 | + | } | |
303 | + | ||
304 | + | ||
305 | + | ||
306 | + | @Callable(i) | |
307 | + | func keepLimitForFirstHarvest (shareLimit) = if (!(isActive)) | |
308 | + | then throw("DApp is inactive at this moment") | |
309 | + | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStaking], i.callerPublicKey))) | |
310 | + | then throw("Only admin can call this function") | |
311 | + | else [IntegerEntry(kShareLimit, shareLimit)] | |
200 | 312 | ||
201 | 313 | ||
202 | 314 | ||
206 | 318 | let pmtAssetIdB = i.payments[1].assetId | |
207 | 319 | let pmtAmountA = deductStakingFee(i.payments[0].amount, pmtAssetIdA) | |
208 | 320 | let pmtAmountB = deductStakingFee(i.payments[1].amount, pmtAssetIdB) | |
209 | - | let tokenRatio = fraction(fraction(balanceA, scaleValue8, pmtAmountA), scaleValue3, fraction(balanceB, scaleValue8, pmtAmountB)) | |
210 | - | let ratioShareTokensInA = fraction(pmtAmountA, scaleValue8, balanceA) | |
211 | - | let ratioShareTokensInB = fraction(pmtAmountB, scaleValue8, balanceB) | |
212 | - | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8) | |
213 | - | if (!(isActive)) | |
214 | - | then throw("DApp is inactive at this moment") | |
215 | - | else if (if ((0 > slippageTolerance)) | |
216 | - | then true | |
217 | - | else (slippageTolerance > slippageToleranceDelimiter)) | |
218 | - | then throw(((("Slippage tolerance must be between 0 and " + toString(slippageToleranceDelimiter)) + " inclusively. Actual: ") + toString(slippageTolerance))) | |
219 | - | else if ((size(i.payments) != 2)) | |
220 | - | then throw("Two attached assets expected") | |
221 | - | else if (if ((pmtAssetIdA != assetIdA)) | |
321 | + | if (if ((balanceA == 0)) | |
322 | + | then (balanceB == 0) | |
323 | + | else false) | |
324 | + | then { | |
325 | + | let $t01214112218 = getAssetInfo(pmtAssetIdA) | |
326 | + | let pmtStrAssetIdA = $t01214112218._1 | |
327 | + | let pmtAssetNameA = $t01214112218._2 | |
328 | + | let pmtDecimalsA = $t01214112218._3 | |
329 | + | let $t01222712304 = getAssetInfo(pmtAssetIdB) | |
330 | + | let pmtStrAssetIdB = $t01222712304._1 | |
331 | + | let pmtAssetNameB = $t01222712304._2 | |
332 | + | let pmtDecimalsB = $t01222712304._3 | |
333 | + | let tokenRatio = fraction(fraction(assetInitA, scaleValue8, pmtAmountA), scaleValue3, fraction(assetInitB, scaleValue8, pmtAmountB)) | |
334 | + | if ((pmtAssetIdA == pmtAssetIdB)) | |
335 | + | then throw("Assets must be different") | |
336 | + | else { | |
337 | + | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
338 | + | let shareInitialSupply = fraction(pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, DOWN), pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, DOWN), pow(10, 0, shareDecimals, 0, 0, DOWN)) | |
339 | + | if (!(isActive)) | |
340 | + | then throw("DApp is inactive at this moment") | |
341 | + | else if (if ((0 > slippageTolerance)) | |
342 | + | then true | |
343 | + | else (slippageTolerance > slippageToleranceDelimiter)) | |
344 | + | then throw(((("Slippage tolerance must be between 0 and " + toString(slippageToleranceDelimiter)) + " inclusively. Actual: ") + toString(slippageTolerance))) | |
345 | + | else if ((size(i.payments) != 2)) | |
346 | + | then throw("Two attached assets expected") | |
347 | + | else if (if ((((scaleValue3 * (slippageToleranceDelimiter - slippageTolerance)) / slippageToleranceDelimiter) > tokenRatio)) | |
348 | + | then true | |
349 | + | else (tokenRatio > ((scaleValue3 * (slippageToleranceDelimiter + slippageTolerance)) / slippageToleranceDelimiter))) | |
350 | + | then throw("Incorrect assets amount: amounts must have the contract ratio") | |
351 | + | else if (if ((pmtAssetIdA != assetIdA)) | |
352 | + | then true | |
353 | + | else (pmtAssetIdB != assetIdB)) | |
354 | + | then throw(((("Incorrect assets attached. Expected: " + strAssetIdA) + " and ") + strAssetIdB)) | |
355 | + | else if ((shareInitialSupply == 0)) | |
356 | + | then throw("Too small amount to replenish") | |
357 | + | else if (!(hasEnoughBalance)) | |
358 | + | then ([ScriptTransfer(i.caller, pmtAmountA, pmtAssetIdA), ScriptTransfer(i.caller, pmtAmountB, pmtAssetIdB)] ++ suspendSuspicious()) | |
359 | + | else [Reissue(shareAssetId, shareInitialSupply, true), IntegerEntry(keyBalanceA, pmtAmountA), IntegerEntry(keyBalanceB, pmtAmountB), IntegerEntry(keyShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareAssetId)] | |
360 | + | } | |
361 | + | } | |
362 | + | else { | |
363 | + | let tokenRatio = fraction(fraction(balanceA, scaleValue8, pmtAmountA), scaleValue3, fraction(balanceB, scaleValue8, pmtAmountB)) | |
364 | + | let ratioShareTokensInA = fraction(pmtAmountA, scaleValue8, balanceA) | |
365 | + | let ratioShareTokensInB = fraction(pmtAmountB, scaleValue8, balanceB) | |
366 | + | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8) | |
367 | + | if (!(isActive)) | |
368 | + | then throw("DApp is inactive at this moment") | |
369 | + | else if (if ((0 > slippageTolerance)) | |
222 | 370 | then true | |
223 | - | else (pmtAssetIdB != assetIdB)) | |
224 | - | then throw(((("Incorrect assets attached. Expected: " + strAssetIdA) + " and ") + strAssetIdB)) | |
225 | - | else if (if ((((scaleValue3 * (slippageToleranceDelimiter - slippageTolerance)) / slippageToleranceDelimiter) > tokenRatio)) | |
226 | - | then true | |
227 | - | else (tokenRatio > ((scaleValue3 * (slippageToleranceDelimiter + slippageTolerance)) / slippageToleranceDelimiter))) | |
228 | - | then throw("Incorrect assets amount: amounts must have the contract ratio") | |
229 | - | else if ((shareTokenToPayAmount == 0)) | |
230 | - | then throw("Too small amount to replenish") | |
231 | - | else if (!(hasEnoughBalance)) | |
232 | - | then suspend(((((((((((((((("Suspicious state. Actual balances: " + toString(balanceA)) + " ") + assetNameA) + ", ") + toString(balanceB)) + " ") + assetNameB) + ". State: ") + toString(accountBalance(assetIdA))) + " ") + assetNameA) + ", ") + toString(accountBalance(assetIdB))) + " ") + assetNameB)) | |
233 | - | else [IntegerEntry(keyBalanceA, (balanceA + pmtAmountA)), IntegerEntry(keyBalanceB, (balanceB + pmtAmountB)), IntegerEntry(keyShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)] | |
371 | + | else (slippageTolerance > slippageToleranceDelimiter)) | |
372 | + | then throw(((("Slippage tolerance must be between 0 and " + toString(slippageToleranceDelimiter)) + " inclusively. Actual: ") + toString(slippageTolerance))) | |
373 | + | else if ((size(i.payments) != 2)) | |
374 | + | then throw("Two attached assets expected") | |
375 | + | else if (if ((pmtAssetIdA != assetIdA)) | |
376 | + | then true | |
377 | + | else (pmtAssetIdB != assetIdB)) | |
378 | + | then throw(((("Incorrect assets attached. Expected: " + strAssetIdA) + " and ") + strAssetIdB)) | |
379 | + | else if (if ((((scaleValue3 * (slippageToleranceDelimiter - slippageTolerance)) / slippageToleranceDelimiter) > tokenRatio)) | |
380 | + | then true | |
381 | + | else (tokenRatio > ((scaleValue3 * (slippageToleranceDelimiter + slippageTolerance)) / slippageToleranceDelimiter))) | |
382 | + | then throw("Incorrect assets amount: amounts must have the contract ratio") | |
383 | + | else if ((shareTokenToPayAmount == 0)) | |
384 | + | then throw("Too small amount to replenish") | |
385 | + | else if (!(hasEnoughBalance)) | |
386 | + | then ([ScriptTransfer(i.caller, pmtAmountA, pmtAssetIdA), ScriptTransfer(i.caller, pmtAmountB, pmtAssetIdB)] ++ suspendSuspicious()) | |
387 | + | else [IntegerEntry(keyBalanceA, (balanceA + pmtAmountA)), IntegerEntry(keyBalanceB, (balanceB + pmtAmountB)), IntegerEntry(keyShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)] | |
388 | + | } | |
234 | 389 | } | |
235 | 390 | ||
236 | 391 | ||
237 | 392 | ||
238 | 393 | @Callable(i) | |
239 | 394 | func withdraw () = { | |
240 | - | let $ | |
241 | - | let pmtAmount = $ | |
242 | - | let pmtAssetId = $ | |
395 | + | let $t01670316853 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
396 | + | let pmtAmount = $t01670316853._1 | |
397 | + | let pmtAssetId = $t01670316853._2 | |
243 | 398 | let amountToPayA = deductStakingFee(fraction(pmtAmount, balanceA, shareAssetSupply), assetIdA) | |
244 | 399 | let amountToPayB = deductStakingFee(fraction(pmtAmount, balanceB, shareAssetSupply), assetIdB) | |
245 | 400 | if (!(isActive)) | |
249 | 404 | else if ((pmtAssetId != shareAssetId)) | |
250 | 405 | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
251 | 406 | else if (!(hasEnoughBalance)) | |
252 | - | then | |
407 | + | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
253 | 408 | else if (if ((amountToPayA > availableBalanceA)) | |
254 | 409 | then true | |
255 | 410 | else (amountToPayB > availableBalanceB)) | |
261 | 416 | ||
262 | 417 | @Callable(i) | |
263 | 418 | func exchange (minAmountToReceive) = { | |
264 | - | let $ | |
265 | - | let pmtAmount = $ | |
266 | - | let pmtAssetId = $ | |
419 | + | let $t01805918134 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
420 | + | let pmtAmount = $t01805918134._1 | |
421 | + | let pmtAssetId = $t01805918134._2 | |
267 | 422 | func calculateFees (tokenFrom,tokenTo) = { | |
268 | 423 | let amountWithoutFee = fraction(tokenTo, pmtAmount, (pmtAmount + tokenFrom)) | |
269 | 424 | let amountWithFee = fraction(amountWithoutFee, (commissionScaleDelimiter - commission), commissionScaleDelimiter) | |
275 | 430 | ||
276 | 431 | if (!(isActive)) | |
277 | 432 | then throw("DApp is inactive at this moment") | |
278 | - | else if ((0 >= minAmountToReceive)) | |
279 | - | then throw(("Minimal amount to receive must be positive. Actual: " + toString(minAmountToReceive))) | |
280 | - | else if ((size(i.payments) != 1)) | |
281 | - | then throw("One attached payment expected") | |
282 | - | else if (!(hasEnoughBalance)) | |
283 | - | then suspend(((((((((((((((("Suspicious state. Actual balances: " + toString(balanceA)) + " ") + assetNameA) + ", ") + toString(balanceB)) + " ") + assetNameB) + ". State: ") + toString(accountBalance(assetIdA))) + " ") + assetNameA) + ", ") + toString(accountBalance(assetIdB))) + " ") + assetNameB)) | |
284 | - | else if ((pmtAssetId == assetIdA)) | |
285 | - | then { | |
286 | - | let assetIdSend = assetIdB | |
287 | - | let $t01224112332 = calculateFees(balanceA, balanceB) | |
288 | - | let amountWithoutFee = $t01224112332._1 | |
289 | - | let amountWithFee = $t01224112332._2 | |
290 | - | let governanceReward = $t01224112332._3 | |
291 | - | let newBalanceA = (balanceA + pmtAmount) | |
292 | - | let newBalanceB = ((balanceB - amountWithFee) - governanceReward) | |
293 | - | if (if (if ((assetIdA == USDN)) | |
294 | - | then (stakedAmountUSDN >= newBalanceA) | |
295 | - | else false) | |
296 | - | then true | |
297 | - | else if ((assetIdB == USDN)) | |
298 | - | then (stakedAmountUSDN >= newBalanceB) | |
299 | - | else false) | |
300 | - | then throwInsufficientAvailableBalance(amountWithFee, availableBalanceB, assetNameB) | |
301 | - | else [IntegerEntry(keyBalanceA, newBalanceA), IntegerEntry(keyBalanceB, newBalanceB), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(governanceAddress, governanceReward, assetIdSend)] | |
302 | - | } | |
303 | - | else if ((pmtAssetId == assetIdB)) | |
433 | + | else if (if ((balanceA == 0)) | |
434 | + | then true | |
435 | + | else (balanceB == 0)) | |
436 | + | then throw("Can't exchange with zero balance") | |
437 | + | else if ((0 >= minAmountToReceive)) | |
438 | + | then throw(("Minimal amount to receive must be positive. Actual: " + toString(minAmountToReceive))) | |
439 | + | else if ((size(i.payments) != 1)) | |
440 | + | then throw("One attached payment expected") | |
441 | + | else if (!(hasEnoughBalance)) | |
442 | + | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
443 | + | else if ((pmtAssetId == assetIdA)) | |
304 | 444 | then { | |
305 | - | let assetIdSend = | |
306 | - | let $ | |
307 | - | let amountWithoutFee = $ | |
308 | - | let amountWithFee = $ | |
309 | - | let governanceReward = $ | |
310 | - | let newBalanceA = ( | |
311 | - | let newBalanceB = (balanceB | |
445 | + | let assetIdSend = assetIdB | |
446 | + | let $t01940819499 = calculateFees(balanceA, balanceB) | |
447 | + | let amountWithoutFee = $t01940819499._1 | |
448 | + | let amountWithFee = $t01940819499._2 | |
449 | + | let governanceReward = $t01940819499._3 | |
450 | + | let newBalanceA = (balanceA + pmtAmount) | |
451 | + | let newBalanceB = ((balanceB - amountWithFee) - governanceReward) | |
312 | 452 | if (if (if ((assetIdA == USDN)) | |
313 | 453 | then (stakedAmountUSDN >= newBalanceA) | |
314 | 454 | else false) | |
316 | 456 | else if ((assetIdB == USDN)) | |
317 | 457 | then (stakedAmountUSDN >= newBalanceB) | |
318 | 458 | else false) | |
319 | - | then throwInsufficientAvailableBalance(amountWithFee, | |
320 | - | else [IntegerEntry(keyBalanceA, newBalanceA), IntegerEntry(keyBalanceB, newBalanceB), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer( | |
459 | + | then throwInsufficientAvailableBalance(amountWithFee, availableBalanceB, assetNameB) | |
460 | + | else [IntegerEntry(keyBalanceA, newBalanceA), IntegerEntry(keyBalanceB, newBalanceB), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(walletAddress, governanceReward, assetIdSend)] | |
321 | 461 | } | |
322 | - | else throw(((("Incorrect asset attached. Expected: " + strAssetIdA) + " or ") + strAssetIdB)) | |
462 | + | else if ((pmtAssetId == assetIdB)) | |
463 | + | then { | |
464 | + | let assetIdSend = assetIdA | |
465 | + | let $t02036820459 = calculateFees(balanceB, balanceA) | |
466 | + | let amountWithoutFee = $t02036820459._1 | |
467 | + | let amountWithFee = $t02036820459._2 | |
468 | + | let governanceReward = $t02036820459._3 | |
469 | + | let newBalanceA = ((balanceA - amountWithFee) - governanceReward) | |
470 | + | let newBalanceB = (balanceB + pmtAmount) | |
471 | + | if (if (if ((assetIdA == USDN)) | |
472 | + | then (stakedAmountUSDN >= newBalanceA) | |
473 | + | else false) | |
474 | + | then true | |
475 | + | else if ((assetIdB == USDN)) | |
476 | + | then (stakedAmountUSDN >= newBalanceB) | |
477 | + | else false) | |
478 | + | then throwInsufficientAvailableBalance(amountWithFee, availableBalanceA, assetNameA) | |
479 | + | else [IntegerEntry(keyBalanceA, newBalanceA), IntegerEntry(keyBalanceB, newBalanceB), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(walletAddress, governanceReward, assetIdSend)] | |
480 | + | } | |
481 | + | else throw(((("Incorrect asset attached. Expected: " + strAssetIdA) + " or ") + strAssetIdB)) | |
323 | 482 | } | |
324 | 483 | ||
325 | 484 | ||
346 | 505 | func takeIntoAccountExtraFunds (amountLeave) = { | |
347 | 506 | let uncountableAmountEnrollAssetA = (accountBalanceWithStakedA - balanceA) | |
348 | 507 | let uncountableAmountEnrollAssetB = (accountBalanceWithStakedB - balanceB) | |
349 | - | let amountEnrollA = (uncountableAmountEnrollAssetA - (if ((assetIdA == | |
508 | + | let amountEnrollA = (uncountableAmountEnrollAssetA - (if ((assetIdA == unit)) | |
350 | 509 | then amountLeave | |
351 | 510 | else 0)) | |
352 | - | let amountEnrollB = (uncountableAmountEnrollAssetB - (if ((assetIdB == | |
511 | + | let amountEnrollB = (uncountableAmountEnrollAssetB - (if ((assetIdB == unit)) | |
353 | 512 | then amountLeave | |
354 | 513 | else 0)) | |
355 | 514 | if (!(isActive)) | |
372 | 531 | ||
373 | 532 | @Verifier(tx) | |
374 | 533 | func verify () = match tx { | |
375 | - | case | |
376 | - | let callTakeIntoAccount = if (( | |
377 | - | then ( | |
534 | + | case inv: InvokeScriptTransaction => | |
535 | + | let callTakeIntoAccount = if ((inv.dApp == this)) | |
536 | + | then (inv.function == "takeIntoAccountExtraFunds") | |
378 | 537 | else false | |
379 | - | let callStaking = if (( | |
380 | - | then if (if (if (( | |
381 | - | then (size( | |
538 | + | let callStaking = if ((inv.dApp == stakingAddress)) | |
539 | + | then if (if (if ((inv.function == "lockNeutrino")) | |
540 | + | then (size(inv.payments) == 1) | |
382 | 541 | else false) | |
383 | - | then ( | |
542 | + | then (inv.payments[0].assetId == USDN) | |
384 | 543 | else false) | |
385 | 544 | then true | |
386 | - | else if (( | |
387 | - | then (size( | |
545 | + | else if ((inv.function == "unlockNeutrino")) | |
546 | + | then (size(inv.payments) == 0) | |
388 | 547 | else false | |
389 | 548 | else false | |
549 | + | let exchangeToWaves = if (if (if ((inv.dApp == USDNToWavesExchanger)) | |
550 | + | then (inv.function == "exchange") | |
551 | + | else false) | |
552 | + | then (assetIdA == USDN) | |
553 | + | else false) | |
554 | + | then true | |
555 | + | else if ((assetIdB == USDN)) | |
556 | + | then (inv.payments[0].assetId == USDN) | |
557 | + | else false | |
390 | 558 | let signedByAdmin = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
391 | 559 | then true | |
392 | 560 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey2)) | |
394 | 562 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey3)) | |
395 | 563 | then true | |
396 | 564 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKeyStaking) | |
397 | - | if (callTakeIntoAccount) | |
565 | + | if (if (if (callTakeIntoAccount) | |
398 | 566 | then true | |
399 | - | else callStaking | |
567 | + | else callStaking) | |
568 | + | then true | |
569 | + | else exchangeToWaves) | |
570 | + | then signedByAdmin | |
571 | + | else false | |
400 | 572 | case _ => | |
401 | - | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
573 | + | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
574 | + | then 1 | |
575 | + | else 0 | |
576 | + | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
577 | + | then 1 | |
578 | + | else 0 | |
579 | + | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
580 | + | then 1 | |
581 | + | else 0 | |
582 | + | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
402 | 583 | } | |
403 | 584 |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let version = "1.0.0" | |
5 | 5 | ||
6 | 6 | let keyVersion = "version" | |
7 | 7 | ||
8 | 8 | let keyActive = "active" | |
9 | 9 | ||
10 | 10 | let keyAssetIdA = "A_asset_id" | |
11 | 11 | ||
12 | 12 | let keyAssetIdB = "B_asset_id" | |
13 | 13 | ||
14 | 14 | let keyBalanceA = "A_asset_balance" | |
15 | 15 | ||
16 | 16 | let keyBalanceB = "B_asset_balance" | |
17 | 17 | ||
18 | + | let keyBalanceInitA = "A_asset_init" | |
19 | + | ||
20 | + | let keyBalanceInitB = "B_asset_init" | |
21 | + | ||
18 | 22 | let keyShareAssetId = "share_asset_id" | |
19 | 23 | ||
20 | 24 | let keyShareAssetSupply = "share_asset_supply" | |
21 | 25 | ||
22 | 26 | let keyCommission = "commission" | |
23 | 27 | ||
24 | 28 | let keyCommissionScaleDelimiter = "commission_scale_delimiter" | |
25 | 29 | ||
26 | 30 | let keyCause = "shutdown_cause" | |
27 | 31 | ||
28 | - | let | |
32 | + | let keyFirstHarvest = "first_harvest" | |
29 | 33 | ||
30 | - | let | |
34 | + | let keyFirstHarvestHeight = "first_harvest_height" | |
31 | 35 | ||
32 | - | let adminPubKey3 = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
36 | + | let kShareLimit = "share_limit_on_first_harvest" | |
37 | + | ||
38 | + | let kBasePeriod = "base_period" | |
39 | + | ||
40 | + | let kPeriodLength = "period_length" | |
41 | + | ||
42 | + | let kStartHeight = "start_height" | |
43 | + | ||
44 | + | let kFirstHarvestHeight = "first_harvest_height" | |
45 | + | ||
46 | + | let keyAdminPubKey1 = "admin_pub_1" | |
47 | + | ||
48 | + | let keyAdminPubKey2 = "admin_pub_2" | |
49 | + | ||
50 | + | let keyAdminPubKey3 = "admin_pub_3" | |
51 | + | ||
52 | + | let oracle = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
53 | + | ||
54 | + | func getAdminPub (keyAdminPub) = match getString(oracle, keyAdminPub) { | |
55 | + | case string: String => | |
56 | + | fromBase58String(string) | |
57 | + | case nothing => | |
58 | + | throw("Admin public key is empty") | |
59 | + | } | |
60 | + | ||
61 | + | ||
62 | + | let adminPubKey1 = getAdminPub(keyAdminPubKey1) | |
63 | + | ||
64 | + | let adminPubKey2 = getAdminPub(keyAdminPubKey2) | |
65 | + | ||
66 | + | let adminPubKey3 = getAdminPub(keyAdminPubKey3) | |
33 | 67 | ||
34 | 68 | let adminPubKeyStartStop = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
35 | 69 | ||
36 | 70 | let adminPubKeyStaking = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
37 | 71 | ||
38 | - | let governanceAddress = Address(base58'3NAGTtZz6WpupSN89NZD5rMZwwziZEg4Kx4') | |
72 | + | let walletAddress = Address(base58'3NAGTtZz6WpupSN89NZD5rMZwwziZEg4Kx4') | |
73 | + | ||
74 | + | let votingAddress = Address(base58'3MrJgdL1GniipErHy44YF9idzLaUL2iX5DQ') | |
39 | 75 | ||
40 | 76 | let stakingAddress = Address(base58'3N6q7sCGSSLBUXDdjBdYGTJbZGZfhhh8cNg') | |
41 | 77 | ||
42 | - | let | |
78 | + | let USDNToWavesExchanger = Address(base58'3N77kfPbQyjXWpDALX3xjKw3iEGMWEctV37') | |
43 | 79 | ||
44 | - | let stakingFeeInUSDN = (9 * value(value(assetInfo(USDN)).minSponsoredFee)) | |
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)) + 3) | |
87 | + | ||
88 | + | let USDN = base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p' | |
89 | + | ||
90 | + | let stakingFeeInUSDN = 270000 | |
45 | 91 | ||
46 | 92 | let isActive = getBooleanValue(this, keyActive) | |
47 | 93 | ||
48 | 94 | let strAssetIdA = getStringValue(this, keyAssetIdA) | |
49 | 95 | ||
50 | 96 | let strAssetIdB = getStringValue(this, keyAssetIdB) | |
51 | 97 | ||
52 | 98 | let assetIdA = if ((strAssetIdA == "WAVES")) | |
53 | 99 | then unit | |
54 | 100 | else fromBase58String(strAssetIdA) | |
55 | 101 | ||
56 | 102 | let assetIdB = if ((strAssetIdB == "WAVES")) | |
57 | 103 | then unit | |
58 | 104 | else fromBase58String(strAssetIdB) | |
59 | 105 | ||
60 | 106 | let assetNameA = match assetIdA { | |
61 | 107 | case id: ByteVector => | |
62 | 108 | value(assetInfo(id)).name | |
63 | 109 | case waves: Unit => | |
64 | 110 | "WAVES" | |
65 | 111 | case _ => | |
66 | 112 | throw("Match error") | |
67 | 113 | } | |
68 | 114 | ||
69 | 115 | let assetNameB = match assetIdB { | |
70 | 116 | case id: ByteVector => | |
71 | 117 | value(assetInfo(id)).name | |
72 | 118 | case waves: Unit => | |
73 | 119 | "WAVES" | |
74 | 120 | case _ => | |
75 | 121 | throw("Match error") | |
76 | 122 | } | |
77 | 123 | ||
78 | 124 | let balanceA = getIntegerValue(this, keyBalanceA) | |
79 | 125 | ||
80 | 126 | let balanceB = getIntegerValue(this, keyBalanceB) | |
81 | 127 | ||
82 | 128 | let shareAssetId = fromBase58String(getStringValue(this, keyShareAssetId)) | |
83 | 129 | ||
84 | 130 | let shareAssetSupply = getIntegerValue(this, keyShareAssetSupply) | |
85 | 131 | ||
86 | 132 | let commission = 3000 | |
87 | 133 | ||
88 | 134 | let commissionGovernance = 1200 | |
89 | 135 | ||
90 | 136 | let commissionScaleDelimiter = 1000000 | |
91 | 137 | ||
92 | 138 | let scaleValue3 = 1000 | |
93 | 139 | ||
94 | 140 | let scaleValue8 = 100000000 | |
95 | 141 | ||
96 | 142 | let slippageToleranceDelimiter = 1000 | |
97 | 143 | ||
98 | 144 | let scaleValue8Digits = 8 | |
99 | 145 | ||
100 | 146 | func accountBalance (assetId) = match assetId { | |
101 | 147 | case id: ByteVector => | |
102 | 148 | assetBalance(this, id) | |
103 | 149 | case waves: Unit => | |
104 | 150 | wavesBalance(this).available | |
105 | 151 | case _ => | |
106 | 152 | throw("Match error") | |
107 | 153 | } | |
108 | 154 | ||
109 | 155 | ||
110 | 156 | let stakedAmountUSDN = match getInteger(stakingAddress, ((("rpd_balance_" + toBase58String(USDN)) + "_") + toString(this))) { | |
111 | 157 | case staked: Int => | |
112 | 158 | staked | |
113 | 159 | case nothing: Unit => | |
114 | 160 | 0 | |
115 | 161 | case _ => | |
116 | 162 | throw("Match error") | |
117 | 163 | } | |
118 | 164 | ||
165 | + | let assetInitA = getIntegerValue(this, keyBalanceInitA) | |
166 | + | ||
167 | + | let assetInitB = getIntegerValue(this, keyBalanceInitB) | |
168 | + | ||
119 | 169 | let availableBalanceA = (balanceA - (if ((assetIdA == USDN)) | |
120 | 170 | then stakedAmountUSDN | |
121 | 171 | else 0)) | |
122 | 172 | ||
123 | 173 | let availableBalanceB = (balanceB - (if ((assetIdB == USDN)) | |
124 | 174 | then stakedAmountUSDN | |
125 | 175 | else 0)) | |
126 | 176 | ||
127 | 177 | let accountBalanceWithStakedA = (accountBalance(assetIdA) + (if ((assetIdA == USDN)) | |
128 | 178 | then stakedAmountUSDN | |
129 | 179 | else 0)) | |
130 | 180 | ||
131 | 181 | let accountBalanceWithStakedB = (accountBalance(assetIdB) + (if ((assetIdB == USDN)) | |
132 | 182 | then stakedAmountUSDN | |
133 | 183 | else 0)) | |
134 | 184 | ||
135 | 185 | let hasEnoughBalance = if ((accountBalanceWithStakedA >= balanceA)) | |
136 | 186 | then (accountBalanceWithStakedB >= balanceB) | |
137 | 187 | else false | |
138 | 188 | ||
139 | 189 | func getAssetInfo (assetId) = match assetId { | |
140 | 190 | case id: ByteVector => | |
141 | 191 | let stringId = toBase58String(id) | |
142 | 192 | let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist")) | |
143 | 193 | $Tuple3(stringId, info.name, info.decimals) | |
144 | 194 | case waves: Unit => | |
145 | 195 | $Tuple3("WAVES", "WAVES", 8) | |
146 | 196 | case _ => | |
147 | 197 | throw("Match error") | |
148 | 198 | } | |
149 | 199 | ||
150 | 200 | ||
201 | + | func getAssetInfoFromString (assetStr) = if ((assetStr == "WAVES")) | |
202 | + | then $Tuple3("WAVES", "WAVES", 8) | |
203 | + | else { | |
204 | + | let stringId = assetStr | |
205 | + | let id = fromBase58String(assetStr) | |
206 | + | let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist")) | |
207 | + | $Tuple3(stringId, info.name, info.decimals) | |
208 | + | } | |
209 | + | ||
210 | + | ||
151 | 211 | func suspend (cause) = [BooleanEntry(keyActive, false), StringEntry(keyCause, cause)] | |
152 | 212 | ||
153 | 213 | ||
154 | 214 | func deductStakingFee (amount,assetId) = if ((assetId == USDN)) | |
155 | 215 | then { | |
156 | 216 | let result = (amount - stakingFeeInUSDN) | |
157 | 217 | if ((0 >= result)) | |
158 | 218 | then throw((((("Insufficient amount " + toString(amount)) + " to deduct staking fee ") + toString(stakingFeeInUSDN)) + " USD-N")) | |
159 | 219 | else result | |
160 | 220 | } | |
161 | 221 | else amount | |
162 | 222 | ||
163 | 223 | ||
164 | 224 | 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")) | |
165 | 225 | ||
166 | 226 | ||
167 | 227 | 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")) | |
168 | 228 | ||
169 | 229 | ||
230 | + | func suspendSuspicious () = suspend(((((((((((((((("Suspicious state. Actual balances: " + toString(accountBalanceWithStakedA)) + " ") + assetNameA) + ", ") + toString(accountBalanceWithStakedB)) + " ") + assetNameB) + ". State: ") + toString(balanceA)) + " ") + assetNameA) + ", ") + toString(balanceB)) + " ") + assetNameB)) | |
231 | + | ||
232 | + | ||
170 | 233 | @Callable(i) | |
171 | - | func init () = { | |
172 | - | let $t047504827 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
173 | - | let pmtAmountA = $t047504827._1 | |
174 | - | let pmtAssetIdA = $t047504827._2 | |
175 | - | let $t048324909 = $Tuple2(i.payments[1].amount, i.payments[1].assetId) | |
176 | - | let pmtAmountB = $t048324909._1 | |
177 | - | let pmtAssetIdB = $t048324909._2 | |
178 | - | let $t049144991 = getAssetInfo(pmtAssetIdA) | |
179 | - | let pmtStrAssetIdA = $t049144991._1 | |
180 | - | let pmtAssetNameA = $t049144991._2 | |
181 | - | let pmtDecimalsA = $t049144991._3 | |
182 | - | let $t049965073 = getAssetInfo(pmtAssetIdB) | |
183 | - | let pmtStrAssetIdB = $t049965073._1 | |
184 | - | let pmtAssetNameB = $t049965073._2 | |
185 | - | let pmtDecimalsB = $t049965073._3 | |
186 | - | if (isDefined(getBoolean(this, keyActive))) | |
187 | - | then throw("DApp is already active") | |
188 | - | else if ((pmtAssetIdA == pmtAssetIdB)) | |
189 | - | then throw("Assets must be different") | |
190 | - | else { | |
191 | - | let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7)) | |
192 | - | let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this)) | |
193 | - | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
194 | - | let shareInitialSupply = fraction(pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, HALFDOWN), pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, HALFDOWN), pow(10, 0, shareDecimals, 0, 0, HALFDOWN)) | |
195 | - | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
196 | - | let shareIssueId = calculateAssetId(shareIssue) | |
197 | - | [StringEntry(keyVersion, version), BooleanEntry(keyActive, true), StringEntry(keyAssetIdA, pmtStrAssetIdA), StringEntry(keyAssetIdB, pmtStrAssetIdB), IntegerEntry(keyBalanceA, pmtAmountA), IntegerEntry(keyBalanceB, pmtAmountB), IntegerEntry(keyCommission, commission), IntegerEntry(keyCommissionScaleDelimiter, commissionScaleDelimiter), shareIssue, StringEntry(keyShareAssetId, toBase58String(shareIssueId)), IntegerEntry(keyShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareIssueId)] | |
198 | - | } | |
234 | + | func init (firstHarvest) = { | |
235 | + | let $t067096786 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
236 | + | let pmtAmountA = $t067096786._1 | |
237 | + | let pmtAssetIdA = $t067096786._2 | |
238 | + | let $t067916868 = $Tuple2(i.payments[1].amount, i.payments[1].assetId) | |
239 | + | let pmtAmountB = $t067916868._1 | |
240 | + | let pmtAssetIdB = $t067916868._2 | |
241 | + | let $t068736950 = getAssetInfo(pmtAssetIdA) | |
242 | + | let pmtStrAssetIdA = $t068736950._1 | |
243 | + | let pmtAssetNameA = $t068736950._2 | |
244 | + | let pmtDecimalsA = $t068736950._3 | |
245 | + | let $t069557032 = getAssetInfo(pmtAssetIdB) | |
246 | + | let pmtStrAssetIdB = $t069557032._1 | |
247 | + | let pmtAssetNameB = $t069557032._2 | |
248 | + | let pmtDecimalsB = $t069557032._3 | |
249 | + | if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStaking], i.callerPublicKey))) | |
250 | + | then throw("Only admin can call this function") | |
251 | + | else if (isDefined(getBoolean(this, keyActive))) | |
252 | + | then throw("DApp is already active") | |
253 | + | else if ((pmtAssetIdA == pmtAssetIdB)) | |
254 | + | then throw("Assets must be different") | |
255 | + | else { | |
256 | + | let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7)) | |
257 | + | let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this)) | |
258 | + | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
259 | + | let arg1 = pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, DOWN) | |
260 | + | let arg2 = pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, DOWN) | |
261 | + | let arg3 = pow(10, 0, shareDecimals, 0, 0, DOWN) | |
262 | + | let shareInitialSupply = fraction(arg1, arg2, arg3) | |
263 | + | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
264 | + | let shareIssueId = calculateAssetId(shareIssue) | |
265 | + | let baseEntry = [StringEntry(keyVersion, version), BooleanEntry(keyActive, true), StringEntry(keyAssetIdA, pmtStrAssetIdA), StringEntry(keyAssetIdB, pmtStrAssetIdB), IntegerEntry(keyBalanceA, pmtAmountA), IntegerEntry(keyBalanceB, pmtAmountB), IntegerEntry(keyCommission, commission), IntegerEntry(keyCommissionScaleDelimiter, commissionScaleDelimiter), shareIssue, StringEntry(keyShareAssetId, toBase58String(shareIssueId)), IntegerEntry(keyShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareIssueId)] | |
266 | + | if (firstHarvest) | |
267 | + | then (baseEntry ++ [BooleanEntry(keyFirstHarvest, firstHarvest), IntegerEntry(keyFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))]) | |
268 | + | else baseEntry | |
269 | + | } | |
199 | 270 | } | |
271 | + | ||
272 | + | ||
273 | + | ||
274 | + | @Callable(i) | |
275 | + | func initWithInitRatio (amtAssetA,amtAssetB,strAssetIdA,strAssetIdB,firstHarvest) = { | |
276 | + | let $t092779364 = getAssetInfoFromString(strAssetIdA) | |
277 | + | let pmtStrAssetIdA = $t092779364._1 | |
278 | + | let pmtAssetNameA = $t092779364._2 | |
279 | + | let pmtDecimalsA = $t092779364._3 | |
280 | + | let $t093699456 = getAssetInfoFromString(strAssetIdB) | |
281 | + | let pmtStrAssetIdB = $t093699456._1 | |
282 | + | let pmtAssetNameB = $t093699456._2 | |
283 | + | let pmtDecimalsB = $t093699456._3 | |
284 | + | if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStaking], i.callerPublicKey))) | |
285 | + | then throw("Only admin can call this function") | |
286 | + | else if (isDefined(getBoolean(this, keyActive))) | |
287 | + | then throw("DApp is already active") | |
288 | + | else if ((strAssetIdA == strAssetIdB)) | |
289 | + | then throw("Assets must be different") | |
290 | + | else { | |
291 | + | let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7)) | |
292 | + | let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this)) | |
293 | + | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
294 | + | let shareInitialSupply = 0 | |
295 | + | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
296 | + | let shareIssueId = calculateAssetId(shareIssue) | |
297 | + | let baseEntry = [StringEntry(keyVersion, version), BooleanEntry(keyActive, true), StringEntry(keyAssetIdA, pmtStrAssetIdA), StringEntry(keyAssetIdB, pmtStrAssetIdB), IntegerEntry(keyBalanceInitA, amtAssetA), IntegerEntry(keyBalanceInitB, amtAssetB), IntegerEntry(keyBalanceA, 0), IntegerEntry(keyBalanceB, 0), IntegerEntry(keyCommission, commission), IntegerEntry(keyCommissionScaleDelimiter, commissionScaleDelimiter), shareIssue, StringEntry(keyShareAssetId, toBase58String(shareIssueId)), IntegerEntry(keyShareAssetSupply, shareInitialSupply)] | |
298 | + | if (firstHarvest) | |
299 | + | then (baseEntry ++ [BooleanEntry(keyFirstHarvest, firstHarvest), IntegerEntry(keyFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))]) | |
300 | + | else baseEntry | |
301 | + | } | |
302 | + | } | |
303 | + | ||
304 | + | ||
305 | + | ||
306 | + | @Callable(i) | |
307 | + | func keepLimitForFirstHarvest (shareLimit) = if (!(isActive)) | |
308 | + | then throw("DApp is inactive at this moment") | |
309 | + | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStaking], i.callerPublicKey))) | |
310 | + | then throw("Only admin can call this function") | |
311 | + | else [IntegerEntry(kShareLimit, shareLimit)] | |
200 | 312 | ||
201 | 313 | ||
202 | 314 | ||
203 | 315 | @Callable(i) | |
204 | 316 | func replenishWithTwoTokens (slippageTolerance) = { | |
205 | 317 | let pmtAssetIdA = i.payments[0].assetId | |
206 | 318 | let pmtAssetIdB = i.payments[1].assetId | |
207 | 319 | let pmtAmountA = deductStakingFee(i.payments[0].amount, pmtAssetIdA) | |
208 | 320 | let pmtAmountB = deductStakingFee(i.payments[1].amount, pmtAssetIdB) | |
209 | - | let tokenRatio = fraction(fraction(balanceA, scaleValue8, pmtAmountA), scaleValue3, fraction(balanceB, scaleValue8, pmtAmountB)) | |
210 | - | let ratioShareTokensInA = fraction(pmtAmountA, scaleValue8, balanceA) | |
211 | - | let ratioShareTokensInB = fraction(pmtAmountB, scaleValue8, balanceB) | |
212 | - | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8) | |
213 | - | if (!(isActive)) | |
214 | - | then throw("DApp is inactive at this moment") | |
215 | - | else if (if ((0 > slippageTolerance)) | |
216 | - | then true | |
217 | - | else (slippageTolerance > slippageToleranceDelimiter)) | |
218 | - | then throw(((("Slippage tolerance must be between 0 and " + toString(slippageToleranceDelimiter)) + " inclusively. Actual: ") + toString(slippageTolerance))) | |
219 | - | else if ((size(i.payments) != 2)) | |
220 | - | then throw("Two attached assets expected") | |
221 | - | else if (if ((pmtAssetIdA != assetIdA)) | |
321 | + | if (if ((balanceA == 0)) | |
322 | + | then (balanceB == 0) | |
323 | + | else false) | |
324 | + | then { | |
325 | + | let $t01214112218 = getAssetInfo(pmtAssetIdA) | |
326 | + | let pmtStrAssetIdA = $t01214112218._1 | |
327 | + | let pmtAssetNameA = $t01214112218._2 | |
328 | + | let pmtDecimalsA = $t01214112218._3 | |
329 | + | let $t01222712304 = getAssetInfo(pmtAssetIdB) | |
330 | + | let pmtStrAssetIdB = $t01222712304._1 | |
331 | + | let pmtAssetNameB = $t01222712304._2 | |
332 | + | let pmtDecimalsB = $t01222712304._3 | |
333 | + | let tokenRatio = fraction(fraction(assetInitA, scaleValue8, pmtAmountA), scaleValue3, fraction(assetInitB, scaleValue8, pmtAmountB)) | |
334 | + | if ((pmtAssetIdA == pmtAssetIdB)) | |
335 | + | then throw("Assets must be different") | |
336 | + | else { | |
337 | + | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
338 | + | let shareInitialSupply = fraction(pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, DOWN), pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, DOWN), pow(10, 0, shareDecimals, 0, 0, DOWN)) | |
339 | + | if (!(isActive)) | |
340 | + | then throw("DApp is inactive at this moment") | |
341 | + | else if (if ((0 > slippageTolerance)) | |
342 | + | then true | |
343 | + | else (slippageTolerance > slippageToleranceDelimiter)) | |
344 | + | then throw(((("Slippage tolerance must be between 0 and " + toString(slippageToleranceDelimiter)) + " inclusively. Actual: ") + toString(slippageTolerance))) | |
345 | + | else if ((size(i.payments) != 2)) | |
346 | + | then throw("Two attached assets expected") | |
347 | + | else if (if ((((scaleValue3 * (slippageToleranceDelimiter - slippageTolerance)) / slippageToleranceDelimiter) > tokenRatio)) | |
348 | + | then true | |
349 | + | else (tokenRatio > ((scaleValue3 * (slippageToleranceDelimiter + slippageTolerance)) / slippageToleranceDelimiter))) | |
350 | + | then throw("Incorrect assets amount: amounts must have the contract ratio") | |
351 | + | else if (if ((pmtAssetIdA != assetIdA)) | |
352 | + | then true | |
353 | + | else (pmtAssetIdB != assetIdB)) | |
354 | + | then throw(((("Incorrect assets attached. Expected: " + strAssetIdA) + " and ") + strAssetIdB)) | |
355 | + | else if ((shareInitialSupply == 0)) | |
356 | + | then throw("Too small amount to replenish") | |
357 | + | else if (!(hasEnoughBalance)) | |
358 | + | then ([ScriptTransfer(i.caller, pmtAmountA, pmtAssetIdA), ScriptTransfer(i.caller, pmtAmountB, pmtAssetIdB)] ++ suspendSuspicious()) | |
359 | + | else [Reissue(shareAssetId, shareInitialSupply, true), IntegerEntry(keyBalanceA, pmtAmountA), IntegerEntry(keyBalanceB, pmtAmountB), IntegerEntry(keyShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareAssetId)] | |
360 | + | } | |
361 | + | } | |
362 | + | else { | |
363 | + | let tokenRatio = fraction(fraction(balanceA, scaleValue8, pmtAmountA), scaleValue3, fraction(balanceB, scaleValue8, pmtAmountB)) | |
364 | + | let ratioShareTokensInA = fraction(pmtAmountA, scaleValue8, balanceA) | |
365 | + | let ratioShareTokensInB = fraction(pmtAmountB, scaleValue8, balanceB) | |
366 | + | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8) | |
367 | + | if (!(isActive)) | |
368 | + | then throw("DApp is inactive at this moment") | |
369 | + | else if (if ((0 > slippageTolerance)) | |
222 | 370 | then true | |
223 | - | else (pmtAssetIdB != assetIdB)) | |
224 | - | then throw(((("Incorrect assets attached. Expected: " + strAssetIdA) + " and ") + strAssetIdB)) | |
225 | - | else if (if ((((scaleValue3 * (slippageToleranceDelimiter - slippageTolerance)) / slippageToleranceDelimiter) > tokenRatio)) | |
226 | - | then true | |
227 | - | else (tokenRatio > ((scaleValue3 * (slippageToleranceDelimiter + slippageTolerance)) / slippageToleranceDelimiter))) | |
228 | - | then throw("Incorrect assets amount: amounts must have the contract ratio") | |
229 | - | else if ((shareTokenToPayAmount == 0)) | |
230 | - | then throw("Too small amount to replenish") | |
231 | - | else if (!(hasEnoughBalance)) | |
232 | - | then suspend(((((((((((((((("Suspicious state. Actual balances: " + toString(balanceA)) + " ") + assetNameA) + ", ") + toString(balanceB)) + " ") + assetNameB) + ". State: ") + toString(accountBalance(assetIdA))) + " ") + assetNameA) + ", ") + toString(accountBalance(assetIdB))) + " ") + assetNameB)) | |
233 | - | else [IntegerEntry(keyBalanceA, (balanceA + pmtAmountA)), IntegerEntry(keyBalanceB, (balanceB + pmtAmountB)), IntegerEntry(keyShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)] | |
371 | + | else (slippageTolerance > slippageToleranceDelimiter)) | |
372 | + | then throw(((("Slippage tolerance must be between 0 and " + toString(slippageToleranceDelimiter)) + " inclusively. Actual: ") + toString(slippageTolerance))) | |
373 | + | else if ((size(i.payments) != 2)) | |
374 | + | then throw("Two attached assets expected") | |
375 | + | else if (if ((pmtAssetIdA != assetIdA)) | |
376 | + | then true | |
377 | + | else (pmtAssetIdB != assetIdB)) | |
378 | + | then throw(((("Incorrect assets attached. Expected: " + strAssetIdA) + " and ") + strAssetIdB)) | |
379 | + | else if (if ((((scaleValue3 * (slippageToleranceDelimiter - slippageTolerance)) / slippageToleranceDelimiter) > tokenRatio)) | |
380 | + | then true | |
381 | + | else (tokenRatio > ((scaleValue3 * (slippageToleranceDelimiter + slippageTolerance)) / slippageToleranceDelimiter))) | |
382 | + | then throw("Incorrect assets amount: amounts must have the contract ratio") | |
383 | + | else if ((shareTokenToPayAmount == 0)) | |
384 | + | then throw("Too small amount to replenish") | |
385 | + | else if (!(hasEnoughBalance)) | |
386 | + | then ([ScriptTransfer(i.caller, pmtAmountA, pmtAssetIdA), ScriptTransfer(i.caller, pmtAmountB, pmtAssetIdB)] ++ suspendSuspicious()) | |
387 | + | else [IntegerEntry(keyBalanceA, (balanceA + pmtAmountA)), IntegerEntry(keyBalanceB, (balanceB + pmtAmountB)), IntegerEntry(keyShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)] | |
388 | + | } | |
234 | 389 | } | |
235 | 390 | ||
236 | 391 | ||
237 | 392 | ||
238 | 393 | @Callable(i) | |
239 | 394 | func withdraw () = { | |
240 | - | let $ | |
241 | - | let pmtAmount = $ | |
242 | - | let pmtAssetId = $ | |
395 | + | let $t01670316853 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
396 | + | let pmtAmount = $t01670316853._1 | |
397 | + | let pmtAssetId = $t01670316853._2 | |
243 | 398 | let amountToPayA = deductStakingFee(fraction(pmtAmount, balanceA, shareAssetSupply), assetIdA) | |
244 | 399 | let amountToPayB = deductStakingFee(fraction(pmtAmount, balanceB, shareAssetSupply), assetIdB) | |
245 | 400 | if (!(isActive)) | |
246 | 401 | then throw("DApp is inactive at this moment") | |
247 | 402 | else if ((size(i.payments) != 1)) | |
248 | 403 | then throw("One attached payment expected") | |
249 | 404 | else if ((pmtAssetId != shareAssetId)) | |
250 | 405 | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
251 | 406 | else if (!(hasEnoughBalance)) | |
252 | - | then | |
407 | + | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
253 | 408 | else if (if ((amountToPayA > availableBalanceA)) | |
254 | 409 | then true | |
255 | 410 | else (amountToPayB > availableBalanceB)) | |
256 | 411 | then throwInsufficientAvailableBalances(amountToPayA, amountToPayB) | |
257 | 412 | else [IntegerEntry(keyBalanceA, (balanceA - amountToPayA)), IntegerEntry(keyBalanceB, (balanceB - amountToPayB)), IntegerEntry(keyShareAssetSupply, (shareAssetSupply - pmtAmount)), Burn(shareAssetId, pmtAmount), ScriptTransfer(i.caller, amountToPayA, assetIdA), ScriptTransfer(i.caller, amountToPayB, assetIdB)] | |
258 | 413 | } | |
259 | 414 | ||
260 | 415 | ||
261 | 416 | ||
262 | 417 | @Callable(i) | |
263 | 418 | func exchange (minAmountToReceive) = { | |
264 | - | let $ | |
265 | - | let pmtAmount = $ | |
266 | - | let pmtAssetId = $ | |
419 | + | let $t01805918134 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
420 | + | let pmtAmount = $t01805918134._1 | |
421 | + | let pmtAssetId = $t01805918134._2 | |
267 | 422 | func calculateFees (tokenFrom,tokenTo) = { | |
268 | 423 | let amountWithoutFee = fraction(tokenTo, pmtAmount, (pmtAmount + tokenFrom)) | |
269 | 424 | let amountWithFee = fraction(amountWithoutFee, (commissionScaleDelimiter - commission), commissionScaleDelimiter) | |
270 | 425 | let governanceReward = fraction(amountWithoutFee, commissionGovernance, commissionScaleDelimiter) | |
271 | 426 | if ((minAmountToReceive > amountWithFee)) | |
272 | 427 | then throw(((("Calculated amount to receive " + toString(amountWithFee)) + " is less than specified minimum ") + toString(minAmountToReceive))) | |
273 | 428 | else $Tuple3(amountWithoutFee, amountWithFee, governanceReward) | |
274 | 429 | } | |
275 | 430 | ||
276 | 431 | if (!(isActive)) | |
277 | 432 | then throw("DApp is inactive at this moment") | |
278 | - | else if ((0 >= minAmountToReceive)) | |
279 | - | then throw(("Minimal amount to receive must be positive. Actual: " + toString(minAmountToReceive))) | |
280 | - | else if ((size(i.payments) != 1)) | |
281 | - | then throw("One attached payment expected") | |
282 | - | else if (!(hasEnoughBalance)) | |
283 | - | then suspend(((((((((((((((("Suspicious state. Actual balances: " + toString(balanceA)) + " ") + assetNameA) + ", ") + toString(balanceB)) + " ") + assetNameB) + ". State: ") + toString(accountBalance(assetIdA))) + " ") + assetNameA) + ", ") + toString(accountBalance(assetIdB))) + " ") + assetNameB)) | |
284 | - | else if ((pmtAssetId == assetIdA)) | |
285 | - | then { | |
286 | - | let assetIdSend = assetIdB | |
287 | - | let $t01224112332 = calculateFees(balanceA, balanceB) | |
288 | - | let amountWithoutFee = $t01224112332._1 | |
289 | - | let amountWithFee = $t01224112332._2 | |
290 | - | let governanceReward = $t01224112332._3 | |
291 | - | let newBalanceA = (balanceA + pmtAmount) | |
292 | - | let newBalanceB = ((balanceB - amountWithFee) - governanceReward) | |
293 | - | if (if (if ((assetIdA == USDN)) | |
294 | - | then (stakedAmountUSDN >= newBalanceA) | |
295 | - | else false) | |
296 | - | then true | |
297 | - | else if ((assetIdB == USDN)) | |
298 | - | then (stakedAmountUSDN >= newBalanceB) | |
299 | - | else false) | |
300 | - | then throwInsufficientAvailableBalance(amountWithFee, availableBalanceB, assetNameB) | |
301 | - | else [IntegerEntry(keyBalanceA, newBalanceA), IntegerEntry(keyBalanceB, newBalanceB), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(governanceAddress, governanceReward, assetIdSend)] | |
302 | - | } | |
303 | - | else if ((pmtAssetId == assetIdB)) | |
433 | + | else if (if ((balanceA == 0)) | |
434 | + | then true | |
435 | + | else (balanceB == 0)) | |
436 | + | then throw("Can't exchange with zero balance") | |
437 | + | else if ((0 >= minAmountToReceive)) | |
438 | + | then throw(("Minimal amount to receive must be positive. Actual: " + toString(minAmountToReceive))) | |
439 | + | else if ((size(i.payments) != 1)) | |
440 | + | then throw("One attached payment expected") | |
441 | + | else if (!(hasEnoughBalance)) | |
442 | + | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
443 | + | else if ((pmtAssetId == assetIdA)) | |
304 | 444 | then { | |
305 | - | let assetIdSend = | |
306 | - | let $ | |
307 | - | let amountWithoutFee = $ | |
308 | - | let amountWithFee = $ | |
309 | - | let governanceReward = $ | |
310 | - | let newBalanceA = ( | |
311 | - | let newBalanceB = (balanceB | |
445 | + | let assetIdSend = assetIdB | |
446 | + | let $t01940819499 = calculateFees(balanceA, balanceB) | |
447 | + | let amountWithoutFee = $t01940819499._1 | |
448 | + | let amountWithFee = $t01940819499._2 | |
449 | + | let governanceReward = $t01940819499._3 | |
450 | + | let newBalanceA = (balanceA + pmtAmount) | |
451 | + | let newBalanceB = ((balanceB - amountWithFee) - governanceReward) | |
312 | 452 | if (if (if ((assetIdA == USDN)) | |
313 | 453 | then (stakedAmountUSDN >= newBalanceA) | |
314 | 454 | else false) | |
315 | 455 | then true | |
316 | 456 | else if ((assetIdB == USDN)) | |
317 | 457 | then (stakedAmountUSDN >= newBalanceB) | |
318 | 458 | else false) | |
319 | - | then throwInsufficientAvailableBalance(amountWithFee, | |
320 | - | else [IntegerEntry(keyBalanceA, newBalanceA), IntegerEntry(keyBalanceB, newBalanceB), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer( | |
459 | + | then throwInsufficientAvailableBalance(amountWithFee, availableBalanceB, assetNameB) | |
460 | + | else [IntegerEntry(keyBalanceA, newBalanceA), IntegerEntry(keyBalanceB, newBalanceB), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(walletAddress, governanceReward, assetIdSend)] | |
321 | 461 | } | |
322 | - | else throw(((("Incorrect asset attached. Expected: " + strAssetIdA) + " or ") + strAssetIdB)) | |
462 | + | else if ((pmtAssetId == assetIdB)) | |
463 | + | then { | |
464 | + | let assetIdSend = assetIdA | |
465 | + | let $t02036820459 = calculateFees(balanceB, balanceA) | |
466 | + | let amountWithoutFee = $t02036820459._1 | |
467 | + | let amountWithFee = $t02036820459._2 | |
468 | + | let governanceReward = $t02036820459._3 | |
469 | + | let newBalanceA = ((balanceA - amountWithFee) - governanceReward) | |
470 | + | let newBalanceB = (balanceB + pmtAmount) | |
471 | + | if (if (if ((assetIdA == USDN)) | |
472 | + | then (stakedAmountUSDN >= newBalanceA) | |
473 | + | else false) | |
474 | + | then true | |
475 | + | else if ((assetIdB == USDN)) | |
476 | + | then (stakedAmountUSDN >= newBalanceB) | |
477 | + | else false) | |
478 | + | then throwInsufficientAvailableBalance(amountWithFee, availableBalanceA, assetNameA) | |
479 | + | else [IntegerEntry(keyBalanceA, newBalanceA), IntegerEntry(keyBalanceB, newBalanceB), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(walletAddress, governanceReward, assetIdSend)] | |
480 | + | } | |
481 | + | else throw(((("Incorrect asset attached. Expected: " + strAssetIdA) + " or ") + strAssetIdB)) | |
323 | 482 | } | |
324 | 483 | ||
325 | 484 | ||
326 | 485 | ||
327 | 486 | @Callable(i) | |
328 | 487 | func shutdown () = if (!(isActive)) | |
329 | 488 | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, keyCause), "the cause wasn't specified"))) | |
330 | 489 | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStartStop], i.callerPublicKey))) | |
331 | 490 | then throw("Only admin can call this function") | |
332 | 491 | else suspend("Paused by admin") | |
333 | 492 | ||
334 | 493 | ||
335 | 494 | ||
336 | 495 | @Callable(i) | |
337 | 496 | func activate () = if (isActive) | |
338 | 497 | then throw("DApp is already active") | |
339 | 498 | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStartStop], i.callerPublicKey))) | |
340 | 499 | then throw("Only admin can call this function") | |
341 | 500 | else [BooleanEntry(keyActive, true), DeleteEntry(keyCause)] | |
342 | 501 | ||
343 | 502 | ||
344 | 503 | ||
345 | 504 | @Callable(i) | |
346 | 505 | func takeIntoAccountExtraFunds (amountLeave) = { | |
347 | 506 | let uncountableAmountEnrollAssetA = (accountBalanceWithStakedA - balanceA) | |
348 | 507 | let uncountableAmountEnrollAssetB = (accountBalanceWithStakedB - balanceB) | |
349 | - | let amountEnrollA = (uncountableAmountEnrollAssetA - (if ((assetIdA == | |
508 | + | let amountEnrollA = (uncountableAmountEnrollAssetA - (if ((assetIdA == unit)) | |
350 | 509 | then amountLeave | |
351 | 510 | else 0)) | |
352 | - | let amountEnrollB = (uncountableAmountEnrollAssetB - (if ((assetIdB == | |
511 | + | let amountEnrollB = (uncountableAmountEnrollAssetB - (if ((assetIdB == unit)) | |
353 | 512 | then amountLeave | |
354 | 513 | else 0)) | |
355 | 514 | if (!(isActive)) | |
356 | 515 | then throw("DApp is inactive at this moment") | |
357 | 516 | else if ((i.caller != this)) | |
358 | 517 | then throw("Only the DApp itself can call this function") | |
359 | 518 | else if ((0 > amountLeave)) | |
360 | 519 | then throw(("Argument 'amountLeave' cannot be negative. Actual: " + toString(amountLeave))) | |
361 | 520 | else if (if ((0 > uncountableAmountEnrollAssetA)) | |
362 | 521 | then true | |
363 | 522 | else (0 > uncountableAmountEnrollAssetB)) | |
364 | 523 | then suspend("Enroll amount negative") | |
365 | 524 | else if (if ((0 > amountEnrollA)) | |
366 | 525 | then true | |
367 | 526 | else (0 > amountEnrollB)) | |
368 | 527 | then throw("Too large amountLeave") | |
369 | 528 | else [IntegerEntry(keyBalanceA, (balanceA + amountEnrollA)), IntegerEntry(keyBalanceB, (balanceB + amountEnrollB)), IntegerEntry(("last_income_" + strAssetIdA), amountEnrollA), IntegerEntry(("last_income_" + strAssetIdB), amountEnrollB)] | |
370 | 529 | } | |
371 | 530 | ||
372 | 531 | ||
373 | 532 | @Verifier(tx) | |
374 | 533 | func verify () = match tx { | |
375 | - | case | |
376 | - | let callTakeIntoAccount = if (( | |
377 | - | then ( | |
534 | + | case inv: InvokeScriptTransaction => | |
535 | + | let callTakeIntoAccount = if ((inv.dApp == this)) | |
536 | + | then (inv.function == "takeIntoAccountExtraFunds") | |
378 | 537 | else false | |
379 | - | let callStaking = if (( | |
380 | - | then if (if (if (( | |
381 | - | then (size( | |
538 | + | let callStaking = if ((inv.dApp == stakingAddress)) | |
539 | + | then if (if (if ((inv.function == "lockNeutrino")) | |
540 | + | then (size(inv.payments) == 1) | |
382 | 541 | else false) | |
383 | - | then ( | |
542 | + | then (inv.payments[0].assetId == USDN) | |
384 | 543 | else false) | |
385 | 544 | then true | |
386 | - | else if (( | |
387 | - | then (size( | |
545 | + | else if ((inv.function == "unlockNeutrino")) | |
546 | + | then (size(inv.payments) == 0) | |
388 | 547 | else false | |
389 | 548 | else false | |
549 | + | let exchangeToWaves = if (if (if ((inv.dApp == USDNToWavesExchanger)) | |
550 | + | then (inv.function == "exchange") | |
551 | + | else false) | |
552 | + | then (assetIdA == USDN) | |
553 | + | else false) | |
554 | + | then true | |
555 | + | else if ((assetIdB == USDN)) | |
556 | + | then (inv.payments[0].assetId == USDN) | |
557 | + | else false | |
390 | 558 | let signedByAdmin = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
391 | 559 | then true | |
392 | 560 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey2)) | |
393 | 561 | then true | |
394 | 562 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey3)) | |
395 | 563 | then true | |
396 | 564 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKeyStaking) | |
397 | - | if (callTakeIntoAccount) | |
565 | + | if (if (if (callTakeIntoAccount) | |
398 | 566 | then true | |
399 | - | else callStaking | |
567 | + | else callStaking) | |
568 | + | then true | |
569 | + | else exchangeToWaves) | |
570 | + | then signedByAdmin | |
571 | + | else false | |
400 | 572 | case _ => | |
401 | - | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
573 | + | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
574 | + | then 1 | |
575 | + | else 0 | |
576 | + | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
577 | + | then 1 | |
578 | + | else 0 | |
579 | + | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
580 | + | then 1 | |
581 | + | else 0 | |
582 | + | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
402 | 583 | } | |
403 | 584 |
github/deemru/w8io/026f985 92.88 ms ◑