-
Notifications
You must be signed in to change notification settings - Fork 94
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
Cosmos integration. #1432
Comments
* Got balance of arbitrary address. * Checked balance of address that has IBC asset in addition to ATOM. * Activated testnet ATOM and got correct balance. * Withdraw WIP. * Made a first testnet withdraw. * WIP. Preparing for tendermint rpc support under WASM. * WIP. Added WASM. Got rid of unwrap. Started using account sequence in withdraw. * Finalize PoC. * Add my_balance RPC test for ATOM. * Use constants for header names and values. start_history_background_fetching unimplemented for tendermint. * Review fixes + reorder lp_coins imports. * Add TIMEOUT_HEIGHT_DELTA. * Add multiple rpc_urls support TODO. * Fixes after merge. * Use opt-level = 2 for release profile. Co-authored-by: Artem Vitae <[email protected]>
I've made a brief research on atomic swaps support on Cosmos, discovered the following:
According to this, to swap the native ATOM, we will need to perform IBC transfer of it to one of these chains, lock there, and IBC back to Cosmos Hub when the swap is completed. It will require users to also have a native asset of the specific blockchain (e.g. IRIS) to pay IBC transfers fees, which might be inconvenient from an UX perspective. Though, I've not figured out a better solution for this yet. @ozkanonur I think the plan is as follows for you:
|
@ozkanonur As you finished HTLC PoC for IRIS and tokens, we can proceed with further steps. For now, we can implement IRIS swaps and consider creating our own HTLC-enabled chain later (approved by @tonymorony and @ca333). It would be perfect to also demo IBC Atom swap in the coming two weeks, though I'm unsure if it's really feasible. As per implementation, you can create a test similar to https://github.com/KomodoPlatform/atomicDEX-API/blob/c7dde3a0aeff113db4ba58cbfaa4da6926cd9612/mm2src/mm2_main/src/mm2_tests.rs#L963 to start the swap. You will get Please let me know if you need any assistance with it 🙂 |
* create iris coin instance and execute `my_balance` Signed-off-by: Onur Özkan <[email protected]> * save development state Signed-off-by: Onur Özkan <[email protected]> * implement htlc for iris network Signed-off-by: Onur Özkan <[email protected]> * implement `hash_lock` generation in p.o.c test Signed-off-by: Onur Özkan <[email protected]> * save htlc claiming P.O.C state Signed-off-by: Onur Özkan <[email protected]> * update target address for htlc transactions Signed-off-by: Onur Özkan <[email protected]> * save htlc p.o.c(on IBC asset) work state Signed-off-by: Onur Özkan <[email protected]> * add doc-comments to iris/htlc.rs Signed-off-by: Onur Özkan <[email protected]> * save development state Signed-off-by: Onur Özkan <[email protected]> * save development state Signed-off-by: Onur Özkan <[email protected]> * save development state Signed-off-by: Onur Özkan <[email protected]> * update structs privacy of iris/htlc module Signed-off-by: Onur Özkan <[email protected]> * apply some beauty Signed-off-by: ozkanonur <[email protected]> * Exclude p.o.c derive attributes that are no longer required Signed-off-by: ozkanonur <[email protected]> * update annotation style Signed-off-by: ozkanonur <[email protected]> * fix code formatting Signed-off-by: ozkanonur <[email protected]> * fix review notes Signed-off-by: ozkanonur <[email protected]> * make `any_to_signed_raw_tx` sync Signed-off-by: ozkanonur <[email protected]> * drop mutability of `hash_lock_hash` Signed-off-by: Onur Özkan <[email protected]> * fix review note Signed-off-by: Onur Özkan <[email protected]> Signed-off-by: Onur Özkan <[email protected]> Signed-off-by: ozkanonur <[email protected]>
* create iris coin instance and execute `my_balance` Signed-off-by: Onur Özkan <[email protected]> * save development state Signed-off-by: Onur Özkan <[email protected]> * implement htlc for iris network Signed-off-by: Onur Özkan <[email protected]> * implement `hash_lock` generation in p.o.c test Signed-off-by: Onur Özkan <[email protected]> * save htlc claiming P.O.C state Signed-off-by: Onur Özkan <[email protected]> * update target address for htlc transactions Signed-off-by: Onur Özkan <[email protected]> * save htlc p.o.c(on IBC asset) work state Signed-off-by: Onur Özkan <[email protected]> * add doc-comments to iris/htlc.rs Signed-off-by: Onur Özkan <[email protected]> * save development state Signed-off-by: Onur Özkan <[email protected]> * save development state Signed-off-by: Onur Özkan <[email protected]> * save development state Signed-off-by: Onur Özkan <[email protected]> * update structs privacy of iris/htlc module Signed-off-by: Onur Özkan <[email protected]> * apply some beauty Signed-off-by: ozkanonur <[email protected]> * Exclude p.o.c derive attributes that are no longer required Signed-off-by: ozkanonur <[email protected]> * update annotation style Signed-off-by: ozkanonur <[email protected]> * fix code formatting Signed-off-by: ozkanonur <[email protected]> * fix review notes Signed-off-by: ozkanonur <[email protected]> * make `any_to_signed_raw_tx` sync Signed-off-by: ozkanonur <[email protected]> * drop mutability of `hash_lock_hash` Signed-off-by: Onur Özkan <[email protected]> * fix review note Signed-off-by: Onur Özkan <[email protected]> Signed-off-by: Onur Özkan <[email protected]> Signed-off-by: ozkanonur <[email protected]>
Checklist for the future:
|
* save development state Signed-off-by: ozkanonur <[email protected]> * save dev state Signed-off-by: ozkanonur <[email protected]> * save dev state Signed-off-by: Onur Özkan <[email protected]> * save dev state Signed-off-by: Onur Özkan <[email protected]> * IBC asset boilerplate. IRIS + USDC single RPC activation test WIP. * save dev state Signed-off-by: ozkanonur <[email protected]> * save dev state Signed-off-by: Onur Özkan <[email protected]> * save dev state Signed-off-by: ozkanonur <[email protected]> * save dev state Signed-off-by: ozkanonur <[email protected]> * WIP. Activation in progress. * save dev state Signed-off-by: ozkanonur <[email protected]> * save dev state Signed-off-by: Onur Özkan <[email protected]> * save todo notes Signed-off-by: ozkanonur <[email protected]> * IRIS + USDC activation done. Always set MsgCreateHtlc::timestamp to 0. Pass secret hash directly. * save dev state Signed-off-by: ozkanonur <[email protected]> * Add sleep to wait_for_taker_payment_spend to test. * save dev state Signed-off-by: ozkanonur <[email protected]> * Display correct address for Tendermint related orders. * save dev state Signed-off-by: Onur Özkan <[email protected]> * save dev state (integration test now passes) Signed-off-by: ozkanonur <[email protected]> * Add test that finds HTLC claim tx by HLTC id and extracts secret successfully. * calculate amount Signed-off-by: ozkanonur <[email protected]> * save dev state Signed-off-by: ozkanonur <[email protected]> * Implement wait_for_tx_spend with test. * implement `fn extract_secret` Signed-off-by: ozkanonur <[email protected]> * fix clippy errors Signed-off-by: ozkanonur <[email protected]> * Fixed WASM compilation. * Enable WASM tests on iris-swap-poc temporarily. * handle errors/panics Signed-off-by: ozkanonur <[email protected]> * Added SecretHashAlgo and made SHA256 default temporarily. * Lock sequence_lock in swap payments methods. NIMDA/RICK swap fails. Temporarily remove is_tx_not_found_error check. * Swap with UTXO works, but having issues with sequence on concurrent txs sending. * WIP. Swaps fail. * Refactor IBC -> TENDERMINTTOKEN. Make USDC and NIMDA TENDERMINTTOKEN in tests. * Fix tests compilation. * Pass secret hash as argument to HTLC spending methods. * Temporarily return error from TendermintToken::withdraw (not implemented). * Fix compilation. * Additional logs in tests. * implement `enable_tendermint_token` endpoint Signed-off-by: ozkanonur <[email protected]> * WIP. Adding ETH swaps support with sha256 secret hash. * implement `tendermint_token::withdraw` and write unit test for withdraw&token activation Signed-off-by: ozkanonur <[email protected]> * Add USDC-IBC-IRIS/tBNB to swaps test. Successful. * support multiple rpc_urls Signed-off-by: ozkanonur <[email protected]> * fix wasm test Signed-off-by: ozkanonur <[email protected]> * fix `fmt` error Signed-off-by: ozkanonur <[email protected]> * save dev state Signed-off-by: ozkanonur <[email protected]> * provide wasm compatibility Signed-off-by: ozkanonur <[email protected]> * Hotfix for orderbook and best orders v2 RPCs. * [cosmos] increase tendermint fee * increase fees Signed-off-by: Onur Özkan <[email protected]> * save dev state Signed-off-by: ozkanonur <[email protected]> * save dev state Signed-off-by: ozkanonur <[email protected]> * reduce time blocking Signed-off-by: ozkanonur <[email protected]> * Fixes after merge. * Fix some tests. * WIP. Iris dex fee validation. Swaps can fail! * Fix clippy. * WIP. Dex fee validation. Swaps work. * save fee calculation dev state Signed-off-by: ozkanonur <[email protected]> * update `fn calculate_fee` Signed-off-by: ozkanonur <[email protected]> * implement dynamic fee calculation via tx simulation Signed-off-by: ozkanonur <[email protected]> * implement dynamic fee calculation on tendermint token and move `uuid` to shared dependency section Signed-off-by: ozkanonur <[email protected]> * implement missing parts of fee calculation Signed-off-by: ozkanonur <[email protected]> * WIP. HTLC validation. * WIP. Queried HTLC successfully. * WIP. Payment validation done for now. Swaps work. * Remove some #[allow(unused_variables)]. Impl get_public_key. * Impl get_raw_transaction. * make gas price as configurable Signed-off-by: ozkanonur <[email protected]> * save TODO notes for avg block time that will be used for time_lock calc Signed-off-by: ozkanonur <[email protected]> * save dev state of time_lock calculation Signed-off-by: Onur Özkan <[email protected]> * refactor time_lock calculation Signed-off-by: ozkanonur <[email protected]> * fix wasm compilation Signed-off-by: ozkanonur <[email protected]> * Add TODO title on p.o.c implementations Signed-off-by: ozkanonur <[email protected]> * implement `fn check_if_my_payment_sent` Signed-off-by: ozkanonur <[email protected]> * provide wasm compatibility for `fn check_if_my_payment_sent` Signed-off-by: ozkanonur <[email protected]> * provide Abci paths as constants Signed-off-by: Onur Özkan <[email protected]> * rollback wasm pipeline diff Signed-off-by: ozkanonur <[email protected]> * support `memo` field for withdraws Signed-off-by: ozkanonur <[email protected]> * downgrade visibility of `TX_DEFAULT_MEMO` Signed-off-by: ozkanonur <[email protected]> * use `TX_DEFAULT_MEMO` if memo is None for withdraws Signed-off-by: ozkanonur <[email protected]> * Fix few minor notes. * use constants for ABCI request defaults Signed-off-by: Onur Özkan <[email protected]> * fix some review notes Signed-off-by: Onur Özkan <[email protected]> * fix some reivew notes Signed-off-by: Onur Özkan <[email protected]> * update `tendermint_token::check_if_my_payment_sent` Signed-off-by: Onur Özkan <[email protected]> * fix some PR notes Signed-off-by: Onur Özkan <[email protected]> * Stop ignoring some tests. * create `MIN_TX_SATOSHIS` for tendermint Signed-off-by: Onur Özkan <[email protected]> * Fix some error mappings to avoid using empty ticker. * Implement new trait methods after other PRs merge. * refactor `fn check_if_my_payment_sent` Signed-off-by: Onur Özkan <[email protected]> * fix lint error Signed-off-by: Onur Özkan <[email protected]> * return `None` if can't find htlc in `fn check_if_my_payment_sent` Signed-off-by: Onur Özkan <[email protected]> * add fixes and optimizations Signed-off-by: ozkanonur <[email protected]> * fix some notes Signed-off-by: Onur Özkan <[email protected]> * return error instead of `None` on error code Signed-off-by: ozkanonur <[email protected]> * fix fmt Signed-off-by: Onur Özkan <[email protected]> * Fixes after merge. * fix compilation error for tests Signed-off-by: ozkanonur <[email protected]> * update condition comment Signed-off-by: ozkanonur <[email protected]> * Fix extremely long-running eth_tests. * Fix tendermint_coin_tests::validate_payment_test. * Fix more tests. Signed-off-by: ozkanonur <[email protected]> Signed-off-by: Onur Özkan <[email protected]> Co-authored-by: Artem Vitae <[email protected]> Co-authored-by: Artem Vitae <[email protected]> Co-authored-by: Anton TonyL Lysakov <[email protected]> Co-authored-by: Artem Vitae <[email protected]>
…1527) * Implement methods used in recover_funds_of_swap for Tendermint. Also implemented validate_address. Add dummy error return for others to avoid occasional panics. * Review fix. * Ignore test_spl_transactions. Co-authored-by: Artem Vitae <[email protected]>
* increase simulated gas to predict better values for real tx operations Signed-off-by: Onur Özkan <[email protected]> * remove couple TODO notes and impelement `lp_coins::wait_for_confirmations` for tendermint Signed-off-by: Onur Özkan <[email protected]> * create new fn `tendermint_coin::get_tx_status_code_or_none` Signed-off-by: Onur Özkan <[email protected]> * if no `gui_auth` was given, consider it as `false` Signed-off-by: ozkanonur <[email protected]> * implement `get_sender_trade_fee` Signed-off-by: ozkanonur <[email protected]> * implement `trade_fee` functionalities for cosmos Signed-off-by: ozkanonur <[email protected]> * group wasm and native rpcs under the rpc mod Signed-off-by: ozkanonur <[email protected]> * Create TendermintResultOrder and impl it's required traits Signed-off-by: ozkanonur <[email protected]> * fix wasm compilation Signed-off-by: ozkanonur <[email protected]> * fix avg_blocktime confusion Signed-off-by: ozkanonur <[email protected]> * save dev state Signed-off-by: ozkanonur <[email protected]> * save dev state Signed-off-by: ozkanonur <[email protected]> * save dev state Signed-off-by: ozkanonur <[email protected]> * add iris mod Signed-off-by: ozkanonur <[email protected]> * fix wasm compilation Signed-off-by: ozkanonur <[email protected]> * save dev state Signed-off-by: ozkanonur <[email protected]> * save dev state Signed-off-by: ozkanonur <[email protected]> * add TODO notes Signed-off-by: ozkanonur <[email protected]> * add TODO note Signed-off-by: ozkanonur <[email protected]> * avoid memory pressure, skip existed txs in tx_history, add fee_details Signed-off-by: ozkanonur <[email protected]> * remove no-longer required notes Signed-off-by: ozkanonur <[email protected]> * save dev state Signed-off-by: ozkanonur <[email protected]> * implement `WaitForHistoryUpdateTrigger` for tendermint tx_history v2 Signed-off-by: ozkanonur <[email protected]> * remove not required todo notes Signed-off-by: ozkanonur <[email protected]> * update `fn process_history_loop` Signed-off-by: ozkanonur <[email protected]> * update TODO notes of tendermint_token Signed-off-by: ozkanonur <[email protected]> * save dev state Signed-off-by: ozkanonur <[email protected]> * complete tx_history_v2 functionality for tendermint Signed-off-by: ozkanonur <[email protected]> * move token insert to right before of result returning Signed-off-by: ozkanonur <[email protected]> * implement better error handling for tx_history v2 on tendermint Signed-off-by: ozkanonur <[email protected]> * shorten `fn is_tx_exists` Signed-off-by: ozkanonur <[email protected]> * rename `iris_swap_poc` into `iris_swap` remove ingored flag from the test Signed-off-by: ozkanonur <[email protected]> * update name of the iris swap test function Signed-off-by: ozkanonur <[email protected]> * re-ignore iris swap integration tests because of iris bug Signed-off-by: ozkanonur <[email protected]> * fix review notes Signed-off-by: ozkanonur <[email protected]> * show extra tx for platform fees on token txs Signed-off-by: ozkanonur <[email protected]> * partial fixes for review notes Signed-off-by: ozkanonur <[email protected]> * update expected log for tendermint tx history test Signed-off-by: ozkanonur <[email protected]> * read highest height for tendermint history Signed-off-by: ozkanonur <[email protected]> * remap tx amounts and insert all possible assets for tendermint Signed-off-by: ozkanonur <[email protected]> * fix balance problem Signed-off-by: ozkanonur <[email protected]> * skip `uamount` field for `TendermintFeeDetails` Signed-off-by: ozkanonur <[email protected]> * parse multiple tx events Signed-off-by: ozkanonur <[email protected]> * save dev state Signed-off-by: ozkanonur <[email protected]> * remove debug lines Signed-off-by: ozkanonur <[email protected]> * refactor tendermit tx history test Signed-off-by: ozkanonur <[email protected]> * fix review notes Signed-off-by: ozkanonur <[email protected]> Signed-off-by: Onur Özkan <[email protected]> Signed-off-by: ozkanonur <[email protected]>
Is this part of the cosmos integration? It seemed like nucleus project is out of scope for this task. |
@onur-ozkan I think we can close this issue as completed. Only item left in the checklist is |
Full Cosmos/Tendermint support in AtomicDEX.
Useful resources:
The text was updated successfully, but these errors were encountered: