tx · H6NAZNDdryr85MZdYetmrYRfHGyL2AQYJr9CPTm5HBMN

3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL:  -0.01000000 Waves

2021.08.31 23:35 [1683004] smart account 3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL > SELF 0.00000000 Waves

{ "type": 13, "id": "H6NAZNDdryr85MZdYetmrYRfHGyL2AQYJr9CPTm5HBMN", "fee": 1000000, "feeAssetId": null, "timestamp": 1630442148413, "version": 2, "chainId": 84, "sender": "3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL", "senderPublicKey": "EYAKsFBespqQveBrfmX29rsehBJrSwQ3B6yN4ADyw8Kx", "proofs": [ "FprD7yEnusB5F5ciTWuHdyfVpJQVtQ2zvvNSskBoqbfoLADBwxPQcovdLkKXZU5DHhYWSBBa37yK6PXgDCdMe3f" ], "script": "base64:AAIFAAAAAAAAAoQIAhIGCgQYEQIBGgcKAmExEgFpGhAKAmEyEgpleGNoYW5nZXJzGgoKAmEzEgRhcmdzGhQKAmE0Eg5yZWNlaXZlQXNzZXRJZBoYCgJhNRISbWluQW1vdW50VG9SZWNlaXZlGhEKAmE2Egtyb3V0aW5nU2l6ZRoSCgJhNxIMZXhjaGFuZ2VGb2xkGhEKAmE4EgthY2N1bXVsYXRlZBoPCgJhORIJZXhjaGFuZ2VyGg8KAmIxEgkkdDA5MzU5OTgaFQoCYjISD2V4Y2hhbmdlQ291bnRlchoUCgJiMxIOYW1vdW50c1dpdGhGZWUaEgoCYjQSDGFzc2V0c0lkU2VuZBoWCgJiNRIQZXhjaGFuZ2VyQWRkcmVzcxoRCgJiNhILJHQwMTExODExOTIaDwoCYjcSCXBtdEFtb3VudBoQCgJiOBIKcG10QXNzZXRJZBoJCgJiORIDaW52Gg0KAmMxEgckbWF0Y2gwGhEKAmMyEgskdDAxNDIwMTQ1OBoTCgJjMxINYW1vdW50V2l0aEZlZRoRCgJjNBILYXNzZXRJZFNlbmQaEQoCYzUSCyR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RUb1JlY2VpdmUAAAAABxTS0Q==", "height": 1683004, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7PBgbC1b53QzfyYZWAt9xrKrmbfxW54qmCay3kqZKRER Next: Etm5MQN1TzsssDx3HaSNwdHysxHzgFXEhZNvUD4ysCCG Diff:
OldNewDifferences
44
55
66 @Callable(i)
7-func routingTrade (exchangers,args,assetsToPay,assetToUserSend,minAmountToReceive) = {
7+func routingTrade (exchangers,args,receiveAssetId,minAmountToReceive) = {
88 let routingSize = size(exchangers)
9- func exchangeFold (accumulated,exchanger) = if ((accumulated == 0))
10- then {
11- let exchangerAddress = addressFromStringValue(exchanger)
12- let $t09801054 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
13- let pmtAmount = $t09801054._1
14- let pmtAssetId = $t09801054._2
15- if ((assetsToPay[0] != pmtAssetId))
16- then throw("Incorrect payment and assetsToPay array")
17- else {
18- let inv = invoke(exchangerAddress, "exchange", [args[accumulated]], [AttachedPayment(pmtAssetId, pmtAmount)])
9+ func exchangeFold (accumulated,exchanger) = {
10+ let $t0935998 = accumulated
11+ let exchangeCounter = $t0935998._1
12+ let amountsWithFee = $t0935998._2
13+ let assetsIdSend = $t0935998._3
14+ if ((exchangeCounter == 0))
15+ then {
16+ let exchangerAddress = addressFromStringValue(exchanger)
17+ let $t011181192 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
18+ let pmtAmount = $t011181192._1
19+ let pmtAssetId = $t011181192._2
20+ let inv = invoke(exchangerAddress, "exchange", [args[exchangeCounter]], [AttachedPayment(pmtAssetId, pmtAmount)])
21+ if ((inv == inv))
22+ then match inv {
23+ case inv: (Int, ByteVector) =>
24+ let $t014201458 = inv
25+ let amountWithFee = $t014201458._1
26+ let assetIdSend = $t014201458._2
27+ $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend)
28+ case _ =>
29+ throw("Incorrect invoke result: expected amountWithFee and assetsIdSend")
30+ }
31+ else throw("Strict value is not equal to itself.")
32+ }
33+ else if (if ((exchangeCounter > 0))
34+ then (routingSize > exchangeCounter)
35+ else false)
36+ then {
37+ let exchangerAddress = addressFromStringValue(exchanger)
38+ let $t018041943 = $Tuple2(assetsIdSend, amountsWithFee)
39+ let pmtAssetId = $t018041943._1
40+ let pmtAmount = $t018041943._2
41+ let inv = invoke(exchangerAddress, "exchange", [args[exchangeCounter]], [AttachedPayment(pmtAssetId, pmtAmount)])
1942 if ((inv == inv))
20- then (accumulated + 1)
43+ then match inv {
44+ case inv: (Int, ByteVector) =>
45+ let $t021712209 = inv
46+ let amountWithFee = $t021712209._1
47+ let assetIdSend = $t021712209._2
48+ $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend)
49+ case _ =>
50+ throw("Incorrect invoke result: expected amountWithFee and assetsIdSend")
51+ }
2152 else throw("Strict value is not equal to itself.")
2253 }
23- }
24- else if (if ((accumulated > 0))
25- then (routingSize > accumulated)
26- else false)
27- then {
28- let exchangerAddress = addressFromStringValue(exchanger)
29- let pmtAssetId = assetsToPay[accumulated]
30- let pmtAmount = assetBalance(this, pmtAssetId)
31- let inv = invoke(exchangerAddress, "exchange", [args[accumulated]], [AttachedPayment(pmtAssetId, pmtAmount)])
32- if ((inv == inv))
33- then (accumulated + 1)
34- else throw("Strict value is not equal to itself.")
35- }
36- else accumulated
54+ else accumulated
55+ }
3756
38- let routing = {
39- let $list18031839 = exchangers
40- let $size18031839 = size($list18031839)
41- let $acc018031839 = 0
42- if (($size18031839 == 0))
43- then $acc018031839
57+ let $t024472548 = {
58+ let $list24992548 = exchangers
59+ let $size24992548 = size($list24992548)
60+ let $acc024992548 = $Tuple3(0, 0, base58'')
61+ if (($size24992548 == 0))
62+ then $acc024992548
4463 else {
45- let $acc118031839 = exchangeFold($acc018031839, $list18031839[0])
46- if (($size18031839 == 1))
47- then $acc118031839
64+ let $acc124992548 = exchangeFold($acc024992548, $list24992548[0])
65+ if (($size24992548 == 1))
66+ then $acc124992548
4867 else {
49- let $acc218031839 = exchangeFold($acc118031839, $list18031839[1])
50- if (($size18031839 == 2))
51- then $acc218031839
68+ let $acc224992548 = exchangeFold($acc124992548, $list24992548[1])
69+ if (($size24992548 == 2))
70+ then $acc224992548
5271 else {
53- let $acc318031839 = exchangeFold($acc218031839, $list18031839[2])
54- if (($size18031839 == 3))
55- then $acc318031839
72+ let $acc324992548 = exchangeFold($acc224992548, $list24992548[2])
73+ if (($size24992548 == 3))
74+ then $acc324992548
5675 else {
57- let $acc418031839 = exchangeFold($acc318031839, $list18031839[3])
58- if (($size18031839 == 4))
59- then $acc418031839
60- else {
61- let $acc518031839 = exchangeFold($acc418031839, $list18031839[4])
62- if (($size18031839 == 5))
63- then $acc518031839
64- else {
65- let $acc618031839 = exchangeFold($acc518031839, $list18031839[5])
66- throw("List size exceed 5")
67- }
68- }
76+ let $acc424992548 = exchangeFold($acc324992548, $list24992548[3])
77+ throw("List size exceed 3")
6978 }
7079 }
7180 }
7281 }
7382 }
74- let amountToRecieve = assetBalance(this, assetToUserSend)
75- if (if ((routing == routingSize))
83+ let exchangeCounter = $t024472548._1
84+ let amountsWithFee = $t024472548._2
85+ let assetsIdSend = $t024472548._3
86+ let amountToRecieve = assetBalance(this, receiveAssetId)
87+ if (if ((exchangeCounter == routingSize))
7688 then (amountToRecieve >= minAmountToReceive)
7789 else false)
78- then [ScriptTransfer(i.caller, amountToRecieve, assetToUserSend)]
90+ then [ScriptTransfer(i.caller, amountToRecieve, receiveAssetId)]
7991 else throw("routing != routingSize or amountToRecieve < minAmountToReceive")
8092 }
8193
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44
55
66 @Callable(i)
7-func routingTrade (exchangers,args,assetsToPay,assetToUserSend,minAmountToReceive) = {
7+func routingTrade (exchangers,args,receiveAssetId,minAmountToReceive) = {
88 let routingSize = size(exchangers)
9- func exchangeFold (accumulated,exchanger) = if ((accumulated == 0))
10- then {
11- let exchangerAddress = addressFromStringValue(exchanger)
12- let $t09801054 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
13- let pmtAmount = $t09801054._1
14- let pmtAssetId = $t09801054._2
15- if ((assetsToPay[0] != pmtAssetId))
16- then throw("Incorrect payment and assetsToPay array")
17- else {
18- let inv = invoke(exchangerAddress, "exchange", [args[accumulated]], [AttachedPayment(pmtAssetId, pmtAmount)])
9+ func exchangeFold (accumulated,exchanger) = {
10+ let $t0935998 = accumulated
11+ let exchangeCounter = $t0935998._1
12+ let amountsWithFee = $t0935998._2
13+ let assetsIdSend = $t0935998._3
14+ if ((exchangeCounter == 0))
15+ then {
16+ let exchangerAddress = addressFromStringValue(exchanger)
17+ let $t011181192 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
18+ let pmtAmount = $t011181192._1
19+ let pmtAssetId = $t011181192._2
20+ let inv = invoke(exchangerAddress, "exchange", [args[exchangeCounter]], [AttachedPayment(pmtAssetId, pmtAmount)])
21+ if ((inv == inv))
22+ then match inv {
23+ case inv: (Int, ByteVector) =>
24+ let $t014201458 = inv
25+ let amountWithFee = $t014201458._1
26+ let assetIdSend = $t014201458._2
27+ $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend)
28+ case _ =>
29+ throw("Incorrect invoke result: expected amountWithFee and assetsIdSend")
30+ }
31+ else throw("Strict value is not equal to itself.")
32+ }
33+ else if (if ((exchangeCounter > 0))
34+ then (routingSize > exchangeCounter)
35+ else false)
36+ then {
37+ let exchangerAddress = addressFromStringValue(exchanger)
38+ let $t018041943 = $Tuple2(assetsIdSend, amountsWithFee)
39+ let pmtAssetId = $t018041943._1
40+ let pmtAmount = $t018041943._2
41+ let inv = invoke(exchangerAddress, "exchange", [args[exchangeCounter]], [AttachedPayment(pmtAssetId, pmtAmount)])
1942 if ((inv == inv))
20- then (accumulated + 1)
43+ then match inv {
44+ case inv: (Int, ByteVector) =>
45+ let $t021712209 = inv
46+ let amountWithFee = $t021712209._1
47+ let assetIdSend = $t021712209._2
48+ $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend)
49+ case _ =>
50+ throw("Incorrect invoke result: expected amountWithFee and assetsIdSend")
51+ }
2152 else throw("Strict value is not equal to itself.")
2253 }
23- }
24- else if (if ((accumulated > 0))
25- then (routingSize > accumulated)
26- else false)
27- then {
28- let exchangerAddress = addressFromStringValue(exchanger)
29- let pmtAssetId = assetsToPay[accumulated]
30- let pmtAmount = assetBalance(this, pmtAssetId)
31- let inv = invoke(exchangerAddress, "exchange", [args[accumulated]], [AttachedPayment(pmtAssetId, pmtAmount)])
32- if ((inv == inv))
33- then (accumulated + 1)
34- else throw("Strict value is not equal to itself.")
35- }
36- else accumulated
54+ else accumulated
55+ }
3756
38- let routing = {
39- let $list18031839 = exchangers
40- let $size18031839 = size($list18031839)
41- let $acc018031839 = 0
42- if (($size18031839 == 0))
43- then $acc018031839
57+ let $t024472548 = {
58+ let $list24992548 = exchangers
59+ let $size24992548 = size($list24992548)
60+ let $acc024992548 = $Tuple3(0, 0, base58'')
61+ if (($size24992548 == 0))
62+ then $acc024992548
4463 else {
45- let $acc118031839 = exchangeFold($acc018031839, $list18031839[0])
46- if (($size18031839 == 1))
47- then $acc118031839
64+ let $acc124992548 = exchangeFold($acc024992548, $list24992548[0])
65+ if (($size24992548 == 1))
66+ then $acc124992548
4867 else {
49- let $acc218031839 = exchangeFold($acc118031839, $list18031839[1])
50- if (($size18031839 == 2))
51- then $acc218031839
68+ let $acc224992548 = exchangeFold($acc124992548, $list24992548[1])
69+ if (($size24992548 == 2))
70+ then $acc224992548
5271 else {
53- let $acc318031839 = exchangeFold($acc218031839, $list18031839[2])
54- if (($size18031839 == 3))
55- then $acc318031839
72+ let $acc324992548 = exchangeFold($acc224992548, $list24992548[2])
73+ if (($size24992548 == 3))
74+ then $acc324992548
5675 else {
57- let $acc418031839 = exchangeFold($acc318031839, $list18031839[3])
58- if (($size18031839 == 4))
59- then $acc418031839
60- else {
61- let $acc518031839 = exchangeFold($acc418031839, $list18031839[4])
62- if (($size18031839 == 5))
63- then $acc518031839
64- else {
65- let $acc618031839 = exchangeFold($acc518031839, $list18031839[5])
66- throw("List size exceed 5")
67- }
68- }
76+ let $acc424992548 = exchangeFold($acc324992548, $list24992548[3])
77+ throw("List size exceed 3")
6978 }
7079 }
7180 }
7281 }
7382 }
74- let amountToRecieve = assetBalance(this, assetToUserSend)
75- if (if ((routing == routingSize))
83+ let exchangeCounter = $t024472548._1
84+ let amountsWithFee = $t024472548._2
85+ let assetsIdSend = $t024472548._3
86+ let amountToRecieve = assetBalance(this, receiveAssetId)
87+ if (if ((exchangeCounter == routingSize))
7688 then (amountToRecieve >= minAmountToReceive)
7789 else false)
78- then [ScriptTransfer(i.caller, amountToRecieve, assetToUserSend)]
90+ then [ScriptTransfer(i.caller, amountToRecieve, receiveAssetId)]
7991 else throw("routing != routingSize or amountToRecieve < minAmountToReceive")
8092 }
8193
8294

github/deemru/w8io/169f3d6 
58.63 ms