Skip to content

Implement update_metadata for bounty titles and add backend PATCH end… - #707

Open
elcabasa wants to merge 1 commit into
ritik4ever:mainfrom
elcabasa:feat/update-metadata-231
Open

Implement update_metadata for bounty titles and add backend PATCH end…#707
elcabasa wants to merge 1 commit into
ritik4ever:mainfrom
elcabasa:feat/update-metadata-231

Conversation

@elcabasa

@elcabasa elcabasa commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Description

fixes #231
This PR resolves issue #231 by implementing the update_metadata functionality, allowing maintainers to correct bounty titles on non-finalized bounties without having to cancel and recreate them. The implementation spans both the Soroban smart contract and the off-chain backend indexing API endpoint.

Scope of Changes

Smart Contract (contract.rs)

  • Added the BountyMetadataUpdated contract type struct for indexer event streams.
  • Implemented pub fn update_metadata(env: Env, bounty_id: u64, maintainer: Address, new_title: String) with the following security guardrails:
    • Enforces caller authorization via maintainer.require_auth().
    • Rejects execution with a MaintainerMismatch error if a non-owner attempts an modification.
    • Rejects execution if the target bounty status evaluates to Released, Refunded, or Expired.
    • Safely overwrites the existing state on success and publishes the BountyMetadataUpdated event containing both the old and new titles.

Backend REST API

  • Created a PATCH /api/bounties/:id/metadata controller routing endpoint.
  • Introduced off-chain validation guards matching the contract logic (preventing updates on unauthorized access or finalized/expired statuses).

Acceptance Criteria Verified

  • Only the original maintainer can call update_metadata.
  • Rejected on Released, Refunded, or Expired statuses.
  • Emits BountyMetadataUpdated event with old and new title.
  • Added backend /api/bounties/:id/metadata PATCH endpoint.
  • Added unit tests checking success, missing authentication, and status constraints.

Testing Matrix

  • Executed smart contract unit testing assertions covering edge cases:
    cargo test

@vercel

vercel Bot commented Jul 3, 2026

Copy link
Copy Markdown

@elcabasa is attempting to deploy a commit to the ritik4ever's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jul 3, 2026

Copy link
Copy Markdown

@elcabasa 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add update_title function for maintainers to correct bounty metadata

1 participant