What you can do
| open-trove | Lock ETH and borrow LUSD | send ETH as value to BorrowerOperations.openTrove(maxFee, LUSDAmount, upperHint, lowerHint); LUSDAmount must be at least 1800 LUSD and the 200 LUSD gas compensation is added to the debt on top; no approval needed |
| repay | Repay LUSD debt | BorrowerOperations.repayLUSD(amount, upperHint, lowerHint); the caller needs the LUSD in its wallet; no approval needed |
| adjust-collateral | Add or remove ETH collateral | addColl with ETH value to add, or withdrawColl(amount, upperHint, lowerHint) to remove; the trove must stay above 110 percent |
| close-trove | Repay everything and get the ETH back | hold LUSD for the debt minus 200 LUSD, then call BorrowerOperations.closeTrove(); not possible in recovery mode |
| stability-deposit | Earn ETH from liquidations | StabilityPool.provideToSP(amount, zeroAddress) after holding LUSD; no approval needed |
| claim-stability-gains | Claim ETH and LQTY gains from the Stability Pool | StabilityPool.withdrawFromSP(0) for a depositor |
| stake-lqty | Stake LQTY to earn fee income | LQTYStaking.stake(amount); LQTYStaking.unstake(0) claims gains |
| redeem-lusd | Swap LUSD for ETH at face value | get hints from HintHelpers.getRedemptionHints(amount, price, maxIterations), then TroveManager.redeemCollateral(...) |
The contracts are immutable. No admin can pause them or fix a bug after deployment.
A trove is liquidated when its collateral ratio falls below 110 percent. Keep a margin and watch the ETH price.
While the whole system is below 150 percent collateral, recovery mode blocks some actions and changes the withdrawal rule.
Any LUSD holder can redeem against your trove at face value. A redemption closes or shrinks your trove and you receive ETH at the oracle price.
Contracts
Read any function, or build a write and sign it. Amounts are in base units (1 USDC = 1000000).BorrowerOperations (trove entry point)router on ethereum0x24179CD81c9e782A4096035f7eC97fB8B783e007
write openTrove(uint256,uint256,address,address)
Open a trove. Send ETH as the value (collateral). Arguments: maxFeePercentage (1e18 is 100 percent, so 0.5 percent is 5e15), LUSDAmount in wei (at least 1800 LUSD; the 200 LUSD gas compensation and the borrowing fee are added to the debt on top), upperHint and lowerHint (sorted-list position hints; get them from HintHelpers.getApproxHint).
write adjustTrove(uint256,uint256,uint256,bool,address,address)
Change collateral and debt in one call. Arguments: maxFeePercentage, collWithdrawal (ETH to take out in wei), LUSDChange (LUSD to borrow or repay), isDebtIncrease (true to borrow more, false to repay), upperHint, lowerHint. Send ETH as value to add collateral.
write addColl(address,address)
Add ETH collateral to an open trove. Send ETH as the value. Arguments: upperHint, lowerHint.
write withdrawColl(uint256,address,address)
Withdraw ETH collateral. Arguments: collWithdrawal in wei, upperHint, lowerHint. Reverts if the trove would drop below 110 percent collateral ratio (150 percent while the system is in recovery mode).
write withdrawLUSD(uint256,uint256,address,address)
Borrow more LUSD against an open trove. Arguments: maxFeePercentage, LUSDAmount, upperHint, lowerHint. The borrowing fee is added to the debt.
write repayLUSD(uint256,address,address)
Repay LUSD debt. Arguments: LUSDAmount, upperHint, lowerHint. No approval is needed: the LUSD is burned from the caller's balance.
write closeTrove()
Close the trove. The caller must hold LUSD equal to the debt minus the 200 LUSD gas compensation. The ETH collateral is sent back to the caller in the same transaction.
write claimCollateral()
Claim ETH left in the surplus pool after a redemption, or after a liquidation in recovery mode.
TroveManagerother on ethereum0xA39739EF8b0231DbFA0DcdA07d7e29faAbCf4bb2
write liquidate(address)
Liquidate a trove whose collateral ratio is below 110 percent. Anyone can call it. Argument: the borrower address. The caller receives gas compensation in LUSD and ETH.
write redeemCollateral(uint256,address,address,address,uint256,uint256,uint256)
Swap LUSD for ETH at face value, taking collateral from the lowest-collateralized troves first. Arguments: LUSDamount, firstRedemptionHint, upperPartialRedemptionHint, lowerPartialRedemptionHint, partialRedemptionHintNICR, maxIterations (caps how many troves the call processes), maxFeePercentage. Get the hints from HintHelpers.getRedemptionHints.
read getEntireDebtAndColl(address)
Returns collateral, debt, and pending ETH and LUSD rewards from liquidations for a trove. Amounts are in wei.
read getTroveStatus(address)
Trove status code: 0 does not exist, 1 active, 2 closed by owner, 3 closed by liquidation, 4 closed by redemption.
read getCurrentICR(address,uint256)
Current collateral ratio of a trove. Arguments: borrower, ETH price in USD with 18 decimals. 1e18 means 100 percent.
read getTroveOwnersCount()
Number of troves currently open.
StabilityPoolpool on ethereum0x66017D22b0f8556afDd19FC67041899Eb65a21bb
write provideToSP(uint256,address)
Deposit LUSD into the Stability Pool. Arguments: amount in wei, frontEndTag (zero address if no front end). No approval is needed. Starts earning liquidated ETH and LQTY rewards. Not allowed for addresses that are registered front ends.
write withdrawFromSP(uint256)
Withdraw LUSD from the pool. Argument: amount in wei. Passing 0 only claims the ETH and LQTY gains. A non-zero withdrawal reverts while any trove is under-collateralized and waiting for liquidation.
write withdrawETHGainToTrove(address,address)
Move accrued ETH gains into your trove as collateral without withdrawing LUSD. Arguments: upperHint, lowerHint.
read getDepositorETHGain(address)
ETH gain available to a depositor, in wei.
read getDepositorLQTYGain(address)
LQTY gain available to a depositor, in wei.
read getCompoundedLUSDDeposit(address)
Current LUSD value of a depositor's stake after any liquidation losses.
read getTotalLUSDDeposits()
Total LUSD held in the Stability Pool.
LUSD tokentoken on ethereum0x5f98805A4E8be255a32880FDeC7F6728C6568bA0
read balanceOf(address)
LUSD balance of an address, in wei (18 decimals).
write transfer(address,uint256)
Send LUSD to an address. Amount in wei.
write approve(address,uint256)
Let a third-party contract pull LUSD with transferFrom. The Liquity contracts do not need this approval.
LQTYStakingstaking on ethereum0x4f9Fbb3f1E99B56e0Fe2892e623Ed36A76Fc605d
write stake(uint256)
Stake LQTY to earn a share of protocol fees paid in ETH and LUSD. Argument: amount in wei. No approval is needed. Any pending gains are paid out first.
write unstake(uint256)
Unstake LQTY. Argument: amount in wei. Passing 0 only claims the pending ETH and LUSD gains.
read getPendingETHGain(address)
Pending ETH fee gain for a staker, in wei.
read getPendingLUSDGain(address)
Pending LUSD fee gain for a staker, in wei.
read stakes(address)
Amount of LQTY a user has staked, in wei.
HintHelpersother on ethereum0xE84251b93D9524E0d2e621Ba7dc7cb3579F997C0
read getApproxHint(uint256,uint256,uint256)
Approximate sorted-list position for a new or adjusted trove. Arguments: nominal collateral ratio (1e18 scale), number of trials, random seed (use any number). Returns a hint address to pass as upperHint or lowerHint.
read getRedemptionHints(uint256,uint256,uint256)
Hints for redeemCollateral. Arguments: LUSD amount to redeem, ETH price with 18 decimals, maxIterations. Returns the first redemption hint, the partial redemption hint NICR, and the LUSD amount that will actually be redeemed.