Skip to content

Implement swap intent for pumpx #3354

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

Merged
merged 37 commits into from
Apr 10, 2025

Conversation

silva-fj
Copy link
Contributor

@silva-fj silva-fj commented Apr 9, 2025

This PR introduces a draft implementation of the swap intent processing for pumpx so we can start testing.

Important notes:

  • Cross chain swaps are not implemented yet. (It will be implemented in a separate PR)
  • The integration has not been tested yet, there may be some things that need to be adjusted (we need to test them).
  • The assets locking mechanism in the intent-executor (sanity check) is commented out as it needs adjustments. (We will need to do asset conversion as we receive float numbers from pumpx but we need amounts in the asset smallest unit.

Copy link

linear bot commented Apr 9, 2025

@silva-fj silva-fj changed the title P 1427 implement cross chain swap intent for pumpx Implement cross chain swap intent for pumpx Apr 9, 2025
@silva-fj silva-fj changed the title Implement cross chain swap intent for pumpx Implement swap intent for pumpx (single chain swap) Apr 10, 2025
@silva-fj silva-fj changed the title Implement swap intent for pumpx (single chain swap) Implement swap intent for pumpx Apr 10, 2025
@silva-fj silva-fj requested review from Kailai-Wang, kziemianek and a team April 10, 2025 14:45
@silva-fj silva-fj marked this pull request as ready for review April 10, 2025 14:45
Copy link
Collaborator

@Kailai-Wang Kailai-Wang left a comment

Choose a reason for hiding this comment

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

The logic looks good - I have a few comments.

The address is the main missing part

execution_result,
);
ctx.transaction_signer.sign(intent_executed_call).await
let tx = ctx.transaction_signer.sign(intent_executed_call).await;
if rpc_client.submit_tx(&tx).await.is_err() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It doesn't wait for any finalisation, does it? (We don't want to wait for it)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No it does not wait, when we want to wait we use submit_and_watch_tx_until

@@ -60,16 +77,19 @@ pub type ParentchainTxSigner = TxSigner<
SubxtMetadataProvider<CustomConfig>,
>;

// TODO: should we rename this to something like MultiChainIntentExecutor?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good idea - but probably in separate PR

@silva-fj silva-fj requested a review from Kailai-Wang April 10, 2025 21:34
@@ -29,7 +29,7 @@ pub trait IntentExecutor: Send {
account_id: &AccountId,
intent_id: IntentId,
intent: Intent,
) -> Result<(), ()>;
) -> Result<Option<Vec<u8>>, ()>;
Copy link
Member

Choose a reason for hiding this comment

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

Can this be generic ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean like a trait object?

@silva-fj silva-fj enabled auto-merge (squash) April 10, 2025 21:51
@silva-fj silva-fj merged commit 2f6164c into dev Apr 10, 2025
21 checks passed
@silva-fj silva-fj deleted the p-1427-implement-cross-chain-swap-intent-for-pumpx branch April 10, 2025 22:42
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.

3 participants