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(protocol): Strike price to token grants #15506

Closed
wants to merge 8 commits into from

Conversation

adaki2004
Copy link
Contributor

TKO tokens now shall be bought when withdrawn for a strike price (per TKO in stable token) - it still can be 0.

Copy link

vercel bot commented Jan 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
bridge-ui-v2-a5 ✅ Ready (Inspect) Visit Preview Jan 16, 2024 1:23pm
bridge-ui-v2-a6 ✅ Ready (Inspect) Visit Preview Jan 16, 2024 1:23pm
bridge-ui-v2-internal ✅ Ready (Inspect) Visit Preview Jan 16, 2024 1:23pm

packages/protocol/contracts/team/TimelockTokenPool.sol Outdated Show resolved Hide resolved
packages/protocol/contracts/team/TimelockTokenPool.sol Outdated Show resolved Hide resolved
packages/protocol/contracts/team/TimelockTokenPool.sol Outdated Show resolved Hide resolved
packages/protocol/contracts/team/TimelockTokenPool.sol Outdated Show resolved Hide resolved
amount += _getAmountUnlocked(r.grants[i]);
uint128 perGrantAmount;

perGrantAmount = _getAmountUnlocked(r.grants[i]);
Copy link
Contributor

Choose a reason for hiding this comment

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

it will be great to merge these 3 lines into the _getAmountUnlocked and rename it as _getAmountAndCostUnlocked

Copy link
Contributor

Choose a reason for hiding this comment

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

Here is a logical error: r.amountWithdrawn is the total amount withdrawn for all grants assigned to this address, previously this is ok, but now each grant has a different strike price, you have to calculated the cost per grant with its own amountWithdrawn. The Recipient must be modified to remove amountWithdrawn and put amountWithdrawn inside each grant`. How tests didn't capture this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.
Tests were not catching because i set the strikePrices to 0 every existing tests, and added 2 new, but they did not intermediary steps, just X years after 100% fully unlocks, so this kind of case did not come up. Now i modified all files to have a non-zero strike price.

Co-authored-by: Daniel Wang <99078276+dantaik@users.noreply.github.com>
@dantaik
Copy link
Contributor

dantaik commented Jan 18, 2024

I prefer another implementation in #15522 with minimal changes.

@adaki2004 adaki2004 closed this Jan 18, 2024
@dantaik dantaik deleted the strike_price_to_token_grants branch March 1, 2024 09:29
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