Commit Graph

237 Commits

Author SHA1 Message Date
Christian Kamm a6ad8b2fdb README: Add grant instruction 2021-12-05 20:46:21 +01:00
Christian Kamm 119bdffcec Add grant instruction 2021-12-05 20:36:01 +01:00
Christian Kamm 4cbe9ad4d6 Make create_voter idempotent 2021-12-05 15:29:14 +01:00
Christian Kamm 05582700cf Make create_voter permissionless 2021-12-05 14:34:03 +01:00
Christian Kamm bae63655cc Update voter weight record in withdraw
This avoids a security issue where three separate transactions in the
same slot may update the voter weight record, withdraw funds and then
vote with the stale voter weight record.
2021-12-05 11:58:56 +01:00
Christian Kamm 01168bad3c Fix new withdraw() instruction check 2021-12-05 11:39:39 +01:00
microwavedcola1 14040bafc7 Revert "this condition is not needed anymore, since we check that the withdraw is the first ix in the tx"
This reverts commit 5f2bfea4e3.
2021-12-05 11:31:00 +01:00
microwavedcola1 5f2bfea4e3 this condition is not needed anymore, since we check that the withdraw is the first ix in the tx
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-05 10:14:56 +01:00
microwavedcola1 bac332b1c8 add-todo
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-05 10:14:05 +01:00
microwavedcola1 3f1be68c06 typo
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-05 10:12:47 +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 edc64452ed Address test compilation warnings 2021-12-05 09:04:04 +01:00
Christian Kamm 645f02ebd4 Tests: Add a test that checks integration with spl-governance
By making a proposal (with the necessary amount of vote weight) and
voting on it.
2021-12-05 09:00:07 +01:00
Christian Kamm 03cfe65d9c Simplify withdraw/clawback authority checks 2021-12-04 10:54:33 +01:00
microwavedcola1 9c1763f8c4 separate clawback and withdraw
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-04 09:22:22 +01:00
microwavedcola1 a9731a749c add seed checks
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2021-12-04 09:02:20 +01:00
Christian Kamm 9a3233db98 README: Fix bad links 2021-12-03 21:56:53 +01:00
Christian Kamm f68809c8f6 README: Add instruction overview 2021-12-03 21:51:46 +01:00
Christian Kamm 9472c882ee Minor local var rename 2021-12-03 21:19:33 +01:00
Christian Kamm aad6f296da Restructure and add sanity asserts 2021-12-03 21:13:32 +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 15c69a317a Lockup: share common code and checks 2021-12-03 14:51:10 +01:00
Christian Kamm 6392e5f2c9 Add function for computing amount of locked tokens 2021-12-03 14:36:23 +01:00
Christian Kamm bee5c556ca Remove unneeded mint accounts 2021-12-03 14:26:42 +01:00
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