Skip to main content
Repay is always live. Withdrawing collateral needs LIVE, no pause, and a healthy account after the pull. Addresses: Addresses. ABI: 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

  • Unhealthy if withdraw would put the account under LT.
  • RegimeBlocked / Paused on withdraw.
  • Zap leftover ETH transfer revert ZeroAmount.
  • Decimal mixup on USDG (18 on testnet, 6 on mainnet when listed).
Deleveraging is always live. That is an invariant, not a courtesy. Guardian pause cannot block repay or supplyCollateral. 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.