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

chore: migrate deposits into sd59x60 #9

Merged
merged 6 commits into from
Nov 21, 2023
Merged

Conversation

kosecki123
Copy link
Contributor

This simplifies the code by using sd59x60 for deposits.

feesDenominatedInPoolTokens[0] += restFee;//we give rest of the fee (if any) to the first recipient
}

function calculateRedemptionFee(address tco2, address pool, uint256 depositAmount) external override returns (address[] memory recipients, uint256[] memory feesDenominatedInPoolTokens) {
require(depositAmount > 0, "depositAmount must be > 0");
Copy link
Contributor

@PawelTroka PawelTroka Nov 21, 2023

Choose a reason for hiding this comment

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

Redemption amount must be > 0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea, but our interface has the param "depositAmount" so intentionally keep it like this

Copy link
Contributor

Choose a reason for hiding this comment

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

yea, but our interface has the param "depositAmount" so intentionally keep it like this

should it though? maybe the interface should be changed then as well

feesDenominatedInPoolTokens[i] = (totalFee * _shares[i]) / 100;
restFee -= feesDenominatedInPoolTokens[i];
}

require(restFee >=0);
require(restFee >= 0);
recipients = _recipients;
Copy link
Contributor

Choose a reason for hiding this comment

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

is this ok that we assign a reference here to our field and expose it outside? or is it still copied over?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's copied but not via the manually copying each item, should be more efficient

@@ -44,27 +34,30 @@ contract FeeCalculator is IDepositFeeCalculator, IRedemptionFeeCalculator {
}

function calculateDepositFees(address tco2, address pool, uint256 depositAmount) external override returns (address[] memory recipients, uint256[] memory feesDenominatedInPoolTokens) {
require(depositAmount > 0, "depositAmount must be > 0");
Copy link
Contributor

Choose a reason for hiding this comment

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

Deposit amount must be greater than 0 could be a better phrasing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

depositAmount refers to param name

Copy link
Contributor

@PawelTroka PawelTroka left a comment

Choose a reason for hiding this comment

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

looks good, just some comments to consider

@kosecki123 kosecki123 merged commit abf0c6d into main Nov 21, 2023
1 check passed
@kosecki123 kosecki123 deleted the chore/deposits-into-sd branch November 21, 2023 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants