tx · 9HbGXYy6qCuQohGBSwGiCJnLMwTkEp1trcLNwoTWcsnz
3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL: -0.01000000 Waves
2021.08.08 18:49 [1649571] smart account 3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL > SELF 0.00000000 Waves
{
"type": 13,
"id": "9HbGXYy6qCuQohGBSwGiCJnLMwTkEp1trcLNwoTWcsnz",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1628437774643,
"version": 2,
"chainId": 84,
"sender": "3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL",
"senderPublicKey": "EYAKsFBespqQveBrfmX29rsehBJrSwQ3B6yN4ADyw8Kx",
"proofs": [
"4zosapN59jXxbbvENaxMfUtUMs51Pw8DEWheHhSfzWvmP3JDmuUaVx6BpKMgerxUZJn4RQ9LfLp5Carrn9KPJNWw"
],
"script": "base64:AAIFAAAAAAAAAgsIAhIGCgQYERIBGgcKAmExEgFpGhAKAmEyEgpleGNoYW5nZXJzGgoKAmEzEgRhcmdzGg4KAmE0Eghhc3NldFBheRoYCgJhNRISbWluQW1vdW50VG9SZWNlaXZlGg8KAmE2EgkkdDA2MjQ2OTkaDwoCYTcSCXBtdEFtb3VudBoQCgJhOBIKcG10QXNzZXRJZBoRCgJhORILcm91dGluZ1NpemUaEgoCYjESDGV4Y2hhbmdlRm9sZBoRCgJiMhILYWNjdW11bGF0ZWQaDwoCYjMSCWV4Y2hhbmdlchoWCgJiNBIQZXhjaGFuZ2VyQWRkcmVzcxoHCgJiNRIBYRoNCgJiNhIHJG1hdGNoMBoHCgJiNxIBdBoHCgJiOBIBdRoJCgJiORIDaW52Gg0KAmMxEgdyb3V0aW5nGhMKAmMyEg0kbGlzdDEzNjgxNDA0GhMKAmMzEg0kc2l6ZTEzNjgxNDA0GhMKAmM0Eg0kYWNjMDEzNjgxNDA0GhMKAmM1Eg0kYWNjMTEzNjgxNDA0GhMKAmM2Eg0kYWNjMjEzNjgxND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1649571,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 5pGjXFkyxGep1K38YdPhbKvjEhUDAdXR9fsdUUPwg2hz
Next: 9RP3MsCPgfNRGrnAJijcGx9TRrCg943VaE7Jf2J4zExc
Diff:
Old | New | | Differences |
---|
12 | 12 | | func exchangeFold (accumulated,exchanger) = if ((routingSize > accumulated)) |
---|
13 | 13 | | then { |
---|
14 | 14 | | let exchangerAddress = addressFromStringValue(exchanger) |
---|
15 | | - | let inv = invoke(exchangerAddress, "exchange", [args[accumulated]], [AttachedPayment(unit, 100000)]) |
---|
| 15 | + | let a = match pmtAssetId { |
---|
| 16 | + | case t: ByteVector => |
---|
| 17 | + | t |
---|
| 18 | + | case u: Unit => |
---|
| 19 | + | u |
---|
| 20 | + | case _ => |
---|
| 21 | + | throw("Match error") |
---|
| 22 | + | } |
---|
| 23 | + | let inv = invoke(exchangerAddress, "exchange", [args[accumulated]], [AttachedPayment(a, 100000)]) |
---|
16 | 24 | | if ((inv == inv)) |
---|
17 | 25 | | then (accumulated + 1) |
---|
18 | 26 | | else throw("Strict value is not equal to itself.") |
---|
|
20 | 28 | | else accumulated |
---|
21 | 29 | | |
---|
22 | 30 | | let routing = { |
---|
23 | | - | let $list12471283 = exchangers |
---|
24 | | - | let $size12471283 = size($list12471283) |
---|
25 | | - | let $acc012471283 = 0 |
---|
26 | | - | if (($size12471283 == 0)) |
---|
27 | | - | then $acc012471283 |
---|
| 31 | + | let $list13681404 = exchangers |
---|
| 32 | + | let $size13681404 = size($list13681404) |
---|
| 33 | + | let $acc013681404 = 0 |
---|
| 34 | + | if (($size13681404 == 0)) |
---|
| 35 | + | then $acc013681404 |
---|
28 | 36 | | else { |
---|
29 | | - | let $acc112471283 = exchangeFold($acc012471283, $list12471283[0]) |
---|
30 | | - | if (($size12471283 == 1)) |
---|
31 | | - | then $acc112471283 |
---|
| 37 | + | let $acc113681404 = exchangeFold($acc013681404, $list13681404[0]) |
---|
| 38 | + | if (($size13681404 == 1)) |
---|
| 39 | + | then $acc113681404 |
---|
32 | 40 | | else { |
---|
33 | | - | let $acc212471283 = exchangeFold($acc112471283, $list12471283[1]) |
---|
34 | | - | if (($size12471283 == 2)) |
---|
35 | | - | then $acc212471283 |
---|
| 41 | + | let $acc213681404 = exchangeFold($acc113681404, $list13681404[1]) |
---|
| 42 | + | if (($size13681404 == 2)) |
---|
| 43 | + | then $acc213681404 |
---|
36 | 44 | | else { |
---|
37 | | - | let $acc312471283 = exchangeFold($acc212471283, $list12471283[2]) |
---|
38 | | - | if (($size12471283 == 3)) |
---|
39 | | - | then $acc312471283 |
---|
| 45 | + | let $acc313681404 = exchangeFold($acc213681404, $list13681404[2]) |
---|
| 46 | + | if (($size13681404 == 3)) |
---|
| 47 | + | then $acc313681404 |
---|
40 | 48 | | else { |
---|
41 | | - | let $acc412471283 = exchangeFold($acc312471283, $list12471283[3]) |
---|
42 | | - | if (($size12471283 == 4)) |
---|
43 | | - | then $acc412471283 |
---|
| 49 | + | let $acc413681404 = exchangeFold($acc313681404, $list13681404[3]) |
---|
| 50 | + | if (($size13681404 == 4)) |
---|
| 51 | + | then $acc413681404 |
---|
44 | 52 | | else { |
---|
45 | | - | let $acc512471283 = exchangeFold($acc412471283, $list12471283[4]) |
---|
46 | | - | if (($size12471283 == 5)) |
---|
47 | | - | then $acc512471283 |
---|
| 53 | + | let $acc513681404 = exchangeFold($acc413681404, $list13681404[4]) |
---|
| 54 | + | if (($size13681404 == 5)) |
---|
| 55 | + | then $acc513681404 |
---|
48 | 56 | | else { |
---|
49 | | - | let $acc612471283 = exchangeFold($acc512471283, $list12471283[5]) |
---|
| 57 | + | let $acc613681404 = exchangeFold($acc513681404, $list13681404[5]) |
---|
50 | 58 | | throw("List size exceed 5") |
---|
51 | 59 | | } |
---|
52 | 60 | | } |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 5 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | |
---|
5 | 5 | | |
---|
6 | 6 | | @Callable(i) |
---|
7 | 7 | | func routingTrade (exchangers,args,assetPay,minAmountToReceive) = { |
---|
8 | 8 | | let $t0624699 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) |
---|
9 | 9 | | let pmtAmount = $t0624699._1 |
---|
10 | 10 | | let pmtAssetId = $t0624699._2 |
---|
11 | 11 | | let routingSize = size(exchangers) |
---|
12 | 12 | | func exchangeFold (accumulated,exchanger) = if ((routingSize > accumulated)) |
---|
13 | 13 | | then { |
---|
14 | 14 | | let exchangerAddress = addressFromStringValue(exchanger) |
---|
15 | | - | let inv = invoke(exchangerAddress, "exchange", [args[accumulated]], [AttachedPayment(unit, 100000)]) |
---|
| 15 | + | let a = match pmtAssetId { |
---|
| 16 | + | case t: ByteVector => |
---|
| 17 | + | t |
---|
| 18 | + | case u: Unit => |
---|
| 19 | + | u |
---|
| 20 | + | case _ => |
---|
| 21 | + | throw("Match error") |
---|
| 22 | + | } |
---|
| 23 | + | let inv = invoke(exchangerAddress, "exchange", [args[accumulated]], [AttachedPayment(a, 100000)]) |
---|
16 | 24 | | if ((inv == inv)) |
---|
17 | 25 | | then (accumulated + 1) |
---|
18 | 26 | | else throw("Strict value is not equal to itself.") |
---|
19 | 27 | | } |
---|
20 | 28 | | else accumulated |
---|
21 | 29 | | |
---|
22 | 30 | | let routing = { |
---|
23 | | - | let $list12471283 = exchangers |
---|
24 | | - | let $size12471283 = size($list12471283) |
---|
25 | | - | let $acc012471283 = 0 |
---|
26 | | - | if (($size12471283 == 0)) |
---|
27 | | - | then $acc012471283 |
---|
| 31 | + | let $list13681404 = exchangers |
---|
| 32 | + | let $size13681404 = size($list13681404) |
---|
| 33 | + | let $acc013681404 = 0 |
---|
| 34 | + | if (($size13681404 == 0)) |
---|
| 35 | + | then $acc013681404 |
---|
28 | 36 | | else { |
---|
29 | | - | let $acc112471283 = exchangeFold($acc012471283, $list12471283[0]) |
---|
30 | | - | if (($size12471283 == 1)) |
---|
31 | | - | then $acc112471283 |
---|
| 37 | + | let $acc113681404 = exchangeFold($acc013681404, $list13681404[0]) |
---|
| 38 | + | if (($size13681404 == 1)) |
---|
| 39 | + | then $acc113681404 |
---|
32 | 40 | | else { |
---|
33 | | - | let $acc212471283 = exchangeFold($acc112471283, $list12471283[1]) |
---|
34 | | - | if (($size12471283 == 2)) |
---|
35 | | - | then $acc212471283 |
---|
| 41 | + | let $acc213681404 = exchangeFold($acc113681404, $list13681404[1]) |
---|
| 42 | + | if (($size13681404 == 2)) |
---|
| 43 | + | then $acc213681404 |
---|
36 | 44 | | else { |
---|
37 | | - | let $acc312471283 = exchangeFold($acc212471283, $list12471283[2]) |
---|
38 | | - | if (($size12471283 == 3)) |
---|
39 | | - | then $acc312471283 |
---|
| 45 | + | let $acc313681404 = exchangeFold($acc213681404, $list13681404[2]) |
---|
| 46 | + | if (($size13681404 == 3)) |
---|
| 47 | + | then $acc313681404 |
---|
40 | 48 | | else { |
---|
41 | | - | let $acc412471283 = exchangeFold($acc312471283, $list12471283[3]) |
---|
42 | | - | if (($size12471283 == 4)) |
---|
43 | | - | then $acc412471283 |
---|
| 49 | + | let $acc413681404 = exchangeFold($acc313681404, $list13681404[3]) |
---|
| 50 | + | if (($size13681404 == 4)) |
---|
| 51 | + | then $acc413681404 |
---|
44 | 52 | | else { |
---|
45 | | - | let $acc512471283 = exchangeFold($acc412471283, $list12471283[4]) |
---|
46 | | - | if (($size12471283 == 5)) |
---|
47 | | - | then $acc512471283 |
---|
| 53 | + | let $acc513681404 = exchangeFold($acc413681404, $list13681404[4]) |
---|
| 54 | + | if (($size13681404 == 5)) |
---|
| 55 | + | then $acc513681404 |
---|
48 | 56 | | else { |
---|
49 | | - | let $acc612471283 = exchangeFold($acc512471283, $list12471283[5]) |
---|
| 57 | + | let $acc613681404 = exchangeFold($acc513681404, $list13681404[5]) |
---|
50 | 58 | | throw("List size exceed 5") |
---|
51 | 59 | | } |
---|
52 | 60 | | } |
---|
53 | 61 | | } |
---|
54 | 62 | | } |
---|
55 | 63 | | } |
---|
56 | 64 | | } |
---|
57 | 65 | | } |
---|
58 | 66 | | if ((routing == routingSize)) |
---|
59 | 67 | | then { |
---|
60 | 68 | | let ammountToRecieve = assetBalance(this, assetPay[(routingSize - 1)]) |
---|
61 | 69 | | [ScriptTransfer(i.caller, ammountToRecieve, assetPay[(routingSize - 1)])] |
---|
62 | 70 | | } |
---|
63 | 71 | | else nil |
---|
64 | 72 | | } |
---|
65 | 73 | | |
---|
66 | 74 | | |
---|