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

Astrovault swap adapter #141

Merged

Conversation

FSoaresDev
Copy link
Contributor

This PR adds Astrovault swap venue (DEX) adapter to work with Skip.

let mut msgs = vec![transfer_funds_back_msg];

// ADDED: Also create the return of cashback funds msg if available
if let Some(cashback_addr) = ASTROVAULT_CASHBACK_ADDRESS.may_load(deps.storage)? {
Copy link
Member

Choose a reason for hiding this comment

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

Question to learn: could we give this back to the user in some way? What is the purpose of sending it back to the cashback_addr here?

Copy link
Contributor Author

@FSoaresDev FSoaresDev Oct 1, 2024

Choose a reason for hiding this comment

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

We are sending it back to the router address so it does not get lost on the adapter contract.

If the user wallet address is available on the adapter we can send it to them, but I'm not seeing this info being sent by the entrypoint contract. Is there a way to get this info on the adapter during the execution of the swap?

We can also send it to the entrypoint contract but then we would need to add some code to the entrypoint contract also to handle the send of cashback to the user during the post-swap-validation.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah the entrypoint has access to such a user address, but heard that this would all require adding more logic and likely not worth it for now, thanks for the clarification!

) -> ContractResult<SimulateSmartSwapExactAssetInResponse> {
let asset_out = simulate_smart_swap_exact_asset_in(deps, ask_denom, routes.clone())?;

// TODO: Implement spot price calculation for smart swaps
Copy link
Member

Choose a reason for hiding this comment

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

This still seems like an open TODO, should be able to do a weighted calculation of the spot prices to get the total route spot price output, lmk if need any support here

Copy link
Member

@NotJeremyLiu NotJeremyLiu left a comment

Choose a reason for hiding this comment

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

left a comment on the outstanding todo

@FSoaresDev
Copy link
Contributor Author

Added a commit to enable that left TODO. commit: 84b789c
Can you check if its correct?

both of these checks are already validated in the entrypoint contract, removing to reduce gas
@NotJeremyLiu NotJeremyLiu self-requested a review October 29, 2024 22:14
Copy link
Member

@NotJeremyLiu NotJeremyLiu left a comment

Choose a reason for hiding this comment

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

fantastic, approving

@NotJeremyLiu NotJeremyLiu merged commit 36d39e1 into skip-mev:main Oct 29, 2024
5 checks passed
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.

2 participants