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

Staking #107

Merged
merged 20 commits into from
Jun 18, 2024
Merged

Staking #107

merged 20 commits into from
Jun 18, 2024

Conversation

tensojka
Copy link
Contributor

No description provided.

@tensojka tensojka marked this pull request as ready for review June 12, 2024 12:40
@tensojka
Copy link
Contributor Author

known issue: can unstake when tokens are delegated

@tensojka
Copy link
Contributor Author

tensojka commented Jun 12, 2024

also missing:

  • events – staked when?
  • view fn for stake_id,contract_address -> stake info
  • how much currently is staked

@tensojka tensojka marked this pull request as draft June 12, 2024 12:50
Copy link
Collaborator

@Nerrolol Nerrolol left a comment

Choose a reason for hiding this comment

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

The whole structure looks good to me as well as the code (I may need another look to make sure I got it all).
A few questions : atm the staking curve is set only for points 1M, 3M, 6M, 1Y with pre-defined conversion rates. I assume it's for testing purposes only and a true staking curve logic is to be implemented ?

In the staking_tests file, when you verify the balance of the staker is correct (stake of 937 for 3 months => 2342 with the 2,5X conversion rate) why is it rounded to the lowest int?

Maybe a quick test add of unstaking before the unlock_date

Why the line "start_warp(CheatTarget::One(gov.contract_address), get_block_timestamp() + ONE_MONTH * 4 + 1);" remains alone at the end of the test_multiple_overlapping_stake_unstake() after stop_warp ?

@tensojka
Copy link
Contributor Author

tensojka commented Jun 14, 2024

@Nerrolol

The production curve will still be discrete.

It's rounded to the lowest int, because, let's assume we rounded up and not down: let's say you want to lock 1000 KONOHA for a duration that gives you a 1.6x multiplier.

If you lock 1000 directly, you get 1600 veKONOHA.

But if you lock 1000x1 KONOHA (call the function stake() 1000 times), you get 2000 veKONOHA. (1000 KONOHA means 1000*10**-18 KONOHA actually if you account for decimals)

Adding a test of unstaking before expiry

@tensojka tensojka marked this pull request as ready for review June 14, 2024 16:04
@tensojka tensojka requested a review from Chepelau June 14, 2024 16:05
@Nerrolol Nerrolol self-requested a review June 14, 2024 20:21
Copy link
Collaborator

@Nerrolol Nerrolol left a comment

Choose a reason for hiding this comment

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

lgtm

src/constants.cairo Outdated Show resolved Hide resolved
src/staking.cairo Outdated Show resolved Hide resolved
src/token.cairo Show resolved Hide resolved
@tensojka tensojka merged commit 1d7306e into master Jun 18, 2024
1 check passed
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.

3 participants