Skip to content

Feature/escrow swap mode#425

Merged
fejilaup-cloud merged 3 commits intoAtomicIP:mainfrom
james2177:feature/escrow-swap-mode
Apr 29, 2026
Merged

Feature/escrow swap mode#425
fejilaup-cloud merged 3 commits intoAtomicIP:mainfrom
james2177:feature/escrow-swap-mode

Conversation

@james2177
Copy link
Copy Markdown
Contributor

closes #305

- Add DataKey::IpDisputes(u64) to store Vec<IpChallenge>
- Add IpChallenge struct (challenger, reason, timestamp, resolved, resolution)
- Implement challenge_ip(env, ip_id, challenger, reason) — open to anyone
- Implement resolve_ip_dispute(env, ip_id, resolution) — admin-only
- Implement get_ip_disputes(env, ip_id) -> Vec<IpChallenge>
- Add tests: single challenge, multiple challengers, resolve marks all open,
  empty disputes, nonexistent IP panics
- Add SwapMode::Atomic and SwapMode::Escrow enum
- Add DataKey::SwapMode(u64) and DataKey::EscrowDeposit(u64)
- Implement initiate_escrow_swap(env, token, ip_id, seller, price, buyer, timeout)
- Implement escrow_deposit(env, swap_id) — buyer deposits funds, moves to Accepted
- Implement escrow_withdraw(env, swap_id) — buyer reclaims after timeout expires
- Seller reveals key via existing reveal_key() to complete escrow swap
- Add escrow_tests.rs: full flow, timeout withdraw, withdraw-before-timeout panics,
  deposit-on-atomic panics, double-deposit panics, SwapMode stored correctly
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 29, 2026

@james2177 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@fejilaup-cloud fejilaup-cloud merged commit 5c1a2e8 into AtomicIP:main Apr 29, 2026
0 of 2 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.

Implement Escrow-Based Swap

2 participants