examples/lockup: Match beneficiary on unstaking
This commit is contained in:
parent
012e258705
commit
c6552e8ded
|
@ -33,7 +33,7 @@ mod registry {
|
||||||
// Hard code the authority because the first version of this program
|
// Hard code the authority because the first version of this program
|
||||||
// did not set an authority account in the global state.
|
// did not set an authority account in the global state.
|
||||||
//
|
//
|
||||||
// When we remove the program's upgrade authority, we should remove
|
// When removing the program's upgrade authority, one should remove
|
||||||
// this method first, redeploy, then remove the upgrade authority.
|
// this method first, redeploy, then remove the upgrade authority.
|
||||||
let expected: Pubkey = "HUgFuN4PbvF5YzjDSw9dQ8uTJUcwm2ANsMXwvRdY4ABx"
|
let expected: Pubkey = "HUgFuN4PbvF5YzjDSw9dQ8uTJUcwm2ANsMXwvRdY4ABx"
|
||||||
.parse()
|
.parse()
|
||||||
|
@ -784,6 +784,7 @@ pub struct Stake<'info> {
|
||||||
#[derive(Accounts)]
|
#[derive(Accounts)]
|
||||||
pub struct StartUnstake<'info> {
|
pub struct StartUnstake<'info> {
|
||||||
// Stake instance globals.
|
// Stake instance globals.
|
||||||
|
#[account(has_one = reward_event_q)]
|
||||||
registrar: ProgramAccount<'info, Registrar>,
|
registrar: ProgramAccount<'info, Registrar>,
|
||||||
reward_event_q: ProgramAccount<'info, RewardQueue>,
|
reward_event_q: ProgramAccount<'info, RewardQueue>,
|
||||||
#[account(mut)]
|
#[account(mut)]
|
||||||
|
@ -792,7 +793,7 @@ pub struct StartUnstake<'info> {
|
||||||
// Member.
|
// Member.
|
||||||
#[account(init)]
|
#[account(init)]
|
||||||
pending_withdrawal: ProgramAccount<'info, PendingWithdrawal>,
|
pending_withdrawal: ProgramAccount<'info, PendingWithdrawal>,
|
||||||
#[account(belongs_to = registrar)]
|
#[account(has_one = beneficiary, belongs_to = registrar)]
|
||||||
member: ProgramAccount<'info, Member>,
|
member: ProgramAccount<'info, Member>,
|
||||||
#[account(signer)]
|
#[account(signer)]
|
||||||
beneficiary: AccountInfo<'info>,
|
beneficiary: AccountInfo<'info>,
|
||||||
|
@ -829,8 +830,10 @@ pub struct EndUnstake<'info> {
|
||||||
#[account(mut, belongs_to = registrar, belongs_to = member, "!pending_withdrawal.burned")]
|
#[account(mut, belongs_to = registrar, belongs_to = member, "!pending_withdrawal.burned")]
|
||||||
pending_withdrawal: ProgramAccount<'info, PendingWithdrawal>,
|
pending_withdrawal: ProgramAccount<'info, PendingWithdrawal>,
|
||||||
|
|
||||||
// if we had ordered maps implementing Accounts we could do a constraint like
|
// If we had ordered maps implementing Accounts we could do a constraint like
|
||||||
// balances.get(pending_withdrawal.balance_id).vault == vault.key
|
// balances.get(pending_withdrawal.balance_id).vault == vault.key.
|
||||||
|
//
|
||||||
|
// Note: we do the constraints check in the handler, not here.
|
||||||
#[account(mut)]
|
#[account(mut)]
|
||||||
vault: AccountInfo<'info>,
|
vault: AccountInfo<'info>,
|
||||||
#[account(mut)]
|
#[account(mut)]
|
||||||
|
|
Loading…
Reference in New Issue