-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidate the fee module interface functions into a single function per action that returns both the fee a user needs to pay plus a FeeDistribution struct that contains all the necessary info for the pool to distribute the fee. This consolidation should: * make it easier for pools to integrate with the fee module since there is only a single function per action to use * make the interface future-proof in case fee modules in the future are determining fee recipients based on the TCO2 that is deposited to or redeemed from the pool * make the fee calculation more performant since there is only a single CALL to the fee module instead of two per action This change partially reverts 99f19a4
- Loading branch information
1 parent
5ded2d4
commit 2199e61
Showing
6 changed files
with
194 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,11 @@ | |
// If you encounter a vulnerability or an issue, please contact <[email protected]> | ||
pragma solidity ^0.8.13; | ||
|
||
struct FeeDistribution { | ||
address[] recipients; | ||
uint256[] shares; | ||
} | ||
|
||
/// @title IFeeCalculator | ||
/// @author Neutral Labs Inc. | ||
/// @notice This interface defines methods for calculating fees. | ||
|
@@ -18,7 +23,7 @@ interface IFeeCalculator { | |
function calculateDepositFees(address tco2, address pool, uint256 depositAmount) | ||
external | ||
view | ||
returns (uint256 feeAmount); | ||
returns (uint256 feeAmount, FeeDistribution memory feeDistribution); | ||
|
||
/// @notice Calculates the redemption fees for a given amount. | ||
/// @param tco2 The address of the TCO2 token. | ||
|
@@ -29,23 +34,5 @@ interface IFeeCalculator { | |
function calculateRedemptionFees(address tco2, address pool, uint256 redemptionAmount) | ||
external | ||
view | ||
returns (uint256 feeAmount); | ||
|
||
/// @notice Calculates the fee shares and recipients for a deposit based on the total fee. | ||
/// @param totalFee The total fee to be shared. | ||
/// @return recipients The addresses of the fee recipients. | ||
/// @return feesDenominatedInPoolTokens The amount of fees each recipient should receive. | ||
function calculateDepositFeeShares(uint256 totalFee) | ||
external | ||
view | ||
returns (address[] memory recipients, uint256[] memory feesDenominatedInPoolTokens); | ||
|
||
/// @notice Calculates the fee shares and recipients for a redemption based on the total fee. | ||
/// @param totalFee The total fee to be shared. | ||
/// @return recipients The addresses of the fee recipients. | ||
/// @return feesDenominatedInPoolTokens The amount of fees each recipient should receive. | ||
function calculateRedemptionFeeShares(uint256 totalFee) | ||
external | ||
view | ||
returns (address[] memory recipients, uint256[] memory feesDenominatedInPoolTokens); | ||
returns (uint256 feeAmount, FeeDistribution memory feeDistribution); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.