Skip to content

feat(contract): expose version() view function on PaymentRouter - #807

Merged
Abdulazeem-code merged 4 commits into
Abdulazeem-code:mainfrom
abrak01:feat/contract-versioning
Oct 3, 2026
Merged

Abdulazeem-code merged 4 commits into
Abdulazeem-code:mainfrom
abrak01:feat/contract-versioning

Conversation

@abrak01

@abrak01 abrak01 commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a version() read-only function to the PaymentRouter Soroban smart contract. The UI and any integration client can call this before submitting transactions to confirm they are talking to a compatible deployment.


Implementation

const CONTRACT_VERSION: &str = "1.0.0";

pub fn version(env: Env) -> String {
    String::from_str(&env, CONTRACT_VERSION)
}
  • CONTRACT_VERSION is a compile-time constant following MAJOR.MINOR.PATCH semver:
    • MAJOR — breaking change to the public interface
    • MINOR — backwards-compatible new function or behaviour
    • PATCH — internal fix with no interface change
  • version() is a pure view function — no ledger writes, costs only the base invocation fee.
  • To bump for a future release, update CONTRACT_VERSION in src/lib.rs and redeploy. No storage migration is needed.

Acceptance criteria

  • Exposes a version() view function
  • Returns a string version ("1.0.0")

Tests

Two unit tests added in src/lib.rs:

Test What it verifies
test_version_returns_expected_string Return value equals String::from_str(&env, CONTRACT_VERSION) — constant and function can never drift apart
test_version_is_non_empty Return value length > 0 — guards against accidental empty string

Run with:

cd payment_router
cargo test --features testutils

Closes #260
Closes #269

Exposes a read-only version() function on the PaymentRouter Soroban
contract so the UI and any integration client can confirm they are
talking to a compatible deployment before submitting transactions.

Implementation:
- CONTRACT_VERSION constant set to "1.0.0" (MAJOR.MINOR.PATCH)
- version(env: Env) -> String returns the constant as a soroban_sdk::String
- No ledger writes; costs only the base invocation fee
- Two unit tests:
    test_version_returns_expected_string — asserts the return value
      equals String::from_str(&env, CONTRACT_VERSION) so constant and
      function can never drift apart
    test_version_is_non_empty — guards against an accidental empty string

To bump the version for a future release, change CONTRACT_VERSION in
src/lib.rs and redeploy. No schema or storage migration is needed.

Closes Abdulazeem-code#269
@vercel

vercel Bot commented Sep 25, 2026

Copy link
Copy Markdown

@abrak01 is attempting to deploy a commit to the Abdulazeem's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Sep 25, 2026

Copy link
Copy Markdown

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

@Abdulazeem-code

Copy link
Copy Markdown
Owner

Resolve conflicts and failed checks

@Abdulazeem-code

Copy link
Copy Markdown
Owner

Please resolve conflicts

@Abdulazeem-code

Copy link
Copy Markdown
Owner

Kindly resolve conflicts

@abrak01

abrak01 commented Oct 3, 2026 via email

Copy link
Copy Markdown
Contributor Author

@Abdulazeem-code
Abdulazeem-code merged commit 41ef618 into Abdulazeem-code:main Oct 3, 2026
10 of 17 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.

Add Contract Versioning Standardize API Error Responses

2 participants