Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

WrappedRewardToken

Git Source

Inherits: ERC20

A wrapper vault built on ERC4626 to facilitate reward tokens that have low decimals eg 6 like USDC

State Variables

asset

ERC20 public immutable asset;

scaling

The scaling factor to adjust for decimal differences (10^18 / 10^asset.decimals()).

uint256 public immutable scaling;

Functions

constructor

constructor(ERC20 _asset, string memory _name, string memory _symbol)
    ERC20(_name, _symbol, 18);

deposit

function deposit(uint256 assets, address receiver)
    public
    virtual
    returns (uint256 shares);

mint

function mint(uint256 shares, address receiver)
    public
    virtual
    returns (uint256 assets);

withdraw

function withdraw(uint256 assets, address receiver, address owner)
    public
    virtual
    returns (uint256 shares);

redeem

function redeem(uint256 shares, address receiver, address owner)
    public
    virtual
    returns (uint256 assets);

totalAssets

function totalAssets() public view virtual returns (uint256);

convertToShares

function convertToShares(uint256 assets)
    public
    view
    virtual
    returns (uint256);

convertToAssets

function convertToAssets(uint256 shares)
    public
    view
    virtual
    returns (uint256);

previewDeposit

function previewDeposit(uint256 assets) public view virtual returns (uint256);

previewMint

function previewMint(uint256 shares) public view virtual returns (uint256);

previewWithdraw

function previewWithdraw(uint256 assets)
    public
    view
    virtual
    returns (uint256);

previewRedeem

function previewRedeem(uint256 shares) public view virtual returns (uint256);

maxDeposit

function maxDeposit(address) public view virtual returns (uint256);

maxMint

function maxMint(address) public view virtual returns (uint256);

maxWithdraw

function maxWithdraw(address owner) public view virtual returns (uint256);

maxRedeem

function maxRedeem(address owner) public view virtual returns (uint256);

beforeWithdraw

function beforeWithdraw(uint256 assets, uint256 shares) internal virtual;

afterDeposit

function afterDeposit(uint256 assets, uint256 shares) internal virtual;

Events

Deposit

event Deposit(
    address indexed caller,
    address indexed owner,
    uint256 assets,
    uint256 shares
);

Withdraw

event Withdraw(
    address indexed caller,
    address indexed receiver,
    address indexed owner,
    uint256 assets,
    uint256 shares
);