Skip to content

Commit

Permalink
Merge pull request #49 from ToucanProtocol/miotto/lila-6858-add-erc-1…
Browse files Browse the repository at this point in the history
…155-support-in-fee-calculator

feat(hh): add ERC1155 support
  • Loading branch information
0xmichalis authored Apr 10, 2024
2 parents db24c72 + 7737f27 commit 061f6d4
Show file tree
Hide file tree
Showing 16 changed files with 1,005 additions and 377 deletions.
151 changes: 102 additions & 49 deletions src/FeeCalculator.sol

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions src/interfaces/IFeeCalculator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,30 @@ interface IFeeCalculator {
external
view
returns (FeeDistribution memory feeDistribution);

/// @notice Calculates the deposit fee for a given amount of an ERC1155 project.
/// @param pool The address of the pool.
/// @param erc1155 The address of the ERC1155 project
/// @param tokenId The tokenId of the vintage.
/// @param depositAmount The amount to be deposited.
/// @return feeDistribution How the fee is meant to be
/// distributed among the fee recipients.
function calculateDepositFees(address pool, address erc1155, uint256 tokenId, uint256 depositAmount)
external
view
returns (FeeDistribution memory feeDistribution);

/// @notice Calculates the redemption fees for a given amount on ERC1155 projects.
/// @param pool The address of the pool.
/// @param erc1155s The addresses of the ERC1155 projects.
/// @param tokenIds The tokenIds of the project vintages.
/// @param redemptionAmounts The amounts to be redeemed.
/// @return feeDistribution How the fee is meant to be
/// distributed among the fee recipients.
function calculateRedemptionFees(
address pool,
address[] calldata erc1155s,
uint256[] calldata tokenIds,
uint256[] calldata redemptionAmounts
) external view returns (FeeDistribution memory feeDistribution);
}
12 changes: 9 additions & 3 deletions src/interfaces/IPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ interface IPool {

/// @notice Exposes the total TCO2 supply of a project in a pool,
/// tracked as the aggregation of deposit, redemmption and bridge actions
/// @param projectTokenId The token id of the project as it's tracked
/// in the CarbonProjects contract
/// @param tco2 The TCO2 address of the project
/// @return supply Current supply of a project in the pool
function totalPerProjectTCO2Supply(uint256 projectTokenId) external view returns (uint256 supply);
function totalPerProjectSupply(address tco2) external view returns (uint256 supply);

/// @notice Exposes the total TCO2 supply of a project in a pool,
/// tracked as the aggregation of deposit, redemmption and bridge actions
/// @param erc1155 The ERC1155 address of the project
/// @param tokenId The token id of the project
/// @return supply Current supply of a project in the pool
function totalPerProjectSupply(address erc1155, uint256 tokenId) external view returns (uint256 supply);
}
Loading

0 comments on commit 061f6d4

Please sign in to comment.