Skip to content

Add rescue funds admin entrypoint#608

Merged
greatest0fallt1me merged 2 commits into
CalloraOrg:mainfrom
gloskull:add-rescue-funds-admin-entrypoint
Jun 29, 2026
Merged

Add rescue funds admin entrypoint#608
greatest0fallt1me merged 2 commits into
CalloraOrg:mainfrom
gloskull:add-rescue-funds-admin-entrypoint

Conversation

@gloskull

Copy link
Copy Markdown
Contributor

Motivation
Provide an admin-gated recovery mechanism to rescue tokens accidentally sent to the vault while protecting tracked USDC balances.
Ensure the rescue operation can be executed by the campaign multisig/timelock (admin) and is audit-friendly via an event.
Description
Added a focused helper module contracts/vault/src/rescue.rs implementing rescue_funds(env, token_address, to, amount, protected_balance) which enforces positive amounts, available/on-ledger checks, and performs the transfer.
Exposed an admin entrypoint rescue_funds in contracts/vault/src/lib.rs that requires the configured admin, reserves tracked USDC when applicable, calls the helper, and emits an rescue_funds event.
Reworked distribute to use the rescue helper for safe surplus transfers and added the canonical event constructor event_rescue_funds in contracts/vault/src/events.rs.
Added focused unit tests in contracts/vault/src/test.rs covering non-USDC rescue, USDC-surplus protection, auth/amount rejection, and event shape, and updated the public interface docs in docs/interfaces/vault.json.
Testing
Ran rustfmt on modified files which completed successfully.
Ran cargo check -p callora-vault which failed to build due to pre-existing compilation blockers in the vault project (duplicate exported function definitions and contract macro parameter issues surfaced during the build), so the new tests were not executed.
Attempted cargo test -p callora-vault rescue_funds which could not run because the build failed for the same compile errors; the rescue tests are present and will run once the underlying build issues are resolved.
Closes #563

@gloskull

Copy link
Copy Markdown
Contributor Author

Done with this issue.
Please merge and give and high review.
Please if there are any more tasks, assign them to me, i'd make sure to get them done quickly and submit my PR's in under 5 hours

@greatest0fallt1me greatest0fallt1me merged commit 2960841 into CalloraOrg:main Jun 29, 2026
1 of 6 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 'rescue funds' admin entrypoint

2 participants