BTB
/

Liquity V2

CDPwebsite
Immutable CDP protocol on Ethereum issuing the BOLD stablecoin. Agents can open Troves against WETH, wstETH or rETH at a self-chosen interest rate, adjust or close them, earn BOLD interest + liquidation gains in each branch's Stability Pool, and redeem BOLD for collateral at face value via the CollateralRegistry.

What you can do

open-troveBorrow BOLD against WETH/wstETH/rETH1) Pick branch (0 WETH, 1 wstETH, 2 rETH) and rate (e.g. 5e16 = 5%). 2) fee = HintHelpers.predictOpenTroveUpfrontFee(idx, bold, rate). 3) (hint,,) = HintHelpers.getApproxHint(idx, rate, 15*sqrt(SortedTroves.getSize()), seed); (upper, lower) = SortedTroves.findInsertPosition(rate, hint, hint). 4) Approve collateral (+0.0375 WETH gas deposit) to BorrowerOperations. 5) BorrowerOperations.openTrove(owner, ownerIndex, coll, bold, upper, lower, rate, fee*1.01, 0x0, 0x0, 0x0). Keep ICR well above MCR (110% WETH, 120% LSTs) and debt >= 2,000 BOLD. Or use WETHZapper/GasCompZapper.openTroveWithRawETH to pay in ETH.
adjust-troveAdd/remove collateral, borrow/repayBorrowerOperations.adjustTrove(troveId, collChange, isCollIncrease, boldChange, isDebtIncrease, maxUpfrontFee) (fee from HintHelpers.predictAdjustTroveUpfrontFee when borrowing), or addColl / withdrawColl / withdrawBold / repayBold.
set-interest-rateChange a Trove's interest rateHints as in open-trove for the new rate; fee = HintHelpers.predictAdjustInterestRateUpfrontFee(idx, troveId, newRate) (0 if >= 7 days since last change); BorrowerOperations.adjustTroveInterestRate(troveId, newRate, upper, lower, fee).
close-troveRepay all and withdraw collateraldebt = TroveManager.getLatestTroveData(troveId).entireDebt; hold that much BOLD (plus a little for interest accrual); BorrowerOperations.closeTrove(troveId).
earn-stability-poolDeposit BOLD in a branch Stability PoolStabilityPool.provideToSP(amount, true). Read getCompoundedBoldDeposit / getDepositorYieldGainWithPending / getDepositorCollGain. Exit with withdrawFromSP(amount, true).
redeemRedeem BOLD for collateral at $1Check CollateralRegistry.getRedemptionRateForRedeemedAmount(amount); CollateralRegistry.redeemCollateral(amount, maxIterationsPerCollateral (e.g. 50), maxFee 1e18-scaled). For min-out protection use RedemptionHelper.truncateRedemption (eth_call) then redeemCollateral(bold, iters, maxFeePct, minCollPerBranch[3]) after approving BOLD to it.
liquidateLiquidate undercollateralized TrovesFind Troves with TroveManager.getCurrentICR(id, PriceFeed.lastGoodPrice()) < MCR; TroveManager.batchLiquidateTroves([ids]).
Redemptions: anyone can redeem BOLD for collateral at $1 (minus a fee of at least 0.5%), starting from the Troves with the LOWEST interest rate in each branch. Redeemed borrowers lose collateral equal to the debt repaid (no net loss at the oracle price, but exposure is lost). Keep your rate competitive; MultiTroveGetter.getDebtPerInterestRateAscending shows the debt in front of you.
Zombie Troves: a redemption that leaves debt < 2,000 BOLD marks the Trove 'zombie' (status 4); it stays open but must be fixed with adjustZombieTrove.
Liquidation when ICR < MCR (110% WETH, 120% wstETH/rETH): the Trove loses its collateral (up to the penalty: 5% via the Stability Pool, up to 10% WETH / 20% LST via redistribution) and the 0.0375 WETH gas deposit. Branch TCR below CCR (150% / 160%) restricts borrowing and collateral withdrawals.
Upfront fee: every new borrow (and rate changes within 7 days of the last one) pays 7 days of the branch average interest rate, added to debt and non-refundable.

Contracts

