Hey everyone,
I’m currently developing a DeFi app that requires executing a large number of automated swaps on ICP-based AMMs (such as ICPSwap, Sonic, KongSwap, ICDex, and ICPex). The goal is to ensure that swaps are fully executed or, if they fail, automatically retried after a short delay—without requiring any manual intervention.
One key concern I have is atomicity. Do atomic swaps exist on the IC, or is there a best practice for ensuring that a swap either fully completes or fails cleanly (with no stuck funds or manual recovery required)? If not, what strategies have you used to handle failures gracefully and automate retries?
The tokens we’re working with are:
- ICP
- ICRC-2 tokens
I’d love to hear from other developers who have tackled this problem. If anyone has insights, best practices, or know apps or GitHub repositories of projects that have perfected this process, I’d greatly appreciate it!
Since I’m still relatively new to Rust and development, any guidance, insight or example implementations would be super helpful. Looking forward to your thoughts!
Thanks!