Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion programs/nft_proxy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "nft-proxy"
version = "0.0.2"
version = "0.0.3"
description = "Created with Anchor"
edition = "2021"

Expand Down
7 changes: 7 additions & 0 deletions programs/nft_proxy/src/instructions/unassign_proxy_v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,12 @@ pub struct UnassignProxyV0<'info> {
pub fn handler(ctx: Context<UnassignProxyV0>) -> Result<()> {
ctx.accounts.prev_proxy_assignment.next_voter = Pubkey::default();

if ctx.accounts.prev_proxy_assignment.index == 0 {
ctx
.accounts
.prev_proxy_assignment
.close(ctx.accounts.rent_refund.to_account_info())?;
}

Ok(())
}
6 changes: 2 additions & 4 deletions tests/nft-voter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,8 @@ describe("nft-voter", () => {
.rpc({ skipPreflight: true });

expect(
(
await proxyProgram.account.proxyAssignmentV0.fetch(myProxy)
).nextVoter.toBase58()
).to.eq(PublicKey.default.toBase58());
await proxyProgram.account.proxyAssignmentV0.fetchNullable(myProxy)
).to.be.null;
expect(
await proxyProgram.account.proxyAssignmentV0.fetchNullable(
toUnassignProxy
Expand Down
Loading