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

Seed Gauge System: add view function for subgraph. #843

Merged
merged 1 commit into from
Apr 28, 2024

Conversation

Brean0
Copy link
Contributor

@Brean0 Brean0 commented Apr 28, 2024

When a user calls getLockedBeans in the same block as the sunrise block, the function returns an empty array, due to the lockedBeans implmentation using a twaReserves and the inability to calculate the twaReserves when no time has passed. Implementing an alternative where the current reserves were used would lead to an inaccurate amount.

This PR adds getLockedBeansFromTwaReserves, which allows the user to input a cumulativeReserves and timestamp. In practice, this can be used at the sunrise block by using the cumulativeReserves emitted by the WellOracle Event and timestamp of the previous season.

The view function was added to beanstalk.

function getLockedBeansFromTwaReserves(
        bytes memory cumulativeReserves,
        uint40 timestamp
    ) external view

@Brean0 Brean0 merged commit cbef4ff into bip39-seedGauge Apr 28, 2024
1 check passed
@Brean0 Brean0 deleted the lockedBeans-subgraph branch April 28, 2024 22:31
@BeanstalkFarmsOperations BeanstalkFarmsOperations changed the title add view function for subgraph. Seed Gauge System: add view function for subgraph. Apr 30, 2024
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.

1 participant