WERC20
The WERC20 contract is an ERC1155 compliant contract that wraps ERC20 tokens. This contract is used to hold Leveraged LP Tokens in the BlueberryBank and do not generate yields. LP Tokens are identified by tokenIds encoded from the lp token address.
Functions
initialize
Initializes the contract by initializing ReentrancyGuard and setting the name of the token as WERC20.
_encodeTokenId
This function encodes the underlying token address to tokenId.
_decodeTokenId
This function decodes the given tokenId to underlyingToken address.
getUnderlyingToken
This function returns the underlying ERC-20 token for the given ERC-1155 token id. It takes tokenId
as input and returns token
which is the underlying ERC-20 token.
pendingRewards
This function returns the pending rewards from the farming pool. Reward tokens can be multiple tokens. It takes tokenId
and amount
as input and returns two arrays, address[] memory
and uint256[] memory
.
balanceOfERC20
This function returns the underlying ERC20 balance for the user. It takes token
and user
as input and returns uint256
which is the balance of the user.
mint
This function mints ERC1155 token for the given ERC20 token. It takes token
and amount
as input and mints ERC1155 token.
burn
This function burns ERC1155 token to redeem ERC20 token back. It takes token
and amount
as input and burns ERC1155 token.
Last updated