Stockline.json, PositionRouter.json.
1
Repay
Approve USDG on
Stockline, then repay(bookId, amount, onBehalf). Any amount. Any regime. Pause does not block it.2
Withdraw collateral
withdrawCollateral is risk-up. It needs LIVE and not paused. PositionRouter.closePosition repays then withdraws in one transaction if the router is an operator.3
Zap out
Zap.zapWithdraw(usdgAmount, token) pulls sUSDG and pays USDC, USDT, or ETH. USDG withdraw can pause. See Zap.What can go wrong
Unhealthyif withdraw would put the account under LT.RegimeBlocked/Pausedon withdraw.- Zap leftover ETH transfer revert
ZeroAmount. - Decimal mixup on USDG (18 on testnet, 6 on mainnet when listed).
deleverage on the router is risk-down and skips LIVE and pause gates. ARCHITECTURE.md omitted that row. The contract includes it.
closePosition on the router repays then withdraws. It still needs an operator grant for the withdraw half. If you only repay, call the core. If you zap from USDC, zapRepay is always live and does not need LIVE.
Withdrawing sUSDG can pause. That is the USDG pool side, not collateral. Users who need Cash during a pause should already hold Cash, not only Earning.
Decimals: testnet faucet USDG is 18. Mainnet USDG is 6 when listed. Read decimals(). Round debt up and shares down if you write your own math. The core already rounds in the protocol’s favor.