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: Extend Evm Vault swaps functionality #5344

Merged
merged 43 commits into from
Oct 29, 2024

Conversation

albert-llimos
Copy link
Contributor

@albert-llimos albert-llimos commented Oct 22, 2024

Pull Request

Closes: PRO-1696, PRO-1737

Checklist

Please conduct a thorough self-review before opening the PR.

  • I am confident that the code works.
  • I have written sufficient tests.
  • I have written and tested required migrations.
  • I have updated documentation where appropriate.

Summary

  • Add Fok, DCA and Boost functionality to Vault swaps for EVM.
  • Rename cfParameters into ccmAdditionalData for clarity (breaking change).
  • Update bouncer to properly encode the new vault swap parameters.
  • Update bouncer tests (Fok & DCA) to also test contract swaps.

The SDK needs to be updated for this to work, as there is a breaking change. There's a few TODOs in the bouncer indicating that. However, the contract swaps can already be tested and are working correctly.

I'll work on the SDK to have the intended interface (encoding values in the SDK instead) so we have the end-to-end flow working for all swaps. I'll then update the logic around the TODOs.

@msgmaxim Nothing that affects Bitcoin Vault though but just fyi. Also, I'll merge the changes in #5343 when completed.

EDIT: Just put up a draft for the SDK to it's easy to follow the changes end-to-end: chainflip-io/chainflip-sdk-monorepo#1037

@albert-llimos albert-llimos changed the title Feat/evm extend contract swaps functionality Feat: Evm extend contract swaps functionality Oct 22, 2024
@albert-llimos albert-llimos marked this pull request as ready for review October 22, 2024 09:03
// TODO: This will need some refactoring either putting the cfParameters outside the
// ccmParams and the user should encode it as done here or, probably better, we just
// add the SwapParameters support (Fok/Dca/Boost) as separate parameters, rename
// cfParameters to ccmAdditionalData and do the encoding within the SDK.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll move the encodeCfParameters into the SDK and then pass the DCA/Boost/Fok parameters separately here, as for deposit channels, so we abstract that layer of complexity from the end user.

@albert-llimos albert-llimos added this pull request to the merge queue Oct 28, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 28, 2024
@kylezs
Copy link
Contributor

kylezs commented Oct 28, 2024

Another lp api flakiness issue... hopefully I can get the fix in soon.

@kylezs kylezs added this pull request to the merge queue Oct 28, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 28, 2024
@albert-llimos albert-llimos added this pull request to the merge queue Oct 28, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 28, 2024
@albert-llimos albert-llimos added this pull request to the merge queue Oct 28, 2024
github-merge-queue bot pushed a commit that referenced this pull request Oct 28, 2024
* feat: witnessing btc smart contract swaps

* chore: address minor review comments

* chore: start implementation

* test: fix deposit witnessing tests

* chore: add intial scale encoding for cfParameters

* chore: improve logic

* fix: address RuntimeCall size limit

* chore: address clippy

* chore: more cleanup and refactoring

* chore: add contract swaps to dca test

* chore: engine refactor

* chore: refactor createEvmWallet

* chore: cleanup

* chore: add MAX_VAULT_SWAP_ATTRIBUTES_LENGTH

* chore: refactor bouncer

* chore: refactor into common for reusal

* chore: rename attributes to parameters

* chore: pass extra parameters to sdk

* chore: fix issues

* chore: engine renaming

* chore: update SDK with new encoding logic

* chore: remove unnecessary bouncer ts-scale

* chore: lint

* chore: update to right name

* chore: fix missing rename

* chore: add beneficiares and make FoK mandatory

* chore: lint

* chore: update broker_fees and cli

* chore: update with hardcoded cfParameters

* chore: bump sdk

* fix: simplify cf params decoding

* chore: downgrade error -> warning

* chore: bump sdk with new broker_fees type

* chore: fix failing test

* chore: bump sdk

* chore: lint

---------

Co-authored-by: Maxim Shishmarev <maxim@chainflip.io>
Co-authored-by: Daniel <daniel@chainflip.io>
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 28, 2024
@albert-llimos albert-llimos added this pull request to the merge queue Oct 28, 2024
github-merge-queue bot pushed a commit that referenced this pull request Oct 28, 2024
* feat: witnessing btc smart contract swaps

* chore: address minor review comments

* chore: start implementation

* test: fix deposit witnessing tests

* chore: add intial scale encoding for cfParameters

* chore: improve logic

* fix: address RuntimeCall size limit

* chore: address clippy

* chore: more cleanup and refactoring

* chore: add contract swaps to dca test

* chore: engine refactor

* chore: refactor createEvmWallet

* chore: cleanup

* chore: add MAX_VAULT_SWAP_ATTRIBUTES_LENGTH

* chore: refactor bouncer

* chore: refactor into common for reusal

* chore: rename attributes to parameters

* chore: pass extra parameters to sdk

* chore: fix issues

* chore: engine renaming

* chore: update SDK with new encoding logic

* chore: remove unnecessary bouncer ts-scale

* chore: lint

* chore: update to right name

* chore: fix missing rename

* chore: add beneficiares and make FoK mandatory

* chore: lint

* chore: update broker_fees and cli

* chore: update with hardcoded cfParameters

* chore: bump sdk

* fix: simplify cf params decoding

* chore: downgrade error -> warning

* chore: bump sdk with new broker_fees type

* chore: fix failing test

* chore: bump sdk

* chore: lint

---------

Co-authored-by: Maxim Shishmarev <maxim@chainflip.io>
Co-authored-by: Daniel <daniel@chainflip.io>
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 28, 2024
@albert-llimos albert-llimos added this pull request to the merge queue Oct 29, 2024
github-merge-queue bot pushed a commit that referenced this pull request Oct 29, 2024
* feat: witnessing btc smart contract swaps

* chore: address minor review comments

* chore: start implementation

* test: fix deposit witnessing tests

* chore: add intial scale encoding for cfParameters

* chore: improve logic

* fix: address RuntimeCall size limit

* chore: address clippy

* chore: more cleanup and refactoring

* chore: add contract swaps to dca test

* chore: engine refactor

* chore: refactor createEvmWallet

* chore: cleanup

* chore: add MAX_VAULT_SWAP_ATTRIBUTES_LENGTH

* chore: refactor bouncer

* chore: refactor into common for reusal

* chore: rename attributes to parameters

* chore: pass extra parameters to sdk

* chore: fix issues

* chore: engine renaming

* chore: update SDK with new encoding logic

* chore: remove unnecessary bouncer ts-scale

* chore: lint

* chore: update to right name

* chore: fix missing rename

* chore: add beneficiares and make FoK mandatory

* chore: lint

* chore: update broker_fees and cli

* chore: update with hardcoded cfParameters

* chore: bump sdk

* fix: simplify cf params decoding

* chore: downgrade error -> warning

* chore: bump sdk with new broker_fees type

* chore: fix failing test

* chore: bump sdk

* chore: lint

---------

Co-authored-by: Maxim Shishmarev <maxim@chainflip.io>
Co-authored-by: Daniel <daniel@chainflip.io>
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 29, 2024
@albert-llimos albert-llimos added this pull request to the merge queue Oct 29, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 29, 2024
@albert-llimos albert-llimos added this pull request to the merge queue Oct 29, 2024
Merged via the queue into main with commit 92436ff Oct 29, 2024
48 of 49 checks passed
@albert-llimos albert-llimos deleted the feat/evm-extend-contract-swaps-functionality branch October 29, 2024 13:48
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.

4 participants