Lemma
Search…
LemmaRouter
LemmaRouter is helper contract that facilitates interacting with Lemma's core contracts

Public Functions

mintUSDL

Function purpose: msg.sender deposits WETH and mints USDL.
function mintUSDL(
uint256 amount,
uint256 maxCollateralRequired,
uint256 dexIndex,
IERC20 collateral) public
Parameters
Description
Attribute
amount
Amount of USDL to be minted.
USD, 18 decimals
maxCollateralRequired
Max amount of WETH to be deposited to mint the USDL amount above.
WETH, 18 decimals
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer
collateral
IERC20 for type of asset to be deposited as collateral on the derivative dex.
ERC20 address, initially will be just WETH - 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1​

mintUSDLTo

Function purpose: msg.sender deposits WETH and mints USDL to a given address.
function mintUSDLTo(
address to,
uint256 amount,
uint256 maxCollateralRequired,
uint256 dexIndex,
IERC20 collateral) public
Parameters
Description
Attribute
to
Address where USDL will be minted.
ERC20 address
amount
Amount of USDL to be minted.
USD, 18 decimals
maxCollateralRequired
Max amount of WETH to be deposited to mint the USDL amount above.
WETH, 18 decimals
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer
collateral
IERC20 for type of asset to be deposited as collateral on the derivative dex.
ERC20 address, initially will be just WETH - 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1​

mintUSDLETH

Function purpose: msg.sender deposits ETH, converts the ETH to WETH and mints USDL.
function mintUSDLETH(uint256 amount, uint256 dexIndex) public payable
Parameters
Description
Attributes
msg.value
Max amount of ETH to be deposited to mint the USDL amount below.
ETH, 18 decimals
amount
Amount of USDL to be minted.
USD, 18 decimals
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer

mintUSDLToETH

Function purpose: msg.sender deposits ETH, converts the ETH to WETH and mints USDL to a given address.
function mintUSDLToETH(
address to,
uint256 amount,
uint256 dexIndex) public payable
Parameters
Description
Attributes
msg.value
Max amount of ETH to be deposited to mint the USDL amount below.
ETH, 18 decimals
to
Address where USDL will be minted.
ERC20 address
amount
Amount of USDL to be minted.
USD, 18 decimals
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer

mintUSDLUsingToken

Function purpose: msg.sender deposits a given token, converts the token to WETH and mints USDL.
function mintUSDLUsingToken(
IERC20 token,
uint256 tokenAmount,
address[] memory _swapActions,
bytes[] memory _swapDatas,
uint256 amount,
uint256 maxCollateralRequired,
uint256 dexIndex,
IERC20 collateral) public
Parameter
Description
Attributes
token
IERC20 address for token type to be used to mint USDL.
ERC20 Address
tokenAmount
Amount of token to be deposited to mint USDL amount below.
Token, number of decimals depends on token
_swapActions
Array of dex contract addresses you want 1inch to use for swapping (or to let 1inch decide, put in "0x111111125434b319222cdbf8c261674adb56f3ae").
address[]
_swapDatas
Array of the "data" variable outputted by a request you need to make to the 1inch API's Swap GET call.
bytes[]
amount
Amount of USDL to be minted.
USD, 18 decimals
maxCollateralRequired
Max amount of WETH to be deposited to mint the USDL amount above.
WETH, 18 decimals
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer
collateral
IERC20 for type of asset to be deposited as collateral on the derivative dex.
ERC20 address, initially will be just WETH - 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1​

mintUSDLToUsingToken

Function purpose: msg.sender deposits a given token, converts the token to WETH and mints USDL to a given address.
function mintUSDLToUsingToken(
IERC20 token,
uint256 tokenAmount,
address[] memory _swapActions,
bytes[] memory _swapDatas,
address to,
uint256 amount,
uint256 maxCollateralRequired,
uint256 dexIndex,
IERC20 collateral) public
Parameter
Description
Attributes
token
IERC20 address for token type to be used to mint USDL.
ERC20 Address
tokenAmount
Amount of token to be deposited to mint USDL amount below.
Token, number of decimals depends on token
_swapActions
Array of dex contract addresses you want 1inch to use for swapping (or to let 1inch decide, put in "0x111111125434b319222cdbf8c261674adb56f3ae").
address[]
_swapDatas
Array of the "data" variable outputted by a request you need to make to the 1inch API's Swap GET call.
bytes[]
to
Address where USDL will be minted.
ERC20 address
amount
Amount of USDL to be redeemed.
USD, 18 decimals
maxCollateralRequired
Max amount of WETH to be deposited to mint the USDL amount above.
WETH, 18 decimals
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer
collateral
IERC20 for type of asset to be deposited as collateral on the derivative dex.
ERC20 address, initially will be just WETH - 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1​

