BoringVault

Git Source

Inherits: ERC20, Auth, ERC721Holder, ERC1155Holder

State Variables

hook

Contract responsible for implementing beforeTransfer.

BeforeTransferHook public hook;

Functions

constructor

constructor(
    address _owner,
    string memory _name,
    string memory _symbol,
    uint8 _decimals
)
    ERC20(_name, _symbol, _decimals)
    Auth(_owner, Authority(address(0)));

manage

Allows manager to make an arbitrary function call from this contract.

Callable by MANAGER_ROLE.

function manage(
    address target,
    bytes calldata data,
    uint256 value
)
    external
    requiresAuth
    returns (bytes memory result);

manage

Allows manager to make arbitrary function calls from this contract.

Callable by MANAGER_ROLE.

function manage(
    address[] calldata targets,
    bytes[] calldata data,
    uint256[] calldata values
)
    external
    requiresAuth
    returns (bytes[] memory results);

enter

Allows minter to mint shares, in exchange for assets.

If assetAmount is zero, no assets are transferred in.

Callable by MINTER_ROLE.

function enter(address from, ERC20 asset, uint256 assetAmount, address to, uint256 shareAmount) external requiresAuth;

exit

Allows burner to burn shares, in exchange for assets.

If assetAmount is zero, no assets are transferred out.

Callable by BURNER_ROLE.

function exit(address to, ERC20 asset, uint256 assetAmount, address from, uint256 shareAmount) external requiresAuth;

setBeforeTransferHook

Sets the share locker.

If set to zero address, the share locker logic is disabled.

Callable by OWNER_ROLE.

function setBeforeTransferHook(address _hook) external requiresAuth;

_callBeforeTransfer

Check if from addresses shares are locked, reverting if so.

function _callBeforeTransfer(address from) internal view;

transfer

function transfer(address to, uint256 amount) public override returns (bool);

transferFrom

function transferFrom(address from, address to, uint256 amount) public override returns (bool);

receive

receive() external payable;

Events

Enter

event Enter(address indexed from, address indexed asset, uint256 amount, address indexed to, uint256 shares);

Exit

event Exit(address indexed to, address indexed asset, uint256 amount, address indexed from, uint256 shares);