|
| 1 | +// SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | +pragma solidity ^0.8.4; |
| 3 | + |
| 4 | +import "./IPCVDeposit.sol"; |
| 5 | +import "../external/Decimal.sol"; |
| 6 | + |
| 7 | +/** |
| 8 | + @title a PCV Deposit aggregation interface |
| 9 | + @author Fei Protocol |
| 10 | +
|
| 11 | + This contract is a single interface for allocating a specific token to multiple PCV Deposits. |
| 12 | + The aggregator handles new incoming funds and outgoing funds by selecting deposits which are over or under-funded to save for gas and efficiency |
| 13 | +*/ |
| 14 | +interface IPCVDepositAggregator is IPCVDeposit { |
| 15 | + |
| 16 | + // ----------- State changing api ----------- |
| 17 | + /// @notice rebalance funds of the underlying deposits to the optimal target percents |
| 18 | + function rebalance() external; |
| 19 | + |
| 20 | + // ----------- Governor only state changing api ----------- |
| 21 | + /// @notice adds a new PCV Deposit to the set of deposits |
| 22 | + /// @param weight a relative (i.e. not normalized) weight of this PCV deposit |
| 23 | + function addPCVDeposit(IPCVDeposit newPCVDeposit, uint256 weight) external; |
| 24 | + |
| 25 | + /// @notice replaces this contract with a new PCV Deposit Aggregator on the rewardsAssetManager |
| 26 | + function setNewAggregator(IPCVDepositAggregator newAggregator) external; |
| 27 | + |
| 28 | + // ----------- Governor or Guardian only state changing api ----------- |
| 29 | + /// @notice remove a PCV deposit from the set of deposits |
| 30 | + function removePCVDeposit(IPCVDeposit pcvDeposit) external; |
| 31 | + |
| 32 | + // ----------- Read-only api ----------- |
| 33 | + /// @notice the upstream rewardsAssetManager funding this contract |
| 34 | + function rewardsAssetManager() external returns(address); |
| 35 | + |
| 36 | + /// @notice the set of PCV deposits and non-normalized weights this contract allocates to |
| 37 | + function pcvDeposits() external view returns(IPCVDeposit[] memory deposits, uint256[] memory weights); |
| 38 | + |
| 39 | + /// @notice current percent of PCV held by the input `pcvDeposit` relative to the total managed by aggregator. |
| 40 | + /// @param depositAmount a hypothetical deposit amount, to be included in the calculation |
| 41 | + function percentHeld(IPCVDeposit pcvDeposit, uint256 depositAmount) external view returns(Decimal.D256 memory); |
| 42 | + |
| 43 | + /// @notice the normalized target percent of PCV held by `pcvDeposit` relative to aggregator total |
| 44 | + function targetPercentHeld(IPCVDeposit pcvDeposit) external view returns(Decimal.D256 memory); |
| 45 | + |
| 46 | + /// @notice the raw amount of PCV off of the target percent held by `pcvDeposit` |
| 47 | + function amountFromTarget(IPCVDeposit pcvDeposit) external view returns(int256); |
| 48 | +} |
0 commit comments