uTokens

uToken.sol

The uTokens are the implementation of the interest-bearing token for the Unlockd protocol. They are the reserves, where all the underlying tokens will be stored.

View Methods

balanceOf

function balanceOf(address user) public view returns (uint256)

Calculates the balance of the user: principal balance + interest generated by the principal

Call Params

Return Values

scaledBalanceOf

function scaledBalanceOf(address user) external view returns (uint256)

Returns the scaled balance of the user. The scaled balance is the sum of all the updated stored balances divided by the reserve's liquidity index at the moment of the update.

Call Params

Return Values

getScaledUserBalanceAndSupply

function getScaledUserBalanceAndSupply(address user) external view returns (uint256, uint256)

Returns the scaled balance of the user and the scaled total supply.

Call Params

Return Values

UNDERLYING_ASSET_ADDRESS

function UNDERLYING_ASSET_ADDRESS() public view returns (address)

Returns the address of the underlying asset of this uToken.

Return Values

RESERVE_TREASURY_ADDRESS

function RESERVE_TREASURY_ADDRESS() public view returns (address)

Returns the address of the Unlockd treasury, receiving the fees on this uToken

Return Values

scaledTotalSupply

function scaledTotalSupply() public view virtual returns (uint256)

Returns the scaled total supply of the variable debt token. Represents sum(debt/index).

Return Values

totalSupply

function totalSupply() public view returns (uint256)

Calculates the total supply of the specific uToken since the balance of every single user increases over time. The total supply does that too.

Return Values

Write Methods

burn

function burn(address user, address receiverOfUnderlying, uint256 amount, uint256 index) external

Burns uTokens from user and sends the equivalent amount of underlying to receiverOfUnderlying. This happens after a withdrawal.

Only callable by the LendPool

Call Params

mint

function mint(address user, uint256 amount, uint256 index) external returns (bool)

Mints amount uTokens to the user. This happens after a deposit.

Only callable by the LendPool.

Call Params

Return Values

mintToTreasury

function mintToTreasury(uint256 amount, uint256 index) external

Mints uTokens to the treasury wallet or contract address.

Only callable by the LendPool

Call Params

transferUnderlyingTo

function transferUnderlyingTo(address target, uint256 amount) external returns (uint256)

Transfers the underlying asset to target. Used by the LendPool to transfer assets in borrow(), withdraw() and flashLoan()

Call Params

Return Values

Last updated