# Vault

The Core Vault contract adheres to the ERC-4626 and ERC-20 standards, implementing the essential functionalities required by the vault. However, it's important to note that the Core Vault contract cannot be used independently; it needs to be inherited and have other internal functions implemented before it can be utilized. This contract is capable of receiving and managing user deposits, and it mints LazyOtter Vault tokens as withdrawal vouchers. LazyOtter Vault tokens also represent the share held in the vault, which is used to calculate the funds that users can withdraw.

### Methods

#### decimals

Returns the decimals of the underlying asset.

```solidity
function decimals() public view override returns (uint8)
```

#### totalAssets

Returns the total amount of underlying assets managed by the Vault.

```solidity
function totalAssets() public view virtual returns (uint256)
```

#### maxDeposit

Returns the maximum amount of underlying assets that can be deposited into the Vault.

```solidity
function maxDeposit(address) public view virtual returns (uint256)
```

#### maxMint

Returns the maximum amount of Vault Tokens that can be minted.

```solidity
function maxMint(address receiver) public view returns (uint256)
```

#### maxWithdraw

Returns the maximum amount of underlying assets that can be withdrawn from the Vault.

```solidity
function maxWithdraw(address owner) public view virtual returns (uint256)
```

#### maxRedeem

Returns the maximum amount of Vault Tokens that can be redeemed.

```solidity
function maxRedeem(address owner) public view returns (uint256)
```

#### convertToShares

Returns the amount of Vault Tokens that can be exchanged for the underlying assets.

```solidity
function convertToShares(uint256 assets) public view returns (uint256)
```

#### convertToAssets

Returns the amount of underlying assets that can be exchanged for Vault Tokens.

```solidity
 function convertToAssets(uint256 shares) public view returns (uint256)
```

#### previewDeposit

Returns the amount of Vault Tokens that can be obtained when depositing a specified amount of underlying assets.

```solidity
function previewDeposit(uint256 assets) public view returns (uint256) 
```

#### previewMint

Returns the amount of underlying assets needed to mint a specified amount of Vault Tokens.

```solidity
function previewMint(uint256 shares) public view returns (uint256)
```

#### previewWithdraw

Returns the amount of Vault Tokens needed to withdraw a specified amount of underlying assets.

```solidity
function previewWithdraw(uint256 assets) public view returns (uint256)
```

#### previewRedeem

Returns the amount of underlying assets needed to redeem a specified amount of Vault Tokens.

```solidity
function previewRedeem(uint256 shares) public view returns (uint256)
```

#### deposit

Deposits the specified amount of underlying assets and mints Vault Tokens for the receiver based on the deposit amount.

```solidity
function deposit(uint256 assets, address receiver) external nonReentrant whenNotPaused returns (uint256)
```

#### mint

Mints the specified amount of Vault Tokens for the receiver and collects the required underlying assets from the caller.

```solidity
function mint(uint256 shares, address receiver) external nonReentrant whenNotPaused returns (uint256)
```

#### withdraw

Withdraws the specified amount of underlying assets and burn the required Vault Tokens.

```solidity
function withdraw(uint256 assets, address receiver, address owner) external nonReentrant returns (uint256)
```

#### redeem

Redeems the specified amount of Vault Tokens and sends the corresponding amount of underlying assets to the receiver.

```solidity
function redeem(uint256 shares, address receiver, address owner) external nonReentrant returns (uint256)
```

#### harvest

Harvests the currently earned rewards.

```solidity
function harvest(address caller) external nonReentrant returns (uint256)
```

#### permit

Implements the EIP-2612 permit function.

```solidity
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)
```

#### pause

Pauses accepting deposits into the Vault.

```solidity
function pause() external 
```

#### unpause

Unpauses accepting deposits into the Vault.

```solidity
function unpause() external
```

#### emergencyWithdraw

Withdraws the underlying assets from the external protocol in case of an emergency.

```solidity
function emergencyWithdraw() external
```
