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

feat(slp): add slp tokens & arrr support #1176

Closed
wants to merge 56 commits into from
Closed

Conversation

Milerius
Copy link

@Milerius Milerius commented Aug 9, 2021

  • add testnet bch + update translation
  • add usdf
  • add slp token integration backend
  • add slp token integration frontend

to test:

  • enable usdf also enable tbch
  • withdraw
  • addressbook
  • swaps
  • explorer
  • tag coin type
  • try to receive coins by sending through another account

(please reset your cfg before)

to test ARRR:

  • reset asset configuration
  • launch komodod ./komodod -addnode=88.99.212.81 -ac_private=1 -ac_supply=0 -ac_name=PIRATE -ac_reward=25600000000 -ac_halving=77777 -addnode=158.69.255.49 -daemon
  • be fully synced
  • enable ARRR
  • enjoy

@Milerius
Copy link
Author

@Milerius Milerius requested a review from cipig August 10, 2021 00:53
@Milerius Milerius changed the title feat(slp): first part of the integration feat(slp): add slp tokens Aug 10, 2021
@Milerius Milerius requested a review from smk762 August 10, 2021 17:42
@Milerius Milerius marked this pull request as ready for review August 10, 2021 17:42
@Milerius Milerius linked an issue Aug 10, 2021 that may be closed by this pull request
@Milerius Milerius self-assigned this Aug 10, 2021
@smk762
Copy link
Collaborator

smk762 commented Aug 11, 2021

explorer link from tBCH not working (redirects)
https://explorer.bitcoin.com/tbch/tx/be84d5229b5b3dbdea07930eab9928d0bd6df1b5f6c17f9ac5fd0b612b6edf1c

usdf explorer link ok ✔️

addressbook validation fails without slptest: prefix

withdraw ok ✔️
swaps completed ok ✔️
coins activated ok ✔️

On one of my accounts, it wont let me disable USDF or tBCH (another account is ok). no logs to indicate reason, but I did catch this on an assets config reset [13:36:37] [warning] [main.prerequisites.hpp:92] [1286997]: qrc:/atomic_defi_design/qml/Settings/SettingModal.qml:215: Error: Invalid write to global property "dialog"
and this on reload [13:39:33] [warning] [main.prerequisites.hpp:92] [1287786]: qrc:/atomic_defi_design/qml/Dashboard/NotificationsModal.qml:357: TypeError: Value is undefined and could not be converted to an object

@Milerius
Copy link
Author

Milerius commented Aug 11, 2021

The slptest prefix is expected for slp tokens

For the qml warning i believe they are present on dev

For the explorer the usdf explorer should work the tbch doesn't need to be tested

smk762
smk762 previously approved these changes Aug 11, 2021
Copy link
Collaborator

@smk762 smk762 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Milerius
Copy link
Author

I will merge it once tx history and main net will be added and tested, i let it in standby meanwhile this time

@tonymorony
Copy link

I will merge it once tx history and main net will be added and tested, i let it in standby meanwhile this time

it can be merged to dev only after slp related changes will be propagated to mm2.1 branch

@Milerius Milerius marked this pull request as ready for review January 12, 2022 15:04
@Milerius Milerius requested a review from smk762 January 12, 2022 15:04
@smk762
Copy link
Collaborator

smk762 commented Jan 13, 2022

not sure if related to this PR, but I get error for smart bch
image

No tx history for tBCH
image

[14:41:46] [debug] [qt.wallet.transactions.model.cpp:200] [1722872]: first time initialization, inserting 0 transactions
[14:41:46] [debug] [qt.wallet.transactions.model.cpp:227] [1722872]: transactions model size: 0

@Milerius
Copy link
Author

not sure if related to this PR, but I get error for smart bch image

No tx history for tBCH image

[14:41:46] [debug] [qt.wallet.transactions.model.cpp:200] [1722872]: first time initialization, inserting 0 transactions
[14:41:46] [debug] [qt.wallet.transactions.model.cpp:227] [1722872]: transactions model size: 0

