Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set min_volume to dust in orders #849

Closed
cipig opened this issue Mar 7, 2021 · 5 comments
Closed

set min_volume to dust in orders #849

cipig opened this issue Mar 7, 2021 · 5 comments
Assignees

Comments

@cipig
Copy link
Member

cipig commented Mar 7, 2021

Currently mm2 sets min_volume to 0.00777 as default if nothing else is passed. Can it be set to the setting of dust from coins file instead, in case the dust setting is higher than 0.00777 (or always use the dust setting as min_volume)?
DOGE has 100000000 sats (1 DOGE): https://github.com/Komodoplatform/coins/blob/master/coins#L546
This would prevent buys of < 1 DOGE by takers from starting and failing, like in https://discord.com/channels/412898016371015680/449950331577565194/818155230298112020
Thing is also that they don't even know why it fails, they only get the 180s timeout error. Maker has this: https://dexapi.cipig.net/public/error.php?uuid=1a85e6fa-c60f-455a-9b38-5cf97ae01e00

@artemii235 artemii235 self-assigned this Mar 8, 2021
@artemii235
Copy link
Member

Thanks for creating the issue! It's easy to add, doing now.

@cipig
Copy link
Member Author

cipig commented Mar 8, 2021

i fear min_volume needs to be set even higher, 2 * dust, because the swap 1ee3ee1b-e034-40c9-a877-b7aba4849694 with

"maker_coin" : "DOGE",
"maker_amount" : "1",

was successful on maker side (spent takerpayment), but failed on taker side: https://dexapi.cipig.net/public/error.php?uuid=1ee3ee1b-e034-40c9-a877-b7aba4849694

dogecoin-cli decoderawtransaction 010000000140f74756b67b88f2094848a96f5d77e687c543396a88647bc923f8537981656000000000d8483045022100dc0cfe763de91393610cf71c4aaba780a155d696b701751365cf9a3bebb3687a02207434c969e9a9aa026d776b66675360542494aca7747a94b1d2a60ae83ef4a756012006039a188bf40b3d6f9b2c1b5148e121fc09ad42512544e4dadc7f1c730b016c004c6b6304408d4660b17521028c525305d08a87a608aa257267bb5910aedbcb747e863a59da54d74815925083ac6782012088a914f737139c6e6d250dbb05a87d1bff1d6f096290c38821026879e3acedfa6a58f436c64d026e2f1f167e98898d11c6a31a8353354e7f59f1ac68ffffffff0100000000000000001976a91414a912746303176912b88849297888b062049d4088ac408d4660
{
  "txid": "89ffc81bc6369e99026453ca205f41fd6f46bee2168218ce575a18e4733dbc2c",
  "hash": "89ffc81bc6369e99026453ca205f41fd6f46bee2168218ce575a18e4733dbc2c",
  "size": 301,
  "vsize": 301,
  "version": 1,
  "locktime": 1615236416,
  "vin": [
    {
      "txid": "6065817953f823c97b64886a3943c587e6775d6fa9484809f2887bb65647f740",
      "vout": 0,
      "scriptSig": {
        "asm": "3045022100dc0cfe763de91393610cf71c4aaba780a155d696b701751365cf9a3bebb3687a02207434c969e9a9aa026d776b66675360542494aca7747a94b1d2a60ae83ef4a756[ALL] 06039a188bf40b3d6f9b2c1b5148e121fc09ad42512544e4dadc7f1c730b016c 0 6304408d4660b17521028c525305d08a87a608aa257267bb5910aedbcb747e863a59da54d74815925083ac6782012088a914f737139c6e6d250dbb05a87d1bff1d6f096290c38821026879e3acedfa6a58f436c64d026e2f1f167e98898d11c6a31a8353354e7f59f1ac68",
        "hex": "483045022100dc0cfe763de91393610cf71c4aaba780a155d696b701751365cf9a3bebb3687a02207434c969e9a9aa026d776b66675360542494aca7747a94b1d2a60ae83ef4a756012006039a188bf40b3d6f9b2c1b5148e121fc09ad42512544e4dadc7f1c730b016c004c6b6304408d4660b17521028c525305d08a87a608aa257267bb5910aedbcb747e863a59da54d74815925083ac6782012088a914f737139c6e6d250dbb05a87d1bff1d6f096290c38821026879e3acedfa6a58f436c64d026e2f1f167e98898d11c6a31a8353354e7f59f1ac68"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 0.00000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 14a912746303176912b88849297888b062049d40 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a91414a912746303176912b88849297888b062049d4088ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "D72LbRskVw2x8FNpdKvhX4UdroSkjMSHHp"
        ]
      }
    }
  ]
}

"value": 0.00000000 is not good, should be at least 1 :-)

@artemii235
Copy link
Member

Yeah, the miner fee is deducted from the payment output upon spending attempt. I guess the min_volume = 2 x dust is too low in this case - the user will receive just 1 DOGE instead of 2, which might be quite unexpected. Maybe we should set min_volume = 100 x dust so the dust/fee is not more than 1% of trading volume?

artemii235 added a commit that referenced this issue Mar 15, 2021
…838 #833 (#858)

* WIP.

* WIP. Refactor.

* WIP.

* WIP. Refactoring.

* WIP. Add maker_order_timeout to MM2 json conf.

* WIP. Add my_order_uuid to my_swap_status.

* Fix tests.

* WIP. Tests fail.

* Calculate min_volume using min_tx_amount on setprice.

* Replace match with unwrap_or_else.
@cipig
Copy link
Member Author

cipig commented Mar 21, 2021

Tested min_volume cases and it works as expected when i operate with base DOGE, both bid and asks (buy/sell DOGE) have base/rel min_volume to 10 DOGE (10x dust).
When i place same orders by operating with base KMD and rel DOGE, the min_volume is set in regards to KMD, because that is the base coin.
orderbook base DOGE, rel KMD:

      "base_max_volume": "74.1",
      "base_min_volume": "0.191919",
      "rel_max_volume": "3",
      "rel_min_volume": "0.00777"

base_min_volume = 0.191919 DOGE
as long as the taker operates with base DOGE when he tries to buy/sell DOGE it will work fine, which i guess is the common case

@cipig
Copy link
Member Author

cipig commented Apr 9, 2021

last case covered in above PR, all orders in DOGE/KMD have "base_min_volume": "10" DOGE, bids and asks, and "rel_min_volume": "0.14xxx KMD, which is the same as 10 DOGE

@cipig cipig closed this as completed Apr 9, 2021
artemii235 added a commit that referenced this issue Apr 12, 2021
#873 #849

* Reduce min trading vol in certain cases.
Add RPC call to display it.

* Fix compilation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants