Commit Graph

31 Commits

Author SHA1 Message Date
Sebastian Bor dd6be5bef8 chore: Make Clippy happy 2022-12-21 13:10:19 +00: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 b7782dcd5c LogVoterInfo: Make range configurable
Previously the instruction was hardcoded to return 16 accounts. It
turned out that this number was too big for the current limits on
compute units.
2022-02-11 13:47:47 +01:00
microwavedcola1 2105e1b173
fix clippy warnings and some other deprecations (#33)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-02-04 09:32:55 +01:00
Christian Kamm 1a577eb7bd
Upgrade spl-governance version (#30)
Upgrade to latest spl-governance

Co-authored-by: microwavedcola1 <microwavedcola@gmail.com>
2022-02-01 10:46:03 +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 7b7ce7d8ce Add internal_transfer_unlocked
Rename internal_transfer -> internal_transfer_locked

The new instruction can move only unlocked funds and is useful to avoid
needing to withdraw funds if they should be re-locked in a different
deposit entry.

Withdrawing can be impossible when a voter is engaged in proposals.
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 183626ad32 Add LogVoterInfo instruction
It has no effect on any state. It logs information about the voter and
all of its deposits to the program log. This can be used from the UI.
2022-01-19 09:04:39 +01:00
Christian Kamm 9c8dd35ba6 Grant/CreateDeposit: Allow control of start timestamp 2021-12-17 07:51:06 +01:00
Christian Kamm 3071c1edcf Update program ids for devnet deployment 2021-12-14 12:47:12 +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 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
Christian Kamm 119bdffcec Add grant instruction 2021-12-05 20:36:01 +01:00
microwavedcola1 9c1763f8c4 separate clawback and withdraw
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-04 09:22:22 +01:00
Christian Kamm 3374f6c09c Rename ExchangeRate -> VotingMintConfig 2021-12-03 20:49:34 +01:00
Christian Kamm 0b049ad3f8 Add reset_lockup tests / add max period check 2021-12-03 11:38:45 +01:00
Christian Kamm 0612a3f918 Simplify state:: use 2021-12-03 09:52:48 +01:00
Christian Kamm b91f9ba595 Pass deposit_entry_index to create_deposit_entry()
This allows create_deposit_entry() and deposit() to be in the same
transaction.
2021-12-03 09:48:10 +01:00
Christian Kamm 5983a67de7 Consistently use 'deposit_entry_index' as a name for the index 2021-12-03 09:08:29 +01:00
microwavedcola1 9823f282d4 split accounts.rs into state/*
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-02 20:05:43 +01:00
Christian Kamm 6d15fb8d77 Simplification and doc comments 2021-12-02 19:30:41 +01:00
Christian Kamm f5ea3180d1 Move all instructions to separate files 2021-12-02 16:28:12 +01:00
Christian Kamm 37a3ab9b0f Rename CloseDeposit -> CloseDepositEntry 2021-12-02 11:08:18 +01:00
Christian Kamm f5ecf79765 Rename UpdateDeposit -> Deposit 2021-12-02 11:06:15 +01:00
Christian Kamm daf4609c41 Rename CreateDeposit -> CreateDepositEntry and make it separate
It doesn't implicitly call UpdateDeposit now
2021-12-02 11:01:14 +01:00
microwavedcola1 333584ad92 rename
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-01 14:51:40 +01:00
microwavedcola1 75335477ef fix bug: clawback should only happen on a not-closed deposit
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-01 14:34:42 +01:00
Christian Kamm 0543f5fe20 Rename to voter-stake-registry 2021-12-01 13:28:38 +01:00