diff --git a/crates/core/diesel.toml b/crates/core/diesel.toml index 9a22b5f76..85c249ab8 100644 --- a/crates/core/diesel.toml +++ b/crates/core/diesel.toml @@ -9,8 +9,17 @@ import_types = [ """crate::db::custom_types::{\ ListingEventLifecycle as Listingeventlifecycle, \ Mode, \ + ProposalState as Proposalstate, \ + InstructionExecutionFlags as Instructionexecutionflags, \ + ProposalVoteType as Proposalvotetype, \ + OptionVoteResult as Optionvoteresult, \ + MintMaxVoteType as Mintmaxvotetype, \ + VoteTipping as Votetipping, \ + VoteRecordV2Vote as Vote_record_v2_vote, \ + VoteThresholdType as Votethresholdtype, \ + GovernanceAccountType as Governanceaccounttype, \ OfferEventLifecycle as Offereventlifecycle, \ SettingType as Settingtype, \ TokenStandard as Token_standard, \ }""", -] \ No newline at end of file +] diff --git a/crates/core/migrations/2022-08-01-194600_create_spl_governance_tables/down.sql b/crates/core/migrations/2022-08-01-194600_create_spl_governance_tables/down.sql new file mode 100644 index 000000000..e6f0ad80c --- /dev/null +++ b/crates/core/migrations/2022-08-01-194600_create_spl_governance_tables/down.sql @@ -0,0 +1,20 @@ +drop table if exists governance_configs; +drop table if exists governances; +drop table if exists realm_configs; +drop table if exists realms; +drop table if exists vote_records_v2; +drop table if exists vote_record_v2_vote_approve_vote_choices; +drop table if exists token_owner_records_v2; +drop table if exists signatory_records_v2; +drop table if exists proposals_v2; +drop table if exists proposal_vote_type_multi_choices; +drop table if exists proposal_options; +drop type if exists governanceaccounttype; +drop type if exists votethresholdtype; +drop type if exists votetipping; +drop type if exists mintmaxvotetype; +drop type if exists vote_record_v2_vote; +drop type if exists proposalstate; +drop type if exists instructionexecutionflags; +drop type if exists proposalvotetype; +drop type if exists optionvoteresult; diff --git a/crates/core/migrations/2022-08-01-194600_create_spl_governance_tables/up.sql b/crates/core/migrations/2022-08-01-194600_create_spl_governance_tables/up.sql new file mode 100644 index 000000000..1421fbef4 --- /dev/null +++ b/crates/core/migrations/2022-08-01-194600_create_spl_governance_tables/up.sql @@ -0,0 +1,240 @@ +create type governanceaccounttype as enum ( + 'Uninitialized', 'RealmV1', 'TokenOwnerRecordV1', + 'GovernanceV1', 'ProgramGovernanceV1', + 'ProposalV1', 'SignatoryRecordV1', + 'VoteRecordV1', 'ProposalInstructionV1', + 'MintGovernanceV1', 'TokenGovernanceV1', + 'RealmConfig', 'VoteRecordV2', 'ProposalTransactionV2', + 'ProposalV2', 'ProgramMetadata', + 'RealmV2', 'TokenOwnerRecordV2', + 'GovernanceV2', 'ProgramGovernanceV2', + 'MintGovernanceV2', 'TokenGovernanceV2', + 'SignatoryRecordV2' +); + +create type votethresholdtype +as enum ('YesVote', 'Quorum'); + +create type votetipping +as enum ('Strict', 'Early', 'Disabled'); + +create type mintmaxvotetype +as enum ('SupplyFraction', 'Absolute'); + +create type vote_record_v2_vote +as enum ('Approve', 'Deny', 'Abstain', 'Veto'); + +create type proposalstate +as enum ('Draft', 'SigningOff', 'Voting', 'Succeeded', 'Executing', 'Completed', 'Cancelled', 'Defeated', 'ExecutingWithErrors'); + +create type instructionexecutionflags +as enum ('None', 'Ordered', 'UseTransaction'); + +create type proposalvotetype +as enum ('SingleChoice', 'MultiChoice'); + +create type optionvoteresult +as enum ('None', 'Succeeded', 'Defeated'); + +create table if not exists governances ( + address varchar(48) primary key, + account_type governanceaccounttype not null, + realm varchar(48) not null, + governed_account varchar(48) not null, + proposals_count bigint not null, + reserved bytea not null, + voting_proposal_count smallint not null, + slot bigint not null, + write_version bigint not null +); + +create table if not exists governance_configs ( + governance_address varchar(48) primary key, + vote_threshold_type votethresholdtype not null, + vote_threshold_percentage smallint not null, + min_community_weight_to_create_proposal bigint not null, + min_instruction_hold_up_time bigint not null, + max_voting_time bigint not null, + vote_tipping votetipping not null, + proposal_cool_off_time bigint not null, + min_council_weight_to_create_proposal bigint not null, + slot bigint not null, + write_version bigint not null, + + foreign key (governance_address) references governances (address) +); + +create table if not exists realms ( + address varchar(48) primary key, + account_type governanceaccounttype not null, + community_mint varchar(48) not null, + reserved bytea not null, + voting_proposal_count smallint not null, + authority varchar(48), + name text not null, + reserved_v2 bytea not null, + slot bigint not null, + write_version bigint not null +); + +create table if not exists realm_configs ( + realm_address varchar(48) primary key, + use_community_voter_weight_addin bool not null, + use_max_community_voter_weight_addin bool not null, + reserved bytea not null, + min_community_weight_to_create_governance bigint not null, + community_mint_max_vote_weight_source mintmaxvotetype not null, + community_mint_max_vote_weight bigint not null, + council_mint varchar(48), + slot bigint not null, + write_version bigint not null, + + foreign key (realm_address) references realms (address) +); + +create table if not exists vote_records_v2 ( + address varchar(48) primary key, + account_type governanceaccounttype not null, + proposal varchar(48) not null, + governing_token_owner varchar(48) not null, + is_relinquished bool not null, + voter_weight bigint not null, + vote vote_record_v2_vote not null, + slot bigint not null, + write_version bigint not null +); + +create table if not exists vote_record_v2_vote_approve_vote_choices ( + vote_record_v2_address varchar(48) not null, + rank smallint not null, + weight_percentage smallint not null, + slot bigint not null, + write_version bigint not null, + + primary key (vote_record_v2_address, rank, weight_percentage) + +); + +create table if not exists token_owner_records_v2 ( + address varchar(48) primary key, + account_type governanceaccounttype not null, + realm varchar(48) not null, + governing_token_mint varchar(48) not null, + governing_token_owner varchar(48) not null, + governing_token_deposit_amount bigint not null, + unrelinquished_votes_count bigint not null, + total_votes_count bigint not null, + outstanding_proposal_count smallint not null, + reserved bytea not null, + governance_delegate varchar(48), + slot bigint not null, + write_version bigint not null +); + +create table if not exists signatory_records_v2 ( + address varchar(48) primary key, + account_type governanceaccounttype not null, + proposal varchar(48) not null, + signatory varchar(48) not null, + signed_off bool not null, + slot bigint not null, + write_version bigint not null +); + +create table if not exists proposals_v2 ( + address varchar(48) primary key, + account_type governanceaccounttype not null, + governance varchar(48) not null, + governing_token_mint varchar(48) not null, + state proposalstate not null, + token_owner_record varchar(48) not null, + signatories_count smallint not null, + signatories_signed_off_count smallint not null, + vote_type proposalvotetype not null, + deny_vote_weight bigint, + veto_vote_weight bigint, + abstain_vote_weight bigint, + start_voting_at timestamp, + draft_at timestamp not null, + signing_off_at timestamp, + voting_at timestamp, + voting_at_slot bigint, + voting_completed_at timestamp, + executing_at timestamp, + closed_at timestamp, + execution_flags instructionexecutionflags not null, + max_vote_weight bigint, + max_voting_time bigint, + vote_threshold_type votethresholdtype, + vote_threshold_percentage smallint, + name text not null, + description_link text not null, + slot bigint not null, + write_version bigint not null +); + +create table if not exists proposal_vote_type_multi_choices ( + address varchar(48) primary key, + max_voter_options smallint not null, + max_winning_options smallint not null, + slot bigint not null, + write_version bigint not null +); + +create table if not exists proposal_options ( + proposal_address varchar(48) not null, + label text not null, + vote_weight bigint not null, + vote_result optionvoteresult not null, + transactions_executed_count smallint not null, + transactions_count smallint not null, + transactions_next_index smallint not null, + slot bigint not null, + write_version bigint not null, + + primary key (proposal_address, label) +); + +create trigger governances_check_slot_wv +before update on governances for row +execute function check_slot_wv(); + +create trigger governance_configs_check_slot_wv +before update on governance_configs for row +execute function check_slot_wv(); + +create trigger realms_check_slot_wv +before update on realms for row +execute function check_slot_wv(); + +create trigger realm_configs_check_slot_wv +before update on realm_configs for row +execute function check_slot_wv(); + +create trigger vote_records_v2_check_slot_wv +before update on vote_records_v2 for row +execute function check_slot_wv(); + +create trigger vote_record_v2_vote_approve_vote_choices_check_slot_wv +before update on vote_record_v2_vote_approve_vote_choices for row +execute function check_slot_wv(); + +create trigger token_owner_records_v2_check_slot_wv +before update on token_owner_records_v2 for row +execute function check_slot_wv(); + +create trigger signatory_records_v2_check_slot_wv +before update on signatory_records_v2 for row +execute function check_slot_wv(); + +create trigger proposals_v2_check_slot_wv +before update on proposals_v2 for row +execute function check_slot_wv(); + +create trigger proposal_vote_type_multi_choices_check_slot_wv +before update on proposal_vote_type_multi_choices for row +execute function check_slot_wv(); + +create trigger proposal_options_check_slot_wv +before update on proposal_options for row +execute function check_slot_wv(); \ No newline at end of file diff --git a/crates/core/src/db/custom_types.rs b/crates/core/src/db/custom_types.rs index 6f689af8f..21a4feec8 100644 --- a/crates/core/src/db/custom_types.rs +++ b/crates/core/src/db/custom_types.rs @@ -186,6 +186,170 @@ impl FromSql for ListingEventLifecycleEnum { } } +/// SPL Governance account type +#[derive(SqlType, Debug, Clone, Copy)] +#[postgres(type_name = "governanceaccounttype")] +/// Represents database `governanceaccounttype` enum +pub struct GovernanceAccountType; + +#[derive( + Debug, PartialEq, FromSqlRow, AsExpression, Clone, Copy, strum::EnumString, strum::Display, +)] +#[allow(missing_docs)] +#[sql_type = "GovernanceAccountType"] +pub enum GovernanceAccountTypeEnum { + Uninitialized, + RealmV1, + TokenOwnerRecordV1, + GovernanceV1, + ProgramGovernanceV1, + ProposalV1, + SignatoryRecordV1, + VoteRecordV1, + ProposalInstructionV1, + MintGovernanceV1, + TokenGovernanceV1, + RealmConfig, + VoteRecordV2, + ProposalTransactionV2, + ProposalV2, + ProgramMetadata, + RealmV2, + TokenOwnerRecordV2, + GovernanceV2, + ProgramGovernanceV2, + MintGovernanceV2, + TokenGovernanceV2, + SignatoryRecordV2, +} + +impl ToSql for GovernanceAccountTypeEnum { + fn to_sql(&self, out: &mut Output) -> serialize::Result { + to_bytes(self, out, |_| false) + } +} + +impl FromSql for GovernanceAccountTypeEnum { + fn from_sql(bytes: Option<&[u8]>) -> deserialize::Result { + from_bytes(bytes) + } +} + +/// `VoteThreshold` type +#[derive(SqlType, Debug, Clone, Copy)] +#[postgres(type_name = "votethresholdtype")] +/// Represents database `votethresholdtype` enum +pub struct VoteThresholdType; + +#[derive( + Debug, PartialEq, FromSqlRow, AsExpression, Clone, Copy, strum::EnumString, strum::Display, +)] +#[allow(missing_docs)] +#[sql_type = "VoteThresholdType"] +pub enum VoteThresholdEnum { + YesVote, + Quorum, +} + +impl ToSql for VoteThresholdEnum { + fn to_sql(&self, out: &mut Output) -> serialize::Result { + to_bytes(self, out, |_| false) + } +} + +impl FromSql for VoteThresholdEnum { + fn from_sql(bytes: Option<&[u8]>) -> deserialize::Result { + from_bytes(bytes) + } +} + +/// `VoteWeightSource` type +#[derive(SqlType, Debug, Clone, Copy)] +/// Represents database `voteweightsourcce` enum +#[postgres(type_name = "votetipping")] +pub struct VoteTipping; + +#[derive( + Debug, PartialEq, FromSqlRow, AsExpression, Clone, Copy, strum::EnumString, strum::Display, +)] +#[sql_type = "VoteTipping"] +#[allow(missing_docs)] +pub enum VoteTippingEnum { + Strict, + Early, + Disabled, +} + +impl ToSql for VoteTippingEnum { + fn to_sql(&self, out: &mut Output) -> serialize::Result { + to_bytes(self, out, |_| false) + } +} + +impl FromSql for VoteTippingEnum { + fn from_sql(bytes: Option<&[u8]>) -> deserialize::Result { + from_bytes(bytes) + } +} + +/// `MintMaxVote` type +#[derive(SqlType, Debug, Clone, Copy)] +/// Represents database `mintmaxvotetype` enum +#[postgres(type_name = "mintmaxvotetype")] +pub struct MintMaxVoteType; + +#[derive( + Debug, PartialEq, FromSqlRow, AsExpression, Clone, Copy, strum::EnumString, strum::Display, +)] +#[sql_type = "MintMaxVoteType"] +#[allow(missing_docs)] +pub enum MintMaxVoteEnum { + SupplyFraction, + Absolute, +} + +impl ToSql for MintMaxVoteEnum { + fn to_sql(&self, out: &mut Output) -> serialize::Result { + to_bytes(self, out, |_| false) + } +} + +impl FromSql for MintMaxVoteEnum { + fn from_sql(bytes: Option<&[u8]>) -> deserialize::Result { + from_bytes(bytes) + } +} + +/// `VoteRecordV2 Vote` type +#[derive(SqlType, Debug, Clone, Copy)] +/// Represents database `vote_record_v2_vote` enum +#[postgres(type_name = "vote_record_v2_vote")] +pub struct VoteRecordV2Vote; + +#[derive( + Debug, PartialEq, FromSqlRow, AsExpression, Clone, Copy, strum::EnumString, strum::Display, +)] +#[sql_type = "VoteRecordV2Vote"] +#[allow(missing_docs)] +pub enum VoteRecordV2VoteEnum { + Approve, + Deny, + Abstain, + Veto, +} + +impl ToSql for VoteRecordV2VoteEnum { + fn to_sql(&self, out: &mut Output) -> serialize::Result { + to_bytes(self, out, |_| false) + } +} + +impl FromSql for VoteRecordV2VoteEnum { + fn from_sql(bytes: Option<&[u8]>) -> deserialize::Result { + from_bytes(bytes) + } +} + /// Direction for ordering SQL query results by the "ORDER BY" variable(s) #[derive(Debug, Clone, Copy, strum::EnumString, strum::Display)] pub enum OrderDirection { @@ -197,3 +361,124 @@ pub enum OrderDirection { #[strum(serialize = "ASC")] Asc, } + +/// `ProposalV2State` +#[derive(SqlType, Debug, Clone, Copy)] +/// Represents database `proposalstate` enum +#[postgres(type_name = "proposalstate")] +pub struct ProposalState; + +#[derive( + Debug, PartialEq, FromSqlRow, AsExpression, Clone, Copy, strum::EnumString, strum::Display, +)] +#[sql_type = "ProposalState"] +#[allow(missing_docs)] +pub enum ProposalStateEnum { + Draft, + SigningOff, + Voting, + Succeeded, + Executing, + Completed, + Cancelled, + Defeated, + ExecutingWithErrors, +} + +impl ToSql for ProposalStateEnum { + fn to_sql(&self, out: &mut Output) -> serialize::Result { + to_bytes(self, out, |_| false) + } +} + +impl FromSql for ProposalStateEnum { + fn from_sql(bytes: Option<&[u8]>) -> deserialize::Result { + from_bytes(bytes) + } +} + +/// `InstructionExecutionFlags` +#[derive(SqlType, Debug, Clone, Copy)] +/// Represents database `instructionexecutionflags` enum +#[postgres(type_name = "instructionexecutionflags")] +pub struct InstructionExecutionFlags; + +#[derive( + Debug, PartialEq, FromSqlRow, AsExpression, Clone, Copy, strum::EnumString, strum::Display, +)] +#[sql_type = "InstructionExecutionFlags"] +#[allow(missing_docs)] +pub enum InstructionExecutionFlagsEnum { + None, + Ordered, + UseTransaction, +} + +impl ToSql for InstructionExecutionFlagsEnum { + fn to_sql(&self, out: &mut Output) -> serialize::Result { + to_bytes(self, out, |_| false) + } +} + +impl FromSql for InstructionExecutionFlagsEnum { + fn from_sql(bytes: Option<&[u8]>) -> deserialize::Result { + from_bytes(bytes) + } +} + +/// `ProposalV2VoteType` +#[derive(SqlType, Debug, Clone, Copy)] +/// Represents database `votetype` enum +#[postgres(type_name = "proposalvotetype")] +pub struct ProposalVoteType; + +#[derive( + Debug, PartialEq, FromSqlRow, AsExpression, Clone, Copy, strum::EnumString, strum::Display, +)] +#[sql_type = "ProposalVoteType"] +#[allow(missing_docs)] +pub enum ProposalVoteTypeEnum { + SingleChoice, + MultiChoice, +} + +impl ToSql for ProposalVoteTypeEnum { + fn to_sql(&self, out: &mut Output) -> serialize::Result { + to_bytes(self, out, |_| false) + } +} + +impl FromSql for ProposalVoteTypeEnum { + fn from_sql(bytes: Option<&[u8]>) -> deserialize::Result { + from_bytes(bytes) + } +} + +/// `ProposalV2 OptionVoteResult` +#[derive(SqlType, Debug, Clone, Copy)] +/// Represents database `optionvoteresult` enum +#[postgres(type_name = "optionvoteresult")] +pub struct OptionVoteResult; + +#[derive( + Debug, PartialEq, FromSqlRow, AsExpression, Clone, Copy, strum::EnumString, strum::Display, +)] +#[sql_type = "OptionVoteResult"] +#[allow(missing_docs)] +pub enum OptionVoteResultEnum { + None, + Succeeded, + Defeated, +} + +impl ToSql for OptionVoteResultEnum { + fn to_sql(&self, out: &mut Output) -> serialize::Result { + to_bytes(self, out, |_| false) + } +} + +impl FromSql for OptionVoteResultEnum { + fn from_sql(bytes: Option<&[u8]>) -> deserialize::Result { + from_bytes(bytes) + } +} diff --git a/crates/core/src/db/models.rs b/crates/core/src/db/models.rs index b7724678f..6b0d5c95f 100644 --- a/crates/core/src/db/models.rs +++ b/crates/core/src/db/models.rs @@ -11,8 +11,10 @@ use uuid::Uuid; #[allow(clippy::wildcard_imports)] use super::schema::*; use crate::db::custom_types::{ - EndSettingType, ListingEventLifecycle, ListingEventLifecycleEnum, OfferEventLifecycle, - OfferEventLifecycleEnum, TokenStandardEnum, WhitelistMintMode, + EndSettingType, GovernanceAccountTypeEnum, InstructionExecutionFlagsEnum, + ListingEventLifecycle, ListingEventLifecycleEnum, MintMaxVoteEnum, OfferEventLifecycle, + OfferEventLifecycleEnum, OptionVoteResultEnum, ProposalStateEnum, ProposalVoteTypeEnum, + TokenStandardEnum, VoteRecordV2VoteEnum, VoteThresholdEnum, VoteTippingEnum, WhitelistMintMode, }; /// A row in the `bids` table @@ -2561,3 +2563,215 @@ pub struct GenoRentalAgreement<'a> { /// The write version of this account's last known update pub write_version: i64, } + +#[derive(Debug, Clone, Queryable, Insertable, AsChangeset)] +#[diesel(treat_none_as_null = true)] +#[allow(missing_docs)] +pub struct Governance<'a> { + pub address: Cow<'a, str>, + pub account_type: GovernanceAccountTypeEnum, + pub realm: Cow<'a, str>, + pub governed_account: Cow<'a, str>, + pub proposals_count: i64, + pub reserved: Cow<'a, [u8]>, + pub voting_proposal_count: i16, + /// The slot number of this account's last known update + pub slot: i64, + /// The write version of this account's last known update + pub write_version: i64, +} + +#[derive(Debug, Clone, Queryable, Insertable, AsChangeset)] +#[diesel(treat_none_as_null = true)] +#[allow(missing_docs)] +pub struct GovernanceConfig<'a> { + pub governance_address: Cow<'a, str>, + pub vote_threshold_type: VoteThresholdEnum, + pub vote_threshold_percentage: i16, + pub min_community_weight_to_create_proposal: i64, + pub min_instruction_hold_up_time: i64, + pub max_voting_time: i64, + pub vote_tipping: VoteTippingEnum, + pub proposal_cool_off_time: i64, + pub min_council_weight_to_create_proposal: i64, + /// The slot number of this account's last known update + pub slot: i64, + /// The write version of this account's last known update + pub write_version: i64, +} + +#[derive(Debug, Clone, Queryable, Insertable, AsChangeset)] +#[diesel(treat_none_as_null = true)] +#[allow(missing_docs)] +pub struct Realm<'a> { + pub address: Cow<'a, str>, + pub account_type: GovernanceAccountTypeEnum, + pub community_mint: Cow<'a, str>, + pub reserved: Cow<'a, [u8]>, + pub voting_proposal_count: i16, + pub authority: Option>, + pub name: Cow<'a, str>, + pub reserved_v2: Cow<'a, [u8]>, + /// The slot number of this account's last known update + pub slot: i64, + /// The write version of this account's last known update + pub write_version: i64, +} + +#[derive(Debug, Clone, Queryable, Insertable, AsChangeset)] +#[diesel(treat_none_as_null = true)] +#[allow(missing_docs)] +pub struct RealmConfig<'a> { + pub realm_address: Cow<'a, str>, + pub use_community_voter_weight_addin: bool, + pub use_max_community_voter_weight_addin: bool, + pub reserved: Cow<'a, [u8]>, + pub min_community_weight_to_create_governance: i64, + pub community_mint_max_vote_weight_source: MintMaxVoteEnum, + pub community_mint_max_vote_weight: i64, + pub council_mint: Option>, + /// The slot number of this account's last known update + pub slot: i64, + /// The write version of this account's last known update + pub write_version: i64, +} + +#[derive(Debug, Clone, Queryable, Insertable, AsChangeset)] +#[diesel(treat_none_as_null = true)] +#[table_name = "vote_records_v2"] +#[allow(missing_docs)] +pub struct VoteRecordV2<'a> { + pub address: Cow<'a, str>, + pub account_type: GovernanceAccountTypeEnum, + pub proposal: Cow<'a, str>, + pub governing_token_owner: Cow<'a, str>, + pub is_relinquished: bool, + pub voter_weight: i64, + pub vote: VoteRecordV2VoteEnum, + /// The slot number of this account's last known update + pub slot: i64, + /// The write version of this account's last known update + pub write_version: i64, +} + +#[derive(Debug, Clone, Queryable, Insertable, AsChangeset)] +#[diesel(treat_none_as_null = true)] +#[table_name = "vote_record_v2_vote_approve_vote_choices"] +#[allow(missing_docs)] +pub struct VoteChoice<'a> { + pub vote_record_v2_address: Cow<'a, str>, + pub rank: i16, + pub weight_percentage: i16, + /// The slot number of this account's last known update + pub slot: i64, + /// The write version of this account's last known update + pub write_version: i64, +} + +#[derive(Debug, Clone, Queryable, Insertable, AsChangeset)] +#[diesel(treat_none_as_null = true)] +#[table_name = "token_owner_records_v2"] +#[allow(missing_docs)] +pub struct TokenOwnerRecordV2<'a> { + pub address: Cow<'a, str>, + pub account_type: GovernanceAccountTypeEnum, + pub realm: Cow<'a, str>, + pub governing_token_mint: Cow<'a, str>, + pub governing_token_owner: Cow<'a, str>, + pub governing_token_deposit_amount: i64, + pub unrelinquished_votes_count: i64, + pub total_votes_count: i64, + pub outstanding_proposal_count: i16, + pub reserved: Cow<'a, [u8]>, + pub governance_delegate: Option>, + /// The slot number of this account's last known update + pub slot: i64, + /// The write version of this account's last known update + pub write_version: i64, +} + +#[derive(Debug, Clone, Queryable, Insertable, AsChangeset)] +#[diesel(treat_none_as_null = true)] +#[table_name = "signatory_records_v2"] +#[allow(missing_docs)] +pub struct SignatoryRecordV2<'a> { + pub address: Cow<'a, str>, + pub account_type: GovernanceAccountTypeEnum, + pub proposal: Cow<'a, str>, + pub signatory: Cow<'a, str>, + pub signed_off: bool, + /// The slot number of this account's last known update + pub slot: i64, + /// The write version of this account's last known update + pub write_version: i64, +} + +#[derive(Debug, Clone, Queryable, Insertable, AsChangeset)] +#[diesel(treat_none_as_null = true)] +#[table_name = "proposals_v2"] +#[allow(missing_docs)] +pub struct ProposalV2<'a> { + pub address: Cow<'a, str>, + pub account_type: GovernanceAccountTypeEnum, + pub governance: Cow<'a, str>, + pub governing_token_mint: Cow<'a, str>, + pub state: ProposalStateEnum, + pub token_owner_record: Cow<'a, str>, + pub signatories_count: i16, + pub signatories_signed_off_count: i16, + pub vote_type: ProposalVoteTypeEnum, + pub deny_vote_weight: Option, + pub veto_vote_weight: Option, + pub abstain_vote_weight: Option, + pub start_voting_at: Option, + pub draft_at: NaiveDateTime, + pub signing_off_at: Option, + pub voting_at: Option, + pub voting_at_slot: Option, + pub voting_completed_at: Option, + pub executing_at: Option, + pub closed_at: Option, + pub execution_flags: InstructionExecutionFlagsEnum, + pub max_vote_weight: Option, + pub max_voting_time: Option, + pub vote_threshold_type: Option, + pub vote_threshold_percentage: Option, + pub name: Cow<'a, str>, + pub description_link: Cow<'a, str>, + /// The slot number of this account's last known update + pub slot: i64, + /// The write version of this account's last known update + pub write_version: i64, +} + +#[derive(Debug, Clone, Queryable, Insertable, AsChangeset)] +#[diesel(treat_none_as_null = true)] +#[table_name = "proposal_vote_type_multi_choices"] +#[allow(missing_docs)] +pub struct MultiChoice<'a> { + pub address: Cow<'a, str>, + pub max_voter_options: i16, + pub max_winning_options: i16, + /// The slot number of this account's last known update + pub slot: i64, + /// The write version of this account's last known update + pub write_version: i64, +} + +#[derive(Debug, Clone, Queryable, Insertable, AsChangeset)] +#[diesel(treat_none_as_null = true)] +#[table_name = "proposal_options"] +#[allow(missing_docs)] +pub struct ProposalOption<'a> { + pub proposal_address: Cow<'a, str>, + pub label: Cow<'a, str>, + pub vote_weight: i64, + pub vote_result: OptionVoteResultEnum, + pub transactions_executed_count: i16, + pub transactions_count: i16, + pub transactions_next_index: i16, + /// The slot number of this account's last known update + pub slot: i64, + /// The write version of this account's last known update + pub write_version: i64, +} diff --git a/crates/core/src/db/schema.rs b/crates/core/src/db/schema.rs index a98f30c23..31c724d80 100644 --- a/crates/core/src/db/schema.rs +++ b/crates/core/src/db/schema.rs @@ -1,7 +1,7 @@ table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; attributes (id) { metadata_address -> Varchar, @@ -17,7 +17,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; auction_caches (address) { address -> Varchar, @@ -33,7 +33,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; auction_datas (address) { address -> Varchar, @@ -52,7 +52,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; auction_datas_ext (address) { address -> Varchar, @@ -65,7 +65,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; auction_houses (address) { address -> Varchar, @@ -88,7 +88,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; bid_receipts (address) { address -> Varchar, @@ -113,7 +113,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; bids (listing_address, bidder_address) { listing_address -> Varchar, @@ -127,7 +127,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; bonding_changes (address, slot) { address -> Varchar, @@ -141,7 +141,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; buy_instructions (id) { id -> Uuid, @@ -168,7 +168,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; cancel_instructions (id) { id -> Uuid, @@ -189,7 +189,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; candy_machine_collection_pdas (address) { address -> Varchar, @@ -201,7 +201,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; candy_machine_config_lines (address) { address -> Varchar, @@ -213,7 +213,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; candy_machine_creators (candy_machine_address) { candy_machine_address -> Varchar, @@ -226,7 +226,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; candy_machine_datas (candy_machine_address) { candy_machine_address -> Varchar, @@ -245,7 +245,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; candy_machine_end_settings (candy_machine_address) { candy_machine_address -> Varchar, @@ -257,7 +257,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; candy_machine_gate_keeper_configs (candy_machine_address) { candy_machine_address -> Varchar, @@ -269,7 +269,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; candy_machine_hidden_settings (candy_machine_address) { candy_machine_address -> Varchar, @@ -282,7 +282,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; candy_machine_whitelist_mint_settings (candy_machine_address) { candy_machine_address -> Varchar, @@ -296,7 +296,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; candy_machines (address) { address -> Varchar, @@ -310,7 +310,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; cardinal_claim_events (token_manager_address, state_changed_at) { token_manager_address -> Varchar, @@ -360,7 +360,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; cardinal_entries (address) { address -> Varchar, @@ -378,7 +378,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; cardinal_namespaces (address) { address -> Varchar, @@ -400,7 +400,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; cardinal_paid_claim_approvers (paid_claim_approver_address) { paid_claim_approver_address -> Varchar, @@ -416,7 +416,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; cardinal_time_invalidators (time_invalidator_address) { time_invalidator_address -> Varchar, @@ -437,7 +437,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; cardinal_token_manager_invalidators (token_manager_address, invalidator) { token_manager_address -> Varchar, @@ -448,7 +448,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; cardinal_token_managers (address) { address -> Varchar, @@ -473,7 +473,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; cardinal_use_invalidators (use_invalidator_address) { use_invalidator_address -> Varchar, @@ -494,7 +494,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; collection_stats (collection_address) { collection_address -> Varchar, @@ -506,7 +506,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; current_metadata_owners (mint_address) { mint_address -> Varchar, @@ -520,7 +520,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; deposit_instructions (id) { id -> Uuid, @@ -542,7 +542,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; editions (address) { address -> Varchar, @@ -555,7 +555,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; escrows (address) { address -> Varchar, @@ -573,7 +573,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; execute_sale_instructions (id) { id -> Uuid, @@ -607,7 +607,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; feed_event_wallets (wallet_address, feed_event_id) { wallet_address -> Varchar, @@ -618,7 +618,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; feed_events (id) { id -> Uuid, @@ -629,7 +629,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; files (id) { metadata_address -> Varchar, @@ -644,7 +644,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; follow_events (feed_event_id) { graph_connection_address -> Varchar, @@ -655,7 +655,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; geno_habitat_datas (address) { address -> Varchar, @@ -695,7 +695,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; geno_rental_agreements (habitat_address) { habitat_address -> Varchar, @@ -716,7 +716,27 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + + governance_configs (governance_address) { + governance_address -> Varchar, + vote_threshold_type -> Votethresholdtype, + vote_threshold_percentage -> Int2, + min_community_weight_to_create_proposal -> Int8, + min_instruction_hold_up_time -> Int8, + max_voting_time -> Int8, + vote_tipping -> Votetipping, + proposal_cool_off_time -> Int8, + min_council_weight_to_create_proposal -> Int8, + slot -> Int8, + write_version -> Int8, + } +} + +table! { + use diesel::sql_types::*; + use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; governance_parameters (governor_address) { governor_address -> Varchar, @@ -730,7 +750,25 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + + governances (address) { + address -> Varchar, + account_type -> Governanceaccounttype, + realm -> Varchar, + governed_account -> Varchar, + proposals_count -> Int8, + reserved -> Bytea, + voting_proposal_count -> Int2, + slot -> Int8, + write_version -> Int8, + } +} + +table! { + use diesel::sql_types::*; + use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; governors (address) { address -> Varchar, @@ -745,7 +783,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; graph_connections (address) { address -> Varchar, @@ -761,7 +799,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; ins_buffer_bundle_ins_keys (instruction_buffer_address, program_id, pubkey) { instruction_buffer_address -> Varchar, @@ -775,7 +813,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; ins_buffer_bundle_instructions (instruction_buffer_address, program_id) { instruction_buffer_address -> Varchar, @@ -787,7 +825,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; ins_buffer_bundles (instruction_buffer_address) { instruction_buffer_address -> Varchar, @@ -798,7 +836,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; instruction_buffers (address) { address -> Varchar, @@ -813,7 +851,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; listing_denylist (listing_address) { listing_address -> Varchar, @@ -824,7 +862,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; listing_events (feed_event_id) { feed_event_id -> Uuid, @@ -836,7 +874,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; listing_metadatas (listing_address, metadata_address) { listing_address -> Varchar, @@ -848,7 +886,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; listing_receipts (address) { address -> Varchar, @@ -872,7 +910,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; listings (id) { id -> Uuid, @@ -896,7 +934,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; locker_params (locker_address) { locker_address -> Varchar, @@ -911,7 +949,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; locker_whitelist_entries (address) { address -> Varchar, @@ -925,7 +963,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; lockers (address) { address -> Varchar, @@ -940,7 +978,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; master_editions (address) { address -> Varchar, @@ -953,7 +991,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; metadata_collection_keys (metadata_address, collection_address) { metadata_address -> Varchar, @@ -965,7 +1003,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; metadata_collections (id) { metadata_address -> Varchar, @@ -980,7 +1018,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; metadata_creators (metadata_address, creator_address) { metadata_address -> Varchar, @@ -994,7 +1032,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; metadata_jsons (metadata_address) { metadata_address -> Varchar, @@ -1016,7 +1054,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; metadatas (address) { address -> Varchar, @@ -1039,7 +1077,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; mint_events (feed_event_id) { metadata_address -> Varchar, @@ -1050,7 +1088,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; offer_events (feed_event_id) { feed_event_id -> Uuid, @@ -1062,7 +1100,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; offers (id) { id -> Uuid, @@ -1087,7 +1125,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; proposal_account_metas (proposal_address, program_id, pubkey) { proposal_address -> Varchar, @@ -1101,7 +1139,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; proposal_instructions (proposal_address, program_id) { proposal_address -> Varchar, @@ -1113,7 +1151,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; proposal_metas (address) { address -> Varchar, @@ -1126,7 +1164,39 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + + proposal_options (proposal_address, label) { + proposal_address -> Varchar, + label -> Text, + vote_weight -> Int8, + vote_result -> Optionvoteresult, + transactions_executed_count -> Int2, + transactions_count -> Int2, + transactions_next_index -> Int2, + slot -> Int8, + write_version -> Int8, + } +} + +table! { + use diesel::sql_types::*; + use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + + proposal_vote_type_multi_choices (address) { + address -> Varchar, + max_voter_options -> Int2, + max_winning_options -> Int2, + slot -> Int8, + write_version -> Int8, + } +} + +table! { + use diesel::sql_types::*; + use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; proposals (address) { address -> Varchar, @@ -1150,7 +1220,45 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + + proposals_v2 (address) { + address -> Varchar, + account_type -> Governanceaccounttype, + governance -> Varchar, + governing_token_mint -> Varchar, + state -> Proposalstate, + token_owner_record -> Varchar, + signatories_count -> Int2, + signatories_signed_off_count -> Int2, + vote_type -> Proposalvotetype, + deny_vote_weight -> Nullable, + veto_vote_weight -> Nullable, + abstain_vote_weight -> Nullable, + start_voting_at -> Nullable, + draft_at -> Timestamp, + signing_off_at -> Nullable, + voting_at -> Nullable, + voting_at_slot -> Nullable, + voting_completed_at -> Nullable, + executing_at -> Nullable, + closed_at -> Nullable, + execution_flags -> Instructionexecutionflags, + max_vote_weight -> Nullable, + max_voting_time -> Nullable, + vote_threshold_type -> Nullable, + vote_threshold_percentage -> Nullable, + name -> Text, + description_link -> Text, + slot -> Int8, + write_version -> Int8, + } +} + +table! { + use diesel::sql_types::*; + use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; public_buy_instructions (id) { id -> Uuid, @@ -1177,7 +1285,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; purchase_events (feed_event_id) { feed_event_id -> Uuid, @@ -1188,7 +1296,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; purchase_receipts (address) { address -> Varchar, @@ -1209,7 +1317,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; purchases (id) { id -> Uuid, @@ -1229,7 +1337,45 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + + realm_configs (realm_address) { + realm_address -> Varchar, + use_community_voter_weight_addin -> Bool, + use_max_community_voter_weight_addin -> Bool, + reserved -> Bytea, + min_community_weight_to_create_governance -> Int8, + community_mint_max_vote_weight_source -> Mintmaxvotetype, + community_mint_max_vote_weight -> Int8, + council_mint -> Nullable, + slot -> Int8, + write_version -> Int8, + } +} + +table! { + use diesel::sql_types::*; + use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + + realms (address) { + address -> Varchar, + account_type -> Governanceaccounttype, + community_mint -> Varchar, + reserved -> Bytea, + voting_proposal_count -> Int2, + authority -> Nullable, + name -> Text, + reserved_v2 -> Bytea, + slot -> Int8, + write_version -> Int8, + } +} + +table! { + use diesel::sql_types::*; + use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; sell_instructions (id) { id -> Uuid, @@ -1255,7 +1401,23 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + + signatory_records_v2 (address) { + address -> Varchar, + account_type -> Governanceaccounttype, + proposal -> Varchar, + signatory -> Varchar, + signed_off -> Bool, + slot -> Int8, + write_version -> Int8, + } +} + +table! { + use diesel::sql_types::*; + use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; smart_wallet_owners (smart_wallet_address, owner_address) { smart_wallet_address -> Varchar, @@ -1267,7 +1429,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; smart_wallets (address) { address -> Varchar, @@ -1284,7 +1446,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; store_auction_houses (store_config_address, auction_house_address) { store_config_address -> Varchar, @@ -1295,7 +1457,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; store_config_jsons (config_address) { config_address -> Varchar, @@ -1312,7 +1474,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; store_configs (address) { address -> Varchar, @@ -1323,7 +1485,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; store_creators (store_config_address, creator_address) { store_config_address -> Varchar, @@ -1334,7 +1496,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; store_denylist (owner_address) { owner_address -> Varchar, @@ -1345,7 +1507,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; storefronts (address) { owner_address -> Varchar, @@ -1364,7 +1526,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; stores (address) { address -> Varchar, @@ -1376,7 +1538,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; sub_account_infos (address) { address -> Varchar, @@ -1389,7 +1551,29 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + + token_owner_records_v2 (address) { + address -> Varchar, + account_type -> Governanceaccounttype, + realm -> Varchar, + governing_token_mint -> Varchar, + governing_token_owner -> Varchar, + governing_token_deposit_amount -> Int8, + unrelinquished_votes_count -> Int8, + total_votes_count -> Int8, + outstanding_proposal_count -> Int2, + reserved -> Bytea, + governance_delegate -> Nullable, + slot -> Int8, + write_version -> Int8, + } +} + +table! { + use diesel::sql_types::*; + use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; transactions (address) { address -> Varchar, @@ -1408,7 +1592,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; twitter_handle_name_services (address) { address -> Varchar, @@ -1424,7 +1608,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; tx_instruction_keys (transaction_address, program_id, pubkey) { transaction_address -> Varchar, @@ -1438,7 +1622,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; tx_instructions (transaction_address, program_id) { transaction_address -> Varchar, @@ -1450,7 +1634,39 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + + vote_record_v2_vote_approve_vote_choices (vote_record_v2_address, rank, weight_percentage) { + vote_record_v2_address -> Varchar, + rank -> Int2, + weight_percentage -> Int2, + slot -> Int8, + write_version -> Int8, + } +} + +table! { + use diesel::sql_types::*; + use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + + vote_records_v2 (address) { + address -> Varchar, + account_type -> Governanceaccounttype, + proposal -> Varchar, + governing_token_owner -> Varchar, + is_relinquished -> Bool, + voter_weight -> Int8, + vote -> Vote_record_v2_vote, + slot -> Int8, + write_version -> Int8, + } +} + +table! { + use diesel::sql_types::*; + use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; votes (address) { address -> Varchar, @@ -1465,7 +1681,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; wallet_totals (address) { address -> Varchar, @@ -1477,7 +1693,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; whitelisted_creators (address) { address -> Varchar, @@ -1489,7 +1705,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; withdraw_from_fee_instructions (id) { id -> Uuid, @@ -1506,7 +1722,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; withdraw_from_treasury_instructions (id) { id -> Uuid, @@ -1524,7 +1740,7 @@ table! { table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector, TsQuery as Tsquery}; - use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; + use crate::db::custom_types::{ListingEventLifecycle as Listingeventlifecycle, Mode, ProposalState as Proposalstate, InstructionExecutionFlags as Instructionexecutionflags, ProposalVoteType as Proposalvotetype, OptionVoteResult as Optionvoteresult, MintMaxVoteType as Mintmaxvotetype, VoteTipping as Votetipping, VoteRecordV2Vote as Vote_record_v2_vote, VoteThresholdType as Votethresholdtype, GovernanceAccountType as Governanceaccounttype, OfferEventLifecycle as Offereventlifecycle, SettingType as Settingtype, TokenStandard as Token_standard, }; withdraw_instructions (id) { id -> Uuid, @@ -1547,10 +1763,12 @@ joinable!(feed_event_wallets -> feed_events (feed_event_id)); joinable!(follow_events -> feed_events (feed_event_id)); joinable!(follow_events -> graph_connections (graph_connection_address)); joinable!(geno_rental_agreements -> geno_habitat_datas (habitat_address)); +joinable!(governance_configs -> governances (governance_address)); joinable!(listing_events -> feed_events (feed_event_id)); joinable!(mint_events -> feed_events (feed_event_id)); joinable!(offer_events -> feed_events (feed_event_id)); joinable!(purchase_events -> feed_events (feed_event_id)); +joinable!(realm_configs -> realms (realm_address)); allow_tables_to_appear_in_same_query!( attributes, @@ -1592,7 +1810,9 @@ allow_tables_to_appear_in_same_query!( follow_events, geno_habitat_datas, geno_rental_agreements, + governance_configs, governance_parameters, + governances, governors, graph_connections, ins_buffer_bundle_ins_keys, @@ -1619,12 +1839,18 @@ allow_tables_to_appear_in_same_query!( proposal_account_metas, proposal_instructions, proposal_metas, + proposal_options, + proposal_vote_type_multi_choices, proposals, + proposals_v2, public_buy_instructions, purchase_events, purchase_receipts, purchases, + realm_configs, + realms, sell_instructions, + signatory_records_v2, smart_wallet_owners, smart_wallets, store_auction_houses, @@ -1635,10 +1861,13 @@ allow_tables_to_appear_in_same_query!( storefronts, stores, sub_account_infos, + token_owner_records_v2, transactions, twitter_handle_name_services, tx_instruction_keys, tx_instructions, + vote_record_v2_vote_approve_vote_choices, + vote_records_v2, votes, wallet_totals, whitelisted_creators, diff --git a/crates/core/src/pubkeys.rs b/crates/core/src/pubkeys.rs index c1b5a23d9..2b9c2e64c 100644 --- a/crates/core/src/pubkeys.rs +++ b/crates/core/src/pubkeys.rs @@ -52,6 +52,8 @@ pub static TOKEN_BONDING: Pubkey = pubkey!("TBondmkCYxaPCKG4CHYfVTcwQ8on31xnJrPz /// Cardinal .twitter namespace pubkey pub static CARDINAL_TWITTER_NAMESPACE: Pubkey = pubkey!("2zwXjjGEUrFMyE2CF2Ju4CJwMzwdbBMYnF2boEzgPhGu"); +/// Spl Governance program pubkey +pub static SPL_GOVERNANCE: Pubkey = pubkey!("GovER5Lthms3bLBqWub97yVrMmEogzX7xNjdXpPPCVZw"); /// Find the address of a store given its owner's address pub fn find_store_address(owner: impl Borrow) -> (Pubkey, u8) { diff --git a/crates/indexer/src/geyser/accounts/mod.rs b/crates/indexer/src/geyser/accounts/mod.rs index 42a462264..c89da5bdd 100644 --- a/crates/indexer/src/geyser/accounts/mod.rs +++ b/crates/indexer/src/geyser/accounts/mod.rs @@ -19,6 +19,7 @@ pub mod name_service; pub mod namespace; pub mod receipt; pub mod smart_wallet; +pub mod spl_governance; pub mod token; pub(self) use super::Client; diff --git a/crates/indexer/src/geyser/accounts/spl_governance.rs b/crates/indexer/src/geyser/accounts/spl_governance.rs new file mode 100644 index 000000000..eb995ee50 --- /dev/null +++ b/crates/indexer/src/geyser/accounts/spl_governance.rs @@ -0,0 +1,760 @@ +use borsh::{BorshDeserialize, BorshSerialize}; +use indexer_core::{ + db::{ + custom_types::{ + GovernanceAccountTypeEnum, InstructionExecutionFlagsEnum, MintMaxVoteEnum, + OptionVoteResultEnum, ProposalStateEnum, ProposalVoteTypeEnum, VoteRecordV2VoteEnum, + VoteThresholdEnum, VoteTippingEnum, + }, + insert_into, + models::{ + Governance, GovernanceConfig as DbGovernanceConfig, MultiChoice, + ProposalOption as DbProposalOption, ProposalV2 as DbProposalV2, Realm, + RealmConfig as DbRealmConfig, SignatoryRecordV2 as DbSignatoryRecordV2, + TokenOwnerRecordV2 as DbTokenOwnerRecordV2, VoteChoice as DbVoteChoice, + VoteRecordV2 as DbVoteRecordV2, + }, + tables::{ + governance_configs, governances, proposal_options, proposal_vote_type_multi_choices, + proposals_v2, realm_configs, realms, signatory_records_v2, token_owner_records_v2, + vote_record_v2_vote_approve_vote_choices, vote_records_v2, + }, + }, + prelude::*, + util::unix_timestamp, +}; +use solana_program::{clock::UnixTimestamp, slot_history::Slot}; + +use super::Client; +use crate::prelude::*; + +#[derive(Clone, Copy, Debug, PartialEq, BorshDeserialize, BorshSerialize)] +pub enum GovernanceAccountType { + Uninitialized, + RealmV1, + TokenOwnerRecordV1, + GovernanceV1, + ProgramGovernanceV1, + ProposalV1, + SignatoryRecordV1, + VoteRecordV1, + ProposalInstructionV1, + MintGovernanceV1, + TokenGovernanceV1, + RealmConfig, + VoteRecordV2, + ProposalTransactionV2, + ProposalV2, + ProgramMetadata, + RealmV2, + TokenOwnerRecordV2, + GovernanceV2, + ProgramGovernanceV2, + MintGovernanceV2, + TokenGovernanceV2, + SignatoryRecordV2, +} + +impl From for GovernanceAccountTypeEnum { + fn from(v: GovernanceAccountType) -> Self { + match v { + GovernanceAccountType::Uninitialized => GovernanceAccountTypeEnum::Uninitialized, + GovernanceAccountType::RealmV1 => GovernanceAccountTypeEnum::RealmV1, + GovernanceAccountType::TokenOwnerRecordV1 => { + GovernanceAccountTypeEnum::TokenOwnerRecordV1 + }, + GovernanceAccountType::GovernanceV1 => GovernanceAccountTypeEnum::GovernanceV1, + GovernanceAccountType::ProgramGovernanceV1 => { + GovernanceAccountTypeEnum::ProgramGovernanceV1 + }, + GovernanceAccountType::ProposalV1 => GovernanceAccountTypeEnum::ProposalV1, + GovernanceAccountType::SignatoryRecordV1 => { + GovernanceAccountTypeEnum::SignatoryRecordV1 + }, + GovernanceAccountType::VoteRecordV1 => GovernanceAccountTypeEnum::VoteRecordV1, + GovernanceAccountType::ProposalInstructionV1 => { + GovernanceAccountTypeEnum::ProposalInstructionV1 + }, + GovernanceAccountType::MintGovernanceV1 => GovernanceAccountTypeEnum::MintGovernanceV1, + GovernanceAccountType::TokenGovernanceV1 => { + GovernanceAccountTypeEnum::TokenGovernanceV1 + }, + GovernanceAccountType::RealmConfig => GovernanceAccountTypeEnum::RealmConfig, + GovernanceAccountType::VoteRecordV2 => GovernanceAccountTypeEnum::VoteRecordV2, + GovernanceAccountType::ProposalTransactionV2 => { + GovernanceAccountTypeEnum::ProposalTransactionV2 + }, + GovernanceAccountType::ProposalV2 => GovernanceAccountTypeEnum::ProposalV2, + GovernanceAccountType::ProgramMetadata => GovernanceAccountTypeEnum::ProgramMetadata, + GovernanceAccountType::RealmV2 => GovernanceAccountTypeEnum::RealmV2, + GovernanceAccountType::TokenOwnerRecordV2 => { + GovernanceAccountTypeEnum::TokenOwnerRecordV2 + }, + GovernanceAccountType::GovernanceV2 => GovernanceAccountTypeEnum::GovernanceV2, + GovernanceAccountType::ProgramGovernanceV2 => { + GovernanceAccountTypeEnum::ProgramGovernanceV2 + }, + GovernanceAccountType::MintGovernanceV2 => GovernanceAccountTypeEnum::MintGovernanceV2, + GovernanceAccountType::TokenGovernanceV2 => { + GovernanceAccountTypeEnum::TokenGovernanceV2 + }, + GovernanceAccountType::SignatoryRecordV2 => { + GovernanceAccountTypeEnum::SignatoryRecordV2 + }, + } + } +} + +#[derive(Clone, Debug, PartialEq, BorshDeserialize, BorshSerialize)] +pub enum MintMaxVoteWeightSource { + SupplyFraction(u64), + Absolute(u64), +} + +#[derive(Clone, Debug, PartialEq, BorshDeserialize, BorshSerialize)] +pub enum VoteThresholdPercentage { + YesVote(u8), + Quorum(u8), +} + +#[derive(Clone, Copy, Debug, PartialEq, BorshDeserialize, BorshSerialize)] +pub enum VoteTipping { + Strict, + Early, + Disabled, +} + +impl From for VoteTippingEnum { + fn from(v: VoteTipping) -> Self { + match v { + VoteTipping::Strict => VoteTippingEnum::Strict, + VoteTipping::Early => VoteTippingEnum::Early, + VoteTipping::Disabled => VoteTippingEnum::Disabled, + } + } +} + +#[derive(Clone, Debug, PartialEq, BorshDeserialize, BorshSerialize)] +pub struct GovernanceV2 { + pub account_type: GovernanceAccountType, + pub realm: Pubkey, + pub governed_account: Pubkey, + pub proposals_count: u32, + pub config: GovernanceConfig, + pub reserved: [u8; 6], + pub voting_proposal_count: u16, + pub reserved_v2: [u8; 128], +} + +#[derive(Clone, Debug, PartialEq, BorshDeserialize, BorshSerialize)] +pub struct GovernanceConfig { + pub vote_threshold_percentage: VoteThresholdPercentage, + pub min_community_weight_to_create_proposal: u64, + pub min_transaction_hold_up_time: u32, + pub max_voting_time: u32, + pub vote_tipping: VoteTipping, + pub proposal_cool_off_time: u32, + pub min_council_weight_to_create_proposal: u64, +} + +#[derive(Clone, Debug, PartialEq, BorshDeserialize, BorshSerialize)] +pub struct RealmV2 { + pub account_type: GovernanceAccountType, + pub community_mint: Pubkey, + pub config: RealmConfig, + pub reserved: [u8; 6], + pub voting_proposal_count: u16, + pub authority: Option, + pub name: String, + pub reserved_v2: [u8; 128], +} + +#[derive(Clone, Debug, PartialEq, BorshDeserialize, BorshSerialize)] +pub struct RealmConfig { + pub use_community_voter_weight_addin: bool, + pub use_max_community_voter_weight_addin: bool, + pub reserved: [u8; 6], + pub min_community_weight_to_create_governance: u64, + pub community_mint_max_vote_weight_source: MintMaxVoteWeightSource, + pub council_mint: Option, +} + +#[derive(Clone, Debug, PartialEq, BorshDeserialize, BorshSerialize)] +pub struct VoteRecordV2 { + pub account_type: GovernanceAccountType, + pub proposal: Pubkey, + pub governing_token_owner: Pubkey, + pub is_relinquished: bool, + pub voter_weight: u64, + pub vote: Vote, + pub reserved_v2: [u8; 8], +} + +#[derive(Clone, Debug, PartialEq, BorshDeserialize, BorshSerialize)] +pub enum Vote { + Approve(Vec), + Deny, + Abstain, + Veto, +} + +impl From for VoteRecordV2VoteEnum { + fn from(v: Vote) -> Self { + match v { + Vote::Approve(_) => VoteRecordV2VoteEnum::Approve, + Vote::Deny => VoteRecordV2VoteEnum::Deny, + Vote::Abstain => VoteRecordV2VoteEnum::Abstain, + Vote::Veto => VoteRecordV2VoteEnum::Veto, + } + } +} + +#[derive(Clone, Copy, Debug, PartialEq, BorshDeserialize, BorshSerialize)] +pub struct VoteChoice { + pub rank: u8, + pub weight_percentage: u8, +} + +#[derive(Clone, Debug, PartialEq, BorshDeserialize, BorshSerialize)] +pub struct TokenOwnerRecordV2 { + pub account_type: GovernanceAccountType, + pub realm: Pubkey, + pub governing_token_mint: Pubkey, + pub governing_token_owner: Pubkey, + pub governing_token_deposit_amount: u64, + pub unrelinquished_votes_count: u32, + pub total_votes_count: u32, + pub outstanding_proposal_count: u8, + pub reserved: [u8; 7], + pub governance_delegate: Option, + pub reserved_v2: [u8; 128], +} + +#[derive(Clone, Debug, PartialEq, BorshDeserialize, BorshSerialize)] +pub struct SignatoryRecordV2 { + pub account_type: GovernanceAccountType, + pub proposal: Pubkey, + pub signatory: Pubkey, + pub signed_off: bool, + pub reserved_v2: [u8; 8], +} + +#[derive(Clone, Debug, PartialEq, BorshDeserialize, BorshSerialize)] +pub struct ProposalOption { + pub label: String, + pub vote_weight: u64, + pub vote_result: OptionVoteResult, + pub transactions_executed_count: u16, + pub transactions_count: u16, + pub transactions_next_index: u16, +} + +#[derive(Clone, Debug, PartialEq, BorshDeserialize, BorshSerialize)] +pub struct ProposalV2 { + pub account_type: GovernanceAccountType, + pub governance: Pubkey, + pub governing_token_mint: Pubkey, + pub state: ProposalState, + pub token_owner_record: Pubkey, + pub signatories_count: u8, + pub signatories_signed_off_count: u8, + pub vote_type: VoteType, + pub options: Vec, + pub deny_vote_weight: Option, + pub veto_vote_weight: Option, + pub abstain_vote_weight: Option, + pub start_voting_at: Option, + pub draft_at: UnixTimestamp, + pub signing_off_at: Option, + pub voting_at: Option, + pub voting_at_slot: Option, + pub voting_completed_at: Option, + pub executing_at: Option, + pub closed_at: Option, + pub execution_flags: InstructionExecutionFlags, + pub max_vote_weight: Option, + pub max_voting_time: Option, + pub vote_threshold_percentage: Option, + pub reserved: [u8; 64], + pub name: String, + pub description_link: String, +} + +#[derive(Clone, Copy, Debug, PartialEq, BorshDeserialize, BorshSerialize)] +pub enum OptionVoteResult { + None, + Succeeded, + Defeated, +} + +impl From for OptionVoteResultEnum { + fn from(v: OptionVoteResult) -> Self { + match v { + OptionVoteResult::None => OptionVoteResultEnum::None, + OptionVoteResult::Succeeded => OptionVoteResultEnum::Succeeded, + OptionVoteResult::Defeated => OptionVoteResultEnum::Defeated, + } + } +} + +#[derive(Clone, Debug, PartialEq, BorshDeserialize, BorshSerialize)] +pub enum VoteType { + SingleChoice, + MultiChoice { + max_voter_options: u8, + max_winning_options: u8, + }, +} + +#[derive(Clone, Copy, Debug, PartialEq, BorshDeserialize, BorshSerialize)] +pub enum ProposalState { + Draft, + SigningOff, + Voting, + Succeeded, + Executing, + Completed, + Cancelled, + Defeated, + ExecutingWithErrors, +} + +impl From for ProposalStateEnum { + fn from(v: ProposalState) -> Self { + match v { + ProposalState::Draft => ProposalStateEnum::Draft, + ProposalState::SigningOff => ProposalStateEnum::SigningOff, + ProposalState::Voting => ProposalStateEnum::Voting, + ProposalState::Succeeded => ProposalStateEnum::Succeeded, + ProposalState::Executing => ProposalStateEnum::Executing, + ProposalState::Completed => ProposalStateEnum::Completed, + ProposalState::Cancelled => ProposalStateEnum::Cancelled, + ProposalState::Defeated => ProposalStateEnum::Defeated, + ProposalState::ExecutingWithErrors => ProposalStateEnum::ExecutingWithErrors, + } + } +} + +#[derive(Clone, Copy, Debug, PartialEq, BorshDeserialize, BorshSerialize)] +pub enum InstructionExecutionFlags { + None, + Ordered, + UseTransaction, +} + +impl From for InstructionExecutionFlagsEnum { + fn from(v: InstructionExecutionFlags) -> Self { + match v { + InstructionExecutionFlags::None => InstructionExecutionFlagsEnum::None, + InstructionExecutionFlags::Ordered => InstructionExecutionFlagsEnum::Ordered, + InstructionExecutionFlags::UseTransaction => { + InstructionExecutionFlagsEnum::UseTransaction + }, + } + } +} + +pub(crate) async fn process_governance( + client: &Client, + key: Pubkey, + data: GovernanceV2, + slot: u64, + write_version: u64, +) -> Result<()> { + let row = Governance { + address: Owned(key.to_string()), + account_type: data.account_type.into(), + realm: Owned(data.realm.to_string()), + governed_account: Owned(data.governed_account.to_string()), + proposals_count: data.proposals_count.try_into()?, + reserved: Owned(data.reserved.to_vec()), + voting_proposal_count: data.voting_proposal_count.try_into()?, + slot: slot.try_into()?, + write_version: write_version.try_into()?, + }; + + client + .db() + .run(move |db| { + insert_into(governances::table) + .values(&row) + .on_conflict(governances::address) + .do_update() + .set(&row) + .execute(db) + }) + .await + .context("Failed to insert governance account")?; + + let c = data.config; + let (vote_threshold_type, vote_threshold_percentage) = match c.vote_threshold_percentage { + VoteThresholdPercentage::YesVote(p) => (VoteThresholdEnum::YesVote, i16::try_from(p)?), + VoteThresholdPercentage::Quorum(p) => (VoteThresholdEnum::Quorum, i16::try_from(p)?), + }; + + let config = DbGovernanceConfig { + governance_address: Owned(key.to_string()), + vote_threshold_type, + vote_threshold_percentage, + min_community_weight_to_create_proposal: c + .min_community_weight_to_create_proposal + .try_into()?, + min_instruction_hold_up_time: c.min_transaction_hold_up_time.try_into()?, + max_voting_time: c.max_voting_time.try_into()?, + vote_tipping: c.vote_tipping.into(), + proposal_cool_off_time: c.proposal_cool_off_time.try_into()?, + min_council_weight_to_create_proposal: c + .min_council_weight_to_create_proposal + .try_into()?, + slot: slot.try_into()?, + write_version: write_version.try_into()?, + }; + + client + .db() + .run(move |db| { + insert_into(governance_configs::table) + .values(&config) + .on_conflict(governance_configs::governance_address) + .do_update() + .set(&config) + .execute(db) + }) + .await + .context("Failed to insert governance config")?; + + Ok(()) +} + +pub(crate) async fn process_realmv2( + client: &Client, + key: Pubkey, + data: RealmV2, + slot: u64, + write_version: u64, +) -> Result<()> { + let row = Realm { + address: Owned(key.to_string()), + account_type: data.account_type.into(), + community_mint: Owned(data.community_mint.to_string()), + reserved: Owned(data.reserved.to_vec()), + voting_proposal_count: data.voting_proposal_count.try_into()?, + authority: data.authority.map(|a| Owned(a.to_string())), + name: Owned(data.name.to_string()), + reserved_v2: Owned(data.reserved_v2.to_vec()), + slot: slot.try_into()?, + write_version: write_version.try_into()?, + }; + + client + .db() + .run(move |db| { + insert_into(realms::table) + .values(&row) + .on_conflict(realms::address) + .do_update() + .set(&row) + .execute(db) + }) + .await + .context("Failed to insert realm account")?; + + let c = data.config; + let (vote_weight_source, vote_weight) = match c.community_mint_max_vote_weight_source { + MintMaxVoteWeightSource::SupplyFraction(p) => (MintMaxVoteEnum::SupplyFraction, p), + MintMaxVoteWeightSource::Absolute(p) => (MintMaxVoteEnum::Absolute, p), + }; + + let config = DbRealmConfig { + realm_address: Owned(key.to_string()), + use_community_voter_weight_addin: c.use_community_voter_weight_addin, + use_max_community_voter_weight_addin: c.use_max_community_voter_weight_addin, + reserved: Owned(c.reserved.to_vec()), + min_community_weight_to_create_governance: c + .min_community_weight_to_create_governance + .try_into()?, + community_mint_max_vote_weight_source: vote_weight_source, + community_mint_max_vote_weight: vote_weight.try_into()?, + council_mint: c.council_mint.map(|c| Owned(c.to_string())), + slot: slot.try_into()?, + write_version: write_version.try_into()?, + }; + + client + .db() + .run(move |db| { + insert_into(realm_configs::table) + .values(&config) + .on_conflict(realm_configs::realm_address) + .do_update() + .set(&config) + .execute(db) + }) + .await + .context("Failed to insert realm config")?; + + Ok(()) +} + +pub(crate) async fn process_vote_record_v2( + client: &Client, + key: Pubkey, + data: VoteRecordV2, + slot: u64, + write_version: u64, +) -> Result<()> { + let row = DbVoteRecordV2 { + address: Owned(key.to_string()), + account_type: data.account_type.into(), + proposal: Owned(data.proposal.to_string()), + governing_token_owner: Owned(data.governing_token_owner.to_string()), + is_relinquished: data.is_relinquished, + voter_weight: data.voter_weight.try_into()?, + vote: data.vote.clone().into(), + slot: slot.try_into()?, + write_version: write_version.try_into()?, + }; + + client + .db() + .run(move |db| { + insert_into(vote_records_v2::table) + .values(&row) + .on_conflict(vote_records_v2::address) + .do_update() + .set(&row) + .execute(db) + }) + .await + .context("Failed to insert vote record v2")?; + + if let Vote::Approve(choices) = data.vote { + for c in choices { + let r = DbVoteChoice { + vote_record_v2_address: Owned(key.to_string()), + rank: c.rank.try_into()?, + weight_percentage: c.weight_percentage.try_into()?, + slot: slot.try_into()?, + write_version: write_version.try_into()?, + }; + + client + .db() + .run(move |db| { + insert_into(vote_record_v2_vote_approve_vote_choices::table) + .values(&r) + .on_conflict(( + vote_record_v2_vote_approve_vote_choices::vote_record_v2_address, + vote_record_v2_vote_approve_vote_choices::rank, + vote_record_v2_vote_approve_vote_choices::weight_percentage, + )) + .do_update() + .set(&r) + .execute(db) + }) + .await + .context("Failed to insert vote record v2 approve vote choice")?; + } + } + + Ok(()) +} + +pub(crate) async fn process_token_owner_record_v2( + client: &Client, + key: Pubkey, + data: TokenOwnerRecordV2, + slot: u64, + write_version: u64, +) -> Result<()> { + let row = DbTokenOwnerRecordV2 { + address: Owned(key.to_string()), + account_type: data.account_type.into(), + realm: Owned(data.realm.to_string()), + governing_token_mint: Owned(data.governing_token_mint.to_string()), + governing_token_owner: Owned(data.governing_token_owner.to_string()), + governing_token_deposit_amount: data.governing_token_deposit_amount.try_into()?, + unrelinquished_votes_count: data.unrelinquished_votes_count.try_into()?, + total_votes_count: data.total_votes_count.try_into()?, + outstanding_proposal_count: data.outstanding_proposal_count.try_into()?, + reserved: Owned(data.reserved.to_vec()), + governance_delegate: data.governance_delegate.map(|d| Owned(d.to_string())), + slot: slot.try_into()?, + write_version: write_version.try_into()?, + }; + + client + .db() + .run(move |db| { + insert_into(token_owner_records_v2::table) + .values(&row) + .on_conflict(token_owner_records_v2::address) + .do_update() + .set(&row) + .execute(db) + }) + .await + .context("Failed to insert vote record v2")?; + + Ok(()) +} + +pub(crate) async fn process_signatory_record_v2( + client: &Client, + key: Pubkey, + data: SignatoryRecordV2, + slot: u64, + write_version: u64, +) -> Result<()> { + let row = DbSignatoryRecordV2 { + address: Owned(key.to_string()), + account_type: data.account_type.into(), + proposal: Owned(data.proposal.to_string()), + signatory: Owned(data.signatory.to_string()), + signed_off: data.signed_off, + slot: slot.try_into()?, + write_version: write_version.try_into()?, + }; + + client + .db() + .run(move |db| { + insert_into(signatory_records_v2::table) + .values(&row) + .on_conflict(signatory_records_v2::address) + .do_update() + .set(&row) + .execute(db) + }) + .await + .context("Failed to insert signatory record v2")?; + + Ok(()) +} + +#[allow(clippy::too_many_lines)] +pub(crate) async fn process_proposal_v2( + client: &Client, + key: Pubkey, + data: ProposalV2, + slot: u64, + write_version: u64, +) -> Result<()> { + let (vote_threshold_type, vote_threshold_percentage) = match data.vote_threshold_percentage { + Some(VoteThresholdPercentage::YesVote(p)) => { + (Some(VoteThresholdEnum::YesVote), Some(i16::try_from(p)?)) + }, + Some(VoteThresholdPercentage::Quorum(p)) => { + (Some(VoteThresholdEnum::Quorum), Some(i16::try_from(p)?)) + }, + _ => (None, None), + }; + + let row = DbProposalV2 { + address: Owned(key.to_string()), + account_type: data.account_type.into(), + governance: Owned(data.governance.to_string()), + governing_token_mint: Owned(data.governing_token_mint.to_string()), + state: data.state.into(), + token_owner_record: Owned(data.token_owner_record.to_string()), + signatories_count: data.signatories_count.try_into()?, + signatories_signed_off_count: data.signatories_signed_off_count.try_into()?, + vote_type: match data.vote_type { + VoteType::SingleChoice => ProposalVoteTypeEnum::SingleChoice, + VoteType::MultiChoice { .. } => ProposalVoteTypeEnum::MultiChoice, + }, + deny_vote_weight: data.deny_vote_weight.map(TryInto::try_into).transpose()?, + veto_vote_weight: data.veto_vote_weight.map(TryInto::try_into).transpose()?, + + abstain_vote_weight: data + .abstain_vote_weight + .map(TryInto::try_into) + .transpose()?, + start_voting_at: data.start_voting_at.map(unix_timestamp).transpose()?, + draft_at: unix_timestamp(data.draft_at)?, + signing_off_at: data.signing_off_at.map(unix_timestamp).transpose()?, + voting_at: data.voting_at.map(unix_timestamp).transpose()?, + voting_at_slot: data.voting_at_slot.map(TryInto::try_into).transpose()?, + voting_completed_at: data.voting_completed_at.map(unix_timestamp).transpose()?, + executing_at: data.executing_at.map(unix_timestamp).transpose()?, + closed_at: data.closed_at.map(unix_timestamp).transpose()?, + execution_flags: data.execution_flags.into(), + max_vote_weight: data.max_vote_weight.map(TryInto::try_into).transpose()?, + max_voting_time: data.max_voting_time.map(TryInto::try_into).transpose()?, + vote_threshold_type, + vote_threshold_percentage, + name: Owned(data.name.to_string()), + description_link: Owned(data.description_link.to_string()), + slot: slot.try_into()?, + write_version: write_version.try_into()?, + }; + + client + .db() + .run(move |db| { + insert_into(proposals_v2::table) + .values(&row) + .on_conflict(proposals_v2::address) + .do_update() + .set(&row) + .execute(db) + }) + .await + .context("Failed to insert proposal v2")?; + + for o in data.options { + let row = DbProposalOption { + proposal_address: Owned(key.to_string()), + label: Owned(o.label.to_string()), + vote_weight: o.vote_weight.try_into()?, + vote_result: o.vote_result.into(), + transactions_executed_count: o.transactions_next_index.try_into()?, + transactions_count: o.transactions_count.try_into()?, + transactions_next_index: o.transactions_next_index.try_into()?, + slot: slot.try_into()?, + write_version: write_version.try_into()?, + }; + + client + .db() + .run(move |db| { + insert_into(proposal_options::table) + .values(&row) + .on_conflict((proposal_options::proposal_address, proposal_options::label)) + .do_update() + .set(&row) + .execute(db) + }) + .await + .context("Failed to insert proposal option")?; + } + + if let VoteType::MultiChoice { + max_voter_options, + max_winning_options, + } = data.vote_type + { + let row = MultiChoice { + address: Owned(key.to_string()), + max_voter_options: max_voter_options.try_into()?, + max_winning_options: max_winning_options.try_into()?, + slot: slot.try_into()?, + write_version: write_version.try_into()?, + }; + + client + .db() + .run(move |db| { + insert_into(proposal_vote_type_multi_choices::table) + .values(&row) + .on_conflict(proposal_vote_type_multi_choices::address) + .do_update() + .set(&row) + .execute(db) + }) + .await + .context("Failed to insert multichoice vote type")?; + } + + Ok(()) +} diff --git a/crates/indexer/src/geyser/mod.rs b/crates/indexer/src/geyser/mod.rs index 53c8b8020..4a07a5063 100644 --- a/crates/indexer/src/geyser/mod.rs +++ b/crates/indexer/src/geyser/mod.rs @@ -98,6 +98,9 @@ pub async fn process_message( Message::AccountUpdate(update) if update.owner == pubkeys::TOKEN_BONDING => { programs::token_bonding::process(client, update).await }, + Message::AccountUpdate(update) if update.owner == pubkeys::SPL_GOVERNANCE => { + programs::spl_governance::process(client, update).await + }, Message::AccountUpdate(update) if update.owner == genostub::ID => { programs::genopets::process(client, update).await }, diff --git a/crates/indexer/src/geyser/programs/mod.rs b/crates/indexer/src/geyser/programs/mod.rs index ed70ca2cf..31c1a0356 100644 --- a/crates/indexer/src/geyser/programs/mod.rs +++ b/crates/indexer/src/geyser/programs/mod.rs @@ -13,6 +13,7 @@ pub mod metadata; pub mod metaplex; pub mod name_service; pub mod namespaces; +pub mod spl_governance; pub mod token; pub mod token_bonding; pub mod tribeca_govern; diff --git a/crates/indexer/src/geyser/programs/spl_governance.rs b/crates/indexer/src/geyser/programs/spl_governance.rs new file mode 100644 index 000000000..bf86a8861 --- /dev/null +++ b/crates/indexer/src/geyser/programs/spl_governance.rs @@ -0,0 +1,77 @@ +use borsh::BorshDeserialize; + +use super::{ + accounts::spl_governance::{ + process_governance, process_proposal_v2, process_realmv2, process_signatory_record_v2, + process_token_owner_record_v2, process_vote_record_v2, GovernanceAccountType, GovernanceV2, + ProposalV2, RealmV2, SignatoryRecordV2, TokenOwnerRecordV2, VoteRecordV2, + }, + AccountUpdate, Client, +}; +use crate::prelude::*; + +const GOVERNANCE_V2: u8 = GovernanceAccountType::GovernanceV2 as u8; +const REALM_V2: u8 = GovernanceAccountType::RealmV2 as u8; +const VOTE_RECORD_V2: u8 = GovernanceAccountType::VoteRecordV2 as u8; +const TOKEN_OWNER_RECORD_V2: u8 = GovernanceAccountType::TokenOwnerRecordV2 as u8; +const PROPOSAL_V2: u8 = GovernanceAccountType::ProposalV2 as u8; +const SIGNATORY_RECORD_V2: u8 = GovernanceAccountType::SignatoryRecordV2 as u8; + +pub(crate) async fn process(client: &Client, update: AccountUpdate) -> Result<()> { + let discrimintator = update.data[0]; + + match discrimintator { + GOVERNANCE_V2 => process_governancev2_account(client, update).await, + REALM_V2 => process_realmv2_account(client, update).await, + VOTE_RECORD_V2 => process_vote_recordv2_account(client, update).await, + TOKEN_OWNER_RECORD_V2 => process_token_owner_record_v2_account(client, update).await, + PROPOSAL_V2 => process_proposalv2_account(client, update).await, + SIGNATORY_RECORD_V2 => process_signatory_recordv2_account(client, update).await, + _ => Ok(()), + } +} + +async fn process_governancev2_account(client: &Client, update: AccountUpdate) -> Result<()> { + let acc: GovernanceV2 = GovernanceV2::deserialize(&mut update.data.as_slice()) + .context("Failed to deserialize spl governance v2 account ")?; + + process_governance(client, update.key, acc, update.slot, update.write_version).await +} + +async fn process_realmv2_account(client: &Client, update: AccountUpdate) -> Result<()> { + let acc: RealmV2 = RealmV2::deserialize(&mut update.data.as_slice()) + .context("Failed to deserialize spl realm v2 account ")?; + + process_realmv2(client, update.key, acc, update.slot, update.write_version).await +} + +async fn process_vote_recordv2_account(client: &Client, update: AccountUpdate) -> Result<()> { + let acc: VoteRecordV2 = VoteRecordV2::deserialize(&mut update.data.as_slice()) + .context("Failed to deserialize vote record v2 ")?; + + process_vote_record_v2(client, update.key, acc, update.slot, update.write_version).await +} + +async fn process_token_owner_record_v2_account( + client: &Client, + update: AccountUpdate, +) -> Result<()> { + let acc: TokenOwnerRecordV2 = TokenOwnerRecordV2::deserialize(&mut update.data.as_slice()) + .context("Failed to deserialize token owner record v2 account ")?; + + process_token_owner_record_v2(client, update.key, acc, update.slot, update.write_version).await +} + +async fn process_proposalv2_account(client: &Client, update: AccountUpdate) -> Result<()> { + let acc: ProposalV2 = ProposalV2::deserialize(&mut update.data.as_slice()) + .context("Failed to deserialize proposal v2 account")?; + + process_proposal_v2(client, update.key, acc, update.slot, update.write_version).await +} + +async fn process_signatory_recordv2_account(client: &Client, update: AccountUpdate) -> Result<()> { + let acc: SignatoryRecordV2 = SignatoryRecordV2::deserialize(&mut update.data.as_slice()) + .context("Failed to deserialize signatory record v2 account ")?; + + process_signatory_record_v2(client, update.key, acc, update.slot, update.write_version).await +}