Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
pragma solidity 0.6.11;

/**
* @notice For pools that can charge an early withdraw fee
* @notice For vaults that can charge an early withdraw fee
*/
interface IFeePool {
interface IFeeVault {
/**
* @notice Log when the arbitrage fee period changes
* @param arbitrageFeePeriod The new period
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
pragma solidity 0.6.11;

/**
* @notice For pools that can be locked and unlocked in emergencies
* @notice For vaults that can be locked and unlocked in emergencies
*/
interface ILockingPool {
interface ILockingVault {
/** @notice Log when deposits are locked */
event DepositLocked();

Expand Down
6 changes: 3 additions & 3 deletions contracts/index/IReservePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
pragma solidity 0.6.11;

/**
* @notice For pools that keep a separate reserve of tokens
* @notice For vaults that keep a separate reserve of tokens
*/
interface IReservePool {
interface IReserveVault {
/**
* @notice Log when the percent held in reserve is changed
* @param reservePercentage The new percent held in reserve
Expand All @@ -19,7 +19,7 @@ interface IReservePool {

/**
* @notice Transfer an amount of tokens to the LP Account
* @dev This should only be callable by the `MetaPoolToken`
* @dev This should only be callable by the `LpAccountFunder`
* @param amount The amount of tokens
*/
function transferToLpAccount(uint256 amount) external;
Expand Down
39 changes: 39 additions & 0 deletions contracts/index/IReserveVault.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// SPDX-License-Identifier: BUSDL-1.1
pragma solidity 0.6.11;

/**
* @notice For vaults that keep a separate reserve of tokens
*/
interface IReserveVault {
/**
* @notice Log when the percent held in reserve is changed
* @param reservePercentage The new percent held in reserve
*/
event ReservePercentageChanged(uint256 reservePercentage);

/**
* @notice Set a new percent of tokens to hold in reserve
* @param reservePercentage_ The new percent
*/
function setReservePercentage(uint256 reservePercentage_) external;

/**
* @notice Transfer an amount of tokens to the LP Account
* @dev This should only be callable by the `LpAccountFunder`
* @param amount The amount of tokens
*/
function transferToLpAccount(uint256 amount) external;

/**
* @notice Get the amount of tokens missing from the reserve
* @dev A negative amount indicates extra tokens not needed for the reserve
* @return The amount of missing tokens
*/
function getReserveTopUpValue() external view returns (int256);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's come up with a new name for this while we have the opportunity. It may make sense to switch the sign and make it a uint256 as well, because it will only be used to determine excess tokens, never tokens that should be returned.

Maybe we should overall avoid the reference to the LP Account, even with transferToLpAccount. All the vault fundamentally cares about is that there is something it can transfer to, that has permission to initiate the transfer, and that it can only transfer the excess tokens.

One way we could think of this is as a 0% interest loan to another contract. Might be the wrong approach, but let's see how that might look:

function lendUnderlyer(uint256 amount) external;

function getMaxUnderlyerLoan() external view returns (uint256);

Could also keep it simpler and stay with the transfer terminology:

function transferUnderlyer(uint256 amount) external;

function getTransferUnderlyerMaxAmount() external view returns (uint256);

In both cases I think it makes sense to drop the sign and invert the calculation so excess tokens is a positive number. Should simplify the rest of any calculations.


/**
* @notice Get the current percentage of tokens held in reserve
* @return The percent
*/
function reservePercentage() external view returns (uint256);
}
6 changes: 3 additions & 3 deletions contracts/index/Imports.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
pragma solidity 0.6.11;

import {IERC4626} from "./IERC4626.sol";
import {IFeePool} from "./IFeePool.sol";
import {ILockingPool} from "./ILockingPool.sol";
import {IReservePool} from "./IReservePool.sol";
import {IFeeVault} from "./IFeeVault.sol";
import {ILockingVault} from "./ILockingVault.sol";
import {IReserveVault} from "./IReserveVault.sol";
Loading