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.
function balanceOf(address user) public view returns (uint256)
Calculates the balance of the user: principal balance + interest generated by the principal
The user whose balance is calculated
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.
The user whose balance is calculated
The scaled balance of the user
getScaledUserBalanceAndSupply
function getScaledUserBalanceAndSupply(address user) external view returns (uint256, uint256)
Returns the scaled balance of the user and the scaled total supply.
The scaled balance of the user
The scaled balance and the scaled total supply
UNDERLYING_ASSET_ADDRESS
function UNDERLYING_ASSET_ADDRESS() public view returns (address)
Returns the address of the underlying asset of this uToken.
the underlying address of this uToken
RESERVE_TREASURY_ADDRESS
function RESERVE_TREASURY_ADDRESS() public view returns (address)
Returns the address of the Unlockd treasury, receiving the fees on this uToken
the addres of the treasury wallet or contract
scaledTotalSupply
function scaledTotalSupply() public view virtual returns (uint256)
Returns the scaled total supply of the variable debt token. Represents sum(debt/index).
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.
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.
The owner of the uTokens, getting them burned
The address that will receive the underlying
The new liquidity index of the reserve
function mint(address user, uint256 amount, uint256 index) external returns (bool)
Mints amount uTokens to the user. This happens after a deposit.
The address receiving the minted tokens
The amount of tokens getting minted
The new liquidity index of the reserve
true if the the previous balance of the user was 0
function mintToTreasury(uint256 amount, uint256 index) external
Mints uTokens to the treasury wallet or contract address.
The amount of tokens getting minted
The new liquidity index of the reserve
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()
The recipient of the uTokens
The amount getting transferred