tx · 2xmHXGqXj3Gjwu8aYgDJDWVua3bAetd3yvw97jNAJZfn

3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL:  -0.01000000 Waves

2021.09.16 13:59 [1705515] smart account 3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL > SELF 0.00000000 Waves

{ "type": 13, "id": "2xmHXGqXj3Gjwu8aYgDJDWVua3bAetd3yvw97jNAJZfn", "fee": 1000000, "feeAssetId": null, "timestamp": 1631790067107, "version": 2, "chainId": 84, "sender": "3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL", "senderPublicKey": "EYAKsFBespqQveBrfmX29rsehBJrSwQ3B6yN4ADyw8Kx", "proofs": [ "3Rg72BBDkzTLKg1HGZ8yV9FCyLvdB3fYWAj7jfgYpWEcjiVJ7sLQSyw5avSpyvcXsndaYwYYWVGphUq4qZPqNgPE" ], "script": "base64:AAIFAAAAAAAAAA0IAhIJCgcYGBERGAIBAAAACwAAAAAHZGlnaXRzOAAAAAAAAAAACAAAAAAGc2NhbGU4AAAAAAAF9eEAAAAAAAdzY2FsZTEyAAAAAOjUpRAAAAAAAAVhbHBoYQAAAAAAAAAAMgAAAAALYWxwaGFEaWdpdHMAAAAAAAAAAAIAAAAABGJldGEAAAAAAAK954AAAAAACmNvbW1pc3Npb24AAAAAAAAAC7gAAAAAGGNvbW1pc3Npb25TY2FsZURlbGltaXRlcgAAAAAAAA9CQAEAAAAIc2tld25lc3MAAAACAAAAAXgAAAABeQkAAGkAAAACCQAAaQAAAAIJAABkAAAAAgkAAGsAAAADBQAAAAdzY2FsZTEyBQAAAAF4BQAAAAF5CQAAawAAAAMFAAAAB3NjYWxlMTIFAAAAAXkFAAAAAXgAAAAAAAAAAAIAAAAAAAAAJxABAAAADWludmFyaWFudENhbGMAAAACAAAAAXgAAAABeQQAAAACc2sJAQAAAAhza2V3bmVzcwAAAAIFAAAAAXgFAAAAAXkJAABkAAAAAgkAAGsAAAADCQAAZAAAAAIFAAAAA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3NzQJAAGRAAAAAgUAAAANJGxpc3Q2NzI1Njc3NAAAAAAAAAAAAwkAAAIAAAABAgAAABJMaXN0IHNpemUgZXhjZWVkIDMEAAAAD2V4Y2hhbmdlQ291bnRlcggFAAAACyR0MDY2NzM2Nzc0AAAAAl8xBAAAAA5hbW91bnRzV2l0aEZlZQgFAAAACyR0MDY2NzM2Nzc0AAAAAl8yBAAAAAxhc3NldHNJZFNlbmQIBQAAAAskdDA2NjczNjc3NAAAAAJfMwQAAAAPYW1vdW50VG9SZWNpZXZlCQAD8AAAAAIFAAAABHRoaXMFAAAADnJlY2VpdmVBc3NldElkAwMJAAAAAAAAAgUAAAAPZXhjaGFuZ2VDb3VudGVyBQAAAAtyb3V0aW5nU2l6ZQkAAGcAAAACBQAAAA9hbW91bnRUb1JlY2lldmUFAAAAEm1pbkFtb3VudFRvUmVjZWl2ZQcJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAA9hbW91bnRUb1JlY2lldmUFAAAADnJlY2VpdmVBc3NldElkBQAAAANuaWwJAAACAAAAAQIAAAA+cm91dGluZyAhPSByb3V0aW5nU2l6ZSBvciBhbW91bnRUb1JlY2lldmUgPCBtaW5BbW91bnRUb1JlY2VpdmUAAAAA4GNbZw==", "height": 1705515, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 79UEBDqghBiBhmkUSbBN98tYqtzwWgC579ysBhdx5vvH Next: none Diff:
OldNewDifferences
3535 then {
3636 let invariant = invariantCalc(dApp1TokenPay, dApp1TokenGet)
3737 let minAmountToReceive1 = args2[0]
38- let invariantNew = (((invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1)) + invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1))) + invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1))) + invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1)))
38+ let invariantNew = (((((((invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1)) + invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1))) + invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1))) + invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1))) + invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1))) + invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1))) + invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1))) + invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1)))
3939 if ((invariantNew >= invariant))
4040 then minAmountToReceive1
4141 else throw("Flat contract: invariantNew < invariant")
5353
5454 @Callable(i)
5555 func routingTrade (exchangers,exchangersType,args1,args2,routingAssetsKeys,receiveAssetId,minAmountToReceive) = {
56- let $t046454719 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
57- let pmtAmount = $t046454719._1
58- let pmtAssetId = $t046454719._2
56+ let $t050485122 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
57+ let pmtAmount = $t050485122._1
58+ let pmtAssetId = $t050485122._2
5959 if (!(checkPossibilty(pmtAmount, minAmountToReceive, exchangers, exchangersType, routingAssetsKeys, args1, args2)))
6060 then throw("Check transaction possibilty: declined")
6161 else {
6262 let routingSize = size(exchangers)
6363 func exchangeFold (accumulated,exchanger) = {
64- let $t050185081 = accumulated
65- let exchangeCounter = $t050185081._1
66- let amountsWithFee = $t050185081._2
67- let assetsIdSend = $t050185081._3
68- let $t050905213 = if ((exchangeCounter == 0))
64+ let $t054215484 = accumulated
65+ let exchangeCounter = $t054215484._1
66+ let amountsWithFee = $t054215484._2
67+ let assetsIdSend = $t054215484._3
68+ let $t054935616 = if ((exchangeCounter == 0))
6969 then $Tuple2(pmtAssetId, pmtAmount)
7070 else $Tuple2(assetsIdSend, amountsWithFee)
71- let pmtAssetIdRout = $t050905213._1
72- let pmtAmountRout = $t050905213._2
71+ let pmtAssetIdRout = $t054935616._1
72+ let pmtAmountRout = $t054935616._2
7373 if (((if ((exchangeCounter >= 0))
7474 then (routingSize > exchangeCounter)
7575 else false) == true))
8383 if ((inv == inv))
8484 then match inv {
8585 case inv: (Int, ByteVector) =>
86- let $t059826020 = inv
87- let amountWithFee = $t059826020._1
88- let assetIdSend = $t059826020._2
86+ let $t063856423 = inv
87+ let amountWithFee = $t063856423._1
88+ let assetIdSend = $t063856423._2
8989 $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend)
9090 case _ =>
9191 throw("Incorrect invoke result: expected amountWithFee and assetsIdSend")
9595 else accumulated
9696 }
9797
98- let $t062706371 = {
99- let $list63226371 = exchangers
100- let $size63226371 = size($list63226371)
101- let $acc063226371 = $Tuple3(0, 0, base58'')
102- if (($size63226371 == 0))
103- then $acc063226371
98+ let $t066736774 = {
99+ let $list67256774 = exchangers
100+ let $size67256774 = size($list67256774)
101+ let $acc067256774 = $Tuple3(0, 0, base58'')
102+ if (($size67256774 == 0))
103+ then $acc067256774
104104 else {
105- let $acc163226371 = exchangeFold($acc063226371, $list63226371[0])
106- if (($size63226371 == 1))
107- then $acc163226371
105+ let $acc167256774 = exchangeFold($acc067256774, $list67256774[0])
106+ if (($size67256774 == 1))
107+ then $acc167256774
108108 else {
109- let $acc263226371 = exchangeFold($acc163226371, $list63226371[1])
110- if (($size63226371 == 2))
111- then $acc263226371
109+ let $acc267256774 = exchangeFold($acc167256774, $list67256774[1])
110+ if (($size67256774 == 2))
111+ then $acc267256774
112112 else {
113- let $acc363226371 = exchangeFold($acc263226371, $list63226371[2])
114- if (($size63226371 == 3))
115- then $acc363226371
113+ let $acc367256774 = exchangeFold($acc267256774, $list67256774[2])
114+ if (($size67256774 == 3))
115+ then $acc367256774
116116 else {
117- let $acc463226371 = exchangeFold($acc363226371, $list63226371[3])
117+ let $acc467256774 = exchangeFold($acc367256774, $list67256774[3])
118118 throw("List size exceed 3")
119119 }
120120 }
121121 }
122122 }
123123 }
124- let exchangeCounter = $t062706371._1
125- let amountsWithFee = $t062706371._2
126- let assetsIdSend = $t062706371._3
124+ let exchangeCounter = $t066736774._1
125+ let amountsWithFee = $t066736774._2
126+ let assetsIdSend = $t066736774._3
127127 let amountToRecieve = assetBalance(this, receiveAssetId)
128128 if (if ((exchangeCounter == routingSize))
129129 then (amountToRecieve >= minAmountToReceive)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let digits8 = 8
55
66 let scale8 = 100000000
77
88 let scale12 = 1000000000000
99
1010 let alpha = 50
1111
1212 let alphaDigits = 2
1313
1414 let beta = 46000000
1515
1616 let commission = 3000
1717
1818 let commissionScaleDelimiter = 1000000
1919
2020 func skewness (x,y) = (((fraction(scale12, x, y) + fraction(scale12, y, x)) / 2) / 10000)
2121
2222
2323 func invariantCalc (x,y) = {
2424 let sk = skewness(x, y)
2525 (fraction((x + y), scale8, pow(sk, digits8, alpha, alphaDigits, digits8, CEILING)) + (2 * fraction(pow(fraction(x, y, scale8), 0, 5, 1, (digits8 / 2), DOWN), pow((sk - beta), digits8, alpha, alphaDigits, digits8, DOWN), scale8)))
2626 }
2727
2828
2929 func checkPossibilty (pmtAmount,minAmountToReceive,exchangers,exchangersType,routingAssetsKeys,args1,args2) = {
3030 let dApp1TokenPay = getIntegerValue(addressFromStringValue(exchangers[0]), routingAssetsKeys[0])
3131 let dApp1TokenGet = getIntegerValue(addressFromStringValue(exchangers[0]), routingAssetsKeys[1])
3232 let dApp2TokenPay = getIntegerValue(addressFromStringValue(exchangers[1]), routingAssetsKeys[2])
3333 let dApp2TokenGet = getIntegerValue(addressFromStringValue(exchangers[1]), routingAssetsKeys[3])
3434 let getFrom1TradeWithFee = if ((exchangersType[0] == "flat"))
3535 then {
3636 let invariant = invariantCalc(dApp1TokenPay, dApp1TokenGet)
3737 let minAmountToReceive1 = args2[0]
38- let invariantNew = (((invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1)) + invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1))) + invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1))) + invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1)))
38+ let invariantNew = (((((((invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1)) + invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1))) + invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1))) + invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1))) + invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1))) + invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1))) + invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1))) + invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - minAmountToReceive1)))
3939 if ((invariantNew >= invariant))
4040 then minAmountToReceive1
4141 else throw("Flat contract: invariantNew < invariant")
4242 }
4343 else throw("Incorrect exchange type")
4444 let getFrom2TradeWithFee = if ((exchangersType[1] == "cpmm"))
4545 then {
4646 let getFrom2TradeWithoutFee = fraction(dApp2TokenGet, getFrom1TradeWithFee, (getFrom1TradeWithFee + dApp2TokenPay))
4747 fraction(getFrom2TradeWithoutFee, (commissionScaleDelimiter - commission), commissionScaleDelimiter)
4848 }
4949 else throw("Incorrect exchange type")
5050 (getFrom2TradeWithFee >= minAmountToReceive)
5151 }
5252
5353
5454 @Callable(i)
5555 func routingTrade (exchangers,exchangersType,args1,args2,routingAssetsKeys,receiveAssetId,minAmountToReceive) = {
56- let $t046454719 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
57- let pmtAmount = $t046454719._1
58- let pmtAssetId = $t046454719._2
56+ let $t050485122 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
57+ let pmtAmount = $t050485122._1
58+ let pmtAssetId = $t050485122._2
5959 if (!(checkPossibilty(pmtAmount, minAmountToReceive, exchangers, exchangersType, routingAssetsKeys, args1, args2)))
6060 then throw("Check transaction possibilty: declined")
6161 else {
6262 let routingSize = size(exchangers)
6363 func exchangeFold (accumulated,exchanger) = {
64- let $t050185081 = accumulated
65- let exchangeCounter = $t050185081._1
66- let amountsWithFee = $t050185081._2
67- let assetsIdSend = $t050185081._3
68- let $t050905213 = if ((exchangeCounter == 0))
64+ let $t054215484 = accumulated
65+ let exchangeCounter = $t054215484._1
66+ let amountsWithFee = $t054215484._2
67+ let assetsIdSend = $t054215484._3
68+ let $t054935616 = if ((exchangeCounter == 0))
6969 then $Tuple2(pmtAssetId, pmtAmount)
7070 else $Tuple2(assetsIdSend, amountsWithFee)
71- let pmtAssetIdRout = $t050905213._1
72- let pmtAmountRout = $t050905213._2
71+ let pmtAssetIdRout = $t054935616._1
72+ let pmtAmountRout = $t054935616._2
7373 if (((if ((exchangeCounter >= 0))
7474 then (routingSize > exchangeCounter)
7575 else false) == true))
7676 then {
7777 let exchangerAddress = addressFromStringValue(exchanger)
7878 let inv = if ((exchangersType[exchangeCounter] == "cpmm"))
7979 then invoke(exchangerAddress, "exchange", [args1[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)])
8080 else if ((exchangersType[exchangeCounter] == "flat"))
8181 then invoke(exchangerAddress, "exchange", [args1[exchangeCounter], args2[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)])
8282 else throw("Incorrect exchange type")
8383 if ((inv == inv))
8484 then match inv {
8585 case inv: (Int, ByteVector) =>
86- let $t059826020 = inv
87- let amountWithFee = $t059826020._1
88- let assetIdSend = $t059826020._2
86+ let $t063856423 = inv
87+ let amountWithFee = $t063856423._1
88+ let assetIdSend = $t063856423._2
8989 $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend)
9090 case _ =>
9191 throw("Incorrect invoke result: expected amountWithFee and assetsIdSend")
9292 }
9393 else throw("Strict value is not equal to itself.")
9494 }
9595 else accumulated
9696 }
9797
98- let $t062706371 = {
99- let $list63226371 = exchangers
100- let $size63226371 = size($list63226371)
101- let $acc063226371 = $Tuple3(0, 0, base58'')
102- if (($size63226371 == 0))
103- then $acc063226371
98+ let $t066736774 = {
99+ let $list67256774 = exchangers
100+ let $size67256774 = size($list67256774)
101+ let $acc067256774 = $Tuple3(0, 0, base58'')
102+ if (($size67256774 == 0))
103+ then $acc067256774
104104 else {
105- let $acc163226371 = exchangeFold($acc063226371, $list63226371[0])
106- if (($size63226371 == 1))
107- then $acc163226371
105+ let $acc167256774 = exchangeFold($acc067256774, $list67256774[0])
106+ if (($size67256774 == 1))
107+ then $acc167256774
108108 else {
109- let $acc263226371 = exchangeFold($acc163226371, $list63226371[1])
110- if (($size63226371 == 2))
111- then $acc263226371
109+ let $acc267256774 = exchangeFold($acc167256774, $list67256774[1])
110+ if (($size67256774 == 2))
111+ then $acc267256774
112112 else {
113- let $acc363226371 = exchangeFold($acc263226371, $list63226371[2])
114- if (($size63226371 == 3))
115- then $acc363226371
113+ let $acc367256774 = exchangeFold($acc267256774, $list67256774[2])
114+ if (($size67256774 == 3))
115+ then $acc367256774
116116 else {
117- let $acc463226371 = exchangeFold($acc363226371, $list63226371[3])
117+ let $acc467256774 = exchangeFold($acc367256774, $list67256774[3])
118118 throw("List size exceed 3")
119119 }
120120 }
121121 }
122122 }
123123 }
124- let exchangeCounter = $t062706371._1
125- let amountsWithFee = $t062706371._2
126- let assetsIdSend = $t062706371._3
124+ let exchangeCounter = $t066736774._1
125+ let amountsWithFee = $t066736774._2
126+ let assetsIdSend = $t066736774._3
127127 let amountToRecieve = assetBalance(this, receiveAssetId)
128128 if (if ((exchangeCounter == routingSize))
129129 then (amountToRecieve >= minAmountToReceive)
130130 else false)
131131 then [ScriptTransfer(i.caller, amountToRecieve, receiveAssetId)]
132132 else throw("routing != routingSize or amountToRecieve < minAmountToReceive")
133133 }
134134 }
135135
136136

github/deemru/w8io/026f985 
47.07 ms