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

Revert when not enough precision to assign a delegation share #491

Merged
merged 2 commits into from
Sep 22, 2021

Conversation

abarmat
Copy link
Contributor

@abarmat abarmat commented Aug 5, 2021

Description

A delegation pool holds tokens deposited by delegators as well as rewards. When rewards start accruing, depositing a very very small amount of new tokens by a delegator could lead to zero shares being assigned.

uint256 shares = (pool.tokens == 0)
            ? delegatedTokens
            : delegatedTokens.mul(pool.shares).div(pool.tokens)

Solution

Revert in any condition when no shares are assigned.

@abarmat abarmat added GIP bug Something isn't working labels Aug 5, 2021
@abarmat abarmat force-pushed the ariel/delegation-no-shares branch from 9c1eb8f to 059f634 Compare August 9, 2021 13:37
@davekaj
Copy link
Contributor

davekaj commented Aug 12, 2021

rebase the conflicts but otherwise good

@abarmat abarmat force-pushed the ariel/delegation-no-shares branch from 372bd75 to 059f634 Compare September 22, 2021 03:55
@abarmat abarmat merged commit 834854a into dev Sep 22, 2021
@abarmat abarmat deleted the ariel/delegation-no-shares branch September 22, 2021 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working GIP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants