Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #40

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f90a787
Feature/bump deps (#10)
bryzettler Nov 6, 2023
efcf883
add scripts to package.json
bryzettler Nov 6, 2023
a7facc2
chore(release): publish 0.0.6
bryzettler Nov 6, 2023
1c39345
bump deps
bryzettler Nov 7, 2023
5ee87b2
chore(release): publish 0.0.7
bryzettler Nov 7, 2023
896a808
bump deps
bryzettler Nov 10, 2023
1208f11
chore(release): publish 0.0.8
bryzettler Nov 10, 2023
e6cffa4
Merge remote-tracking branch 'origin/main' into develop
ChewingGlass Jan 31, 2024
bdc8e69
Add devnet feature
ChewingGlass Jan 31, 2024
eaa16fb
chore(release): publish 0.0.9
ChewingGlass Mar 13, 2024
af9b632
Merge remote-tracking branch 'origin/main' into develop
ChewingGlass Mar 13, 2024
f96bb03
Merge remote-tracking branch 'origin/main' into develop
ChewingGlass Apr 15, 2024
71326dd
Add recursive delegation for nft-style voting schems (#11)
ChewingGlass Aug 9, 2024
7cf5ec1
conflicts
bryzettler Aug 12, 2024
c369fdb
Chore/publish 0.0.12 (#33)
bryzettler Aug 12, 2024
b6f50ec
Fix mod gov package.json
ChewingGlass Sep 6, 2024
21a23ba
chore(release): publish 0.0.13
ChewingGlass Sep 6, 2024
678073c
Bump version
ChewingGlass Sep 6, 2024
af34eb9
Merge branch 'main' into develop
ChewingGlass Oct 21, 2024
c7bcf86
[HIP-124]: Implement abstain vote (#37)
ChewingGlass Oct 23, 2024
46b2a82
chore(release): publish 0.0.14
ChewingGlass Oct 24, 2024
a5a886b
Bump version
ChewingGlass Oct 24, 2024
ab7c272
bump squads
ChewingGlass Oct 24, 2024
3d4e674
get another release for state controller
ChewingGlass Oct 24, 2024
6065c0f
Add fallbacks for smart contracts used by HPL (#38)
ChewingGlass Dec 6, 2024
9e64627
chore(release): publish 0.0.15
ChewingGlass Dec 6, 2024
ebf582e
Fix bugs in nft and token voter (#39)
ChewingGlass Dec 13, 2024
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
Prev Previous commit
Fix bugs in nft and token voter (#39)
  • Loading branch information
ChewingGlass authored Dec 13, 2024
commit ebf582ec0f51b5488f6fa6257db60bb8af884eb1
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use crate::state::*;
use anchor_lang::prelude::*;
use anchor_spl::token::Mint;
use nft_proxy::state::ProxyConfigV0;

use crate::state::*;

#[derive(AnchorSerialize, AnchorDeserialize, Clone, Default)]
pub struct InitializeNftVoterArgsV0 {
pub name: String,
Expand All @@ -19,7 +20,7 @@ pub struct InitializeNftVoterV0<'info> {
#[account(
init,
payer = payer,
space = 8 + 60 + std::mem::size_of::<NftVoterV0>(),
space = 8 + 60 + std::mem::size_of::<NftVoterV0>() + 4 + args.name.len(),
seeds = [b"nft_voter", args.name.as_bytes()],
bump
)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use crate::{error::ErrorCode, metaplex::MetadataAccount, RelinquishVoteArgsV0};
use anchor_lang::prelude::*;
use anchor_spl::token::Mint;
use nft_proxy::state::ProxyAssignmentV0;
use proposal::{ProposalConfigV0, ProposalV0};

use crate::{nft_voter_seeds, state::*};
use crate::{
error::ErrorCode, metaplex::MetadataAccount, nft_voter_seeds, state::*, RelinquishVoteArgsV0,
};

#[derive(Accounts)]
pub struct ProxiedRelinquishVoteV0<'info> {
Expand Down Expand Up @@ -35,6 +36,7 @@ pub struct ProxiedRelinquishVoteV0<'info> {
constraint = proxy_assignment.proxy_config == nft_voter.proxy_config,
constraint = proxy_assignment.index <= marker.proxy_index,
constraint = proxy_assignment.expiration_time > Clock::get().unwrap().unix_timestamp,
constraint = proxy_assignment.asset == mint.key(),
)]
pub proxy_assignment: Box<Account<'info, ProxyAssignmentV0>>,
#[account(
Expand Down
6 changes: 3 additions & 3 deletions programs/nft_voter/src/instructions/proxied_vote_v0.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use crate::{error::ErrorCode, metaplex::MetadataAccount, VoteArgsV0};
use anchor_lang::prelude::*;
use anchor_spl::token::Mint;
use nft_proxy::state::ProxyAssignmentV0;
use proposal::{ProposalConfigV0, ProposalV0};

use crate::{nft_voter_seeds, state::*};
use crate::{error::ErrorCode, metaplex::MetadataAccount, nft_voter_seeds, state::*, VoteArgsV0};

#[derive(Accounts)]
pub struct ProxyVoteV0<'info> {
Expand All @@ -13,7 +12,7 @@ pub struct ProxyVoteV0<'info> {
#[account(
init_if_needed,
payer = payer,
space = 8 + 60 + std::mem::size_of::<VoteMarkerV0>(),
space = 8 + 60 + std::mem::size_of::<VoteMarkerV0>() + 2 * proposal.choices.len(),
seeds = [b"marker", nft_voter.key().as_ref(), mint.key().as_ref(), proposal.key().as_ref()],
bump
)]
Expand All @@ -24,6 +23,7 @@ pub struct ProxyVoteV0<'info> {
// only the current or earlier delegates can change vote. Or if proposal not set, this was an `init` for the marker
constraint = proxy_assignment.index <= marker.proxy_index || marker.proposal == Pubkey::default(),
constraint = proxy_assignment.expiration_time > Clock::get().unwrap().unix_timestamp,
constraint = proxy_assignment.asset == mint.key(),
)]
pub proxy_assignment: Box<Account<'info, ProxyAssignmentV0>>,
pub nft_voter: Box<Account<'info, NftVoterV0>>,
Expand Down
5 changes: 2 additions & 3 deletions programs/nft_voter/src/instructions/vote_v0.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use crate::{error::ErrorCode, metaplex::MetadataAccount};
use anchor_lang::prelude::*;
use anchor_spl::token::{Mint, TokenAccount};
use proposal::{ProposalConfigV0, ProposalV0};

use crate::{nft_voter_seeds, state::*};
use crate::{error::ErrorCode, metaplex::MetadataAccount, nft_voter_seeds, state::*};

#[derive(AnchorSerialize, AnchorDeserialize, Clone, Default)]
pub struct VoteArgsV0 {
Expand All @@ -17,7 +16,7 @@ pub struct VoteV0<'info> {
#[account(
init_if_needed,
payer = payer,
space = 8 + 60 + std::mem::size_of::<VoteMarkerV0>(),
space = 8 + 60 + std::mem::size_of::<VoteMarkerV0>() + 2 * proposal.choices.len(),
seeds = [b"marker", nft_voter.key().as_ref(), mint.key().as_ref(), proposal.key().as_ref()],
bump
)]
Expand Down
22 changes: 14 additions & 8 deletions programs/token_voter/src/instructions/initialize_token_voter_v0.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
use crate::metaplex::{
create_master_edition_v3, create_metadata_accounts_v3, CollectionDetails, CreateMasterEditionV3,
CreateMetadataAccountsV3, DataV2, Metadata,
};
use crate::{state::*, token_voter_seeds};
use anchor_lang::prelude::*;
use anchor_spl::associated_token::AssociatedToken;
use anchor_spl::token::{self, Mint, MintTo, Token, TokenAccount};
use anchor_spl::{
associated_token::AssociatedToken,
token::{self, Mint, MintTo, Token, TokenAccount},
};

