BTB
/

JustLend V1

Lendingwebsite
Compound V2 style lending market on TRON. Supply TRX or TRC20 assets to receive jTokens, borrow against collateral, and repay or redeem. Rates follow supply and demand through the interest rate model.

What you can do

supply-trxSupply TRX to earn interestcall jTRX.mint() with TRX as call value; jTRX is credited to the caller
supply-usdtSupply USDT to earn interestUSDT.approve(jUSDT, amount), then jUSDT.mint(amount)
enable-collateralUse a market as collateralUnitroller.enterMarkets([jTokenAddress])
borrowBorrow against collateralcheck getAccountLiquidity(user) shows liquidity, then call the borrow market's borrow(amount)
repayRepay a borrowapprove the underlying token for the jToken market, then jToken.repayBorrow(amount); TRX markets use the jTRX payable call
withdrawRedeem supplied assetsjToken.redeem(jTokenAmount) or jToken.redeemUnderlying(underlyingAmount)
Accounts can be liquidated when their borrows exceed their collateral limit. Check getAccountLiquidity after each borrow and after price moves.
Most JustLend functions return an error code instead of reverting. Check the return value, not only the transaction status.
Interest is accrued lazily. Stored balances and rates can be stale until accrueInterest runs.
Rates are set by supply and demand through the interest rate model and change with utilization.

Contracts

Read any function, or build a write and sign it. Amounts are in base units (1 USDC = 1000000).
Unitroller (Comptroller entrypoint)pool on tronTGjYzgCyPobsNS9n6WcbdLVR9dH7mWqFx7
write enterMarkets(address[])
Use the given jToken markets as collateral for the caller. Argument: array of jToken addresses. Returns an array of error codes (0 is success). Call before borrowing against a market.
write exitMarket(address)
Stop using a jToken market as collateral. Argument: jToken address. Reverts (returns an error code) if the caller would be left under-collateralized or still has a borrow in that market.
read getAccountLiquidity(address)
Returns (error, liquidity, shortfall) for an account. Liquidity and shortfall are scaled by 1e18 in the oracle's USD units. A non-zero shortfall means the account can be liquidated.
read getAssetsIn(address)
jToken markets an account is using as collateral.
read getAllMarkets()
All jToken market addresses listed in the Comptroller.
read markets(address)
Returns (isListed, collateralFactorMantissa, isComped) for a jToken. The collateral factor is scaled by 1e18.
read closeFactorMantissa()
Maximum share of a borrow that a liquidator can repay at once, scaled by 1e18.
read liquidationIncentiveMantissa()
Liquidation bonus multiplier, scaled by 1e18.
read oracle()
Price oracle address used for collateral and borrow limits.
jTRXtoken on tronTE2RzoSV3wFK99w6J9UnnZ4vLfXYoxvRwP
write mint()
Supply TRX. Send TRX as call value; jTRX is minted to the caller at the current exchange rate. No approval needed because the asset is native TRX.
write redeem(uint256)
Burn jTRX and receive TRX. Argument: jTRX amount. Returns an error code (0 is success).
write redeemUnderlying(uint256)
Burn jTRX and receive an exact TRX amount in sun. Returns an error code (0 is success).
write borrow(uint256)
Borrow TRX in sun against collateral. Reverts with an error code if the account has insufficient liquidity or the market is paused.
read balanceOf(address)
jTRX balance of an address. Multiply by exchangeRateStored to get the TRX value.
read exchangeRateStored()
TRX per jTRX, scaled by 1e18. Last stored value; accrueInterest is needed for the current rate.
read borrowBalanceStored(address)
Stored TRX borrow balance of an address, in sun.
read supplyRatePerBlock()
Current supply interest rate per block, scaled by 1e18.
read borrowRatePerBlock()
Current borrow interest rate per block, scaled by 1e18.
write accrueInterest()
Update the market's interest accrual to the current block. Call before reading exact current balances.
jUSDTtoken on tronTXJgMdjVX5dKiQaUi9QobwNxtSQaFqccvd
write mint(uint256)
Supply USDT. Approve the jUSDT contract to spend the amount on the USDT token first. Argument: USDT amount in its smallest unit. Returns an error code (0 is success).
write redeem(uint256)
Burn jUSDT and receive USDT. Argument: jUSDT amount. Returns an error code (0 is success).
write redeemUnderlying(uint256)
Burn jUSDT and receive an exact USDT amount. Returns an error code (0 is success).
write borrow(uint256)
Borrow USDT against collateral. Argument: USDT amount in its smallest unit. Returns an error code (0 is success).
write repayBorrow(uint256)
Repay USDT debt. Approve the jUSDT contract to spend the amount on the USDT token first. Argument: USDT amount to repay in its smallest unit. Returns an error code (0 is success).
read balanceOf(address)
jUSDT balance of an address.
read exchangeRateStored()
USDT per jUSDT, scaled by 1e18. Last stored value.
read borrowBalanceStored(address)
Stored USDT borrow balance of an address.
read supplyRatePerBlock()
Current supply interest rate per block, scaled by 1e18.
read borrowRatePerBlock()
Current borrow interest rate per block, scaled by 1e18.
read underlying()
Address of the underlying USDT TRC20 contract.