Skip to content

Add admin transfer functionality to rewards contract#65

Merged
joelpeace48-cell merged 2 commits intoFinesseStudioLab:mainfrom
xqcxx:feature/add-admin-transfer-rewards
Mar 25, 2026
Merged

Add admin transfer functionality to rewards contract#65
joelpeace48-cell merged 2 commits intoFinesseStudioLab:mainfrom
xqcxx:feature/add-admin-transfer-rewards

Conversation

@xqcxx
Copy link
Copy Markdown
Contributor

@xqcxx xqcxx commented Mar 25, 2026

Summary

Implements admin-only point transfer functionality in the rewards contract, allowing administrators to move points between users.

Changes

  • Added Unauthorized error variant (Error code 3)
  • Implemented admin_transfer function with the following features:
    • Admin authorization check
    • Debits points from source user
    • Credits points to destination user
    • Proper error handling for insufficient balance and overflow
    • Storage TTL extension

Implementation Details

The admin_transfer function:

  1. Requires admin authentication via require_auth()
  2. Verifies the caller matches the stored admin address
  3. Safely debits the source account using checked_sub
  4. Safely credits the destination account using checked_add
  5. Returns appropriate errors: Unauthorized, InsufficientBalance, or Overflow

Closes #6

- Add Unauthorized error variant
- Implement admin_transfer function to move points between users
- Include admin authorization checks
- Handle insufficient balance and overflow cases

Closes FinesseStudioLab#6
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 25, 2026

@xqcxx is attempting to deploy a commit to the joelpeace48-cell's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 25, 2026

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

@joelpeace48-cell joelpeace48-cell merged commit e4787fc into FinesseStudioLab:main Mar 25, 2026
1 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.

Add admin transfer in rewards contract

2 participants