sweepCollateral. Unallocated USDG fills the reserve up to a target of 5% of pool borrows, then flows to the treasury. Anyone can spend the reserve on pool bad debt and burn treasury USDG into STK within an epoch budget.
FeeCollector lets you:
- Allocate fresh USDG into reserve, then treasury
- Cover pool bad debt from the reserve
- Buy and burn STK with treasury USDG inside the epoch budget
- Sell seized collateral for USDG along its zap route
- Credit reserve and treasury directly (used by CreatorFeeRouter)
- Read the reserve, treasury, target, and epoch state
The source code is
src/core/FeeCollector.sol on GitHub. The ABI is /abis/FeeCollector.json.
Write methods
notifyInterest
amount of reserve-factor interest has accrued. Only Stockline can call it. This is a counter; the cash arrives later on repay.
Input parameters
notifyLiquidationFee
amount of seized collateral arrived as the protocol’s liquidation share. Only Stockline can call it.
Input parameters
credit
toReserve + toTreasury USDG from the caller and credits the two buckets directly, skipping the target waterfall. Permissionless. CreatorFeeRouter uses it for the 40/30 split. Reverts with ZeroAmount when both are zero.
Direct credits skip the allocate waterfall so a Pons split can raise reserve even when the 5% target is already full.
setReserveTargetPct
pool.borrowed(). Owner only. Reverts with InvalidWad above 1e18.
Input parameters
setBurnEpoch
allocate
reserveTarget, then sends the rest to the treasury. Permissionless. Emits Allocated only when something moved.
coverBadDebt
amount of the reserve into USDGPool through restore, making suppliers whole after a write-off. Permissionless. Allocates first. Reverts with ZeroAmount when amount is 0 or the reserve is empty.
This does not check that the pool actually had bad debt. It always increases pool cash and the sUSDG share price.
buyAndBurn
amount treasury USDG along the buy-and-burn route and sends the output token to the dead address. Permissionless. Reverts with EpochBudgetExceeded above the unused epoch budget, InsufficientTreasury above the treasury balance, CapExceeded above maxPerCall, and InvalidRoute if the route does not start with USDG.
Each epoch’s budget is 20% (2000 bps, fixed) of the treasury at roll time. The first epoch after deployment has a budget of 0, so burns can start only after the first roll. Slippage is checked against the router’s TWAP quote.
sweepCollateral
Read methods
reserveTarget
pool.borrowed() * reserveTargetPct / 1e18.
Return values
unallocated
Events
Allocated
Credited
ReserveTargetPctSet
BurnEpochSet
EpochRolled
Covered
BuyAndBurn
CollateralSwept
Errors
ZeroAddress
NotCore
NotOwner
ZeroAmount
InvalidWad
InsufficientTreasury
CapExceeded
maxPerCall.