Skip to content

orchestration: example dapp contract that can swap on osmosis #8863

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

Open
5 of 6 tasks
0xpatrickdev opened this issue Feb 5, 2024 · 2 comments · May be fixed by #11304
Open
5 of 6 tasks

orchestration: example dapp contract that can swap on osmosis #8863

0xpatrickdev opened this issue Feb 5, 2024 · 2 comments · May be fixed by #11304
Assignees
Labels
enhancement New feature or request

Comments

@0xpatrickdev
Copy link
Member

0xpatrickdev commented Feb 5, 2024

What is the Problem Being Solved?

As a zoe smart contract, I'd like to be able to swap assets on an external chain. A user offers me ATOM* and wants an equivalent amount of BLD** in return. I will use the Osmosis DEX to complete the swap.

  • for simplicity, we may want to start with an Osmosis-native asset like OSMO so we do not need to unwrap ATOM (ibc transfer to gaia -> ibc transfer to osmosis with hook)
    ** tangential to the above, a non-Agoric asset will need to be unwrapped going back to Agoric so we may want to test with a different scenario here as we progress.

Description of the Design

Use vat-transfer (#8624) to make a Transfer Account and execute a Swap on Osmosis using cosmwasm IBC-Hooks.

To start, the goal is to create working zoe contract that using the listed APIs. The author may want to consider future reuse of the contract and how we can expose functionality for this to become a reusable component for other dapps, a la postSvc.

Security Considerations

Scaling Considerations

Test Plan

Possible test cases to cover

  • Swap BLD against OSMO, receiver on Agoric
  • Swap BLD against OSMO, receiver on CosmosHub
  • Swap OSMO against BLD, receiver on Agoric
  • Swap output sent to an unknown address, swap should fail
    • Not sure what's the default XCS behavior is here
    • In case assets are stuck at localchain account's bank, the user should be able to withdraw that
  • Verify osmosis xcs state

Upgrade Considerations

@otoole-brendan
Copy link
Contributor

otoole-brendan commented Apr 1, 2025

Open question: Should Agoric token for example code change from IST to BLD in light of imminent Inter Protocol plans?

Update: Yes. I've updated description to reflect IST to BLD change (for Agoric token)

@0xpatrickdev
Copy link
Member Author

0xpatrickdev commented Apr 1, 2025

Here are scenarios I would suggest covering in tests:

  • BLD on Agoric for OSMO (no PFM necessary)
  • BLD on Agoric for ATOM (PFM transfer after swap to unwrap)
  • ATOM on Agoric for BLD (PFM transfer before swap to unwrap)

anilhelvaci added a commit that referenced this issue Apr 9, 2025
anilhelvaci added a commit that referenced this issue Apr 10, 2025
anilhelvaci added a commit that referenced this issue Apr 10, 2025
anilhelvaci added a commit that referenced this issue Apr 10, 2025
anilhelvaci added a commit that referenced this issue Apr 15, 2025
anilhelvaci added a commit that referenced this issue Apr 15, 2025
anilhelvaci added a commit that referenced this issue Apr 23, 2025
anilhelvaci added a commit that referenced this issue Apr 25, 2025
anilhelvaci added a commit that referenced this issue Apr 28, 2025
anilhelvaci added a commit that referenced this issue Apr 28, 2025
anilhelvaci added a commit that referenced this issue Apr 28, 2025
anilhelvaci added a commit that referenced this issue Apr 28, 2025
anilhelvaci added a commit that referenced this issue Apr 28, 2025
anilhelvaci added a commit that referenced this issue Apr 29, 2025
Jorge-Lopes pushed a commit that referenced this issue May 6, 2025
Jorge-Lopes pushed a commit that referenced this issue May 6, 2025
Jorge-Lopes pushed a commit that referenced this issue May 6, 2025
Jorge-Lopes pushed a commit that referenced this issue May 6, 2025
Jorge-Lopes pushed a commit that referenced this issue May 6, 2025
Jorge-Lopes pushed a commit that referenced this issue May 6, 2025
anilhelvaci added a commit that referenced this issue May 7, 2025
anilhelvaci added a commit that referenced this issue May 7, 2025
anilhelvaci added a commit that referenced this issue May 7, 2025
anilhelvaci added a commit that referenced this issue May 8, 2025
anilhelvaci added a commit that referenced this issue May 9, 2025
Jorge-Lopes pushed a commit that referenced this issue May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants