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
Contributor

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
Contributor 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 May 27, 2025
anilhelvaci added a commit that referenced this issue May 27, 2025
anilhelvaci added a commit that referenced this issue May 27, 2025
anilhelvaci added a commit that referenced this issue May 27, 2025
anilhelvaci pushed a commit that referenced this issue May 27, 2025
test: Automate XCS setup via ava test

chore: improve error handling

fix: style fixes from prettier

Refs: #8863

chore: WIP ci setup

Refs: #8863
anilhelvaci added a commit that referenced this issue May 27, 2025
anilhelvaci added a commit that referenced this issue May 27, 2025
anilhelvaci added a commit that referenced this issue May 27, 2025
anilhelvaci added a commit that referenced this issue May 27, 2025
chore: address account sequence mismatch

chore: refactor osmosis swap test and script to remove hardcoded variables

Additional optimizations were included to handle json objects
A new shell script replaced the use of a makefile to set the osmosis XCS state
Rebase conflicts handled

test: verify osmosis xcs state
Conflicts handled

test: swap BLD for OSMO with receiver on CosmosHub

ref: #8863
anilhelvaci added a commit that referenced this issue May 27, 2025
anilhelvaci added a commit that referenced this issue May 27, 2025
anilhelvaci pushed a commit that referenced this issue May 27, 2025
chore: implement failing IBC msg test case

Refs: #8863
anilhelvaci added a commit that referenced this issue May 27, 2025
anilhelvaci added a commit that referenced this issue May 27, 2025
fix: format fixes

chore: invitation name and tests updated, tests use dynamic xcs address

Refs: #8863
anilhelvaci added a commit that referenced this issue May 27, 2025
anilhelvaci pushed a commit that referenced this issue May 27, 2025
chore: refactor xcs swap helper functions

chore: refactor xcs swap tests with new helpers

chore: remove unused xcs swap scripts

chore: update gitignore

chore: remove need for waitForBlock mehtod

chore: lint fix

chore: import missing packages

fix: address conflicts on @cosmjs/proto-signing

chore: improve xcs swap logging

chore: add waitForBlock between setPoolRoute txs

chore(multichain): create pool by default and update names for clarity

chore(multichain): do not create osmosis pool by default

chore: refactor test tooling for osmosis xcs

ref: #8863
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