-
Notifications
You must be signed in to change notification settings - Fork 43
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
New Staking Curve #113
base: master
Are you sure you want to change the base?
New Staking Curve #113
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing code that gets total_supply and balance_of the voting token – this is now finally possible to be implemented.
How will tokens locked the old way be handled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update voting_token.cairo to use these functions from staking.cairo, we need total_supply to work correctly.
The tests test only staking itself, but not that it works correctly with proposals/upgrades (doesn't mess with quorum, etc)
let unlock_date = current_time + lock_duration; | ||
assert(unlock_date > current_time, 'can only lock in the future(CL)'); | ||
|
||
//maybe a max time assertion? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes definitely, also set MAX_TIME to 2 yrs
} | ||
); | ||
} | ||
fn withdraw(ref self: ComponentState<TContractState>, caller: ContractAddress) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you burn the locked token anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if caller is withdrawing their staked tokens, shouldn't it be transferred back to them and not burned?
New Staking Curve that implements linear decay. Allows for you to create a lock that sets the staking amount and time you will lock it for (create_lock(amount, lock_time). Basically queries when you do so and keeps track of locked amount and lock creation time. Then if you call get_balance_of, it applies linear decay formula which to calculate your current amount at this time stamp.
IMPORTANT:
by changing the functions like set_staking_curve, it affected almost all other test files that used these functions like test_treasury.
Not sure what we must do about this, since both curves are different.