Conversation
ondrejsojka
left a comment
There was a problem hiding this comment.
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?
ondrejsojka
left a comment
There was a problem hiding this comment.
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.
Yes definitely, also set MAX_TIME to 2 yrs
| } | ||
| ); | ||
| } | ||
| fn withdraw(ref self: ComponentState<TContractState>, caller: ContractAddress) { |
There was a problem hiding this comment.
I don't think you burn the locked token anywhere?
There was a problem hiding this comment.
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.