-
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 as originally developed. 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 reverts 99f19a4
- Loading branch information
1 parent
5ded2d4
commit 149ebf0
Showing
6 changed files
with
202 additions
and
161 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. | ||
|
@@ -13,39 +18,21 @@ interface IFeeCalculator { | |
/// @param tco2 The address of the TCO2 token. | ||
/// @param pool The address of the pool. | ||
/// @param depositAmount The amount to be deposited. | ||
/// @return feeAmount The fee to be charged in pool | ||
/// tokens for this deposit. | ||
/// @return feeDistribution How the fee is meant to be | ||
/// distributed among the fee recipients. | ||
function calculateDepositFees(address tco2, address pool, uint256 depositAmount) | ||
external | ||
view | ||
returns (uint256 feeAmount); | ||
returns (FeeDistribution memory feeDistribution); | ||
|
||
/// @notice Calculates the redemption fees for a given amount. | ||
/// @param tco2 The address of the TCO2 token. | ||
/// @param pool The address of the pool. | ||
/// @param redemptionAmount The amount to be redeemed. | ||
/// @return feeAmount The fee to be charged in pool | ||
/// tokens for this redemption. | ||
/// @return feeDistribution How the fee is meant to be | ||
/// distributed among the fee recipients. | ||
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 (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.