feat: Implement bounty creation, claim, deadline support + tests (#1, #2, #3, #5)#7
Closed
aglichandrap wants to merge 1 commit into
Closed
Conversation
… + comprehensive tests Implements issueflow-buidl#1: create_bounty function that locks USDC in the contract Implements issueflow-buidl#2: claim_bounty (releases USDC to solver) and cancel_bounty Implements issueflow-buidl#3: deadline support with strict validation Implements issueflow-buidl#5: comprehensive test suite covering all functions, edge cases, error scenarios Contract changes (lib.rs): - Added Bounty struct with creator, token, amount, deadline, state fields - Added BountyState enum (Open, Claimed, Cancelled) - create_bounty: locks funds from creator, validates amount/deadline - claim_bounty: creator authorizes release to solver - cancel_bounty: creator reclaims after deadline expiry - get_bounty: read-only query - Events for all state transitions - Preserved tip() for backward compatibility Test coverage (test.rs): - 25+ tests covering create, claim, cancel, tip, get_bounty - Edge cases: zero/negative amounts, past deadlines, double-claim/cancel - Full lifecycle tests: create→claim and create→cancel flows - Multi-bounty tests with different deadlines - Authorization failure scenarios Also updated Bounty.sol with matching Solidity implementation.
Author
|
Closing — cleaning up PR portfolio. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements the complete bounty lifecycle for the Soroban contract, addressing issues #1, #2, #3, and #5.
Changes
**** — Full contract implementation:
**** (Closes #5) — 25+ comprehensive tests:
**** — Matching Solidity implementation with ERC-20 escrow pattern.
Design Decisions