tx · AKshftvMpydcDpNp4H8nieFEsWTbstjktnroPRfQosF9

3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL:  -0.01000000 Waves

2021.09.09 23:42 [1696005] smart account 3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL > SELF 0.00000000 Waves

{ "type": 13, "id": "AKshftvMpydcDpNp4H8nieFEsWTbstjktnroPRfQosF9", "fee": 1000000, "feeAssetId": null, "timestamp": 1631220162832, "version": 2, "chainId": 84, "sender": "3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL", "senderPublicKey": "EYAKsFBespqQveBrfmX29rsehBJrSwQ3B6yN4ADyw8Kx", "proofs": [ "4uK1T53qdaKD92SD877vmMj8q25xAySYQQg532AKdwbazMVHkjnQZFi7q6WkCn57J61DHGjEWEU94sE1dEaF2rWh" ], "script": "base64:AAIFAAAAAAAAA+EIAhIICgYYGBEYAgEaFQoCYTESD2NoZWNrUG9zc2liaWx0eRoPCgJhMhIJcG10QW1vdW50GhgKAmEzEhJtaW5BbW91bnRUb1JlY2VpdmUaEAoCYTQSCmV4Y2hhbmdlcnMaFAoCYTUSDmV4Y2hhbmdlcnNUeXBlGhcKAmE2EhFyb3V0aW5nQXNzZXRzS2V5cxoQCgJhNxIKY29tbWlzc2lvbhoeCgJhOBIYY29tbWlzc2lvblNjYWxlRGVsaW1pdGVyGhMKAmE5Eg1kQXBwMVRva2VuUGF5GhMKAmIxEg1kQXBwMVRva2VuR2V0GhMKAmIyEg1kQXBwMlRva2VuUGF5GhMKAmIzEg1kQXBwMlRva2VuR2V0GhMKAmI0Eg1nZXRGcm9tMVRyYWRlGhoKAmI1EhRnZXRGcm9tMVRyYWRlV2l0aEZlZRoTCgJiNhINZ2V0RnJvbTJUcmFkZRoaCgJiNxIUZ2V0RnJvbTJUcmFkZVdpdGhGZWUaBwoCYjgSAWkaCgoCYjkSBGFyZ3MaFAoCYzESDnJlY2VpdmVBc3NldElkGhEKAmMyEgskdDAyMDE4MjA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AAAACBQAAAAJlNQAAAAAAAAAAAgMJAAAAAAAAAgUAAAACZTYAAAAAAAAAAAMFAAAAAmYxBAAAAAJmMgkBAAAAAmM1AAAAAgUAAAACZjEJAAGRAAAAAgUAAAACZTUAAAAAAAAAAAMJAAACAAAAAQIAAAASTGlzdCBzaXplIGV4Y2VlZCAzBAAAAAJjOQgFAAAAAmU0AAAAAl8xBAAAAAJkMQgFAAAAAmU0AAAAAl8yBAAAAAJkMggFAAAAAmU0AAAAAl8zBAAAAAJmMwkAA/AAAAACBQAAAAR0aGlzBQAAAAJjMQMDCQAAAAAAAAIFAAAAAmM5BQAAAAJjNAkAAGcAAAACBQAAAAJmMwUAAAACYTMHCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAJiOAAAAAZjYWxsZXIFAAAAAmYzBQAAAAJjMQUAAAADbmlsCQAAAgAAAAECAAAAPnJvdXRpbmcgIT0gcm91dGluZ1NpemUgb3IgYW1vdW50VG9SZWNpZXZlIDwgbWluQW1vdW50VG9SZWNlaXZlAAAAACPqkoU=", "height": 1696005, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9nRz3prEFDzBQh5ucKzU9hKDdxb8cFGJsRjtacjsum3 Next: CVKTmB7SMgkegv9a3hmMDyC4AV27Ambe2BEhXZ3sNw8X Diff:
OldNewDifferences
1313 let getFrom2Trade = fraction(dApp2TokenGet, getFrom1TradeWithFee, (getFrom1TradeWithFee + dApp2TokenPay))
1414 let getFrom2TradeWithFee = fraction(getFrom2Trade, (commissionScaleDelimiter - commission), commissionScaleDelimiter)
1515 if (true)
16- then throw(toString(dApp1TokenPay))
16+ then throw(toString(dApp1TokenGet))
1717 else if ((getFrom2TradeWithFee >= minAmountToReceive))
1818 then true
1919 else false
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func checkPossibilty (pmtAmount,minAmountToReceive,exchangers,exchangersType,routingAssetsKeys) = {
55 let commission = 3000
66 let commissionScaleDelimiter = 1000000
77 let dApp1TokenPay = getIntegerValue(addressFromStringValue(exchangers[0]), routingAssetsKeys[0])
88 let dApp1TokenGet = getIntegerValue(addressFromStringValue(exchangers[0]), routingAssetsKeys[1])
99 let dApp2TokenPay = getIntegerValue(addressFromStringValue(exchangers[1]), routingAssetsKeys[2])
1010 let dApp2TokenGet = getIntegerValue(addressFromStringValue(exchangers[1]), routingAssetsKeys[3])
1111 let getFrom1Trade = fraction(dApp1TokenGet, pmtAmount, (pmtAmount + dApp1TokenPay))
1212 let getFrom1TradeWithFee = fraction(getFrom1Trade, (commissionScaleDelimiter - commission), commissionScaleDelimiter)
1313 let getFrom2Trade = fraction(dApp2TokenGet, getFrom1TradeWithFee, (getFrom1TradeWithFee + dApp2TokenPay))
1414 let getFrom2TradeWithFee = fraction(getFrom2Trade, (commissionScaleDelimiter - commission), commissionScaleDelimiter)
1515 if (true)
16- then throw(toString(dApp1TokenPay))
16+ then throw(toString(dApp1TokenGet))
1717 else if ((getFrom2TradeWithFee >= minAmountToReceive))
1818 then true
1919 else false
2020 }
2121
2222
2323 @Callable(i)
2424 func routingTrade (exchangers,exchangersType,args,routingAssetsKeys,receiveAssetId,minAmountToReceive) = {
2525 let $t020182092 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
2626 let pmtAmount = $t020182092._1
2727 let pmtAssetId = $t020182092._2
2828 if (!(checkPossibilty(pmtAmount, minAmountToReceive, exchangers, exchangersType, routingAssetsKeys)))
2929 then throw("Check transaction possibilty: declined")
3030 else {
3131 let routingSize = size(exchangers)
3232 func exchangeFold (accumulated,exchanger) = {
3333 let $t023822445 = accumulated
3434 let exchangeCounter = $t023822445._1
3535 let amountsWithFee = $t023822445._2
3636 let assetsIdSend = $t023822445._3
3737 if ((exchangeCounter == 0))
3838 then {
3939 let exchangerAddress = addressFromStringValue(exchanger)
4040 let inv = invoke(exchangerAddress, "exchange", [args[exchangeCounter]], [AttachedPayment(pmtAssetId, pmtAmount)])
4141 if ((inv == inv))
4242 then match inv {
4343 case inv: (Int, ByteVector) =>
4444 let $t027802818 = inv
4545 let amountWithFee = $t027802818._1
4646 let assetIdSend = $t027802818._2
4747 $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend)
4848 case _ =>
4949 throw("Incorrect invoke result: expected amountWithFee and assetsIdSend")
5050 }
5151 else throw("Strict value is not equal to itself.")
5252 }
5353 else if (if ((exchangeCounter > 0))
5454 then (routingSize > exchangeCounter)
5555 else false)
5656 then {
5757 let exchangerAddress = addressFromStringValue(exchanger)
5858 let $t031643230 = $Tuple2(assetsIdSend, amountsWithFee)
5959 let pmtAssetIdRout = $t031643230._1
6060 let pmtAmountRout = $t031643230._2
6161 let inv = invoke(exchangerAddress, "exchange", [args[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)])
6262 if ((inv == inv))
6363 then match inv {
6464 case inv: (Int, ByteVector) =>
6565 let $t034793517 = inv
6666 let amountWithFee = $t034793517._1
6767 let assetIdSend = $t034793517._2
6868 $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend)
6969 case _ =>
7070 throw("Incorrect invoke result: expected amountWithFee and assetsIdSend")
7171 }
7272 else throw("Strict value is not equal to itself.")
7373 }
7474 else accumulated
7575 }
7676
7777 let $t037553856 = {
7878 let $list38073856 = exchangers
7979 let $size38073856 = size($list38073856)
8080 let $acc038073856 = $Tuple3(0, 0, base58'')
8181 if (($size38073856 == 0))
8282 then $acc038073856
8383 else {
8484 let $acc138073856 = exchangeFold($acc038073856, $list38073856[0])
8585 if (($size38073856 == 1))
8686 then $acc138073856
8787 else {
8888 let $acc238073856 = exchangeFold($acc138073856, $list38073856[1])
8989 if (($size38073856 == 2))
9090 then $acc238073856
9191 else {
9292 let $acc338073856 = exchangeFold($acc238073856, $list38073856[2])
9393 if (($size38073856 == 3))
9494 then $acc338073856
9595 else {
9696 let $acc438073856 = exchangeFold($acc338073856, $list38073856[3])
9797 throw("List size exceed 3")
9898 }
9999 }
100100 }
101101 }
102102 }
103103 let exchangeCounter = $t037553856._1
104104 let amountsWithFee = $t037553856._2
105105 let assetsIdSend = $t037553856._3
106106 let amountToRecieve = assetBalance(this, receiveAssetId)
107107 if (if ((exchangeCounter == routingSize))
108108 then (amountToRecieve >= minAmountToReceive)
109109 else false)
110110 then [ScriptTransfer(i.caller, amountToRecieve, receiveAssetId)]
111111 else throw("routing != routingSize or amountToRecieve < minAmountToReceive")
112112 }
113113 }
114114
115115

github/deemru/w8io/026f985 
44.95 ms