{
  "method": "Fraction constant-product reserve difference with adjusted input, floor at each hop, and exact token-aware composition; constructed snapshots only.",
  "cases": [
    {
      "id": "A",
      "amount": "100",
      "routes": [
        {
          "id": "direct",
          "label": "Directa",
          "path": [
            "A",
            "B"
          ],
          "state": "complete",
          "amounts": [
            "100",
            "135"
          ],
          "rows": [
            {
              "step": 1,
              "pool": "AB",
              "input_token": "A",
              "output_token": "B",
              "reserve_in": "1000",
              "reserve_out": "1500",
              "input": "100",
              "output": "135",
              "state": "complete",
              "numerator": "149550000",
              "denominator": "1099700"
            }
          ],
          "final": "135",
          "failed_step": null
        },
        {
          "id": "via",
          "label": "Por X",
          "path": [
            "A",
            "X",
            "B"
          ],
          "state": "complete",
          "amounts": [
            "100",
            "181",
            "152"
          ],
          "rows": [
            {
              "step": 1,
              "pool": "AX",
              "input_token": "A",
              "output_token": "X",
              "reserve_in": "1000",
              "reserve_out": "2000",
              "input": "100",
              "output": "181",
              "state": "complete",
              "numerator": "199400000",
              "denominator": "1099700"
            },
            {
              "step": 2,
              "pool": "XB",
              "input_token": "X",
              "output_token": "B",
              "reserve_in": "1000",
              "reserve_out": "1000",
              "input": "181",
              "output": "152",
              "state": "complete",
              "numerator": "180457000",
              "denominator": "1180457"
            }
          ],
          "final": "152",
          "failed_step": null
        }
      ],
      "difference": "17",
      "outcome": "via"
    },
    {
      "id": "A",
      "amount": "1000",
      "routes": [
        {
          "id": "direct",
          "label": "Directa",
          "path": [
            "A",
            "B"
          ],
          "state": "complete",
          "amounts": [
            "1000",
            "748"
          ],
          "rows": [
            {
              "step": 1,
              "pool": "AB",
              "input_token": "A",
              "output_token": "B",
              "reserve_in": "1000",
              "reserve_out": "1500",
              "input": "1000",
              "output": "748",
              "state": "complete",
              "numerator": "1495500000",
              "denominator": "1997000"
            }
          ],
          "final": "748",
          "failed_step": null
        },
        {
          "id": "via",
          "label": "Por X",
          "path": [
            "A",
            "X",
            "B"
          ],
          "state": "complete",
          "amounts": [
            "1000",
            "998",
            "498"
          ],
          "rows": [
            {
              "step": 1,
              "pool": "AX",
              "input_token": "A",
              "output_token": "X",
              "reserve_in": "1000",
              "reserve_out": "2000",
              "input": "1000",
              "output": "998",
              "state": "complete",
              "numerator": "1994000000",
              "denominator": "1997000"
            },
            {
              "step": 2,
              "pool": "XB",
              "input_token": "X",
              "output_token": "B",
              "reserve_in": "1000",
              "reserve_out": "1000",
              "input": "998",
              "output": "498",
              "state": "complete",
              "numerator": "995006000",
              "denominator": "1995006"
            }
          ],
          "final": "498",
          "failed_step": null
        }
      ],
      "difference": "-250",
      "outcome": "direct"
    },
    {
      "id": "B",
      "amount": "100",
      "routes": [
        {
          "id": "direct",
          "label": "Directa",
          "path": [
            "A",
            "B"
          ],
          "state": "complete",
          "amounts": [
            "100",
            "135"
          ],
          "rows": [
            {
              "step": 1,
              "pool": "AB",
              "input_token": "A",
              "output_token": "B",
              "reserve_in": "1000",
              "reserve_out": "1500",
              "input": "100",
              "output": "135",
              "state": "complete",
              "numerator": "149550000",
              "denominator": "1099700"
            }
          ],
          "final": "135",
          "failed_step": null
        },
        {
          "id": "via",
          "label": "Por X",
          "path": [
            "A",
            "X",
            "B"
          ],
          "state": "complete",
          "amounts": [
            "100",
            "181",
            "152"
          ],
          "rows": [
            {
              "step": 1,
              "pool": "AX",
              "input_token": "A",
              "output_token": "X",
              "reserve_in": "1000",
              "reserve_out": "2000",
              "input": "100",
              "output": "181",
              "state": "complete",
              "numerator": "199400000",
              "denominator": "1099700"
            },
            {
              "step": 2,
              "pool": "XB",
              "input_token": "X",
              "output_token": "B",
              "reserve_in": "1000",
              "reserve_out": "1000",
              "input": "181",
              "output": "152",
              "state": "complete",
              "numerator": "180457000",
              "denominator": "1180457"
            }
          ],
          "final": "152",
          "failed_step": null
        }
      ],
      "difference": "17",
      "outcome": "via"
    },
    {
      "id": "B",
      "amount": "1000",
      "routes": [
        {
          "id": "direct",
          "label": "Directa",
          "path": [
            "A",
            "B"
          ],
          "state": "complete",
          "amounts": [
            "1000",
            "748"
          ],
          "rows": [
            {
              "step": 1,
              "pool": "AB",
              "input_token": "A",
              "output_token": "B",
              "reserve_in": "1000",
              "reserve_out": "1500",
              "input": "1000",
              "output": "748",
              "state": "complete",
              "numerator": "1495500000",
              "denominator": "1997000"
            }
          ],
          "final": "748",
          "failed_step": null
        },
        {
          "id": "via",
          "label": "Por X",
          "path": [
            "A",
            "X",
            "B"
          ],
          "state": "complete",
          "amounts": [
            "1000",
            "998",
            "498"
          ],
          "rows": [
            {
              "step": 1,
              "pool": "AX",
              "input_token": "A",
              "output_token": "X",
              "reserve_in": "1000",
              "reserve_out": "2000",
              "input": "1000",
              "output": "998",
              "state": "complete",
              "numerator": "1994000000",
              "denominator": "1997000"
            },
            {
              "step": 2,
              "pool": "XB",
              "input_token": "X",
              "output_token": "B",
              "reserve_in": "1000",
              "reserve_out": "1000",
              "input": "998",
              "output": "498",
              "state": "complete",
              "numerator": "995006000",
              "denominator": "1995006"
            }
          ],
          "final": "498",
          "failed_step": null
        }
      ],
      "difference": "-250",
      "outcome": "direct"
    },
    {
      "id": "C",
      "amount": "100",
      "routes": [
        {
          "id": "direct",
          "label": "Directa",
          "path": [
            "A",
            "B"
          ],
          "state": "complete",
          "amounts": [
            "100",
            "135"
          ],
          "rows": [
            {
              "step": 1,
              "pool": "AB",
              "input_token": "A",
              "output_token": "B",
              "reserve_in": "1000",
              "reserve_out": "1500",
              "input": "100",
              "output": "135",
              "state": "complete",
              "numerator": "149550000",
              "denominator": "1099700"
            }
          ],
          "final": "135",
          "failed_step": null
        },
        {
          "id": "via",
          "label": "Por X",
          "path": [
            "A",
            "X",
            "B"
          ],
          "state": "zero",
          "amounts": [
            "100",
            "0",
            null
          ],
          "rows": [
            {
              "step": 1,
              "pool": "AX",
              "input_token": "A",
              "output_token": "X",
              "reserve_in": "1000000",
              "reserve_out": "2",
              "input": "100",
              "output": "0",
              "state": "zero",
              "numerator": "199400",
              "denominator": "1000099700"
            },
            {
              "step": 2,
              "pool": "XB",
              "input_token": "X",
              "output_token": "B",
              "reserve_in": "1000",
              "reserve_out": "1000",
              "input": "0",
              "output": null,
              "state": "blocked",
              "numerator": null,
              "denominator": null
            }
          ],
          "final": null,
          "failed_step": 1
        }
      ],
      "difference": null,
      "outcome": "direct_only"
    },
    {
      "id": "C",
      "amount": "1000",
      "routes": [
        {
          "id": "direct",
          "label": "Directa",
          "path": [
            "A",
            "B"
          ],
          "state": "complete",
          "amounts": [
            "1000",
            "748"
          ],
          "rows": [
            {
              "step": 1,
              "pool": "AB",
              "input_token": "A",
              "output_token": "B",
              "reserve_in": "1000",
              "reserve_out": "1500",
              "input": "1000",
              "output": "748",
              "state": "complete",
              "numerator": "1495500000",
              "denominator": "1997000"
            }
          ],
          "final": "748",
          "failed_step": null
        },
        {
          "id": "via",
          "label": "Por X",
          "path": [
            "A",
            "X",
            "B"
          ],
          "state": "zero",
          "amounts": [
            "1000",
            "0",
            null
          ],
          "rows": [
            {
              "step": 1,
              "pool": "AX",
              "input_token": "A",
              "output_token": "X",
              "reserve_in": "1000000",
              "reserve_out": "2",
              "input": "1000",
              "output": "0",
              "state": "zero",
              "numerator": "1994000",
              "denominator": "1000997000"
            },
            {
              "step": 2,
              "pool": "XB",
              "input_token": "X",
              "output_token": "B",
              "reserve_in": "1000",
              "reserve_out": "1000",
              "input": "0",
              "output": null,
              "state": "blocked",
              "numerator": null,
              "denominator": null
            }
          ],
          "final": null,
          "failed_step": 1
        }
      ],
      "difference": null,
      "outcome": "direct_only"
    },
    {
      "id": "D",
      "amount": "100",
      "routes": [
        {
          "id": "direct",
          "label": "Directa",
          "path": [
            "A",
            "B"
          ],
          "state": "complete",
          "amounts": [
            "100",
            "135"
          ],
          "rows": [
            {
              "step": 1,
              "pool": "AB",
              "input_token": "A",
              "output_token": "B",
              "reserve_in": "1000",
              "reserve_out": "1500",
              "input": "100",
              "output": "135",
              "state": "complete",
              "numerator": "149550000",
              "denominator": "1099700"
            }
          ],
          "final": "135",
          "failed_step": null
        },
        {
          "id": "via",
          "label": "Por X",
          "path": [
            "A",
            "X",
            "B"
          ],
          "state": "pending",
          "amounts": [
            "100",
            "181",
            null
          ],
          "rows": [
            {
              "step": 1,
              "pool": "AX",
              "input_token": "A",
              "output_token": "X",
              "reserve_in": "1000",
              "reserve_out": "2000",
              "input": "100",
              "output": "181",
              "state": "complete",
              "numerator": "199400000",
              "denominator": "1099700"
            },
            {
              "step": 2,
              "pool": "XB",
              "input_token": "X",
              "output_token": "B",
              "reserve_in": "1000",
              "reserve_out": null,
              "input": "181",
              "output": null,
              "state": "pending",
              "numerator": null,
              "denominator": null
            }
          ],
          "final": null,
          "failed_step": 2
        }
      ],
      "difference": null,
      "outcome": "pending"
    },
    {
      "id": "D",
      "amount": "1000",
      "routes": [
        {
          "id": "direct",
          "label": "Directa",
          "path": [
            "A",
            "B"
          ],
          "state": "complete",
          "amounts": [
            "1000",
            "748"
          ],
          "rows": [
            {
              "step": 1,
              "pool": "AB",
              "input_token": "A",
              "output_token": "B",
              "reserve_in": "1000",
              "reserve_out": "1500",
              "input": "1000",
              "output": "748",
              "state": "complete",
              "numerator": "1495500000",
              "denominator": "1997000"
            }
          ],
          "final": "748",
          "failed_step": null
        },
        {
          "id": "via",
          "label": "Por X",
          "path": [
            "A",
            "X",
            "B"
          ],
          "state": "pending",
          "amounts": [
            "1000",
            "998",
            null
          ],
          "rows": [
            {
              "step": 1,
              "pool": "AX",
              "input_token": "A",
              "output_token": "X",
              "reserve_in": "1000",
              "reserve_out": "2000",
              "input": "1000",
              "output": "998",
              "state": "complete",
              "numerator": "1994000000",
              "denominator": "1997000"
            },
            {
              "step": 2,
              "pool": "XB",
              "input_token": "X",
              "output_token": "B",
              "reserve_in": "1000",
              "reserve_out": null,
              "input": "998",
              "output": null,
              "state": "pending",
              "numerator": null,
              "denominator": null
            }
          ],
          "final": null,
          "failed_step": 2
        }
      ],
      "difference": null,
      "outcome": "pending"
    }
  ],
  "transfer": [
    {
      "id": "T1",
      "amount": "1",
      "routes": [
        {
          "id": "direct",
          "label": "Directa",
          "path": [
            "A",
            "B"
          ],
          "state": "complete",
          "amounts": [
            "1",
            "1"
          ],
          "rows": [
            {
              "step": 1,
              "pool": "AB",
              "input_token": "A",
              "output_token": "B",
              "reserve_in": "1000",
              "reserve_out": "1500",
              "input": "1",
              "output": "1",
              "state": "complete",
              "numerator": "1495500",
              "denominator": "1000997"
            }
          ],
          "final": "1",
          "failed_step": null
        },
        {
          "id": "via",
          "label": "Por X",
          "path": [
            "A",
            "X",
            "B"
          ],
          "state": "zero",
          "amounts": [
            "1",
            "1",
            "0"
          ],
          "rows": [
            {
              "step": 1,
              "pool": "AX",
              "input_token": "A",
              "output_token": "X",
              "reserve_in": "1000",
              "reserve_out": "2000",
              "input": "1",
              "output": "1",
              "state": "complete",
              "numerator": "1994000",
              "denominator": "1000997"
            },
            {
              "step": 2,
              "pool": "XB",
              "input_token": "X",
              "output_token": "B",
              "reserve_in": "1000",
              "reserve_out": "1000",
              "input": "1",
              "output": "0",
              "state": "zero",
              "numerator": "997000",
              "denominator": "1000997"
            }
          ],
          "final": "0",
          "failed_step": 2
        }
      ],
      "difference": "-1",
      "outcome": "direct_only"
    },
    {
      "id": "T2",
      "amount": "200",
      "routes": [
        {
          "id": "direct",
          "label": "Directa",
          "path": [
            "A",
            "B"
          ],
          "state": "complete",
          "amounts": [
            "200",
            "249"
          ],
          "rows": [
            {
              "step": 1,
              "pool": "AB",
              "input_token": "A",
              "output_token": "B",
              "reserve_in": "1000",
              "reserve_out": "1500",
              "input": "200",
              "output": "249",
              "state": "complete",
              "numerator": "299100000",
              "denominator": "1199400"
            }
          ],
          "final": "249",
          "failed_step": null
        },
        {
          "id": "via",
          "label": "Por X",
          "path": [
            "A",
            "X",
            "B"
          ],
          "state": "complete",
          "amounts": [
            "200",
            "332",
            "248"
          ],
          "rows": [
            {
              "step": 1,
              "pool": "AX",
              "input_token": "A",
              "output_token": "X",
              "reserve_in": "1000",
              "reserve_out": "2000",
              "input": "200",
              "output": "332",
              "state": "complete",
              "numerator": "398800000",
              "denominator": "1199400"
            },
            {
              "step": 2,
              "pool": "XB",
              "input_token": "X",
              "output_token": "B",
              "reserve_in": "1000",
              "reserve_out": "1000",
              "input": "332",
              "output": "248",
              "state": "complete",
              "numerator": "331004000",
              "denominator": "1331004"
            }
          ],
          "final": "248",
          "failed_step": null
        }
      ],
      "difference": "-1",
      "outcome": "direct"
    }
  ]
}
