diff --git a/src/FeeCalculator.sol b/src/FeeCalculator.sol index a8b5a6c..6851fa5 100644 --- a/src/FeeCalculator.sol +++ b/src/FeeCalculator.sol @@ -166,7 +166,7 @@ contract FeeCalculator is IFeeCalculator, Ownable { require(depositAmount > 0, "depositAmount must be > 0"); feeDistribution = - _calculateFee(_getTotalSupply(pool), IPool(pool).totalPerProjectSupply(tco2), depositAmount, _getDepositFee); + _calculateFee(depositAmount, IPool(pool).totalPerProjectSupply(tco2), _getTotalSupply(pool), _getDepositFee); } /// @notice Calculates the fee shares and recipients based on the total fee. @@ -210,7 +210,7 @@ contract FeeCalculator is IFeeCalculator, Ownable { uint256 redemptionAmount = redemptionAmounts[0]; feeDistribution = _calculateFee( - _getTotalSupply(pool), IPool(pool).totalPerProjectSupply(tco2), redemptionAmount, _getRedemptionFee + redemptionAmount, IPool(pool).totalPerProjectSupply(tco2), _getTotalSupply(pool), _getRedemptionFee ); } @@ -230,7 +230,7 @@ contract FeeCalculator is IFeeCalculator, Ownable { require(depositAmount > 0, "depositAmount must be > 0"); feeDistribution = _calculateFee( - _getTotalSupply(pool), IPool(pool).totalPerProjectSupply(erc1155, tokenId), depositAmount, _getDepositFee + depositAmount, IPool(pool).totalPerProjectSupply(erc1155, tokenId), _getTotalSupply(pool), _getDepositFee ); } @@ -255,9 +255,9 @@ contract FeeCalculator is IFeeCalculator, Ownable { uint256 redemptionAmount = redemptionAmounts[0]; feeDistribution = _calculateFee( - _getTotalSupply(pool), - IPool(pool).totalPerProjectSupply(erc1155, tokenId), redemptionAmount, + IPool(pool).totalPerProjectSupply(erc1155, tokenId), + _getTotalSupply(pool), _getRedemptionFee ); } @@ -394,9 +394,9 @@ contract FeeCalculator is IFeeCalculator, Ownable { } function _calculateFee( - uint256 totalPoolSupply, - uint256 projectSupply, uint256 requestedAmount, + uint256 projectSupply, + uint256 totalPoolSupply, function(uint256, uint256, uint256) view returns (uint256) calculator ) internal view returns (FeeDistribution memory) { require(requestedAmount > 0, "requested amount must be > 0"); diff --git a/src/interfaces/ITCO2.sol b/src/interfaces/ITCO2.sol deleted file mode 100644 index fdb59ee..0000000 --- a/src/interfaces/ITCO2.sol +++ /dev/null @@ -1,31 +0,0 @@ -// SPDX-FileCopyrightText: 2024 Toucan Protocol -// -// SPDX-License-Identifier: UNLICENSED - -// If you encounter a vulnerability or an issue, please contact -pragma solidity ^0.8.13; - -struct VintageData { - /// @dev A human-readable string which differentiates this from other vintages in - /// the same project, and helps build the corresponding TCO2 name and symbol. - string name; - uint64 startTime; // UNIX timestamp - uint64 endTime; // UNIX timestamp - uint256 projectTokenId; - uint64 totalVintageQuantity; - bool isCorsiaCompliant; - bool isCCPcompliant; - string coBenefits; - string correspAdjustment; - string additionalCertification; - string uri; - string registry; -} - -/// @title ITCO2 -/// @notice This interface defines methods exposed by the TCO2 -interface ITCO2 { - /// @notice Get the vintage data for the TCO2 - /// @return vintageData Vintage data of the TCO2 - function getVintageData() external view returns (VintageData memory vintageData); -} diff --git a/test/TestUtilities.sol b/test/TestUtilities.sol index e42ea05..65c3043 100644 --- a/test/TestUtilities.sol +++ b/test/TestUtilities.sol @@ -7,8 +7,6 @@ pragma solidity ^0.8.0; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import {VintageData} from "../src/interfaces/ITCO2.sol"; - library TestUtilities { function sumOf(uint256[] memory numbers) internal pure returns (uint256) { uint256 sum = 0; @@ -95,21 +93,4 @@ contract MockToken is IERC20 { function totalSupply() external pure returns (uint256) { return 0; } - - function getVintageData() external pure returns (VintageData memory) { - return VintageData({ - name: "test", - startTime: 0, - endTime: 0, - projectTokenId: 1, - totalVintageQuantity: 0, - isCorsiaCompliant: false, - isCCPcompliant: false, - coBenefits: "", - correspAdjustment: "", - additionalCertification: "", - uri: "", - registry: "" - }); - } }