Commit Graph

15 Commits

Author SHA1 Message Date
Christian Kamm 233e5414f4 Use anchor's new require_*!() macros 2022-05-04 13:50:50 +02:00
Christian Kamm eb46a030d1 Upgrade anchor to 0.24.2 2022-05-04 13:50:50 +02:00
Christian Kamm dd51d3cbdd Renames
"unlocked_scaled_factor" was a confusing name because the value is
also used when computing vote weight for locked deposits. Rename to
"baseline_vote_weight_scaled_factor" and generally change "unlocked"
to "baseline" in several places.

Also rename "lockup_scaled_factor" to
"max_extra_lockup_vote_weight_scaled_factor" to highlight that it's just
the maximum contribution and that it's "extra" - on top of baseline.
2022-02-14 10:51:13 +01:00
Christian Kamm 16d22648f7 Rename padding -> reserved and increase its size 2022-02-14 09:06:29 +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
Christian Kamm 5f07ada27b
Improve docs/readability on ConfigureVotingMint (#21) 2022-01-13 15:28:40 +01:00
microwavedcola1 1477c29a0f linter-fix
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-20 11:09:51 +01:00
Christian Kamm 0e45b0d8a4 Prefer Pubkey::default() over manual init 2021-12-18 14:24:58 +01:00
microwavedcola1 9d72320bdd
make vault per voter+mint instead of global per registrar+mint (#14) 2021-12-17 08:02:14 +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 decdd1230c Address unaligned references, add padding
- Make Registrar zero-copy. While it was using borsh for serialization,
  the array of voting mint configs couldn't be serialized without
  unaligned references.
- Reorganize all zero_copy fields such that switching to repr(C) would
  not make a difference. (just for safety in case that happens)
- Add static asserts on the sizes of all account structs, so any changes
  are visible very early.
- Add padding to structs that didn't have it yet.
2021-12-09 11:59:14 +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 317b7168eb Remove instruction name logs since they would be redundant with next anchor release
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-07 19:12:56 +01:00
Christian Kamm 119bdffcec Add grant instruction 2021-12-05 20:36:01 +01:00
Christian Kamm 3374f6c09c Rename ExchangeRate -> VotingMintConfig 2021-12-03 20:49:34 +01:00