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 the configurator 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

function mint(address to, uint256 amount) external onlyMintVault MintPaused returns (bool)

Allow the vault contract to call this mint function to mint peUSD tokens for users.

Parameters

NameTypeDescription

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

function burn(address account, uint256 amount) external onlyMintVault BurnPaused returns (bool)

Allow the vault contract to call this function Burns a specific amount of peUSD tokens from the specified address.

Parameters

NameTypeDescription

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

function convertToPeUSD(address user, uint256 eusdAmount) public

Allows the user to deposit eUSD and mint peUSD tokens.

Parameters

NameTypeDescription

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

function convertToPeUSDAndCrossChain(
    uint256 eusdAmount,
    uint16 _dstChainId,
    bytes32 _toAddress,
    LzCallParams calldata _callParams
) external payable

Allows users to deposit eUSD and mint peUSD tokens, which can be directly bridged to other networks.

Parameters:

ParameterTypeDescription

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

solidityCopy codefunction convertToEUSD(uint256 peusdAmount) external

Allows users to repay PeUSD tokens and retrieve eUSD.

Parameters

NameTypeDescription

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 to peusdAmount.

sendFrom

solidityCopy codefunction sendFrom(
    address _from,
    uint16 _dstChainId,
    bytes32 _toAddress,
    uint256 _amount,
    LzCallParams calldata _callParams
) public payable virtual override

Sends tokens from a specific address to a destination address on another chain.

Parameters:

NameTypeDescription

_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

solidityCopy codefunction sendAndCall(
    address _from,
    uint16 _dstChainId,
    bytes32 _toAddress,
    uint256 _amount,
    bytes calldata _payload,
    uint64 _dstGasForCall,
    LzCallParams calldata _callParams
) public payable virtual override

Sends tokens from a specific address to a destination address on another chain and invokes a contract call on the destination chain.

Parameters:

NameTypeDescription

_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

function executeFlashloan(
    FlashBorrower receiver,
    uint256 eusdAmount,
    bytes calldata data
) public payable

Allows users to lend out any amount of eUSD for flash loan calls.

Parameters

ParameterTypeDescription

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

function getFee(uint256 share) public view returns (uint256)

Calculates the fee owed for the loaned tokens.

Parameters

NameTypeDescription

share

uint256

The amount of borrowed shares.

Returns:

  • The amount of shares you need to pay as a fee.

getAccruedEUSDInterest

function getAccruedEUSDInterest(address user) public view returns (uint256 eusdAmount)

Returns the interest of eUSD locked by the user.

Parameters

NameTypeDescription

user

address

The address of the user.

Returns:

  • The interest earned by the user.

Last updated