Skip to content

Commit

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

[LILA-6858] Remove unneeded files + param ordering fix
  • Loading branch information
sirnicolaz authored Apr 15, 2024
2 parents 061f6d4 + 090fa2a commit cfa4f36
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 57 deletions.
14 changes: 7 additions & 7 deletions src/FeeCalculator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
);
}

Expand All @@ -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
);
}

Expand All @@ -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
);
}
Expand Down Expand Up @@ -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");
Expand Down
31 changes: 0 additions & 31 deletions src/interfaces/ITCO2.sol

This file was deleted.

19 changes: 0 additions & 19 deletions test/TestUtilities.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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: ""
});
}
}

0 comments on commit cfa4f36

Please sign in to comment.