tx · 737fcYC2GDneexUZCW3e5htMANTLYaZVHZEieyfHXSqW

3MwLcJy3MSb2kq6dUaUR5uBgm8zCKZMjz2S:  -0.01400000 Waves

2021.04.03 22:36 [1466688] smart account 3MwLcJy3MSb2kq6dUaUR5uBgm8zCKZMjz2S > SELF 0.00000000 Waves

{ "type": 13, "id": "737fcYC2GDneexUZCW3e5htMANTLYaZVHZEieyfHXSqW", "fee": 1400000, "feeAssetId": null, "timestamp": 1617478590700, "version": 2, "chainId": 84, "sender": "3MwLcJy3MSb2kq6dUaUR5uBgm8zCKZMjz2S", "senderPublicKey": "CgByewRUvLk7UtWSfRMLSYw4Ap2wT5dcdVYKideqDp9M", "proofs": [ "4fBqnoisXteydFVmcLDuigoEB4Ede8hQh4MYB7W7FB8a5hDTS2t11Gb8bD1N6mpFGHRt9ZzuCrWSVaEtPRWDfyBN" ], "script": "base64:AAIEAAAAAAAAABQIAhIAEgASABIAEgMKAQESAwoBAQAAABcAAAAAEnVzZG5EeXpBQmFsYW5jZUtleQIAAAAYdXNkbl9keXpfYV9hc3NldF9iYWxhbmNlAAAAABJ1c2RuRHl6QkJhbGFuY2VLZXkCAAAAGHVzZG5fZHl6X2JfYXNzZXRfYmFsYW5jZQAAAAARZXRoRHl6QUJhbGFuY2VLZXkCAAAAF2V0aF9keXpfYV9hc3NldF9iYWxhbmNlAAAAABFldGhEeXpCQmFsYW5jZUtleQIAAAAXZXRoX2R5el9iX2Fzc2V0X2JhbGFuY2UAAAAAFnVzZG5EeXpQYWlySXNBY3RpdmVLZXkCAAAAEnVzZG5fZHl6X2lzX2FjdGl2ZQAAAAAVZXRoRHl6UGFpcklzQWN0aXZlS2V5AgAAABFldGhfZHl6X2lzX2FjdGl2ZQAAAAAGZmVlS2V5AgAAAANmZWUAAAAADnRvdGFsRmVlRXRoS2V5AgAAAA10b3RhbF9mZWVfZXRoAAAAAA50b3RhbEZlZVVzZEtleQIAAAANdG90YWxfZmVlX3VzZAAAAAASdG90YWxGZWVEeXpyY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WxjdWxhdGVkIGFtb3VudCB0byByZWNlaXZlIGlzIGxlc3MgdGhhbiBzcGVjaWZpZWQgbWluaW11bQQAAAALdG90YWxGZWVLZXkJAQAAABJnZXRGZWVLZXlCeUFzc2V0SWQAAAABBQAAAAdhc3NldElkBAAAAAh0b3RhbEZlZQkAAGQAAAACCQEAAAAQZ2V0VG90YWxGZWVCeUtleQAAAAEFAAAAC3RvdGFsRmVlS2V5BQAAAAlmZWVBbW91bnQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAAEWV0aER5ekFCYWxhbmNlS2V5BQAAAAtuZXdCYWxhbmNlQQkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAARZXRoRHl6QkJhbGFuY2VLZXkFAAAAC25ld0JhbGFuY2VCCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAAt0b3RhbEZlZUtleQUAAAAIdG90YWxGZWUJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAKZmVlQWRkcmVzcwUAAAAJZmVlQW1vdW50BQAAAAdhc3NldElkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAHckFtb3VudAUAAAAIckFzc2V0SWQFAAAAA25pbAAAAACUYVcN", "height": 1466688, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BUAPPmMevoNGeFhRBWkjKFx9ZU5y6rokVVQBzsphC8zY Next: 3Z9pUrqY6YhEuanLvHmyV61c9K4sYYA9TgkvhTdEcbfG Diff:
OldNewDifferences
8989 }
9090
9191
92+func getEthDyzAmount (assetId,amount) = {
93+ let feeAmount = getFeeAmount(amount)
94+ let amountWithoutFee = (amount - feeAmount)
95+ let balanceA = getIntegerValue(this, ethDyzABalanceKey)
96+ let balanceB = getIntegerValue(this, ethDyzBBalanceKey)
97+ if ((assetId == ethAssetId))
98+ then {
99+ let rAmount = fraction(balanceB, amountWithoutFee, (amountWithoutFee + balanceA))
100+ let rAssetId = dyzraptAssetId
101+ let newBalanceA = (amountWithoutFee + balanceA)
102+ let newBalanceB = (balanceB - rAmount)
103+ $Tuple5(feeAmount, rAmount, rAssetId, newBalanceA, newBalanceB)
104+ }
105+ else if ((assetId == dyzraptAssetId))
106+ then {
107+ let rAmount = fraction(balanceA, amountWithoutFee, (amountWithoutFee + balanceB))
108+ let rAssetId = ethAssetId
109+ let newBalanceA = (balanceA - rAmount)
110+ let newBalanceB = (balanceB + amountWithoutFee)
111+ $Tuple5(feeAmount, rAmount, rAssetId, newBalanceA, newBalanceB)
112+ }
113+ else throw("Incorrect asset attached")
114+ }
115+
116+
92117 @Callable(i)
93118 func initUsdnDyzPair () = if (isDefined(getBoolean(this, usdnDyzPairIsActiveKey)))
94119 then throw("Pair is already active")
95120 else if ((i.callerPublicKey != adminPublicKey))
96121 then throw("Only admin can activate pair")
97122 else {
98- let $t029953072 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
99- let pmtAmountA = $t029953072._1
100- let pmtAssetIdA = $t029953072._2
101- let $t030813158 = $Tuple2(i.payments[1].amount, i.payments[1].assetId)
102- let pmtAmountB = $t030813158._1
103- let pmtAssetIdB = $t030813158._2
123+ let $t039674044 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
124+ let pmtAmountA = $t039674044._1
125+ let pmtAssetIdA = $t039674044._2
126+ let $t040534130 = $Tuple2(i.payments[1].amount, i.payments[1].assetId)
127+ let pmtAmountB = $t040534130._1
128+ let pmtAssetIdB = $t040534130._2
104129 if ((pmtAssetIdA != usdnAssetId))
105130 then throw("A asset is not a usdn")
106131 else if ((pmtAssetIdB != dyzraptAssetId))
107132 then throw("B asset is not a dyzrupt")
108133 else [BooleanEntry(usdnDyzPairIsActiveKey, true), IntegerEntry(usdnDyzABalanceKey, pmtAmountA), IntegerEntry(usdnDyzBBalanceKey, pmtAmountB), IntegerEntry(feeKey, 300)]
134+ }
135+
136+
137+
138+@Callable(i)
139+func initEthDyzPair () = if (isDefined(getBoolean(this, ethDyzPairIsActiveKey)))
140+ then throw("Pair is already active")
141+ else if ((i.callerPublicKey != adminPublicKey))
142+ then throw("Only admin can activate pair")
143+ else {
144+ let $t048634940 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
145+ let pmtAmountA = $t048634940._1
146+ let pmtAssetIdA = $t048634940._2
147+ let $t049495026 = $Tuple2(i.payments[1].amount, i.payments[1].assetId)
148+ let pmtAmountB = $t049495026._1
149+ let pmtAssetIdB = $t049495026._2
150+ if ((pmtAssetIdA != ethAssetId))
151+ then throw("A asset is not a eth")
152+ else if ((pmtAssetIdB != dyzraptAssetId))
153+ then throw("B asset is not a dyzrupt")
154+ else [BooleanEntry(ethDyzPairIsActiveKey, true), IntegerEntry(ethDyzABalanceKey, pmtAmountA), IntegerEntry(ethDyzBBalanceKey, pmtAmountB), IntegerEntry(feeKey, 300)]
155+ }
156+
157+
158+
159+@Callable(i)
160+func addLiquidToUsdnDyz () = if (!(isDefined(getBoolean(this, usdnDyzPairIsActiveKey))))
161+ then throw("Pair is not active")
162+ else if ((i.callerPublicKey != adminPublicKey))
163+ then throw("Only admin can add liquid")
164+ else {
165+ let $t057535830 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
166+ let pmtAmountA = $t057535830._1
167+ let pmtAssetIdA = $t057535830._2
168+ let $t058395916 = $Tuple2(i.payments[1].amount, i.payments[1].assetId)
169+ let pmtAmountB = $t058395916._1
170+ let pmtAssetIdB = $t058395916._2
171+ if ((pmtAssetIdA != usdnAssetId))
172+ then throw("A asset is not a usdn")
173+ else if ((pmtAssetIdB != dyzraptAssetId))
174+ then throw("B asset is not a dyzrupt")
175+ else {
176+ let balanceA = getIntKeyData(usdnDyzABalanceKey)
177+ let balanceB = getIntKeyData(usdnDyzBBalanceKey)
178+ let tokenRatio = fraction(fraction(balanceA, 100000000, pmtAmountA), 1000, fraction(balanceB, 100000000, pmtAmountB))
179+ if ((tokenRatio > maxRatio))
180+ then throw("Incorrect assets amount: amounts must have the contract ratio")
181+ else [IntegerEntry(usdnDyzABalanceKey, (balanceA + pmtAmountA)), IntegerEntry(usdnDyzBBalanceKey, (balanceB + pmtAmountB))]
182+ }
183+ }
184+
185+
186+
187+@Callable(i)
188+func addLiquidToEthDyz () = if (!(isDefined(getBoolean(this, ethDyzPairIsActiveKey))))
189+ then throw("Pair is not active")
190+ else if ((i.callerPublicKey != adminPublicKey))
191+ then throw("Only admin can add liquid")
192+ else {
193+ let $t069867063 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
194+ let pmtAmountA = $t069867063._1
195+ let pmtAssetIdA = $t069867063._2
196+ let $t070727149 = $Tuple2(i.payments[1].amount, i.payments[1].assetId)
197+ let pmtAmountB = $t070727149._1
198+ let pmtAssetIdB = $t070727149._2
199+ if ((pmtAssetIdA != ethAssetId))
200+ then throw("A asset is not a eth")
201+ else if ((pmtAssetIdB != dyzraptAssetId))
202+ then throw("B asset is not a dyzrupt")
203+ else {
204+ let balanceA = getIntKeyData(ethDyzABalanceKey)
205+ let balanceB = getIntKeyData(ethDyzBBalanceKey)
206+ let tokenRatio = fraction(fraction(balanceA, 100000000, pmtAmountA), 1000, fraction(balanceB, 100000000, pmtAmountB))
207+ if ((tokenRatio > maxRatio))
208+ then throw("Incorrect assets amount: amounts must have the contract ratio")
209+ else [IntegerEntry(ethDyzABalanceKey, (balanceA + pmtAmountA)), IntegerEntry(ethDyzBBalanceKey, (balanceB + pmtAmountB))]
210+ }
109211 }
110212
111213
122224 else false)
123225 then throw("Only usdn and dyzrupt are supporting")
124226 else {
125- let $t040554151 = getUsdnDyzAmount(assetId, amount)
126- let feeAmount = $t040554151._1
127- let rAmount = $t040554151._2
128- let rAssetId = $t040554151._3
129- let newBalanceA = $t040554151._4
130- let newBalanceB = $t040554151._5
227+ let $t083818477 = getUsdnDyzAmount(assetId, amount)
228+ let feeAmount = $t083818477._1
229+ let rAmount = $t083818477._2
230+ let rAssetId = $t083818477._3
231+ let newBalanceA = $t083818477._4
232+ let newBalanceB = $t083818477._5
131233 if ((minReceive > rAmount))
132234 then throw("Calculated amount to receive is less than specified minimum")
133235 else {
141243
142244
143245 @Callable(i)
144-func addLiquidToUsdnDyz () = if (!(isDefined(getBoolean(this, usdnDyzPairIsActiveKey))))
246+func exchangeEthDyz (minReceive) = if (!(isDefined(getBoolean(this, ethDyzPairIsActiveKey))))
145247 then throw("Pair is not active")
146- else if ((i.callerPublicKey != adminPublicKey))
147- then throw("Only admin can add liquid")
148- else {
149- let $t050535130 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
150- let pmtAmountA = $t050535130._1
151- let pmtAssetIdA = $t050535130._2
152- let $t051395216 = $Tuple2(i.payments[1].amount, i.payments[1].assetId)
153- let pmtAmountB = $t051395216._1
154- let pmtAssetIdB = $t051395216._2
155- if ((pmtAssetIdA != usdnAssetId))
156- then throw("A asset is not a usdn")
157- else if ((pmtAssetIdB != dyzraptAssetId))
158- then throw("B asset is not a dyzrupt")
248+ else {
249+ let pmt = value(i.payments[0])
250+ let assetId = pmt.assetId
251+ let amount = pmt.amount
252+ if (if ((assetId != ethAssetId))
253+ then (assetId != dyzraptAssetId)
254+ else false)
255+ then throw("Only eth and dyzrupt are supporting")
256+ else {
257+ let $t095409635 = getEthDyzAmount(assetId, amount)
258+ let feeAmount = $t095409635._1
259+ let rAmount = $t095409635._2
260+ let rAssetId = $t095409635._3
261+ let newBalanceA = $t095409635._4
262+ let newBalanceB = $t095409635._5
263+ if ((minReceive > rAmount))
264+ then throw("Calculated amount to receive is less than specified minimum")
159265 else {
160- let balanceA = getIntKeyData(usdnDyzABalanceKey)
161- let balanceB = getIntKeyData(usdnDyzBBalanceKey)
162- let tokenRatio = fraction(fraction(balanceA, 100000000, pmtAmountA), 1000, fraction(balanceB, 100000000, pmtAmountB))
163- if ((tokenRatio > maxRatio))
164- then throw("Incorrect assets amount: amounts must have the contract ratio")
165- else [IntegerEntry(usdnDyzABalanceKey, (balanceA + pmtAmountA)), IntegerEntry(usdnDyzBBalanceKey, (balanceB + pmtAmountB))]
266+ let totalFeeKey = getFeeKeyByAssetId(assetId)
267+ let totalFee = (getTotalFeeByKey(totalFeeKey) + feeAmount)
268+[IntegerEntry(ethDyzABalanceKey, newBalanceA), IntegerEntry(ethDyzBBalanceKey, newBalanceB), IntegerEntry(totalFeeKey, totalFee), ScriptTransfer(feeAddress, feeAmount, assetId), ScriptTransfer(i.caller, rAmount, rAssetId)]
166269 }
167- }
270+ }
271+ }
168272
169273
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let usdnDyzABalanceKey = "usdn_dyz_a_asset_balance"
55
66 let usdnDyzBBalanceKey = "usdn_dyz_b_asset_balance"
77
88 let ethDyzABalanceKey = "eth_dyz_a_asset_balance"
99
1010 let ethDyzBBalanceKey = "eth_dyz_b_asset_balance"
1111
1212 let usdnDyzPairIsActiveKey = "usdn_dyz_is_active"
1313
1414 let ethDyzPairIsActiveKey = "eth_dyz_is_active"
1515
1616 let feeKey = "fee"
1717
1818 let totalFeeEthKey = "total_fee_eth"
1919
2020 let totalFeeUsdKey = "total_fee_usd"
2121
2222 let totalFeeDyzraptKey = "total_fee_dyzrapt"
2323
2424 let maxRatio = 1000
2525
2626 let dyzraptAssetId = base58'Bi4jxKEFjjYG2emeyxZfpkVMS88N7uAogHNsi1urkoJA'
2727
2828 let ethAssetId = base58'3JJkzB4pFXcqdJvC9TcV8ys1FLgesr5SxbhmykkpceQp'
2929
3030 let usdnAssetId = base58'9Nf5wpj6jds3VRZKDryp6Dtf3R9d8MdbjNhencLogCr5'
3131
3232 let adminPublicKey = base58'7zDUSbBXZtec3E333b1fC2wR2MPrnzh69ZrH3rwpQj9S'
3333
3434 let feeAddress = Address(base58'3N7G2kVtBTh94aEnDHQ9dpi4EdsDxAiDXjB')
3535
3636 func getIntKeyDataOrError (key) = {
3737 let v = valueOrErrorMessage(getInteger(this, key), "unable to read key")
3838 v
3939 }
4040
4141
4242 func getIntKeyData (key) = {
4343 let v = valueOrElse(getInteger(this, key), 0)
4444 v
4545 }
4646
4747
4848 func getTotalFeeByKey (key) = getIntKeyData(key)
4949
5050
5151 func getFeeAmount (amount) = {
5252 let fee = getIntKeyDataOrError(feeKey)
5353 let feeAmount = fraction(amount, fee, 10000)
5454 feeAmount
5555 }
5656
5757
5858 func getFeeKeyByAssetId (assetId) = if ((assetId == usdnAssetId))
5959 then totalFeeUsdKey
6060 else if ((assetId == ethAssetId))
6161 then totalFeeEthKey
6262 else if ((assetId == dyzraptAssetId))
6363 then totalFeeDyzraptKey
6464 else throw("Incorrect asset attached")
6565
6666
6767 func getUsdnDyzAmount (assetId,amount) = {
6868 let feeAmount = getFeeAmount(amount)
6969 let amountWithoutFee = (amount - feeAmount)
7070 let balanceA = getIntegerValue(this, usdnDyzABalanceKey)
7171 let balanceB = getIntegerValue(this, usdnDyzBBalanceKey)
7272 if ((assetId == usdnAssetId))
7373 then {
7474 let rAmount = fraction(balanceB, amountWithoutFee, (amountWithoutFee + balanceA))
7575 let rAssetId = dyzraptAssetId
7676 let newBalanceA = (amountWithoutFee + balanceA)
7777 let newBalanceB = (balanceB - rAmount)
7878 $Tuple5(feeAmount, rAmount, rAssetId, newBalanceA, newBalanceB)
7979 }
8080 else if ((assetId == dyzraptAssetId))
8181 then {
8282 let rAmount = fraction(balanceA, amountWithoutFee, (amountWithoutFee + balanceB))
8383 let rAssetId = usdnAssetId
8484 let newBalanceA = (balanceA - rAmount)
8585 let newBalanceB = (balanceB + amountWithoutFee)
8686 $Tuple5(feeAmount, rAmount, rAssetId, newBalanceA, newBalanceB)
8787 }
8888 else throw("Incorrect asset attached")
8989 }
9090
9191
92+func getEthDyzAmount (assetId,amount) = {
93+ let feeAmount = getFeeAmount(amount)
94+ let amountWithoutFee = (amount - feeAmount)
95+ let balanceA = getIntegerValue(this, ethDyzABalanceKey)
96+ let balanceB = getIntegerValue(this, ethDyzBBalanceKey)
97+ if ((assetId == ethAssetId))
98+ then {
99+ let rAmount = fraction(balanceB, amountWithoutFee, (amountWithoutFee + balanceA))
100+ let rAssetId = dyzraptAssetId
101+ let newBalanceA = (amountWithoutFee + balanceA)
102+ let newBalanceB = (balanceB - rAmount)
103+ $Tuple5(feeAmount, rAmount, rAssetId, newBalanceA, newBalanceB)
104+ }
105+ else if ((assetId == dyzraptAssetId))
106+ then {
107+ let rAmount = fraction(balanceA, amountWithoutFee, (amountWithoutFee + balanceB))
108+ let rAssetId = ethAssetId
109+ let newBalanceA = (balanceA - rAmount)
110+ let newBalanceB = (balanceB + amountWithoutFee)
111+ $Tuple5(feeAmount, rAmount, rAssetId, newBalanceA, newBalanceB)
112+ }
113+ else throw("Incorrect asset attached")
114+ }
115+
116+
92117 @Callable(i)
93118 func initUsdnDyzPair () = if (isDefined(getBoolean(this, usdnDyzPairIsActiveKey)))
94119 then throw("Pair is already active")
95120 else if ((i.callerPublicKey != adminPublicKey))
96121 then throw("Only admin can activate pair")
97122 else {
98- let $t029953072 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
99- let pmtAmountA = $t029953072._1
100- let pmtAssetIdA = $t029953072._2
101- let $t030813158 = $Tuple2(i.payments[1].amount, i.payments[1].assetId)
102- let pmtAmountB = $t030813158._1
103- let pmtAssetIdB = $t030813158._2
123+ let $t039674044 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
124+ let pmtAmountA = $t039674044._1
125+ let pmtAssetIdA = $t039674044._2
126+ let $t040534130 = $Tuple2(i.payments[1].amount, i.payments[1].assetId)
127+ let pmtAmountB = $t040534130._1
128+ let pmtAssetIdB = $t040534130._2
104129 if ((pmtAssetIdA != usdnAssetId))
105130 then throw("A asset is not a usdn")
106131 else if ((pmtAssetIdB != dyzraptAssetId))
107132 then throw("B asset is not a dyzrupt")
108133 else [BooleanEntry(usdnDyzPairIsActiveKey, true), IntegerEntry(usdnDyzABalanceKey, pmtAmountA), IntegerEntry(usdnDyzBBalanceKey, pmtAmountB), IntegerEntry(feeKey, 300)]
134+ }
135+
136+
137+
138+@Callable(i)
139+func initEthDyzPair () = if (isDefined(getBoolean(this, ethDyzPairIsActiveKey)))
140+ then throw("Pair is already active")
141+ else if ((i.callerPublicKey != adminPublicKey))
142+ then throw("Only admin can activate pair")
143+ else {
144+ let $t048634940 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
145+ let pmtAmountA = $t048634940._1
146+ let pmtAssetIdA = $t048634940._2
147+ let $t049495026 = $Tuple2(i.payments[1].amount, i.payments[1].assetId)
148+ let pmtAmountB = $t049495026._1
149+ let pmtAssetIdB = $t049495026._2
150+ if ((pmtAssetIdA != ethAssetId))
151+ then throw("A asset is not a eth")
152+ else if ((pmtAssetIdB != dyzraptAssetId))
153+ then throw("B asset is not a dyzrupt")
154+ else [BooleanEntry(ethDyzPairIsActiveKey, true), IntegerEntry(ethDyzABalanceKey, pmtAmountA), IntegerEntry(ethDyzBBalanceKey, pmtAmountB), IntegerEntry(feeKey, 300)]
155+ }
156+
157+
158+
159+@Callable(i)
160+func addLiquidToUsdnDyz () = if (!(isDefined(getBoolean(this, usdnDyzPairIsActiveKey))))
161+ then throw("Pair is not active")
162+ else if ((i.callerPublicKey != adminPublicKey))
163+ then throw("Only admin can add liquid")
164+ else {
165+ let $t057535830 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
166+ let pmtAmountA = $t057535830._1
167+ let pmtAssetIdA = $t057535830._2
168+ let $t058395916 = $Tuple2(i.payments[1].amount, i.payments[1].assetId)
169+ let pmtAmountB = $t058395916._1
170+ let pmtAssetIdB = $t058395916._2
171+ if ((pmtAssetIdA != usdnAssetId))
172+ then throw("A asset is not a usdn")
173+ else if ((pmtAssetIdB != dyzraptAssetId))
174+ then throw("B asset is not a dyzrupt")
175+ else {
176+ let balanceA = getIntKeyData(usdnDyzABalanceKey)
177+ let balanceB = getIntKeyData(usdnDyzBBalanceKey)
178+ let tokenRatio = fraction(fraction(balanceA, 100000000, pmtAmountA), 1000, fraction(balanceB, 100000000, pmtAmountB))
179+ if ((tokenRatio > maxRatio))
180+ then throw("Incorrect assets amount: amounts must have the contract ratio")
181+ else [IntegerEntry(usdnDyzABalanceKey, (balanceA + pmtAmountA)), IntegerEntry(usdnDyzBBalanceKey, (balanceB + pmtAmountB))]
182+ }
183+ }
184+
185+
186+
187+@Callable(i)
188+func addLiquidToEthDyz () = if (!(isDefined(getBoolean(this, ethDyzPairIsActiveKey))))
189+ then throw("Pair is not active")
190+ else if ((i.callerPublicKey != adminPublicKey))
191+ then throw("Only admin can add liquid")
192+ else {
193+ let $t069867063 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
194+ let pmtAmountA = $t069867063._1
195+ let pmtAssetIdA = $t069867063._2
196+ let $t070727149 = $Tuple2(i.payments[1].amount, i.payments[1].assetId)
197+ let pmtAmountB = $t070727149._1
198+ let pmtAssetIdB = $t070727149._2
199+ if ((pmtAssetIdA != ethAssetId))
200+ then throw("A asset is not a eth")
201+ else if ((pmtAssetIdB != dyzraptAssetId))
202+ then throw("B asset is not a dyzrupt")
203+ else {
204+ let balanceA = getIntKeyData(ethDyzABalanceKey)
205+ let balanceB = getIntKeyData(ethDyzBBalanceKey)
206+ let tokenRatio = fraction(fraction(balanceA, 100000000, pmtAmountA), 1000, fraction(balanceB, 100000000, pmtAmountB))
207+ if ((tokenRatio > maxRatio))
208+ then throw("Incorrect assets amount: amounts must have the contract ratio")
209+ else [IntegerEntry(ethDyzABalanceKey, (balanceA + pmtAmountA)), IntegerEntry(ethDyzBBalanceKey, (balanceB + pmtAmountB))]
210+ }
109211 }
110212
111213
112214
113215 @Callable(i)
114216 func exchangeUsdnDyz (minReceive) = if (!(isDefined(getBoolean(this, usdnDyzPairIsActiveKey))))
115217 then throw("Pair is not active")
116218 else {
117219 let pmt = value(i.payments[0])
118220 let assetId = pmt.assetId
119221 let amount = pmt.amount
120222 if (if ((assetId != usdnAssetId))
121223 then (assetId != dyzraptAssetId)
122224 else false)
123225 then throw("Only usdn and dyzrupt are supporting")
124226 else {
125- let $t040554151 = getUsdnDyzAmount(assetId, amount)
126- let feeAmount = $t040554151._1
127- let rAmount = $t040554151._2
128- let rAssetId = $t040554151._3
129- let newBalanceA = $t040554151._4
130- let newBalanceB = $t040554151._5
227+ let $t083818477 = getUsdnDyzAmount(assetId, amount)
228+ let feeAmount = $t083818477._1
229+ let rAmount = $t083818477._2
230+ let rAssetId = $t083818477._3
231+ let newBalanceA = $t083818477._4
232+ let newBalanceB = $t083818477._5
131233 if ((minReceive > rAmount))
132234 then throw("Calculated amount to receive is less than specified minimum")
133235 else {
134236 let totalFeeKey = getFeeKeyByAssetId(assetId)
135237 let totalFee = (getTotalFeeByKey(totalFeeKey) + feeAmount)
136238 [IntegerEntry(usdnDyzABalanceKey, newBalanceA), IntegerEntry(usdnDyzBBalanceKey, newBalanceB), IntegerEntry(totalFeeKey, totalFee), ScriptTransfer(feeAddress, feeAmount, assetId), ScriptTransfer(i.caller, rAmount, rAssetId)]
137239 }
138240 }
139241 }
140242
141243
142244
143245 @Callable(i)
144-func addLiquidToUsdnDyz () = if (!(isDefined(getBoolean(this, usdnDyzPairIsActiveKey))))
246+func exchangeEthDyz (minReceive) = if (!(isDefined(getBoolean(this, ethDyzPairIsActiveKey))))
145247 then throw("Pair is not active")
146- else if ((i.callerPublicKey != adminPublicKey))
147- then throw("Only admin can add liquid")
148- else {
149- let $t050535130 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
150- let pmtAmountA = $t050535130._1
151- let pmtAssetIdA = $t050535130._2
152- let $t051395216 = $Tuple2(i.payments[1].amount, i.payments[1].assetId)
153- let pmtAmountB = $t051395216._1
154- let pmtAssetIdB = $t051395216._2
155- if ((pmtAssetIdA != usdnAssetId))
156- then throw("A asset is not a usdn")
157- else if ((pmtAssetIdB != dyzraptAssetId))
158- then throw("B asset is not a dyzrupt")
248+ else {
249+ let pmt = value(i.payments[0])
250+ let assetId = pmt.assetId
251+ let amount = pmt.amount
252+ if (if ((assetId != ethAssetId))
253+ then (assetId != dyzraptAssetId)
254+ else false)
255+ then throw("Only eth and dyzrupt are supporting")
256+ else {
257+ let $t095409635 = getEthDyzAmount(assetId, amount)
258+ let feeAmount = $t095409635._1
259+ let rAmount = $t095409635._2
260+ let rAssetId = $t095409635._3
261+ let newBalanceA = $t095409635._4
262+ let newBalanceB = $t095409635._5
263+ if ((minReceive > rAmount))
264+ then throw("Calculated amount to receive is less than specified minimum")
159265 else {
160- let balanceA = getIntKeyData(usdnDyzABalanceKey)
161- let balanceB = getIntKeyData(usdnDyzBBalanceKey)
162- let tokenRatio = fraction(fraction(balanceA, 100000000, pmtAmountA), 1000, fraction(balanceB, 100000000, pmtAmountB))
163- if ((tokenRatio > maxRatio))
164- then throw("Incorrect assets amount: amounts must have the contract ratio")
165- else [IntegerEntry(usdnDyzABalanceKey, (balanceA + pmtAmountA)), IntegerEntry(usdnDyzBBalanceKey, (balanceB + pmtAmountB))]
266+ let totalFeeKey = getFeeKeyByAssetId(assetId)
267+ let totalFee = (getTotalFeeByKey(totalFeeKey) + feeAmount)
268+[IntegerEntry(ethDyzABalanceKey, newBalanceA), IntegerEntry(ethDyzBBalanceKey, newBalanceB), IntegerEntry(totalFeeKey, totalFee), ScriptTransfer(feeAddress, feeAmount, assetId), ScriptTransfer(i.caller, rAmount, rAssetId)]
166269 }
167- }
270+ }
271+ }
168272
169273

github/deemru/w8io/169f3d6 
54.25 ms