Commit Graph

15 Commits

Author SHA1 Message Date
Christian Kamm eb46a030d1 Upgrade anchor to 0.24.2 2022-05-04 13:50:50 +02:00
Christian Kamm b0660df3b9 Add function to compute the guaranteed locked vote power bonus
This is useful for other programs that may want to make decisions purely
based on the amount of weight generated from guaranteed-to-be-locked
tokens at a specific time.
2022-03-10 12:38:02 +01:00
Christian Kamm 5b3d07ffb3 Renames for clarity
- withdrawable -> unlocked

  "withdrawable" was a bad name, since these funds - while unlocked -
  are not necessarily withdrawable if the voter is currently engaged in
  a vote.

- only_deposit -> only_unlocked

  Locked funds are technically also deposited. Make it clearer that this
  is talking about the unlocked parts of the funds on the account.
2022-01-26 09:01:17 +01:00
microwavedcola1 e7ffe744e9
close vault and return rent sol (#26)
close vault and recover rent sol via remaining accounts, in close voter ix
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-01-25 14:56:15 +01:00
Christian Kamm b30375e0ac Update error comments for easy error code reference 2022-01-25 13:01:11 +01:00
Christian Kamm 40708e80ef Fix underflow in voting computation
The vote power computation was broken for lockups that start very far
in the future.

- Fix the underflow itself
- Disallow lockups that start more than 100 years in the future
- Error if the lockup-scaled voting power is bigger than the maximum
  lockup voting power
2022-01-25 13:00:45 +01:00
Christian Kamm 49e137eb51 Add constant-maturity lockup
Adds LockupKind::Constant, extends the reset_lockup instruction and
adds the internal_transfer instruction to allow working with constant
maturity lockups.
2021-12-14 10:19:47 +01:00
Christian Kamm 8f3af93f99 Change assert() to require()
So these assumption-guaranteeing checks aren't removed.
2021-12-10 16:22:43 +01:00
Christian Kamm 89f5954961 Allow changing of voting mint config parameters
Previously the configure_voting_mint() instruction could only be run
once per index. Now it's allowed to call it again to change a mint's
parameters.

This will directly be useful for Mango, which will likely start out
configuring the MNGO voting mint without lockup vote scaling and then
later enable it, when the ui is ready.
2021-12-10 09:26:30 +01:00
Christian Kamm ddf37c4de0
Configurable options for vote weight scaling factors (#7)
Configurable options for vote weight scaling and lockup saturation

Co-authored-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-09 11:58:15 +01:00
microwavedcola1 7698d2f45e withdraw should be the firs instruction
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-05 09:53:39 +01:00
Christian Kamm 3374f6c09c Rename ExchangeRate -> VotingMintConfig 2021-12-03 20:49:34 +01:00
microwavedcola1 0f4a0a40c9 some minor renaming
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-03 16:06:44 +01:00
Christian Kamm 5983a67de7 Consistently use 'deposit_entry_index' as a name for the index 2021-12-03 09:08:29 +01:00
Christian Kamm 0543f5fe20 Rename to voter-stake-registry 2021-12-01 13:28:38 +01:00