peUSD Token
Overview
peUSD is a stable, interest-free ERC20-like token minted through eUSD in the Lybra protocol. It is pegged to 1eUSD and does not undergo rebasing. The token operates by allowing users to deposit eUSD and mint an equivalent amount of peUSD. When users redeem peUSD, they can retrieve the corresponding proportion of eUSD. As a result, users can utilize peUSD without sacrificing the yield on their eUSD holdings.
In addition to minting peUSD by using eUSD as collateral, peUSD can also be minted by depositing assets (such as WstETH) into non-rebase asset vaults.
peUSD leverages the LayerZero's OFT protocol to enable native cross-chain functionality, allowing seamless transfers and interactions across different blockchain networks. By integrating with OFT, peUSD is not constrained by liquidity pools and can freely move between chains. This interoperability enhances the versatility and utility of peUSD, empowering users with the ability to utilize peUSD's stable value and features across multiple blockchain ecosystems.
Contract Details
Name: PeUSDMainnet
Token Symbol: peUSD
License: GPL-3.0
Decimals: 18
Flash Loan Usage
The peUSD contract supports flash loans, allowing users to borrow eUSD tokens for temporary use. To use the flash loan feature, implement the FlashBorrower
interface in your contract and call the executeFlashloan
function, specifying the receiver contract and the amount of eUSD to borrow.
Additional Notes
The maximum supply of peUSD tokens is configured through the
getPeUSDMaxSupply
function in theconfigurator
contract.The peUSD token uses the Layer Zero OFT (One-For-Three) mechanism for cross-chain transfers.
For more information about the contract and its functionalities, please refer to the contract source code.
Function Overview
mint
mint
Allow the vault contract to call this mint function to mint peUSD tokens for users.
Parameters
to
address
The address to which the minted peUSD tokens will be assigned.
amount
uint256
The amount of peUSD tokens to mint.
Returns
bool
: A boolean value indicating the success of the mint operation.
burn
burn
Allow the vault contract to call this function Burns a specific amount of peUSD tokens from the specified address.
Parameters
account
address
The address from which the peUSD tokens will be burned.
amount
uint256
The amount of peUSD tokens to burn.
Returns
bool
: A boolean value indicating the success of the burn operation.
convertToPeUSD
convertToPeUSD
Allows the user to deposit eUSD and mint peUSD tokens.
Parameters
user
address
The address of the user who wants to deposit eUSD and mint peUSD.
eusdAmount
uint256
The amount of eUSD to deposit and mint peUSD tokens.
convertToPeUSDAndCrossChain
convertToPeUSDAndCrossChain
Allows users to deposit eUSD and mint peUSD tokens, which can be directly bridged to other networks.
Parameters:
eusdAmount
uint256
The amount of eUSD to deposit and mint peUSD tokens.
eusdAmount
uint16
The chain ID of the target network.
_toAddress
bytes32
The receiving address after cross-chain transfer.
_callParams
LzCallParams calldata
Additional parameters.
convertToEUSD
convertToEUSD
Allows users to repay PeUSD tokens and retrieve eUSD.
Parameters
peusdAmount
uint256
The amount of PeUSD tokens to burn and retrieve eUSD.
Requirements:
The
peusdAmount
must be greater than 0.The user's
mintedPeUSD
must be greater than or equal topeusdAmount
.
sendFrom
Sends tokens from a specific address to a destination address on another chain.
Parameters:
_from
address
The address from which the tokens will be sent.
_dstChainId
uint16
The chain ID of the destination chain.
_toAddress
bytes32
The address on the destination chain.
_amount
uint256
The amount of tokens to be sent.
_callParams
LzCallParams
Additional parameters for the call.
sendAndCall
Sends tokens from a specific address to a destination address on another chain and invokes a contract call on the destination chain.
Parameters:
_from
address
The address from which the tokens will be sent.
_dstChainId
uint16
The chain ID of the destination chain.
_toAddress
bytes32
The address on the destination chain.
_amount
uint256
The amount of tokens to be sent.
_payload
bytes
The payload data for the contract call.
_dstGasForCall
uint64
The amount of gas to be allocated for the contract call on the destination chain.
_callParams
LzCallParams
Additional parameters for the call.
executeFlashloan
executeFlashloan
Allows users to lend out any amount of eUSD for flash loan calls.
Parameters
receiver
address
The address of the contract that will receive the borrowed eUSD.
eusdAmount
uint256
The amount of eUSD to lend out.
data
bytes
The data to be passed to the receiver contract for execution.
View Functions
getFee
getFee
Calculates the fee owed for the loaned tokens.
Parameters
share
uint256
The amount of borrowed shares.
Returns:
The amount of shares you need to pay as a fee.
getAccruedEUSDInterest
getAccruedEUSDInterest
Returns the interest of eUSD locked by the user.
Parameters
user
address
The address of the user.
Returns:
The interest earned by the user.
Last updated