redeemUSDL

Function purpose: msg.sender redeems USDL for WETH.
function redeemUSDL(
uint256 amount,
uint256 minCollateralToGetBack,
uint256 dexIndex,
IERC20 collateral) public
Parameter
Description
Attributes
amount
Amount of USDL to be redeemed.
USD, 18 decimals
minCollateralToGetBack
Min amount of WETH to be received after redeeming the USDL amount above.
WETH, 18 decimals
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer
collateral
IERC20 for type of asset to be claimed from collateral on the derivative dex.
ERC20 address, initially will be just WETH - 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1​

redeemUSDLTo

Function purpose: msg.sender redeems USDL for WETH and receives the WETH at a given address.
function redeemUSDLTo(
address to,
uint256 amount,
uint256 minCollateralToGetBack,
uint256 dexIndex,
IERC20 collateral) public
Parameters
Description
Attributes
to
Address where WETH will be received.
ERC20 address
amount
Amount of USDL to be redeemed.
USD, 18 decimals
minCollateralToGetBack
Min amount of WETH to be received after redeeming the USDL amount above.
WETH, 18 decimals
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer
collateral
IERC20 for type of asset to be claimed from collateral on the derivative dex.
ERC20 address, initially will be just WETH - 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1​

redeemUSDLETH

Function purpose: msg.sender redeems USDL for WETH and converts that WETH to ETH.
function redeemUSDLETH(
uint256 amount,
uint256 minCollateralToGetBack,
uint256 dexIndex) external
Parameter
Description
Attributes
amount
Amount of USDL to be redeemed.
USD, 18 decimals
minCollateralToGetBack
Min amount of WETH to be received after redeeming the USDL amount above.
WETH, 18 decimals
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer

redeemUSDLToETH

Function purpose: msg.sender redeems USDL for WETH, converts that WETH to ETH and receives the ETH at a given address.
function redeemUSDLToETH(
address to,
uint256 amount,
uint256 minCollateralToGetBack,
uint256 dexIndex) public
Parameter
Description
Attributes
to
Address where ETH will be received.
ERC20 address
amount
Amount of USDL to be redeemed.
USD, 18 decimals
minCollateralToGetBack
Min amount of WETH to be received after redeeming the USDL amount above.
WETH, 18 decimals
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer

redeemUSDLUsingToken

Function purpose: msg.sender redeems USDL for WETH and swaps that WETH for a given token.
function redeemUSDLUsingToken(
IERC20 token,
address[] memory _swapActions,
bytes[] memory _swapDatas,
uint256 amount,
uint256 minTokenAmount,
uint256 dexIndex,
IERC20 collateral) external
Parameter
Description
Attributes
token
IERC20 address for token type to be received after redeeming USDL.
ERC20 Address
_swapActions
Array of contract addresses Array of dex contract addresses you want 1inch to use for swapping (or to let 1inch decide, put in "0x111111125434b319222cdbf8c261674adb56f3ae").
address[]
_swapDatas
Array of the "data" variable outputted by a request you need to make to the 1inch API's Swap GET call.
bytes[]
amount
Amount of USDL to be redeemed.
USD, 18 decimals
minTokenAmount
Min amount of token to be received after redeeming the USDL amount above.
Token, number of decimals depends on token
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer
collateral
IERC20 for type of asset to be claimed from collateral on the derivative dex.
ERC20 address, initially will be just WETH - 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1​

redeemUSDLToUsingToken

Function purpose: msg.sender redeems USDL for WETH, swaps that WETH for a given token and receives the token at a given address.
function redeemUSDLToUsingToken(
IERC20 token,
address[] memory _swapActions,
bytes[] memory _swapDatas,
address to,
uint256 amount,
uint256 minTokenAmount,
uint256 dexIndex,
IERC20 collateral) external
Parameter
Description
Attributes
token
IERC20 address for token type to be received after redeeming USDL.
ERC20 Address
_swapActions
Array of dex contract addresses you want 1inch to use for swapping (or to let 1inch decide, put in "0x111111125434b319222cdbf8c261674adb56f3ae").
address[]
_swapDatas
Array of the "data" variable outputted by a request you need to make to the 1inch API's Swap GET call.
bytes[]
to
Address where the given token will be received.
ERC20 address
amount
Amount of USDL to be redeemed.
USD, 18 decimals
minTokenAmount
Min amount of token to be received after redeeming the USDL amount above.
Token, number of decimals depends on token
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer
collateral
IERC20 for type of asset to be claimed from collateral on the derivative dex.
ERC20 address, initially will be just WETH - 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1​

