Skip to content

fix: implement canonical token pin, safe withdraw ordering, remove_authorized, and checked_add - #1543

Merged
aji70 merged 2 commits into
MyFanss:mainfrom
jpetee21-design:Jpete_1394-1397
Jul 28, 2026
Merged

fix: implement canonical token pin, safe withdraw ordering, remove_authorized, and checked_add#1543
aji70 merged 2 commits into
MyFanss:mainfrom
jpetee21-design:Jpete_1394-1397

Conversation

@jpetee21-design

Copy link
Copy Markdown
Contributor

Closes #1394

##Closes #1395
##Closes #1396
##Closes #1397

What does this PR do?

…thorized, and checked_add

## Closes MyFanss#1394, MyFanss#1395, MyFanss#1396, MyFanss#1397

### What does this PR do?

- **MyFanss#1394 - Pin creator-deposits to canonical token:** Stores the canonical token address at init. Deposit now validates that the passed token matches the canonical token, reverting with TokenNotAllowed (error code 6) on mismatch. Includes unit tests.

- **MyFanss#1395 - Transfer before debiting creator-deposits withdraw ledger:** Reorders the withdraw function so the token.transfer call happens BEFORE the balance is debited. If the transfer fails, the ledger balance remains untouched and accounting stays consistent.

- **MyFanss#1396 - Add remove_authorized for creator-earnings depositors:** Adds an admin-only remove_authorized function that removes a depositor from the authorized list and emits an authorized_removed event. Includes tests verifying removed depositors cannot deposit and non-admin calls revert.

- **MyFanss#1397 - Use checked_add when crediting creator-earnings deposits:** Replaces the unchecked  with  in the deposit function, panicking with InvalidAmount on overflow. Includes an overflow regression test.
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@jpetee21-design 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

@aji70
aji70 merged commit 19a91f5 into MyFanss:main Jul 28, 2026
2 of 9 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

2 participants