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

function initialize() external initializer

Initializes the contract by initializing ReentrancyGuard and setting the name of the token as WERC20.

_encodeTokenId

function _encodeTokenId(address uToken) internal pure returns (uint)

This function encodes the underlying token address to tokenId.

_decodeTokenId

function _decodeTokenId(uint tokenId) internal pure returns (address)

This function decodes the given tokenId to underlyingToken address.

getUnderlyingToken

function getUnderlyingToken(uint256 tokenId) external pure override returns (address token)

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

function pendingRewards(uint256 tokenId, uint amount) public view override returns (address[] memory, uint256[] memory)

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

function balanceOfERC20(address token, address user) external view override returns (uint256)

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

function mint(address token, uint256 amount) external override nonReentrant returns (uint256 id)

This function mints ERC1155 token for the given ERC20 token. It takes token and amount as input and mints ERC1155 token.

burn

function burn(address token, uint256 amount) external override nonReentrant

This function burns ERC1155 token to redeem ERC20 token back. It takes token and amount as input and burns ERC1155 token.

Last updated