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

Vault

Git Source

Inherits: IEvents

The vault serves as a liquidity vehicle for market creation using a shared bucket of liquidity. Dao-earned fees are repaid to this vault when the market is resolved, subtracting what’s needed to earn more than the fees.

State Variables

version

uint8 public version

ERC20

IERC20 public ERC20

FACTORY

address public FACTORY

OPERATOR

address public OPERATOR

outstandingDebt

uint256 public outstandingDebt

debt

mapping(address => uint256) debt

authorisedContracts

mapping(address => bool) authorisedContracts

Functions

init

function init(IERC20 _erc20, address _factory, address _operator) external;

borrow

borrow liquidity using code that’s specific to the DPPM where the outlay is known every time.

function borrow(address _for, uint256 _amount) external;

repay

repay the loan that was generated by the DPPM.

function repay(uint256 _feesEarned) external;

drain

drain liquidity using code that only the operator can interact with.

function drain() external returns (uint256 amt);

ammRegister

ammRegister an address using the factory as a trusted worker.

function ammRegister(address _amm) external;

ammReceive

ammReceive an arbitrary amount of liquidity, taking advantage of a trust amount in this contract. Flips the authorised mapping to false as a precaution.

function ammReceive(uint256 _amount) external returns (uint256);

ammGift

ammGift some liquidity to the contract, increasing the amount of fUSDC that’s vested in the vault.

function ammGift(uint256 _amount) external returns (uint256);