Read any function, or build a write and sign it. Amounts are in base units (1 USDC = 1000000).
BOLD (stablecoin)token on ethereum0x6440f144b7e50D6a8439336510312d2F54beB01D
read balanceOf(address)
BOLD balance (18 decimals).
read totalSupply()
Total BOLD supply (18 decimals).
write approve(address,uint256)
Approve a spender (e.g. a zapper for repay/close, or a DEX). Not needed for BorrowerOperations.repayBold/closeTrove, StabilityPool.provideToSP or CollateralRegistry.redeemCollateral: those burn/move BOLD directly.
write transfer(address,uint256)
Transfer BOLD.
write permit(address,address,uint256,uint256,uint8,bytes32,bytes32)
EIP-2612 permit: (owner, spender, value, deadline, v, r, s).
read collateralRegistryAddress()
CollateralRegistry address (should return 0xf949982B91C8c61e952B3bA942cbbfaef5386684).
CollateralRegistry (branch registry + redemptions)other on ethereum0xf949982B91C8c61e952B3bA942cbbfaef5386684
read totalCollaterals()
Number of collateral branches (3: index 0 WETH, 1 wstETH, 2 rETH).
read getToken(uint256)
Collateral token of branch index.
read getTroveManager(uint256)
TroveManager of branch index (use to discover/verify branch contracts).
write redeemCollateral(uint256,uint256,uint256)
Redeem BOLD for collateral at face value ($1 of collateral per BOLD, minus fee): (_boldAmount, _maxIterationsPerCollateral, _maxFeePercentage 1e18=100%). Split across branches in proportion to each branch's unbacked debt (debt not covered by its Stability Pool), hitting the lowest-interest-rate Troves first. BOLD is burned from msg.sender; no approve needed. Reverts if the fee exceeds _maxFeePercentage. Use RedemptionHelper if you need a minimum collateral out.
read getRedemptionRateWithDecay()
Current redemption fee rate (1e18 = 100%), = decayed baseRate + 0.5% floor. Fee grows with redeemed volume and decays with a 6h half-life.
read getRedemptionRateForRedeemedAmount(uint256)
Fee rate a redemption of the given BOLD amount would pay.
read getEffectiveRedemptionFeeInBold(uint256)
Fee in BOLD for redeeming the given amount now.
read baseRate()
Stored base rate (1e18 = 100%).
HintHelpersother on ethereum0xF0caE19C96E572234398d6665cC1147A16cBe657
read getApproxHint(uint256,uint256,uint256,uint256)
(_collIndex, _interestRate, _numTrials, _inputRandomSeed) -> (hintId, diff, latestRandomSeed). Samples Troves for one close to where a Trove at _interestRate goes in the branch's SortedTroves. Use numTrials ~ 10-15 * sqrt(number of Troves); then pass hintId as both args to SortedTroves.findInsertPosition to get exact (upperHint, lowerHint).
read predictOpenTroveUpfrontFee(uint256,uint256,uint256)
(_collIndex, _borrowedAmount, _interestRate) -> upfront fee in BOLD (7 days of the branch's average interest rate on the new debt). Use (plus a small margin) as _maxUpfrontFee in openTrove.
read predictAdjustTroveUpfrontFee(uint256,uint256,uint256)
(_collIndex, _troveId, _debtIncrease) -> upfront fee for borrowing more; use as _maxUpfrontFee for withdrawBold/adjustTrove.
read predictAdjustInterestRateUpfrontFee(uint256,uint256,uint256)
(_collIndex, _troveId, _newInterestRate) -> upfront fee for an interest-rate change (0 if the last change was 7+ days ago).
read predictOpenTroveAndJoinBatchUpfrontFee(uint256,uint256,address)
(_collIndex, _borrowedAmount, _batchManager) -> upfront fee when opening into a delegated-rate batch.
MultiTroveGetterother on ethereum0xFA61dB085510C64B83056Db3A7Acf3b6f631D235
read getMultipleSortedTroves(uint256,int256,uint256)
(_collIndex, _startIdx, _count) -> array of Trove data (id, debt, coll, stake, annualInterestRate, lastDebtUpdateTime, lastInterestRateAdjTime, interestBatchManager, ...). _startIdx >= 0 starts from the highest-rate end of SortedTroves; negative values start from the lowest-rate end (-1 = lowest rate, the next Trove to be redeemed).
read getDebtPerInterestRateAscending(uint256,uint256,uint256)
(_collIndex, _startId (0 = start at the lowest-rate Trove), _maxIterations) -> per Trove (interestBatchManager, interestRate, debt) walking from the lowest rate upwards, plus the id to continue from. Summing debt below your rate shows how much must be redeemed before your Trove is hit.
RedemptionHelperrouter on ethereum0xb366256d033aE7e4f7BDDEc822a5ADEC9DF07b80
read simulateRedemption(uint256,uint256)
(_bold, _maxIterationsPerCollateral) -> per-branch redemption split. Non-view (nonpayable) in the ABI: call it with eth_call, do not send it.
read truncateRedemption(uint256,uint256)
(_bold, _maxIterationsPerCollateral) -> (truncatedBold, feePct, redeemed per branch): the largest amount that can actually be redeemed within the iteration limit. Use with eth_call.
write redeemCollateral(uint256,uint256,uint256,uint256[])
(_bold, _maxIterationsPerCollateral, _maxFeePct, _minCollRedeemed[3] per branch) redemption with slippage protection on collateral out. Approve BOLD to this helper first.
BorrowerOperations (WETH branch)other on ethereum0x372ABD1810eAF23Cb9D941BbE7596DFb2c46BC65
write openTrove(address,uint256,uint256,uint256,uint256,uint256,uint256,uint256,address,address,address)
Open a Trove: (_owner, _ownerIndex, _collAmount, _boldAmount, _upperHint, _lowerHint, _annualInterestRate, _maxUpfrontFee, _addManager, _removeManager, _receiver). First approve WETH to BorrowerOperations for collAmount + 0.0375 (collateral and the gas deposit are both WETH). Interest rate 1e18 = 100%, min 0.5% (5e15), max 250%. Debt incl. upfront fee must be >= 2,000 BOLD and ICR >= MCR 110% (and the branch TCR must stay >= CCR 150%). _maxUpfrontFee from HintHelpers.predictOpenTroveUpfrontFee. Hints from HintHelpers.getApproxHint + SortedTroves.findInsertPosition (0,0 works but costs more gas). Managers/receiver can be address(0). Returns troveId = uint256(keccak256(abi.encode(msg.sender, _owner, _ownerIndex))); an ERC-721 for it is minted to _owner and BOLD to msg.sender.
write adjustTrove(uint256,uint256,bool,uint256,bool,uint256)
(_troveId, _collChange, _isCollIncrease, _boldChange, _isDebtIncrease, _maxUpfrontFee): add/withdraw collateral and borrow/repay in one call. Borrowing more charges an upfront fee (7 days of branch average interest). Resulting ICR must stay >= MCR, debt >= 2,000 BOLD; below CCR (Critical mode) borrowing is only allowed if it lifts TCR above CCR.
write addColl(uint256,uint256)
(_troveId, _collAmount): add collateral (approve the collateral token first).
write withdrawColl(uint256,uint256)
(_troveId, _collWithdrawal): withdraw collateral; ICR must stay >= MCR.
write withdrawBold(uint256,uint256,uint256)
(_troveId, _boldAmount, _maxUpfrontFee): borrow more BOLD; upfront fee applies (predictAdjustTroveUpfrontFee).
write repayBold(uint256,uint256)
(_troveId, _boldAmount): repay debt; cannot take debt below 2,000 BOLD (close the Trove instead). No approve needed.
write adjustTroveInterestRate(uint256,uint256,uint256,uint256,uint256)
(_troveId, _newAnnualInterestRate, _upperHint, _lowerHint, _maxUpfrontFee): set a new rate (1e18 = 100%). Free once per 7 days; a change within 7 days of the last one pays an upfront fee of 7 days' average interest. Lower rates are redeemed first. Not for Troves in a batch.
write closeTrove(uint256)
(_troveId): repay the entire debt (TroveManager.getLatestTroveData(id).entireDebt, incl. accrued interest) from msg.sender's BOLD and get all collateral plus the 0.0375 WETH gas deposit back. Caller must be owner or remove-manager. Reverts if it would push branch TCR below CCR (unless the branch is shut down).
write adjustZombieTrove(uint256,uint256,bool,uint256,bool,uint256,uint256,uint256)
Adjust a 'zombie' Trove (debt < 2,000 BOLD after redemption): (_troveId, _collChange, _isCollIncrease, _boldChange, _isDebtIncrease, _upperHint, _lowerHint, _maxUpfrontFee). Result must have debt >= 2,000 and ICR >= MCR.
write claimCollateral()
Claim surplus collateral left after your Trove was liquidated or fully redeemed (held in CollSurplusPool).
write setInterestBatchManager(uint256,address,uint256,uint256,uint256)
(_troveId, _newBatchManager, _upperHint, _lowerHint, _maxUpfrontFee): delegate rate management to a registered batch manager (pays its management fee; batched Troves need ICR >= MCR + 10%).
read MCR()
Minimum collateral ratio, 1e18 = 100% (110% on this branch).
read CCR()
Critical collateral ratio for the branch TCR (150%).
read hasBeenShutDown()
True if the branch is shut down (TCR fell below SCR 110% or oracle failure): only closing Troves and urgent redemptions then work.
read getEntireBranchDebt()
Total branch debt in BOLD (18 decimals).
TroveManager (WETH branch)other on ethereum0x7bcb64B2c9206a5B699eD43363f6F98D4776Cf5A
read getLatestTroveData(uint256)
Trove state incl. pending interest: (entireDebt, entireColl, redistBoldDebtGain, redistCollGain, accruedInterest, recordedDebt, annualInterestRate, weightedRecordedDebt, accruedBatchManagementFee, lastInterestRateAdjTime). entireDebt is what closeTrove needs.
read getTroveStatus(uint256)
0 nonExistent, 1 active, 2 closedByOwner, 3 closedByLiquidation, 4 zombie (debt < 2,000 BOLD after redemption; unredeemable until topped up).
read getCurrentICR(uint256,uint256)
(_troveId, _price) -> ICR (1e18 = 100%). Price from PriceFeed.lastGoodPrice(). Liquidatable when ICR < MCR (110%).
read getTroveAnnualInterestRate(uint256)
Trove's annual rate (1e18 = 100%; batch rate if batched).
read getTroveIdsCount()
Number of Troves in the branch.
read getTroveFromTroveIdsArray(uint256)
Trove id at index (for enumeration).
write batchLiquidateTroves(uint256[])
Permissionless liquidation of Troves with ICR < MCR. Liquidator earns 0.5% of the collateral (capped at 2 units) plus the 0.0375 WETH gas deposit per Trove. Debt is offset by the branch Stability Pool (SP depositors get collateral at a 5% penalty discount) or, if the SP is empty, redistributed to other Troves (up to 10% penalty).
write urgentRedemption(uint256,uint256[],uint256)
Only after branch shutdown: (_boldAmount, _troveIds, _minCollateral) redeem BOLD from chosen Troves with a 2% collateral bonus and no fee.
StabilityPool (WETH branch)staking on ethereum0x5721cbbd64fc7Ae3Ef44A0A3F9a790A9264Cf9BF
write provideToSP(uint256,bool)
(_topUp, _doClaim): deposit BOLD (no approve needed). Earns 75% of the branch's interest (in BOLD) plus WETH from liquidations. _doClaim=true pays out pending BOLD yield and WETH gains; false compounds the yield into the deposit and stashes the WETH.
write withdrawFromSP(uint256,bool)
(_amount, _doClaim): withdraw BOLD (amount above your deposit withdraws all). Pool must keep >= 1 BOLD total. Withdraw with _doClaim=true to also receive gains.
write claimAllCollGains()
Claim stashed collateral gains; only when you have no deposit left.
read getCompoundedBoldDeposit(address)
Current BOLD deposit after liquidation losses (18 decimals).
read getDepositorYieldGainWithPending(address)
Claimable BOLD interest yield incl. not-yet-minted interest.
read getDepositorCollGain(address)
Pending WETH gain from liquidations (excl. stashed; see stashedColl(address)).
read stashedColl(address)
Collateral gains stashed by earlier _doClaim=false operations.
read getTotalBoldDeposits()
Total BOLD in this pool.
SortedTroves (WETH branch)other on ethereum0xA25269E41BD072513849F2E64Ad221e84f3063F4
read findInsertPosition(uint256,uint256,uint256)
(_annualInterestRate, _prevId, _nextId) -> (upperHint, lowerHint): exact hints for openTrove / adjustTroveInterestRate. Pass HintHelpers.getApproxHint result as both _prevId and _nextId.
read getLast()
Trove with the LOWEST interest rate (the next to be redeemed).
read getFirst()
Trove with the highest interest rate.
read getNext(uint256)
Next Trove toward lower rates.
read getPrev(uint256)
Previous Trove toward higher rates.
read getSize()
Number of Troves in the list (zombie Troves are not in it).
WETHZapper (WETH branch, native ETH)router on ethereum0x7022A4f4A2b9f0C30A5eB0B0073a8Bb4C8e70C1f
write openTroveWithRawETH((address,uint256,uint256,uint256,uint256,uint256,uint256,address,uint256,address,address,address))
Open a WETH-branch Trove paying in ETH. Struct: (owner, ownerIndex, collAmount (ignored: collateral = msg.value - 0.0375 ETH gas deposit), boldAmount, upperHint, lowerHint, annualInterestRate, batchManager (0x0 unless joining a batch; then rate must be 0), maxUpfrontFee, addManager, removeManager, receiver). msg.value must exceed 0.0375 ETH. The zapper opens the Trove, so troveId = uint256(keccak256(abi.encode(zapper, owner, uint256(keccak256(abi.encode(msg.sender, ownerIndex)))))); read it from the return value. BOLD goes to msg.sender, the Trove NFT to owner, and the zapper stays add/remove manager and receiver so later zapper calls work.
write addCollWithRawETH(uint256)
(_troveId): add ETH collateral (msg.value).
write adjustTroveWithRawETH(uint256,uint256,bool,uint256,bool,uint256)
(_troveId, _collChange, _isCollIncrease, _boldChange, _isDebtIncrease, _maxUpfrontFee); when adding collateral msg.value must equal _collChange. Approve BOLD to the zapper when repaying.
write withdrawCollToRawETH(uint256,uint256)
(_troveId, _amount): withdraw collateral as ETH.
write repayBold(uint256,uint256)
(_troveId, _boldAmount): repay via zapper (approve BOLD to zapper).
write withdrawBold(uint256,uint256,uint256)
(_troveId, _boldAmount, _maxUpfrontFee): borrow more via zapper.
write closeTroveToRawETH(uint256)
(_troveId): pulls entireDebt BOLD from msg.sender (approve first) and returns collateral + 0.0375 gas deposit as ETH. Only for Troves where the zapper is the receiver.
PriceFeed (WETH branch)other on ethereum0xCC5F8102eb670c89a4a3c567C13851260303c24F
read lastGoodPrice()
Last valid WETH price in USD (18 decimals) used for ICR; pass to TroveManager.getCurrentICR.
write fetchPrice()
Refreshes and returns (price, oracleFailureDetected). Non-view; use eth_call to read a fresh price. An oracle failure shuts the branch down.
TroveNFT (WETH branch)token on ethereum0x1A0FC0b843aFD9140267D25d4E575Cb37a838013
read ownerOf(uint256)
Owner of a Trove (tokenId = troveId). The NFT owner controls the Trove; transferring it transfers the position.
read balanceOf(address)
Number of Troves owned on this branch.
write transferFrom(address,address,uint256)
Transfer a Trove position.
BorrowerOperations (wstETH branch)other on ethereum0xa741A32f9dcFe6aDBa088fD0f97e90742d7d5DA3
write openTrove(address,uint256,uint256,uint256,uint256,uint256,uint256,uint256,address,address,address)
Open a Trove: (_owner, _ownerIndex, _collAmount, _boldAmount, _upperHint, _lowerHint, _annualInterestRate, _maxUpfrontFee, _addManager, _removeManager, _receiver). First approve wstETH (collAmount) and 0.0375 WETH (gas deposit) to BorrowerOperations. Interest rate 1e18 = 100%, min 0.5% (5e15), max 250%. Debt incl. upfront fee must be >= 2,000 BOLD and ICR >= MCR 120% (and the branch TCR must stay >= CCR 160%). _maxUpfrontFee from HintHelpers.predictOpenTroveUpfrontFee. Hints from HintHelpers.getApproxHint + SortedTroves.findInsertPosition (0,0 works but costs more gas). Managers/receiver can be address(0). Returns troveId = uint256(keccak256(abi.encode(msg.sender, _owner, _ownerIndex))); an ERC-721 for it is minted to _owner and BOLD to msg.sender.
write adjustTrove(uint256,uint256,bool,uint256,bool,uint256)
(_troveId, _collChange, _isCollIncrease, _boldChange, _isDebtIncrease, _maxUpfrontFee): add/withdraw collateral and borrow/repay in one call. Borrowing more charges an upfront fee (7 days of branch average interest). Resulting ICR must stay >= MCR, debt >= 2,000 BOLD; below CCR (Critical mode) borrowing is only allowed if it lifts TCR above CCR.
write addColl(uint256,uint256)
(_troveId, _collAmount): add collateral (approve the collateral token first).
write withdrawColl(uint256,uint256)
(_troveId, _collWithdrawal): withdraw collateral; ICR must stay >= MCR.
write withdrawBold(uint256,uint256,uint256)
(_troveId, _boldAmount, _maxUpfrontFee): borrow more BOLD; upfront fee applies (predictAdjustTroveUpfrontFee).
write repayBold(uint256,uint256)
(_troveId, _boldAmount): repay debt; cannot take debt below 2,000 BOLD (close the Trove instead). No approve needed.
write adjustTroveInterestRate(uint256,uint256,uint256,uint256,uint256)
(_troveId, _newAnnualInterestRate, _upperHint, _lowerHint, _maxUpfrontFee): set a new rate (1e18 = 100%). Free once per 7 days; a change within 7 days of the last one pays an upfront fee of 7 days' average interest. Lower rates are redeemed first. Not for Troves in a batch.
write closeTrove(uint256)
(_troveId): repay the entire debt (TroveManager.getLatestTroveData(id).entireDebt, incl. accrued interest) from msg.sender's BOLD and get all collateral plus the 0.0375 WETH gas deposit back. Caller must be owner or remove-manager. Reverts if it would push branch TCR below CCR (unless the branch is shut down).
write adjustZombieTrove(uint256,uint256,bool,uint256,bool,uint256,uint256,uint256)
Adjust a 'zombie' Trove (debt < 2,000 BOLD after redemption): (_troveId, _collChange, _isCollIncrease, _boldChange, _isDebtIncrease, _upperHint, _lowerHint, _maxUpfrontFee). Result must have debt >= 2,000 and ICR >= MCR.
write claimCollateral()
Claim surplus collateral left after your Trove was liquidated or fully redeemed (held in CollSurplusPool).
write setInterestBatchManager(uint256,address,uint256,uint256,uint256)
(_troveId, _newBatchManager, _upperHint, _lowerHint, _maxUpfrontFee): delegate rate management to a registered batch manager (pays its management fee; batched Troves need ICR >= MCR + 10%).
read MCR()
Minimum collateral ratio, 1e18 = 100% (120% on this branch).
read CCR()
Critical collateral ratio for the branch TCR (160%).
read hasBeenShutDown()
True if the branch is shut down (TCR fell below SCR 120% or oracle failure): only closing Troves and urgent redemptions then work.
read getEntireBranchDebt()
Total branch debt in BOLD (18 decimals).
TroveManager (wstETH branch)other on ethereum0xA2895d6A3bf110561Dfe4b71cA539d84e1928B22
read getLatestTroveData(uint256)
Trove state incl. pending interest: (entireDebt, entireColl, redistBoldDebtGain, redistCollGain, accruedInterest, recordedDebt, annualInterestRate, weightedRecordedDebt, accruedBatchManagementFee, lastInterestRateAdjTime). entireDebt is what closeTrove needs.
read getTroveStatus(uint256)
0 nonExistent, 1 active, 2 closedByOwner, 3 closedByLiquidation, 4 zombie (debt < 2,000 BOLD after redemption; unredeemable until topped up).
read getCurrentICR(uint256,uint256)
(_troveId, _price) -> ICR (1e18 = 100%). Price from PriceFeed.lastGoodPrice(). Liquidatable when ICR < MCR (120%).
read getTroveAnnualInterestRate(uint256)
Trove's annual rate (1e18 = 100%; batch rate if batched).
read getTroveIdsCount()
Number of Troves in the branch.
read getTroveFromTroveIdsArray(uint256)
Trove id at index (for enumeration).
write batchLiquidateTroves(uint256[])
Permissionless liquidation of Troves with ICR < MCR. Liquidator earns 0.5% of the collateral (capped at 2 units) plus the 0.0375 WETH gas deposit per Trove. Debt is offset by the branch Stability Pool (SP depositors get collateral at a 5% penalty discount) or, if the SP is empty, redistributed to other Troves (up to 20% penalty).
write urgentRedemption(uint256,uint256[],uint256)
Only after branch shutdown: (_boldAmount, _troveIds, _minCollateral) redeem BOLD from chosen Troves with a 2% collateral bonus and no fee.
StabilityPool (wstETH branch)staking on ethereum0x9502b7c397E9aa22FE9dB7EF7DAF21cD2AEBe56B
write provideToSP(uint256,bool)
(_topUp, _doClaim): deposit BOLD (no approve needed). Earns 75% of the branch's interest (in BOLD) plus wstETH from liquidations. _doClaim=true pays out pending BOLD yield and wstETH gains; false compounds the yield into the deposit and stashes the wstETH.
write withdrawFromSP(uint256,bool)
(_amount, _doClaim): withdraw BOLD (amount above your deposit withdraws all). Pool must keep >= 1 BOLD total. Withdraw with _doClaim=true to also receive gains.
write claimAllCollGains()
Claim stashed collateral gains; only when you have no deposit left.
read getCompoundedBoldDeposit(address)
Current BOLD deposit after liquidation losses (18 decimals).
read getDepositorYieldGainWithPending(address)
Claimable BOLD interest yield incl. not-yet-minted interest.
read getDepositorCollGain(address)
Pending wstETH gain from liquidations (excl. stashed; see stashedColl(address)).
read stashedColl(address)
Collateral gains stashed by earlier _doClaim=false operations.
read getTotalBoldDeposits()
Total BOLD in this pool.
SortedTroves (wstETH branch)other on ethereum0x84eb85a8C25049255614F0536Bea8F31682e86F1
read findInsertPosition(uint256,uint256,uint256)
(_annualInterestRate, _prevId, _nextId) -> (upperHint, lowerHint): exact hints for openTrove / adjustTroveInterestRate. Pass HintHelpers.getApproxHint result as both _prevId and _nextId.
read getLast()
Trove with the LOWEST interest rate (the next to be redeemed).
read getFirst()
Trove with the highest interest rate.
read getNext(uint256)
Next Trove toward lower rates.
read getPrev(uint256)
Previous Trove toward higher rates.
read getSize()
Number of Troves in the list (zombie Troves are not in it).
GasCompZapper (wstETH branch, ETH gas deposit)router on ethereum0xBD69D3e0eA967d146E925b7572B765c8E9C4127D
write openTroveWithRawETH((address,uint256,uint256,uint256,uint256,uint256,uint256,address,uint256,address,address,address))
Open a wstETH Trove sending exactly 0.0375 ETH (msg.value) as the gas deposit instead of WETH. Approve collAmount of wstETH to the zapper. Struct: (owner, ownerIndex, collAmount, boldAmount, upperHint, lowerHint, annualInterestRate, batchManager, maxUpfrontFee, addManager, removeManager, receiver). The zapper stays manager so later zapper calls work.
write addColl(uint256,uint256)
(_troveId, _amount): add wstETH via zapper (approve to zapper).
write withdrawColl(uint256,uint256)
(_troveId, _amount): withdraw wstETH.
write adjustTrove(uint256,uint256,bool,uint256,bool,uint256)
(_troveId, _collChange, _isCollIncrease, _boldChange, _isDebtIncrease, _maxUpfrontFee) via zapper.
write repayBold(uint256,uint256)
(_troveId, _boldAmount): approve BOLD to the zapper first.
write withdrawBold(uint256,uint256,uint256)
(_troveId, _boldAmount, _maxUpfrontFee).
write closeTroveToRawETH(uint256)
(_troveId): pulls entireDebt BOLD from msg.sender (approve first), returns wstETH and the 0.0375 gas deposit as ETH.
PriceFeed (wstETH branch)other on ethereum0xe7Aa2Ba9E086A379d3beb224098bC634a46e314E
read lastGoodPrice()
Last valid wstETH price in USD (18 decimals) used for ICR; pass to TroveManager.getCurrentICR.
write fetchPrice()
Refreshes and returns (price, oracleFailureDetected). Non-view; use eth_call to read a fresh price. An oracle failure shuts the branch down.
TroveNFT (wstETH branch)token on ethereum0x857aECeBF75f1012DC18E15020C97096aeA31b04
read ownerOf(uint256)
Owner of a Trove (tokenId = troveId). The NFT owner controls the Trove; transferring it transfers the position.
read balanceOf(address)
Number of Troves owned on this branch.
write transferFrom(address,address,uint256)
Transfer a Trove position.
BorrowerOperations (rETH branch)other on ethereum0xe8119fC02953B27a1b48D2573855738485A17329
write openTrove(address,uint256,uint256,uint256,uint256,uint256,uint256,uint256,address,address,address)
Open a Trove: (_owner, _ownerIndex, _collAmount, _boldAmount, _upperHint, _lowerHint, _annualInterestRate, _maxUpfrontFee, _addManager, _removeManager, _receiver). First approve rETH (collAmount) and 0.0375 WETH (gas deposit) to BorrowerOperations. Interest rate 1e18 = 100%, min 0.5% (5e15), max 250%. Debt incl. upfront fee must be >= 2,000 BOLD and ICR >= MCR 120% (and the branch TCR must stay >= CCR 160%). _maxUpfrontFee from HintHelpers.predictOpenTroveUpfrontFee. Hints from HintHelpers.getApproxHint + SortedTroves.findInsertPosition (0,0 works but costs more gas). Managers/receiver can be address(0). Returns troveId = uint256(keccak256(abi.encode(msg.sender, _owner, _ownerIndex))); an ERC-721 for it is minted to _owner and BOLD to msg.sender.
write adjustTrove(uint256,uint256,bool,uint256,bool,uint256)
(_troveId, _collChange, _isCollIncrease, _boldChange, _isDebtIncrease, _maxUpfrontFee): add/withdraw collateral and borrow/repay in one call. Borrowing more charges an upfront fee (7 days of branch average interest). Resulting ICR must stay >= MCR, debt >= 2,000 BOLD; below CCR (Critical mode) borrowing is only allowed if it lifts TCR above CCR.
write addColl(uint256,uint256)
(_troveId, _collAmount): add collateral (approve the collateral token first).
write withdrawColl(uint256,uint256)
(_troveId, _collWithdrawal): withdraw collateral; ICR must stay >= MCR.
write withdrawBold(uint256,uint256,uint256)
(_troveId, _boldAmount, _maxUpfrontFee): borrow more BOLD; upfront fee applies (predictAdjustTroveUpfrontFee).
write repayBold(uint256,uint256)
(_troveId, _boldAmount): repay debt; cannot take debt below 2,000 BOLD (close the Trove instead). No approve needed.
write adjustTroveInterestRate(uint256,uint256,uint256,uint256,uint256)
(_troveId, _newAnnualInterestRate, _upperHint, _lowerHint, _maxUpfrontFee): set a new rate (1e18 = 100%). Free once per 7 days; a change within 7 days of the last one pays an upfront fee of 7 days' average interest. Lower rates are redeemed first. Not for Troves in a batch.
write closeTrove(uint256)
(_troveId): repay the entire debt (TroveManager.getLatestTroveData(id).entireDebt, incl. accrued interest) from msg.sender's BOLD and get all collateral plus the 0.0375 WETH gas deposit back. Caller must be owner or remove-manager. Reverts if it would push branch TCR below CCR (unless the branch is shut down).
write adjustZombieTrove(uint256,uint256,bool,uint256,bool,uint256,uint256,uint256)
Adjust a 'zombie' Trove (debt < 2,000 BOLD after redemption): (_troveId, _collChange, _isCollIncrease, _boldChange, _isDebtIncrease, _upperHint, _lowerHint, _maxUpfrontFee). Result must have debt >= 2,000 and ICR >= MCR.
write claimCollateral()
Claim surplus collateral left after your Trove was liquidated or fully redeemed (held in CollSurplusPool).
write setInterestBatchManager(uint256,address,uint256,uint256,uint256)
(_troveId, _newBatchManager, _upperHint, _lowerHint, _maxUpfrontFee): delegate rate management to a registered batch manager (pays its management fee; batched Troves need ICR >= MCR + 10%).
read MCR()
Minimum collateral ratio, 1e18 = 100% (120% on this branch).
read CCR()
Critical collateral ratio for the branch TCR (160%).
read hasBeenShutDown()
True if the branch is shut down (TCR fell below SCR 120% or oracle failure): only closing Troves and urgent redemptions then work.
read getEntireBranchDebt()
Total branch debt in BOLD (18 decimals).
TroveManager (rETH branch)other on ethereum0xb2B2ABEb5C357a234363FF5D180912D319e3e19e
read getLatestTroveData(uint256)
Trove state incl. pending interest: (entireDebt, entireColl, redistBoldDebtGain, redistCollGain, accruedInterest, recordedDebt, annualInterestRate, weightedRecordedDebt, accruedBatchManagementFee, lastInterestRateAdjTime). entireDebt is what closeTrove needs.
read getTroveStatus(uint256)
0 nonExistent, 1 active, 2 closedByOwner, 3 closedByLiquidation, 4 zombie (debt < 2,000 BOLD after redemption; unredeemable until topped up).
read getCurrentICR(uint256,uint256)
(_troveId, _price) -> ICR (1e18 = 100%). Price from PriceFeed.lastGoodPrice(). Liquidatable when ICR < MCR (120%).
read getTroveAnnualInterestRate(uint256)
Trove's annual rate (1e18 = 100%; batch rate if batched).
read getTroveIdsCount()
Number of Troves in the branch.
read getTroveFromTroveIdsArray(uint256)
Trove id at index (for enumeration).
write batchLiquidateTroves(uint256[])
Permissionless liquidation of Troves with ICR < MCR. Liquidator earns 0.5% of the collateral (capped at 2 units) plus the 0.0375 WETH gas deposit per Trove. Debt is offset by the branch Stability Pool (SP depositors get collateral at a 5% penalty discount) or, if the SP is empty, redistributed to other Troves (up to 20% penalty).
write urgentRedemption(uint256,uint256[],uint256)
Only after branch shutdown: (_boldAmount, _troveIds, _minCollateral) redeem BOLD from chosen Troves with a 2% collateral bonus and no fee.
StabilityPool (rETH branch)staking on ethereum0xd442E41019B7F5C4dD78F50dc03726C446148695
write provideToSP(uint256,bool)
(_topUp, _doClaim): deposit BOLD (no approve needed). Earns 75% of the branch's interest (in BOLD) plus rETH from liquidations. _doClaim=true pays out pending BOLD yield and rETH gains; false compounds the yield into the deposit and stashes the rETH.
write withdrawFromSP(uint256,bool)
(_amount, _doClaim): withdraw BOLD (amount above your deposit withdraws all). Pool must keep >= 1 BOLD total. Withdraw with _doClaim=true to also receive gains.
write claimAllCollGains()
Claim stashed collateral gains; only when you have no deposit left.
read getCompoundedBoldDeposit(address)
Current BOLD deposit after liquidation losses (18 decimals).
read getDepositorYieldGainWithPending(address)
Claimable BOLD interest yield incl. not-yet-minted interest.
read getDepositorCollGain(address)
Pending rETH gain from liquidations (excl. stashed; see stashedColl(address)).
read stashedColl(address)
Collateral gains stashed by earlier _doClaim=false operations.
read getTotalBoldDeposits()
Total BOLD in this pool.
SortedTroves (rETH branch)other on ethereum0x14d8d8011dF2b396Ed2bbC4959bb73250324F386
read findInsertPosition(uint256,uint256,uint256)
(_annualInterestRate, _prevId, _nextId) -> (upperHint, lowerHint): exact hints for openTrove / adjustTroveInterestRate. Pass HintHelpers.getApproxHint result as both _prevId and _nextId.
read getLast()
Trove with the LOWEST interest rate (the next to be redeemed).
read getFirst()
Trove with the highest interest rate.
read getNext(uint256)
Next Trove toward lower rates.
read getPrev(uint256)
Previous Trove toward higher rates.
read getSize()
Number of Troves in the list (zombie Troves are not in it).
GasCompZapper (rETH branch, ETH gas deposit)router on ethereum0xbE8B230dCd12E246F5eDc5c103CC98be68ab636F
write openTroveWithRawETH((address,uint256,uint256,uint256,uint256,uint256,uint256,address,uint256,address,address,address))
Open a rETH Trove sending exactly 0.0375 ETH (msg.value) as the gas deposit instead of WETH. Approve collAmount of rETH to the zapper. Struct: (owner, ownerIndex, collAmount, boldAmount, upperHint, lowerHint, annualInterestRate, batchManager, maxUpfrontFee, addManager, removeManager, receiver). The zapper stays manager so later zapper calls work.
write addColl(uint256,uint256)
(_troveId, _amount): add rETH via zapper (approve to zapper).
write withdrawColl(uint256,uint256)
(_troveId, _amount): withdraw rETH.
write adjustTrove(uint256,uint256,bool,uint256,bool,uint256)
(_troveId, _collChange, _isCollIncrease, _boldChange, _isDebtIncrease, _maxUpfrontFee) via zapper.
write repayBold(uint256,uint256)
(_troveId, _boldAmount): approve BOLD to the zapper first.
write withdrawBold(uint256,uint256,uint256)
(_troveId, _boldAmount, _maxUpfrontFee).
write closeTroveToRawETH(uint256)
(_troveId): pulls entireDebt BOLD from msg.sender (approve first), returns rETH and the 0.0375 gas deposit as ETH.
PriceFeed (rETH branch)other on ethereum0x34F1E9c7dcc279ec70d3c4488EB2D80FBa8B7b2B
read lastGoodPrice()
Last valid rETH price in USD (18 decimals) used for ICR; pass to TroveManager.getCurrentICR.
write fetchPrice()
Refreshes and returns (price, oracleFailureDetected). Non-view; use eth_call to read a fresh price. An oracle failure shuts the branch down.
TroveNFT (rETH branch)token on ethereum0x7ae430E25b67f19B431e1D1Dc048a5BCF24C0873
read ownerOf(uint256)
Owner of a Trove (tokenId = troveId). The NFT owner controls the Trove; transferring it transfers the position.
read balanceOf(address)
Number of Troves owned on this branch.
write transferFrom(address,address,uint256)
Transfer a Trove position.