SBCH is not present in this pr, as mentioned by @artemii235 it uses a specific version of coins file, all the last protocols are not present here.

@smk762
Copy link
Collaborator

smk762 commented Jan 16, 2022

tBCH still shows no history, though USDF does.
Swap between the two was successful.


16 10:41:03, utxo:1849] Use protocol version 1.4 for Electrum "electrs.electroncash.de:60002"
16 10:41:03, utxo:1849] Use protocol version 1.4 for Electrum "tbch.loping.net:60002"
16 10:41:05, coins:bch_and_slp_tx_history:326] INFO Tx history fetching finished for tBCH
16 10:41:07, coins:rpc_clients:2041] ERROR "electroncash.de:50004" error Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }
16 10:41:09, atomicdex_gossipsub:behaviour:188] INFO Subscribed to topic: orbk/USDF:tBCH
16 10:41:18, coins:rpc_clients:2041] ERROR "electroncash.de:50004" error Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }
...
16 10:42:49, coins:rpc_clients:2041] ERROR "electroncash.de:50004" error Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }
etc.

@smk762
Copy link
Collaborator

smk762 commented Jan 18, 2022

Still don't see tBCH history via GUI here.
When sending funds from tBCH, "view on explorer" link button ends up at https://blockchair.com/explorers?from=bitcoin.com (initial url failing, redirects)

While testing in CLI with 2.1.5254_dev_dc9e4c32f_Linux_Release and coins file from https://github.com/KomodoPlatform/coins/blob/bch-slp-mainnet-TEST-ONLY/coins I can see history:

curl --url "http://127.0.0.1:7783" --data '{
  "userpass":"'$userpass'",
  "method":"my_tx_history",
  "mmrpc":"2.0",
  "params": {
    "coin": "tBCH",
    "limit": 2,
    "paging_options": {
      "PageNumber": 1
    }
  }
}'

Response:

{
	"mmrpc": "2.0",
	"result": {
		"coin": "tBCH",
		"current_block": 1483378,
		"transactions": [{
			"tx_hex": "010000000185946ef0e7a20ffeb20df49b7a3af479b3e342a53c9ec4c277b9aaef4d68482a020000006b483045022100dfd11726ee33c1a0b722ed684b3017809857ea630d37ea2e964701d8b36b8272022027143ad239b20bedd596794765ffefa3325d0451f3b3e2143307ab2c26b1803b41210337088855be311c7d961649b0b24e5498858da3dc3c6bcebc8039ff32555cdb87ffffffff0240420f00000000001976a914d346067e3c3c3964c395fee208594790e29ede5d88ac573e3700000000001976a91454aa8893ec5d8ee65cc332089c919416cca2604988ac2d7ce661",
			"tx_hash": "e42f3aad25443160b7aa22c61644419aef7993ef644c6c4133174970b3db9268",
			"from": ["bchtest:qp224zyna3wcaejucveq38y3jstvegnqfyc0gttwtp"],
			"to": ["bchtest:qp224zyna3wcaejucveq38y3jstvegnqfyc0gttwtp", "bchtest:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5y57jt4vw"],
			"total_amount": "0.04620665",
			"spent_by_me": "0",
			"received_by_me": "0.01",
			"my_balance_change": "0.01",
			"block_height": 0,
			"timestamp": 0,
			"fee_details": {
				"type": "Utxo",
				"coin": "tBCH",
				"amount": "0.00000226"
			},
			"coin": "tBCH",
			"internal_id": "e42f3aad25443160b7aa22c61644419aef7993ef644c6c4133174970b3db9268",
			"transaction_type": "StandardTransfer",
			"confirmations": 0
		}],
		"sync_status": {
			"state": "Finished"
		},
		"limit": 2,
		"skipped": 0,
		"total": 1,
		"total_pages": 1,
		"paging_options": {
			"PageNumber": 1
		}
	},
	"id": null
}

CLI testing enabled tBCH with enable_bch_with_tokens.

I manually replaced same mm2 and coins files as used in CLI tests into portable atomicdex assets/tools/mm2 folder and relaunched GUI. Still dont see history for tBCH after assets reset.

@Milerius issue is not my connection, and not related to mm2 or coins file - seems to be within the GUI.

Testing in CLI using userpass from active GUI session also returned expected history response.

@smk762
Copy link
Collaborator

smk762 commented Jan 18, 2022

Right click > "disable tBCH"
Right click > "disable all UTXO assets"
Right click > "disable all assets"

All of the above fail to disable tBCH in the GUI.

Also unable to disable USDF in GUI

@Milerius
Copy link
Author

Issue might be due to

https://github.com/KomodoPlatform/atomicDEX-Desktop/blob/113388b41b46d260a9fe77b6d3f3c0affd1470f0/src/app/app.cpp#L95

(sets tBCH as SLP type)
https://github.com/KomodoPlatform/atomicDEX-Desktop/blob/113388b41b46d260a9fe77b6d3f3c0affd1470f0/src/core/atomicdex/api/mm2/rpc.electrum.cpp#L37-L41

(sets SLP type coins to history: false)

Electrum legacy method is not used for tBCH and BCH anymore, I've removed the dead code, and I confirm that I can disable all those coins as expected.

@tonymorony
Copy link

tonymorony commented Jan 21, 2022

I don't see txhistory for tBCH as well on my side:

paste (44)

@Milerius could you please re-check?

@Milerius
Copy link
Author

Milerius commented Jan 21, 2022

I don't see txhistory for tBCH as well on my side:

paste (44)

@Milerius could you please re-check?

I was able to see the tx history probably due to the local database of previous history - note that I had to hardcode the check for tBCH or BCH in the backend code to my_history v2 for the 2 following UTXO coins: tBCH BCH

Capture d’écran 2022-01-21 à 14 04 03

We should probably support multi-tags in the future in order to avoid such a hardcoded check, 2 ways to implement it:

  • turn coin_type from string into a vec<string> and consider that vec[0] is always the main coin type.
  • or introduce a child_coin_type fields which could have the value SLP in this case. Not sure if a parent chain would have more than 2 coin_types too.

For example such a configuration with this approach:

"tBCH": {
    "coin": "tBCH",
    "active": false,
    "is_testnet": true,
    "coingecko_id": "test-coin",
    "coinpaprika_id": "test-coin",
    "currently_enabled": false,
    "electrum": [
      {
        "url": "tbch.loping.net:60002",
        "protocol": "SSL"
      },
      {
        "url": "electroncash.de:50004",
        "protocol": "SSL"
      },
      {
        "url": "testnet.bitcoincash.network:60002",
        "protocol": "SSL"
      }
    ],
    "explorer_url": [
      "https://explorer.bitcoin.com/tbch/"
    ],
    "bchd_urls": [
      "https://bchd-testnet.greyh.at:18335"
    ],
    "allow_slp_unsafe_conf": false,
    "type": "UTXO",
    "child_type": "SLP",
    "name": "Bitcoin Cash (Testnet)"
  }

Copy link
Collaborator

@smk762 smk762 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tBCH now returning history and disabling as expected. tBCH/USDF swaps completed without issue. If ARRR stuff will be in a different PR, I'm ready to approve this once KomodoPlatform/komodo-defi-framework#1184 is merged and app mm2 updated.

@Milerius
Copy link
Author

artifacts will pass again once we update urls after mm2.1 pr merge.

@ghost ghost closed this Mar 28, 2022
@smk762 smk762 deleted the slp_integration branch August 7, 2023 07:41
This pull request was closed.
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

Successfully merging this pull request may close these issues.

SLP tokens integration.
3 participants