KomodoPlatform / komodo-defi-framework

This is the official Komodo DeFi Framework repository
https://komodoplatform.com/en/docs/komodo-defi-framework/
103 stars 94 forks source link

UTXO to BEP20 orders don't match #1074

Closed cipig closed 3 years ago

cipig commented 3 years ago

This bid in the MCL/USDT-BEP20 orderbook

  "bids": [
    {
      "coin": "USDT-BEP20",
      "address": "0x98298409c949135eed89233d04c2cfef984baff5",
      "price": "0.01253825109999558890195693165487400462638919557474240414159057149487609376122236184296122528412762827",
      "maxvolume": "18",
      "min_volume": "2.37428333333333",
      "pubkey": "031bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8",
      "age": 1632076705,
      "zcredits": 0,
      "uuid": "3c263edc-3781-419a-a879-c7757dd1e3f5",
      "is_mine": true,
      "base_max_volume": "1435.6069165026",
      "base_min_volume": "189.363198615009815813533981",
      "rel_max_volume": "18",
      "rel_min_volume": "2.37428333333333",
      "base_max_volume_aggr": "1435.6069165026",
      "rel_max_volume_aggr": "18"
    }

can't be matched by an order placed with ADEX Desktop (sell 1000 MCL for USDT-BEP20) it is turned into a maker order that looks like this

    {
      "coin": "MCL",
      "address": "RD9Jv1onKkFSey1km2AdcvhsRPvRxv8saX",
      "price": "0.01253825109999558890195693165487400462638919557474240414159057149487609376122236184296122528412762827",
      "maxvolume": "1000",
      "min_volume": "189.36319862",
      "pubkey": "039ef1b42c635c32440099910bbe1c5e8b0c9373274c3f21cf1003750fc88d3499",
      "age": 1632076745,
      "zcredits": 0,
      "uuid": "c5cfa7f0-3428-44cc-862b-29a3cf9b8a5e",
      "is_mine": false,
      "base_max_volume": "1000",
      "base_min_volume": "189.36319862",
      "rel_max_volume": "12.53825109999558890195693165487400462638919557474240414159057149487609376122236184296122528412762827",
      "rel_min_volume": "2.374283333395898182365138155647671429141736135041970930800325992703532055196092959654175752436826006",
      "base_max_volume_aggr": "1000",
      "rel_max_volume_aggr": "12.53825109999558890195693165487400462638919557474240414159057149487609376122236184296122528412762827"
    }

the price matches exactly (the order was placed by selecting the above bid) i observed that the base_min_volume has different precisions on taker and maker... could that be the reason that the orders don't match?

selling 1000 MCL for BCH to the same maker works fine

cipig commented 3 years ago

happens with EFL/USDT-BEP20 too... just have a second example

  "bids": [
    {
      "coin": "USDT-BEP20",
      "address": "0x98298409c949135eed89233d04c2cfef984baff5",
      "price": "0.1786986432165128132153764156483642185813349282028079482210405393374601355635698653459233124556744449",
      "maxvolume": "45",
      "min_volume": "2.8385875",
      "pubkey": "031bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8",
      "age": 1632078542,
      "zcredits": 0,
      "uuid": "7418ab12-95c3-4985-9434-052d725ac473",
      "is_mine": true,
      "base_max_volume": "251.820602496",
      "base_min_volume": "15.88477365528032",
      "rel_max_volume": "45",
      "rel_min_volume": "2.8385875",
      "base_max_volume_aggr": "251.820602496",
      "rel_max_volume_aggr": "45"
    }

can't be matched by

    {
      "coin": "EFL",
      "address": "LP656iEKoagvqmLiTzAooRSRsLq7RYVEKQ",
      "price": "0.1786986432165128132153764156483642185813349282028079482210405393374601355635698653459233124556744449",
      "maxvolume": "100",
      "min_volume": "15.88477366",
      "pubkey": "039ef1b42c635c32440099910bbe1c5e8b0c9373274c3f21cf1003750fc88d3499",
      "age": 1632078542,
      "zcredits": 0,
      "uuid": "1a4da96e-4da5-4314-b0f8-0f4fa1643559",
      "is_mine": false,
      "base_max_volume": "100",
      "base_min_volume": "15.88477366",
      "rel_max_volume": "17.86986432165128132153764156483642185813349282028079482210405393374601355635698653459233124556744449",
      "rel_min_volume": "2.838587500843400412416111194276347761407271635153954833940228617059880612700223852616669422075847339",
      "base_max_volume_aggr": "100",
      "rel_max_volume_aggr": "17.86986432165128132153764156483642185813349282028079482210405393374601355635698653459233124556744449"
    }

selling 100 EFL for USDT-BEP20

this is the output from ADEX Desktop when placing the order:

{
    "action": "Sell",
    "base": "EFL",
    "base_amount": "100",
    "base_amount_rat": [
        [
            1,
            [
                100
            ]
        ],
        [
            1,
            [
                1
            ]
        ]
    ],
    "conf_settings": {
        "base_confs": 3,
        "base_nota": false,
        "rel_confs": 3,
        "rel_nota": false
    },
    "dest_pub_key": "0000000000000000000000000000000000000000000000000000000000000000",
    "match_by": {
        "type": "Any"
    },
    "method": "request",
    "min_volume": "15.88477366",
    "min_volume_fraction": {
        "denom": "50000000",
        "numer": "794238683"
    },
    "min_volume_rat": [
        [
            1,
            [
                794238683
            ]
        ],
        [
            1,
            [
                50000000
            ]
        ]
    ],
    "order_type": {
        "type": "GoodTillCancelled"
    },
    "rel": "USDT-BEP20",
    "rel_amount": "17.86986432165128132153764156483642185813349282028079482210405393374601355635698653459233124556744449",
    "rel_amount_rat": [
        [
            1,
            [
                3906250000
            ]
        ],
        [
            1,
            [
                218594273
            ]
        ]
    ],
    "sender_pubkey": "9ef1b42c635c32440099910bbe1c5e8b0c9373274c3f21cf1003750fc88d3499",
    "uuid": "1a4da96e-4da5-4314-b0f8-0f4fa1643559"
}
artemii235 commented 3 years ago

I'm checking this now.

smk762 commented 3 years ago

Not sure if related, but also failed to match orders while testing MATIC to KMD / UTXO https://github.com/KomodoPlatform/atomicDEX-Desktop/pull/1303#issuecomment-922632507

artemii235 commented 3 years ago

Not sure if related, but also failed to match orders while testing MATIC to KMD / UTXO

Yes, it seems the same bug. I'm preparing a hotfix now.

artemii235 commented 3 years ago

@cipig Could you please test that the problem is fixed in the linked PR?

cipig commented 3 years ago

thanks a lot, problem is fixed after i updated only the maker node, the above orders matched fine

artemii235 commented 3 years ago

Thanks for the report and testing!