stakeUSDL

Function purpose: msg.sender stakes USDL and receives xUSDL in return. Keep in mind the xUSDL price fluctuates with the yields generated and takes 8 hours to unstake.
function stakeUSDL(uint256 amount) public
Paramters
Description
Attributes
amount
Amount of USDL to be staked.
USD, 18 decimals

unstakeUSDL

Function purpose: msg.sender unstakes xUSDL and receives USDL in return. Keep in mind the xUSDL price fluctuates with the yields generated and takes 8 hours to unstake.
function unstakeUSDL(uint256 amount) public
Paramters
Description
Attributes
amount
Amount of xUSDL to be unstaked.
xUSDL, 18 decimals

unstakeUSDLTo

Function purpose: msg.sender unstakes xUSDL and receives USDL at a given address in return. Keep in mind the xUSDL price fluctuates with the yields generated and takes 8 hours to unstake.
function unstakeUSDLTo(address to, uint256 amount) public
Paramters
Description
Attributes
to
Address where USDL will be received.
ERC20 address
amount
Amount of xUSDL to be unstaked.
xUSDL, 18 decimals

mintAndStake

Function purpose: msg.sender deposits WETH, mints USDL, stakes it and receives xUSDL in return. Keep in mind the xUSDL price fluctuates with the yields generated and takes 8 hours to unstake.
function mintAndStake(
uint256 amount,
uint256 dexIndex,
uint256 maxCollateralRequired,
IERC20 collateral) public
Paramters
Description
Attributes
amount
Amount of USDL to be minted & staked.
USD, 18 decimals
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer
maxCollateralRequired
Max amount of WETH to be deposited to mint the USDL amount above.
WETH, 18 decimals
collateral
IERC20 for type of asset to be deposited as collateral on the derivative dex.
ERC20 address, initially will be just WETH - 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1​

mintForEthAndStake

Function purpose: msg.sender deposits ETH, converts that ETH to WETH, mints USDL, stakes it and receives xUSDL in return. Keep in mind the xUSDL price fluctuates with the yields generated and takes 8 hours to unstake.
function mintForEthAndStake(
uint256 amount,
uint256 dexIndex) public payable
Paramters
Description
Attributes
msg.value
Max amount of ETH to be deposited to mint the USDL amount below.
ETH, 18 decimals
amount
Amount of USDL to be minted & staked.
USD, 18 decimals
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer

mintUsingTokenAndStake

Function purpose: msg.sender deposits a given token, swaps it for WETH, mints USDL, stakes it and receives xUSDL in return. Keep in mind the xUSDL price fluctuates with the yields generated and takes 8 hours to unstake.
function mintUsingTokenAndStake(
IERC20 token,
uint256 tokenAmount,
address[] memory _swapActions,
bytes[] memory _swapDatas,
uint256 amount,
uint256 maxCollateralRequired,
uint256 dexIndex,
IERC20 collateral) public
Parameter
Description
Attributes
token
IERC20 address for token type to be used to mint USDL.
ERC20 Address
tokenAmount
Amount of token to be deposited to mint USDL amount below.
Token, number of decimals depends on token
_swapActions
Array of dex contract addresses you want 1inch to use for swapping (or to let 1inch decide, put in "0x111111125434b319222cdbf8c261674adb56f3ae").
address[]
_swapDatas
Array of the "data" variable outputted by a request you need to make to the 1inch API's Swap GET call.
bytes[]
amount
Amount of USDL to be minted & staked.
USD, 18 decimals
maxCollateralRequired
Max amount of WETH to be deposited to mint the USDL amount above.
WETH, 18 decimals
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer
collateral
IERC20 for type of asset to be deposited as collateral on the derivative dex.
ERC20 address, initially will be just WETH - 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1​

unstakeAndRedeemUSDL

Function purpose: msg.sender unstakes xUSDL, receives USDL in return, redeems the USDL and receives WETH in return. Keep in mind the xUSDL price fluctuates with the yields generated and takes 8 hours to unstake.
function unstakeAndRedeemUSDL(
uint256 amount,
uint256 minCollateralToGetBack,
uint256 dexIndex,
IERC20 collateral) public
Paramters
Description
Attributes
amount
Amount of xUSDL to be unstaked.
xUSDL, 18 decimals
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer
minCollateralToGetBack
Min amount of WETH to be received after redeeming the USDL amount above.
WETH, 18 decimals
collateral
IERC20 for type of asset to be claimed from collateral on the derivative dex.
ERC20 address, initially will be just WETH - 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1​

unstakeAndRedeemUSDLTo

