TreasuryRecoveryLibrary
Title: TreasuryRecoveryLibrary
Author: Quantillon Protocol Team
Library for secure token and ETH recovery to treasury addresses
This library factorizes the recoverToken and recoverETH functionality used across all contracts to save gas, reduce bytecode, and ensure consistent security implementation
Note: security-contact: team@quantillon.money
Functions
recoverToken
Recover tokens accidentally sent to the contract to treasury only
SECURITY: Prevents recovery of own tokens and sends only to treasury
Gas optimization: Uses library function to avoid code duplication
Security: Prevents recovery of own tokens and ensures treasury-only recovery
Error handling: Uses custom errors for gas efficiency
Notes:
-
security: Validates input parameters and enforces security checks
-
validation: Validates input parameters and business logic constraints
-
state-changes: Updates contract state variables
-
events: Emits relevant events for state changes
-
errors: Throws custom errors for invalid conditions
-
reentrancy: Protected by reentrancy guard
-
access: Restricted to authorized roles
-
oracle: Requires fresh oracle price data
function recoverToken(address token, uint256 amount, address contractAddress, address treasury) external;
Parameters
| Name | Type | Description |
|---|---|---|
token | address | Token address to recover |
amount | uint256 | Amount to recover |
contractAddress | address | Address of the calling contract (for own token check) |
treasury | address | Treasury address to send recovered tokens to |