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