Function purpose: msg.sender unstakes xUSDL, receives USDL in return, redeems the USDL and receives WETH in return at a given address. Keep in mind the xUSDL price fluctuates with the yields generated and takes 8 hours to unstake.
function unstakeAndRedeemUSDLTo(
address to,
uint256 amount,
uint256 minCollateralToGetBack,
uint256 dexIndex,
IERC20 collateral) public
Paramters
Description
Attributes
to
Address where WETH will be received.
ERC20 address
amount
Amount of xUSDL to be unstaked.
xUSDL, 18 decimals
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer
minCollateralToGetBack
Min amount of WETH to be received after redeeming the USDL amount above.
WETH, 18 decimals
collateral
IERC20 for type of asset to be claimed from collateral on the derivative dex.
ERC20 address, initially will be just WETH - 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1​

unstakeAndRedeemUSDLForEth

Function purpose: msg.sender unstakes xUSDL, receives USDL in return, redeems the USDL, receives WETH in return and converts that WETH for ETH. Keep in mind the xUSDL price fluctuates with the yields generated and takes 8 hours to unstake.
function unstakeAndRedeemUSDLForEth(
uint256 amount,
uint256 dexIndex) public
Paramters
Description
Attributes
amount
Amount of xUSDL to be unstaked.
xUSDL, 18 decimals
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer

unstakeAndRedeemUSDLForEthTo

Function purpose: msg.sender unstakes xUSDL, receives USDL in return, redeems the USDL, receives WETH in return, converts that WETH for ETH and receives that ETH at a given address. Keep in mind the xUSDL price fluctuates with the yields generated and takes 8 hours to unstake.
function unstakeAndRedeemUSDLForEthTo(
address to,
uint256 amount,
uint256 dexIndex) public
Paramters
Description
Attributes
to
Address where ETH will be received.
ERC20 address
amount
Amount of xUSDL to be unstaked.
xUSDL, 18 decimals
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer

unstakeAndRedeemToken

Function purpose: msg.sender unstakes xUSDL, receives USDL in return, redeems the USDL, receives WETH in return and swaps that WETH for a given token. Keep in mind the xUSDL price fluctuates with the yields generated and takes 8 hours to unstake.
function unstakeAndRedeemToken(
IERC20 token,
address[] memory _swapActions,
bytes[] memory _swapDatas,
uint256 amount,
uint256 minTokenAmount,
uint256 dexIndex,
IERC20 collateral) public
Parameter
Description
Attributes
token
IERC20 address for token type to be received after redeeming USDL.
ERC20 Address
_swapActions
Array of dex contract addresses you want 1inch to use for swapping (or to let 1inch decide, put in "0x111111125434b319222cdbf8c261674adb56f3ae").
address[]
_swapDatas
Array of the "data" variable outputted by a request you need to make to the 1inch API's Swap GET call.
bytes[]
amount
Amount of USDL to be redeemed.
USD, 18 decimals
minTokenAmount
Min amount of token to be received after redeeming the USDL amount above.
Token, number of decimals depends on token
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer
collateral
IERC20 for type of asset to be claimed from collateral on the derivative dex.
ERC20 address, initially will be just WETH - 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1​

unstakeAndRedeemToToken

Function purpose: msg.sender unstakes xUSDL, receives USDL in return, redeems the USDL, receives WETH in return, converts that WETH for a given token and receives that token at a given address. Keep in mind the xUSDL price fluctuates with the yields generated and takes 8 hours to unstake.
function unstakeAndRedeemToToken(
IERC20 token,
address[] memory _swapActions,
bytes[] memory _swapDatas,
address to,
uint256 amount,
uint256 minTokenAmount,
uint256 dexIndex,
IERC20 collateral) public
Parameter
Description
Attributes
token
IERC20 address for token type to be received after redeeming USDL.
ERC20 Address
_swapActions
Array of dex contract addresses you want 1inch to use for swapping (or to let 1inch decide, put in "0x111111125434b319222cdbf8c261674adb56f3ae").
address[]
_swapDatas
Array of the "data" variable outputted by a request you need to make to the 1inch API's Swap GET call.
bytes[]
to
Address where token will be received.
ERC20 address
amount
Amount of USDL to be redeemed.
USD, 18 decimals
minTokenAmount
Min amount of token to be received after redeeming the USDL amount above.
Token, number of decimals depends on token
dexIndex
Index for derivative dex to be used (right now only MCDEX is integrated, and its corresponding index is 0).
Integer
collateral
IERC20 for type of asset to be claimed from collateral on the derivative dex.
ERC20 address, initially will be just WETH - 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1​