-
Notifications
You must be signed in to change notification settings - Fork 8
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
Interest distribution operator #415
base: main
Are you sure you want to change the base?
Conversation
src/interfaces/IERC7540.sol
Outdated
@@ -308,6 +308,12 @@ interface IERC7540Vault is | |||
/// @dev MUST be called by endorsed sender | |||
function setEndorsedOperator(address owner, bool approved) external; | |||
|
|||
/// @notice TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// @notice TODO | |
// --- Helpers --- | |
/// @notice Price of 1 unit of share, quoted in the decimals of the asset. |
@@ -0,0 +1,34 @@ | |||
// SPDX-License-Identifier: AGPL-3.0-only | |||
pragma solidity >=0.5.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any specific reason why pragma is defined like that ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allows any integration to pull in these interfaces, using any Solidity version.
} | ||
|
||
/// @inheritdoc IInterestDistributor | ||
function clear(address vault, address controller) external { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rename this to dropOut
. Meaning that you want to drop-out from the interest distribution process.
// Assuming price updates coincide with epoch fulfillments, this results in only requesting | ||
// interest on the previous outstanding balance before the new fulfillment. | ||
uint128 request = priceLastUpdated > user.lastUpdate | ||
? _computeRequest(user.shares, currentShares, user.peak, uint96(currentPrice)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
? _computeRequest(user.shares, currentShares, user.peak, uint96(currentPrice)) | |
? _computerRedeemAmount(user.shares, currentShares, user.peak, uint96(currentPrice)) |
// Calculate request before updating user.shares, so it is based on the balance at the last price update. | ||
// Assuming price updates coincide with epoch fulfillments, this results in only requesting | ||
// interest on the previous outstanding balance before the new fulfillment. | ||
uint128 request = priceLastUpdated > user.lastUpdate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint128 request = priceLastUpdated > user.lastUpdate | |
uint128 redeemAmount = priceLastUpdated > user.lastUpdate |
contract InterestDistributor is IInterestDistributor { | ||
using MathLib for uint256; | ||
|
||
mapping(address vault => mapping(address user => InterestDetails)) internal _users; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mapping(address vault => mapping(address user => InterestDetails)) internal _users; | |
mapping(address vault => mapping(address user => InterestDetails)) public users; |
Coverage after merging interest-distributor into main will be
Coverage Report
|
No description provided.