KomodoPlatform / komodo-defi-framework

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

ARRR-BEP20 swap fails #1078

Open cipig opened 3 years ago

cipig commented 3 years ago

Trying to swap ARRR-BEP20 with only 8 decimals (default is 18):

        {
                "coin": "ARRR-BEP20",
                "name": "arrr_bep20",
                "fname": "Pirate",
                "rpcport": 80,
                "mm2": 1,
                "decimals": 8,
                "chain_id": 56,
                "avg_blocktime": 0.05,
                "required_confirmations": 3,
                "protocol": {
                        "type": "ERC20",
                        "protocol_data": {
                                "platform": "BNB",
                                "contract_address": "0xCDAF240C90F989847c56aC9Dee754F76F41c5833"
                        }
                }
        },

leads to swap being shown as successfull on both sides, but taker (buying ARRR-BEP20) has no funds because the shown MakerPaymentSpent:

      {
         "event" : {
            "data" : {
               "tx_hex" : "f9010d82012c85012a05f200830249f094edc5b89fe1f0382f9e4316069971d90a0951db3180b8a402ed292b38590843eb897d6786135a25ac6c4249d284e94b585a2fff920d8b35d0cd359c000000000000000000000000000000000000000000000000000000000bebc200346b348fd6f99547f0c6138f7b42e4f9e8558387850414a22e5ec608504018bc000000000000000000000000cdaf240c90f989847c56ac9dee754f76f41c583300000000000000000000000098298409c949135eed89233d04c2cfef984baff58194a00a815bf49cc94e0992553853702f62c0578f2deda9338a8be64133e18c3341f1a04cbd061b284eaa68f1adbc5e7f0462c61e0429cc723ac92d4665bc2aa0022ae6",
               "tx_hash" : "0f890c726c47b8e336af78f6b0476f28c3535722173ac7e4c1333389f725aaf1"
            },
            "type" : "MakerPaymentSpent"
         },
         "timestamp" : 1632253177103
      },

actually fails with "Fail with error 'ERC20: transfer amount exceeds balance'" : https://bscscan.com/tx/0x0f890c726c47b8e336af78f6b0476f28c3535722173ac7e4c1333389f725aaf1

cipig commented 3 years ago

nvm, found the reason: it's not because of the decimals, but because they implemented a contract that sends "fees" somewhere else. This is MakerPayment: https://bscscan.com/tx/0x1b74323247ff186246af526e9eae1e3ecc8aa180f3ccdca7def1e809921ba6da there are 2 additional txes with 0.01 each will remove ARRR-BEP20

artemii235 commented 3 years ago

nvm, found the reason: it's not because of the decimals, but because they implemented a contract that sends "fees" somewhere

It's similar to what USDT-ERC20 has done. We don't support such tokens yet.