use crate::{
metaplex::{
create_master_edition_v3, create_metadata_accounts_v3, CollectionDetails,
CreateMasterEditionV3, CreateMetadataAccountsV3, DataV2, Metadata,
},
state::*,
token_voter_seeds,
};

#[derive(AnchorSerialize, AnchorDeserialize, Clone, Default)]
pub struct InitializeTokenVoterArgsV0 {
Expand All @@ -23,7 +29,7 @@ pub struct InitializeTokenVoterV0<'info> {
#[account(
init,
payer = payer,
space = 8 + 60 + std::mem::size_of::<TokenVoterV0>(),
space = 8 + 60 + std::mem::size_of::<TokenVoterV0>() + 4 + args.name.len(),
seeds = [b"token_voter", args.name.as_bytes()],
bump
)]
Expand Down
5 changes: 2 additions & 3 deletions programs/token_voter/src/instructions/vote_v0.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use crate::error::ErrorCode;
use anchor_lang::prelude::*;
use anchor_spl::token::{Mint, TokenAccount};
use proposal::{ProposalConfigV0, ProposalV0};

use crate::{state::*, token_voter_seeds};
use crate::{error::ErrorCode, state::*, token_voter_seeds};

#[derive(AnchorSerialize, AnchorDeserialize, Clone, Default)]
pub struct VoteArgsV0 {
Expand All @@ -17,7 +16,7 @@ pub struct VoteV0<'info> {
#[account(
init_if_needed,
payer = payer,
space = 8 + 60 + std::mem::size_of::<VoteMarkerV0>(),
space = 8 + 60 + std::mem::size_of::<VoteMarkerV0>() + 2 * proposal.choices.len(),
seeds = [b"marker", token_voter.key().as_ref(), mint.key().as_ref(), proposal.key().as_ref()],
bump
)]
Expand Down
17 changes: 10 additions & 7 deletions programs/token_voter/src/instructions/withdraw_v0.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
use crate::metaplex::{burn, Burn, Metadata};
use crate::receipt_seeds;
use crate::state::*;
use anchor_lang::prelude::*;
use anchor_spl::associated_token::AssociatedToken;
use anchor_spl::token::{self, CloseAccount, Transfer};
use anchor_spl::token::{Mint, Token, TokenAccount};
use anchor_spl::{
associated_token::AssociatedToken,
token::{self, CloseAccount, Mint, Token, TokenAccount, Transfer},
};

use crate::{
metaplex::{burn, Burn, Metadata},
receipt_seeds,
state::*,
};

#[derive(Accounts)]
pub struct WithdrawV0<'info> {
Expand Down Expand Up @@ -62,7 +66,6 @@ pub struct WithdrawV0<'info> {

#[account(
mut,
close = refund,
associated_token::authority = receipt,
associated_token::mint = deposit_mint,
)]
Expand Down
Loading