USDGPool lets you:
- Deposit USDG and receive sUSDG shares
- Withdraw or redeem USDG when idle cash allows and the protocol is not paused
- Read cash, borrowed principal, and accrued interest that back the shares
- Receive donated yield from CreatorFeeRouter with no new shares minted
- Receive reserve top-ups from FeeCollector after a bad-debt write-off
The source code is
src/core/USDGPool.sol on GitHub. The ABI is /abis/USDGPool.json.
Write methods
borrow
amount idle USDG to the core and books it as borrowed principal. Only Stockline can call it. Reverts with InsufficientCash when amount exceeds cash. Total assets do not change.
Core pulls idle USDG. totalAssets stays flat: cash down, borrowed up.
repay
Pays accrued interest first, then principal. totalAssets unchanged.
accrue
interest USDG as owed by borrowers. Only Stockline can call it, after the reserve-factor split. The share price rises immediately even though the cash arrives later on repay.
Core reports interest after the reserve-factor split. Share price rises.
realizeBadDebt
amount from what the pool expects back, accrued interest first, then principal. Only Stockline can call it. The share price falls. FeeCollector.coverBadDebt can later restore cash from the reserve.
Socializes a recognized shortfall. Accrued interest first, then principal. Share price falls. SPEC: Reserve and Backstop absorb first once they exist; this is the last waterfall step.
donate
amount USDG from the yield distributor and adds it to cash without minting shares. Only the configured yieldDistributor (CreatorFeeRouter) can call it. Every sUSDG holder gains pro rata.
CreatorFeeRouter path. Increases cash with no new shares, so every holder earns pro rata.
restore
amount USDG from the caller and adds it to cash without minting shares. Permissionless. FeeCollector uses it to spend reserve on bad debt.
Permissionless cash add, no new shares. FeeCollector uses this to spend reserve on bad debt.
Read methods
totalAssets
maxWithdraw
owner can withdraw right now: the lesser of their share value and idle cash, or 0 while the guardian pause is active.
Cap assets by idle cash. Guardian pause (via core) returns 0.
Return values
maxRedeem
owner can redeem right now, capped by idle cash and 0 while paused, so redeem and withdraw stay consistent.
Same cash/pause cap, in shares, so redeem and withdraw stay consistent.
Return values
Events
Borrow
Repay
Accrue
Donate
Restore
restore, typically FeeCollector covering bad debt.