Commit Graph

262 Commits

Author SHA1 Message Date
Christian Kamm 22a050e270 Remove token program from create_registrar 2021-12-03 14:05:03 +01:00
Christian Kamm 9d9ebff1c1 Common code for finding exchange rate index 2021-12-03 13:03:16 +01:00
Christian Kamm 78bebfdd98 Common code for token owner record validation 2021-12-03 12:54:51 +01:00
Christian Kamm 7278eac1fc Common code for deposit entry index checks 2021-12-03 12:46:37 +01:00
Christian Kamm aa1c536b9c Tests: check start up lockup, and withdrawable amount 2021-12-03 12:29:37 +01:00
Christian Kamm 0b049ad3f8 Add reset_lockup tests / add max period check 2021-12-03 11:38:45 +01:00
Christian Kamm e1350c3aa3 Update README 2021-12-03 10:02:03 +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 d9fac29b28 Documentation improvements 2021-12-03 09:19:13 +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 26e1511e3e Add comments 2021-12-02 21:30:15 +01:00
Christian Kamm 0c1d961bdc README: Clarify voting 2021-12-02 21:14:37 +01:00
Christian Kamm 3f158f1f0b Drop unused use 2021-12-02 20:28:03 +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 7fa584e77a Remove unused `use` declarations 2021-12-02 19:34:27 +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 d1471a2820 Resolve some warnings 2021-12-02 12:06:29 +01:00
Christian Kamm 8d4105ee29 Drop ts tests
We can bring them back once we can create a spl-governance instance
inside them - otherwise making a registrar is impossible.
2021-12-02 11:14:42 +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
Christian Kamm d4a37de1c2 Extend README with descriptions and usage 2021-12-02 08:06:56 +01:00
Christian Kamm 17a023fe6d cargo fmt 2021-12-02 08:06:45 +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
Christian Kamm 0efd7c0518 Adjust lockup ending after clawback() 2021-12-01 12:40:52 +01:00
Christian Kamm 304af2ae7d Test: withdraw before and after clawback
This way we check that it can deal with withdrawn vested amounts
2021-12-01 12:36:06 +01:00
Christian Kamm 57dbe54e7c Merge remote-tracking branch 'origin/master' into clawback 2021-12-01 12:25:15 +01:00
Christian Kamm 811063ab44 Minor: remove todo 2021-12-01 12:15:39 +01:00
Christian Kamm 4c49608ac5 Tests: remove stale argument from clawback() 2021-12-01 12:13:07 +01:00
Christian Kamm 6244649140 Remove proxy tokens for locked deposits
It was unclear how clawback() was to burn these tokens when it didn't
have the authority for the voting_token account. update_deposit() also
couldn't pre-approve because it also doesn't have a voter_authority
signature.
2021-12-01 12:09:07 +01:00
Christian Kamm b011d8999b Fix clawback authority validation
Tests currently fail because clawback can't burn voting_token funds.
2021-12-01 12:03:38 +01:00
Christian Kamm 8257f29c4e Deposits with clawback can only be closed when locking period is over 2021-12-01 11:42:08 +01:00
Christian Kamm 98e09c5a89 Require voter_authority for create deposit, not for update deposit 2021-12-01 11:33:35 +01:00
Christian Kamm 89f94ae553 Fix amount_not_yet_vested in clawback 2021-12-01 11:18:02 +01:00
Christian Kamm c7aaa811d4 Remove clawback checks that might prohibit DAO from using it 2021-12-01 11:14:56 +01:00
Christian Kamm 9bfb3ba865 Don't allow update_deposit to change allow_clawback 2021-12-01 11:12:24 +01:00
microwavedcola1 3303c6e627 clawback v1
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-01 10:20:39 +01:00
Christian Kamm bf620a6bea Add constraint notes on UnceckedAccounts 2021-12-01 09:46:13 +01:00
Christian Kamm 62764866d7 Registrar creation needs a valid realm authority 2021-12-01 09:29:07 +01:00
Christian Kamm de80fc6f20 Change withdraw token owner record checks
As suggested by SebastianBor
2021-12-01 09:11:45 +01:00
Christian Kamm 96905a9eb2 Add governing token mint constraint on update voter weight record 2021-12-01 09:01:05 +01:00
Christian Kamm 6b54623831 Don't require signing for UpdateVoterWeightRecord 2021-12-01 08:59:25 +01:00
Christian Kamm 211f70b2ee Use arbitrary governing mint
Also
- fix deposit_cliff test
- proactively avoid collisions in PDA seeds
- macro for getting registrar seeds
2021-12-01 08:52:39 +01:00
microwavedcola1 c5e1f6e9b3 box registrat to prevent hammering of stack
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-01 07:45:00 +01:00
Christian Kamm 10f8961882 Basic cliff vesting tests 2021-11-30 15:11:07 +01:00
microwavedcola1 b8c1c1f1f2 revert clawback change
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-11-30 14:16:07 +01:00