Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LILA-6854] Address Team Omega comments, update emails and versions #56

Merged
merged 5 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions src/FeeCalculator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: UNLICENSED

// If you encounter a vulnerability or an issue, please contact <info@neutralx.com>
// If you encounter a vulnerability or an issue, please contact <security@toucan.earth> or visit security.toucan.earth
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://security.toucan.earth/ would be better here.

pragma solidity 0.8.19;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
Expand Down Expand Up @@ -169,8 +169,6 @@ contract FeeCalculator is IFeeCalculator, Ownable {
override
returns (FeeDistribution memory feeDistribution)
{
require(depositAmount > 0, "depositAmount must be > 0");

feeDistribution =
_calculateFee(depositAmount, IPool(pool).totalPerProjectSupply(tco2), _getTotalSupply(pool), _getDepositFee);
}
Expand All @@ -180,11 +178,11 @@ contract FeeCalculator is IFeeCalculator, Ownable {
/// @return feeDistribution The recipients and the amount of fees each
/// recipient should receive.
function calculateFeeShares(uint256 totalFee) internal view returns (FeeDistribution memory feeDistribution) {
uint256 recipientsLenght = _recipients.length;
uint256[] memory shares = new uint256[](recipientsLenght);
uint256 recipientsLength = _recipients.length;
uint256[] memory shares = new uint256[](recipientsLength);

uint256 restFee = totalFee;
for (uint256 i = 0; i < recipientsLenght; i++) {
for (uint256 i = 0; i < recipientsLength; i++) {
shares[i] = (totalFee * _shares[i]) / 100;
restFee -= shares[i];
}
Expand Down Expand Up @@ -233,8 +231,6 @@ contract FeeCalculator is IFeeCalculator, Ownable {
override
returns (FeeDistribution memory feeDistribution)
{
require(depositAmount > 0, "depositAmount must be > 0");

feeDistribution = _calculateFee(
depositAmount, IPool(pool).totalPerProjectSupply(erc1155, tokenId), _getTotalSupply(pool), _getDepositFee
);
Expand Down
6 changes: 1 addition & 5 deletions src/FlatFeeCalculator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: UNLICENSED

// If you encounter a vulnerability or an issue, please contact <info@neutralx.com>
// If you encounter a vulnerability or an issue, please contact <security@toucan.earth> or visit security.toucan.earth
pragma solidity 0.8.19;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
Expand Down Expand Up @@ -79,8 +79,6 @@ contract FlatFeeCalculator is IFeeCalculator, Ownable {
override
returns (FeeDistribution memory feeDistribution)
{
require(depositAmount > 0, "depositAmount must be > 0");

feeDistribution = _calculateFee(depositAmount);
}

Expand Down Expand Up @@ -135,8 +133,6 @@ contract FlatFeeCalculator is IFeeCalculator, Ownable {
override
returns (FeeDistribution memory feeDistribution)
{
require(depositAmount > 0, "depositAmount must be > 0");

feeDistribution = _calculateFee(depositAmount);
}

Expand Down
2 changes: 1 addition & 1 deletion test/FeeCalculator/AbstractFeeCalculator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ abstract contract AbstractFeeCalculatorTest is Test {
setProjectSupply(address(mockToken), 500 * 1e18);

// Act
vm.expectRevert("depositAmount must be > 0");
vm.expectRevert("requested amount must be > 0");
calculateDepositFees(address(mockPool), address(mockToken), depositAmount);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ abstract contract AbstractFeeCalculatorLaunchParamsTest is Test {
setProjectSupply(address(mockToken), 500 * 1e18);

// Act
vm.expectRevert("depositAmount must be > 0");
vm.expectRevert("requested amount must be > 0");
calculateDepositFees(address(mockPool), address(mockToken), depositAmount);
}

Expand Down