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

feat: remove explicit rounding from getClaimPreview function #5

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

igorsenych-cw
Copy link
Collaborator

Main changes

  1. The getClaimPreview function has been updated by removing a bool round parameter:
    /**
     * @dev Provides a preview of the claimable yield for a given account at the current time.
     * Estimates the yield amount that can be claimed without modifying the contract state.
     *
     * @param account The address of the account to query.
     * @return A `ClaimPreview` struct containing details of the claimable yield.
     */
    function getClaimPreview(address account) external view returns (IYieldStreamerTypes.ClaimPreview memory);
  1. The ClaimPreview has been extended by adding Exact and Rounded groups of fields:
    /**
     * @dev Structure representing a preview of the claimable yield for an account.
     * Used to estimate the yield that can be claimed without modifying the contract state.
     *
     * Fields:
     * - `yieldExact`: The total claimable yield amount available for the account (without rounding).
     * - `feeExact`: The fee amount that would be deducted during the claim (without rounding).
     * - `yieldRounded`: The total claimable yield amount available for the account (rounded).
     * - `feeRounded`: The fee amount that would be deducted during the claim (rounded).
     * - `timestamp`: The timestamp at which the preview was calculated.
     * - `balance`: The account's token balance used in the calculation.
     * - `rates`: The current yield rates applicable to the account.
     * - `caps`: The current rate caps applicable to the account.
     */
    struct ClaimPreview {
        uint256 yieldExact;
        uint256 feeExact;
        uint256 yieldRounded;
        uint256 feeRounded;
        uint256 timestamp;
        uint256 balance;
        uint256[] rates;
        uint256[] caps;
    }

Contract version

The contract version was updated from v2.1.0 to 2.2.0.

Test coverage

The changes are fully covered by the tests.

@igorsenych-cw igorsenych-cw marked this pull request as ready for review November 25, 2024 13:05
@igorsenych-cw igorsenych-cw merged commit 1aba641 into main Nov 25, 2024
6 checks passed
@igorsenych-cw igorsenych-cw deleted the remove-explicit-rounding branch November 25, 2024 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants