lib.rs 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906
  1. // This file is autogenerated with https://github.com/acheroncrypto/native-to-anchor
  2. use anchor_lang::prelude::*;
  3. declare_id!("11111111111111111111111111111111");
  4. #[program]
  5. pub mod spl_governance {
  6. use super::*;
  7. pub fn create_realm(
  8. ctx: Context<CreateRealm>,
  9. name: String,
  10. config_args: RealmConfigArgs,
  11. ) -> Result<()> {
  12. Ok(())
  13. }
  14. pub fn deposit_governing_tokens(
  15. ctx: Context<DepositGoverningTokens>,
  16. amount: u64,
  17. ) -> Result<()> {
  18. Ok(())
  19. }
  20. pub fn withdraw_governing_tokens(ctx: Context<WithdrawGoverningTokens>) -> Result<()> {
  21. Ok(())
  22. }
  23. pub fn set_governance_delegate(
  24. ctx: Context<SetGovernanceDelegate>,
  25. new_governance_delegate: Option<Pubkey>,
  26. ) -> Result<()> {
  27. Ok(())
  28. }
  29. pub fn create_governance(
  30. ctx: Context<CreateGovernance>,
  31. config: GovernanceConfig,
  32. ) -> Result<()> {
  33. Ok(())
  34. }
  35. pub fn create_program_governance(
  36. ctx: Context<CreateProgramGovernance>,
  37. config: GovernanceConfig,
  38. transfer_upgrade_authority: bool,
  39. ) -> Result<()> {
  40. Ok(())
  41. }
  42. pub fn create_proposal(
  43. ctx: Context<CreateProposal>,
  44. name: String,
  45. description_link: String,
  46. vote_type: VoteType,
  47. options: Vec<String>,
  48. use_deny_option: bool,
  49. ) -> Result<()> {
  50. Ok(())
  51. }
  52. pub fn add_signatory(ctx: Context<AddSignatory>, signatory: Pubkey) -> Result<()> {
  53. Ok(())
  54. }
  55. pub fn remove_signatory(ctx: Context<RemoveSignatory>, signatory: Pubkey) -> Result<()> {
  56. Ok(())
  57. }
  58. pub fn insert_transaction(
  59. ctx: Context<InsertTransaction>,
  60. option_index: u8,
  61. index: u16,
  62. hold_up_time: u32,
  63. instructions: Vec<InstructionData>,
  64. ) -> Result<()> {
  65. Ok(())
  66. }
  67. pub fn remove_transaction(ctx: Context<RemoveTransaction>) -> Result<()> {
  68. Ok(())
  69. }
  70. pub fn cancel_proposal(ctx: Context<CancelProposal>) -> Result<()> {
  71. Ok(())
  72. }
  73. pub fn sign_off_proposal(ctx: Context<SignOffProposal>) -> Result<()> {
  74. Ok(())
  75. }
  76. pub fn cast_vote(ctx: Context<CastVote>, vote: Vote) -> Result<()> {
  77. Ok(())
  78. }
  79. pub fn finalize_vote(ctx: Context<FinalizeVote>) -> Result<()> {
  80. Ok(())
  81. }
  82. pub fn relinquish_vote(ctx: Context<RelinquishVote>) -> Result<()> {
  83. Ok(())
  84. }
  85. pub fn execute_transaction(ctx: Context<ExecuteTransaction>) -> Result<()> {
  86. Ok(())
  87. }
  88. pub fn create_mint_governance(
  89. ctx: Context<CreateMintGovernance>,
  90. config: GovernanceConfig,
  91. transfer_mint_authorities: bool,
  92. ) -> Result<()> {
  93. Ok(())
  94. }
  95. pub fn create_token_governance(
  96. ctx: Context<CreateTokenGovernance>,
  97. config: GovernanceConfig,
  98. transfer_account_authorities: bool,
  99. ) -> Result<()> {
  100. Ok(())
  101. }
  102. pub fn set_governance_config(
  103. ctx: Context<SetGovernanceConfig>,
  104. config: GovernanceConfig,
  105. ) -> Result<()> {
  106. Ok(())
  107. }
  108. pub fn flag_transaction_error(ctx: Context<FlagTransactionError>) -> Result<()> {
  109. Ok(())
  110. }
  111. pub fn set_realm_authority(
  112. ctx: Context<SetRealmAuthority>,
  113. action: SetRealmAuthorityAction,
  114. ) -> Result<()> {
  115. Ok(())
  116. }
  117. pub fn set_realm_config(
  118. ctx: Context<SetRealmConfig>,
  119. config_args: RealmConfigArgs,
  120. ) -> Result<()> {
  121. Ok(())
  122. }
  123. pub fn create_token_owner_record(ctx: Context<CreateTokenOwnerRecord>) -> Result<()> {
  124. Ok(())
  125. }
  126. pub fn update_program_metadata(ctx: Context<UpdateProgramMetadata>) -> Result<()> {
  127. Ok(())
  128. }
  129. pub fn create_native_treasury(ctx: Context<CreateNativeTreasury>) -> Result<()> {
  130. Ok(())
  131. }
  132. }
  133. #[derive(Accounts)]
  134. pub struct CreateRealm<'info> {
  135. #[account(mut)]
  136. realm_address: AccountInfo<'info>,
  137. realm_authority: AccountInfo<'info>,
  138. community_token_mint: AccountInfo<'info>,
  139. #[account(mut)]
  140. community_token_holding_address: AccountInfo<'info>,
  141. #[account(mut)]
  142. payer: Signer<'info>,
  143. system_program: Program<'info, System>,
  144. token_program: Program<'info, Token>,
  145. rent: Sysvar<'info, Rent>,
  146. // optional_council_token_mint: AccountInfo<'info>,
  147. // #[account(mut)]
  148. // optional_council_token_holding_address: AccountInfo<'info>,
  149. // optional_community_voter_weight_addin: Signer<'info>,
  150. // optional_max_community_voter_weight_addin: Signer<'info>,
  151. // #[account(mut)]
  152. // optional_realm_config_address: AccountInfo<'info>,
  153. }
  154. #[derive(Accounts)]
  155. pub struct DepositGoverningTokens<'info> {
  156. realm: AccountInfo<'info>,
  157. #[account(mut)]
  158. governing_token_holding_address: AccountInfo<'info>,
  159. #[account(mut)]
  160. governing_token_source: AccountInfo<'info>,
  161. governing_token_owner: Signer<'info>,
  162. governing_token_transfer_authority: Signer<'info>,
  163. #[account(mut)]
  164. token_owner_record_address: AccountInfo<'info>,
  165. #[account(mut)]
  166. payer: Signer<'info>,
  167. system_program: Program<'info, System>,
  168. token_program: Program<'info, Token>,
  169. }
  170. #[derive(Accounts)]
  171. pub struct WithdrawGoverningTokens<'info> {
  172. realm: AccountInfo<'info>,
  173. #[account(mut)]
  174. governing_token_holding_address: AccountInfo<'info>,
  175. #[account(mut)]
  176. governing_token_destination: AccountInfo<'info>,
  177. governing_token_owner: Signer<'info>,
  178. #[account(mut)]
  179. token_owner_record_address: AccountInfo<'info>,
  180. token_program: Program<'info, Token>,
  181. }
  182. #[derive(Accounts)]
  183. pub struct SetGovernanceDelegate<'info> {
  184. governance_authority: Signer<'info>,
  185. #[account(mut)]
  186. vote_record_address: AccountInfo<'info>,
  187. }
  188. #[derive(Accounts)]
  189. pub struct CreateGovernance<'info> {
  190. realm: AccountInfo<'info>,
  191. #[account(mut)]
  192. governance_address: AccountInfo<'info>,
  193. governed_account_address: AccountInfo<'info>,
  194. token_owner_record: AccountInfo<'info>,
  195. #[account(mut)]
  196. payer: Signer<'info>,
  197. system_program: Program<'info, System>,
  198. create_authority: Signer<'info>,
  199. }
  200. #[derive(Accounts)]
  201. pub struct CreateProgramGovernance<'info> {
  202. realm: AccountInfo<'info>,
  203. #[account(mut)]
  204. program_governance_address: AccountInfo<'info>,
  205. governed_program: AccountInfo<'info>,
  206. #[account(mut)]
  207. governed_program_data_address: AccountInfo<'info>,
  208. governed_program_upgrade_authority: Signer<'info>,
  209. token_owner_record: AccountInfo<'info>,
  210. #[account(mut)]
  211. payer: Signer<'info>,
  212. bpf_loader_upgradeable: AccountInfo<'info>,
  213. system_program: Program<'info, System>,
  214. create_authority: Signer<'info>,
  215. }
  216. #[derive(Accounts)]
  217. pub struct CreateProposal<'info> {
  218. realm: AccountInfo<'info>,
  219. #[account(mut)]
  220. proposal_address: AccountInfo<'info>,
  221. #[account(mut)]
  222. governance: AccountInfo<'info>,
  223. #[account(mut)]
  224. proposal_owner_record: AccountInfo<'info>,
  225. governing_token_mint: AccountInfo<'info>,
  226. governance_authority: Signer<'info>,
  227. #[account(mut)]
  228. payer: Signer<'info>,
  229. system_program: Program<'info, System>,
  230. }
  231. #[derive(Accounts)]
  232. pub struct AddSignatory<'info> {
  233. #[account(mut)]
  234. proposal: AccountInfo<'info>,
  235. token_owner_record: AccountInfo<'info>,
  236. governance_authority: Signer<'info>,
  237. #[account(mut)]
  238. signatory_record_address: AccountInfo<'info>,
  239. #[account(mut)]
  240. payer: Signer<'info>,
  241. system_program: Program<'info, System>,
  242. }
  243. #[derive(Accounts)]
  244. pub struct RemoveSignatory<'info> {
  245. #[account(mut)]
  246. proposal: AccountInfo<'info>,
  247. token_owner_record: AccountInfo<'info>,
  248. governance_authority: Signer<'info>,
  249. #[account(mut)]
  250. signatory_record_address: AccountInfo<'info>,
  251. #[account(mut)]
  252. beneficiary: AccountInfo<'info>,
  253. }
  254. #[derive(Accounts)]
  255. pub struct InsertTransaction<'info> {
  256. governance: AccountInfo<'info>,
  257. #[account(mut)]
  258. proposal: AccountInfo<'info>,
  259. token_owner_record: AccountInfo<'info>,
  260. governance_authority: Signer<'info>,
  261. #[account(mut)]
  262. proposal_transaction_address: AccountInfo<'info>,
  263. #[account(mut)]
  264. payer: Signer<'info>,
  265. system_program: Program<'info, System>,
  266. rent: Sysvar<'info, Rent>,
  267. }
  268. #[derive(Accounts)]
  269. pub struct RemoveTransaction<'info> {
  270. #[account(mut)]
  271. proposal: AccountInfo<'info>,
  272. token_owner_record: AccountInfo<'info>,
  273. governance_authority: Signer<'info>,
  274. #[account(mut)]
  275. proposal_transaction: AccountInfo<'info>,
  276. #[account(mut)]
  277. beneficiary: AccountInfo<'info>,
  278. }
  279. #[derive(Accounts)]
  280. pub struct CancelProposal<'info> {
  281. #[account(mut)]
  282. realm: AccountInfo<'info>,
  283. #[account(mut)]
  284. governance: AccountInfo<'info>,
  285. #[account(mut)]
  286. proposal: AccountInfo<'info>,
  287. #[account(mut)]
  288. proposal_owner_record: AccountInfo<'info>,
  289. governance_authority: Signer<'info>,
  290. }
  291. #[derive(Accounts)]
  292. pub struct SignOffProposal<'info> {
  293. #[account(mut)]
  294. realm: AccountInfo<'info>,
  295. #[account(mut)]
  296. governance: AccountInfo<'info>,
  297. #[account(mut)]
  298. proposal: AccountInfo<'info>,
  299. signatory: Signer<'info>,
  300. // optional_proposal_owner_record: AccountInfo<'info>,
  301. // #[account(mut)]
  302. // optional_signatory_record_address: AccountInfo<'info>,
  303. }
  304. #[derive(Accounts)]
  305. pub struct CastVote<'info> {
  306. #[account(mut)]
  307. realm: AccountInfo<'info>,
  308. #[account(mut)]
  309. governance: AccountInfo<'info>,
  310. #[account(mut)]
  311. proposal: AccountInfo<'info>,
  312. #[account(mut)]
  313. proposal_owner_record: AccountInfo<'info>,
  314. #[account(mut)]
  315. voter_token_owner_record: AccountInfo<'info>,
  316. governance_authority: Signer<'info>,
  317. #[account(mut)]
  318. vote_record_address: AccountInfo<'info>,
  319. vote_governing_token_mint: AccountInfo<'info>,
  320. #[account(mut)]
  321. payer: Signer<'info>,
  322. system_program: Program<'info, System>,
  323. }
  324. #[derive(Accounts)]
  325. pub struct FinalizeVote<'info> {
  326. #[account(mut)]
  327. realm: AccountInfo<'info>,
  328. #[account(mut)]
  329. governance: AccountInfo<'info>,
  330. #[account(mut)]
  331. proposal: AccountInfo<'info>,
  332. #[account(mut)]
  333. proposal_owner_record: AccountInfo<'info>,
  334. governing_token_mint: AccountInfo<'info>,
  335. }
  336. #[derive(Accounts)]
  337. pub struct RelinquishVote<'info> {
  338. realm: AccountInfo<'info>,
  339. governance: AccountInfo<'info>,
  340. #[account(mut)]
  341. proposal: AccountInfo<'info>,
  342. #[account(mut)]
  343. token_owner_record: AccountInfo<'info>,
  344. #[account(mut)]
  345. vote_record_address: AccountInfo<'info>,
  346. vote_governing_token_mint: AccountInfo<'info>,
  347. // optional_governance_authority: Signer<'info>,
  348. // #[account(mut)]
  349. // optional_beneficiary: AccountInfo<'info>,
  350. }
  351. #[derive(Accounts)]
  352. pub struct ExecuteTransaction<'info> {
  353. governance: AccountInfo<'info>,
  354. #[account(mut)]
  355. proposal: AccountInfo<'info>,
  356. #[account(mut)]
  357. proposal_transaction: AccountInfo<'info>,
  358. instruction_program: AccountInfo<'info>,
  359. }
  360. #[derive(Accounts)]
  361. pub struct CreateMintGovernance<'info> {
  362. realm: AccountInfo<'info>,
  363. #[account(mut)]
  364. mint_governance_address: AccountInfo<'info>,
  365. #[account(mut)]
  366. governed_mint: AccountInfo<'info>,
  367. governed_mint_authority: Signer<'info>,
  368. token_owner_record: AccountInfo<'info>,
  369. #[account(mut)]
  370. payer: Signer<'info>,
  371. token_program: Program<'info, Token>,
  372. system_program: Program<'info, System>,
  373. create_authority: Signer<'info>,
  374. }
  375. #[derive(Accounts)]
  376. pub struct CreateTokenGovernance<'info> {
  377. realm: AccountInfo<'info>,
  378. #[account(mut)]
  379. token_governance_address: AccountInfo<'info>,
  380. #[account(mut)]
  381. governed_token: AccountInfo<'info>,
  382. governed_token_owner: Signer<'info>,
  383. token_owner_record: AccountInfo<'info>,
  384. #[account(mut)]
  385. payer: Signer<'info>,
  386. token_program: Program<'info, Token>,
  387. system_program: Program<'info, System>,
  388. create_authority: Signer<'info>,
  389. }
  390. #[derive(Accounts)]
  391. pub struct SetGovernanceConfig<'info> {
  392. #[account(mut)]
  393. governance: Signer<'info>,
  394. }
  395. #[derive(Accounts)]
  396. pub struct FlagTransactionError<'info> {
  397. #[account(mut)]
  398. proposal: AccountInfo<'info>,
  399. token_owner_record: AccountInfo<'info>,
  400. governance_authority: Signer<'info>,
  401. #[account(mut)]
  402. proposal_transaction: AccountInfo<'info>,
  403. }
  404. #[derive(Accounts)]
  405. pub struct SetRealmAuthority<'info> {
  406. #[account(mut)]
  407. realm: AccountInfo<'info>,
  408. realm_authority: Signer<'info>,
  409. // optional_new_realm_authority: Signer<'info>,
  410. }
  411. #[derive(Accounts)]
  412. pub struct SetRealmConfig<'info> {
  413. #[account(mut)]
  414. realm: AccountInfo<'info>,
  415. realm_authority: Signer<'info>,
  416. // optional_council_token_mint: AccountInfo<'info>,
  417. // #[account(mut)]
  418. // optional_council_token_holding_address: AccountInfo<'info>,
  419. // optional_system_program: Program<'info, System>,
  420. // #[account(mut)]
  421. // optional_realm_config_address: AccountInfo<'info>,
  422. // optional_community_voter_weight_addin: Signer<'info>,
  423. // optional_max_community_voter_weight_addin: Signer<'info>,
  424. // #[account(mut)]
  425. // optional_payer: Signer<'info>,
  426. }
  427. #[derive(Accounts)]
  428. pub struct CreateTokenOwnerRecord<'info> {
  429. realm: AccountInfo<'info>,
  430. governing_token_owner: AccountInfo<'info>,
  431. #[account(mut)]
  432. token_owner_record_address: AccountInfo<'info>,
  433. governing_token_mint: AccountInfo<'info>,
  434. #[account(mut)]
  435. payer: Signer<'info>,
  436. system_program: Program<'info, System>,
  437. }
  438. #[derive(Accounts)]
  439. pub struct UpdateProgramMetadata<'info> {
  440. #[account(mut)]
  441. program_metadata_address: AccountInfo<'info>,
  442. #[account(mut)]
  443. payer: Signer<'info>,
  444. system_program: Program<'info, System>,
  445. }
  446. #[derive(Accounts)]
  447. pub struct CreateNativeTreasury<'info> {
  448. governance: AccountInfo<'info>,
  449. #[account(mut)]
  450. native_treasury_address: AccountInfo<'info>,
  451. #[account(mut)]
  452. payer: Signer<'info>,
  453. system_program: Program<'info, System>,
  454. }
  455. #[account]
  456. pub struct RealmV2 {
  457. /// Governance account type
  458. pub account_type: GovernanceAccountType,
  459. /// Community mint
  460. pub community_mint: Pubkey,
  461. /// Configuration of the Realm
  462. pub config: RealmConfig,
  463. /// Reserved space for future versions
  464. pub reserved: [u8; 6],
  465. /// The number of proposals in voting state in the Realm
  466. pub voting_proposal_count: u16,
  467. /// Realm authority. The authority must sign transactions which update the realm config
  468. /// The authority should be transferred to Realm Governance to make the Realm self governed through proposals
  469. pub authority: Option<Pubkey>,
  470. /// Governance Realm name
  471. pub name: String,
  472. /// Reserved space for versions v2 and onwards
  473. /// Note: This space won't be available to v1 accounts until runtime supports resizing
  474. pub reserved_v2: [u8; 128],
  475. }
  476. #[account]
  477. pub struct ProposalV2 {
  478. /// Governance account type
  479. pub account_type: GovernanceAccountType,
  480. /// Governance account the Proposal belongs to
  481. pub governance: Pubkey,
  482. /// Indicates which Governing Token is used to vote on the Proposal
  483. /// Whether the general Community token owners or the Council tokens owners vote on this Proposal
  484. pub governing_token_mint: Pubkey,
  485. /// Current proposal state
  486. pub state: ProposalState,
  487. // TODO: add state_at timestamp to have single field to filter recent proposals in the UI
  488. /// The TokenOwnerRecord representing the user who created and owns this Proposal
  489. pub token_owner_record: Pubkey,
  490. /// The number of signatories assigned to the Proposal
  491. pub signatories_count: u8,
  492. /// The number of signatories who already signed
  493. pub signatories_signed_off_count: u8,
  494. /// Vote type
  495. pub vote_type: VoteType,
  496. /// Proposal options
  497. pub options: Vec<ProposalOption>,
  498. /// The total weight of the Proposal rejection votes
  499. /// If the proposal has no deny option then the weight is None
  500. /// Only proposals with the deny option can have executable instructions attached to them
  501. /// Without the deny option a proposal is only non executable survey
  502. pub deny_vote_weight: Option<u64>,
  503. /// Reserved space for future versions
  504. /// This field is a leftover from unused veto_vote_weight: Option<u64>
  505. pub reserved1: u8,
  506. /// The total weight of votes
  507. /// Note: Abstain is not supported in the current version
  508. pub abstain_vote_weight: Option<u64>,
  509. /// Optional start time if the Proposal should not enter voting state immediately after being signed off
  510. /// Note: start_at is not supported in the current version
  511. pub start_voting_at: Option<i64>,
  512. /// When the Proposal was created and entered Draft state
  513. pub draft_at: i64,
  514. /// When Signatories started signing off the Proposal
  515. pub signing_off_at: Option<i64>,
  516. /// When the Proposal began voting as UnixTimestamp
  517. pub voting_at: Option<i64>,
  518. /// When the Proposal began voting as Slot
  519. /// Note: The slot is not currently used but the exact slot is going to be required to support snapshot based vote weights
  520. pub voting_at_slot: Option<u64>,
  521. /// When the Proposal ended voting and entered either Succeeded or Defeated
  522. pub voting_completed_at: Option<i64>,
  523. /// When the Proposal entered Executing state
  524. pub executing_at: Option<i64>,
  525. /// When the Proposal entered final state Completed or Cancelled and was closed
  526. pub closed_at: Option<i64>,
  527. /// Instruction execution flag for ordered and transactional instructions
  528. /// Note: This field is not used in the current version
  529. pub execution_flags: InstructionExecutionFlags,
  530. /// The max vote weight for the Governing Token mint at the time Proposal was decided
  531. /// It's used to show correct vote results for historical proposals in cases when the mint supply or max weight source changed
  532. /// after vote was completed.
  533. pub max_vote_weight: Option<u64>,
  534. /// Max voting time for the proposal if different from parent Governance (only higher value possible)
  535. /// Note: This field is not used in the current version
  536. pub max_voting_time: Option<u32>,
  537. /// The vote threshold at the time Proposal was decided
  538. /// It's used to show correct vote results for historical proposals in cases when the threshold
  539. /// was changed for governance config after vote was completed.
  540. /// TODO: Use this field to override the threshold from parent Governance (only higher value possible)
  541. pub vote_threshold: Option<VoteThreshold>,
  542. /// Reserved space for future versions
  543. pub reserved: [u8; 64],
  544. /// Proposal name
  545. pub name: String,
  546. /// Link to proposal's description
  547. pub description_link: String,
  548. /// The total weight of Veto votes
  549. pub veto_vote_weight: u64,
  550. }
  551. #[account]
  552. pub struct ProgramMetadata {
  553. /// Governance account type
  554. pub account_type: GovernanceAccountType,
  555. /// The slot when the metadata was captured
  556. pub updated_at: u64,
  557. /// The version of the program
  558. /// Max 11 characters XXX.YYY.ZZZ
  559. pub version: String,
  560. /// Reserved
  561. pub reserved: [u8; 64],
  562. }
  563. #[account]
  564. pub struct SignatoryRecordV2 {
  565. /// Governance account type
  566. pub account_type: GovernanceAccountType,
  567. /// Proposal the signatory is assigned for
  568. pub proposal: Pubkey,
  569. /// The account of the signatory who can sign off the proposal
  570. pub signatory: Pubkey,
  571. /// Indicates whether the signatory signed off the proposal
  572. pub signed_off: bool,
  573. /// Reserved space for versions v2 and onwards
  574. /// Note: This space won't be available to v1 accounts until runtime supports resizing
  575. pub reserved_v2: [u8; 8],
  576. }
  577. #[account]
  578. pub struct RealmV1 {
  579. /// Governance account type
  580. pub account_type: GovernanceAccountType,
  581. /// Community mint
  582. pub community_mint: Pubkey,
  583. /// Configuration of the Realm
  584. pub config: RealmConfig,
  585. /// Reserved space for future versions
  586. pub reserved: [u8; 6],
  587. /// The number of proposals in voting state in the Realm
  588. /// Note: This is field introduced in V2 but it took space from reserved
  589. /// and we have preserve it for V1 serialization roundtrip
  590. pub voting_proposal_count: u16,
  591. /// Realm authority. The authority must sign transactions which update the realm config
  592. /// The authority should be transferred to Realm Governance to make the Realm self governed through proposals
  593. pub authority: Option<Pubkey>,
  594. /// Governance Realm name
  595. pub name: String,
  596. }
  597. #[account]
  598. pub struct TokenOwnerRecordV1 {
  599. /// Governance account type
  600. pub account_type: GovernanceAccountType,
  601. /// The Realm the TokenOwnerRecord belongs to
  602. pub realm: Pubkey,
  603. /// Governing Token Mint the TokenOwnerRecord holds deposit for
  604. pub governing_token_mint: Pubkey,
  605. /// The owner (either single or multisig) of the deposited governing SPL Tokens
  606. /// This is who can authorize a withdrawal of the tokens
  607. pub governing_token_owner: Pubkey,
  608. /// The amount of governing tokens deposited into the Realm
  609. /// This amount is the voter weight used when voting on proposals
  610. pub governing_token_deposit_amount: u64,
  611. /// The number of votes cast by TokenOwner but not relinquished yet
  612. /// Every time a vote is cast this number is increased and it's always decreased when relinquishing a vote regardless of the vote state
  613. pub unrelinquished_votes_count: u32,
  614. /// The total number of votes cast by the TokenOwner
  615. /// If TokenOwner withdraws vote while voting is still in progress total_votes_count is decreased and the vote doesn't count towards the total
  616. pub total_votes_count: u32,
  617. /// The number of outstanding proposals the TokenOwner currently owns
  618. /// The count is increased when TokenOwner creates a proposal
  619. /// and decreased once it's either voted on (Succeeded or Defeated) or Cancelled
  620. /// By default it's restricted to 1 outstanding Proposal per token owner
  621. pub outstanding_proposal_count: u8,
  622. /// Reserved space for future versions
  623. pub reserved: [u8; 7],
  624. /// A single account that is allowed to operate governance with the deposited governing tokens
  625. /// It can be delegated to by the governing_token_owner or current governance_delegate
  626. pub governance_delegate: Option<Pubkey>,
  627. }
  628. #[account]
  629. pub struct GovernanceV1 {
  630. /// Account type. It can be Uninitialized, Governance, ProgramGovernance, TokenGovernance or MintGovernance
  631. pub account_type: GovernanceAccountType,
  632. /// Governance Realm
  633. pub realm: Pubkey,
  634. /// Account governed by this Governance and/or PDA identity seed
  635. /// It can be Program account, Mint account, Token account or any other account
  636. ///
  637. /// Note: The account doesn't have to exist. In that case the field is only a PDA seed
  638. ///
  639. /// Note: Setting governed_account doesn't give any authority over the governed account
  640. /// The relevant authorities for specific account types must still be transferred to the Governance PDA
  641. /// Ex: mint_authority/freeze_authority for a Mint account
  642. /// or upgrade_authority for a Program account should be transferred to the Governance PDA
  643. pub governed_account: Pubkey,
  644. /// Running count of proposals
  645. pub proposals_count: u32,
  646. /// Governance config
  647. pub config: GovernanceConfig,
  648. /// Reserved space for future versions
  649. pub reserved: [u8; 6],
  650. /// The number of proposals in voting state in the Governance
  651. /// Note: This is field introduced in V2 but it took space from reserved
  652. /// and we have preserve it for V1 serialization roundtrip
  653. pub voting_proposal_count: u16,
  654. }
  655. #[account]
  656. pub struct ProposalV1 {
  657. /// Governance account type
  658. pub account_type: GovernanceAccountType,
  659. /// Governance account the Proposal belongs to
  660. pub governance: Pubkey,
  661. /// Indicates which Governing Token is used to vote on the Proposal
  662. /// Whether the general Community token owners or the Council tokens owners vote on this Proposal
  663. pub governing_token_mint: Pubkey,
  664. /// Current proposal state
  665. pub state: ProposalState,
  666. /// The TokenOwnerRecord representing the user who created and owns this Proposal
  667. pub token_owner_record: Pubkey,
  668. /// The number of signatories assigned to the Proposal
  669. pub signatories_count: u8,
  670. /// The number of signatories who already signed
  671. pub signatories_signed_off_count: u8,
  672. /// The number of Yes votes
  673. pub yes_votes_count: u64,
  674. /// The number of No votes
  675. pub no_votes_count: u64,
  676. /// The number of the instructions already executed
  677. pub instructions_executed_count: u16,
  678. /// The number of instructions included in the proposal
  679. pub instructions_count: u16,
  680. /// The index of the the next instruction to be added
  681. pub instructions_next_index: u16,
  682. /// When the Proposal was created and entered Draft state
  683. pub draft_at: i64,
  684. /// When Signatories started signing off the Proposal
  685. pub signing_off_at: Option<i64>,
  686. /// When the Proposal began voting as UnixTimestamp
  687. pub voting_at: Option<i64>,
  688. /// When the Proposal began voting as Slot
  689. /// Note: The slot is not currently used but the exact slot is going to be required to support snapshot based vote weights
  690. pub voting_at_slot: Option<u64>,
  691. /// When the Proposal ended voting and entered either Succeeded or Defeated
  692. pub voting_completed_at: Option<i64>,
  693. /// When the Proposal entered Executing state
  694. pub executing_at: Option<i64>,
  695. /// When the Proposal entered final state Completed or Cancelled and was closed
  696. pub closed_at: Option<i64>,
  697. /// Instruction execution flag for ordered and transactional instructions
  698. /// Note: This field is not used in the current version
  699. pub execution_flags: InstructionExecutionFlags,
  700. /// The max vote weight for the Governing Token mint at the time Proposal was decided
  701. /// It's used to show correct vote results for historical proposals in cases when the mint supply or max weight source changed
  702. /// after vote was completed.
  703. pub max_vote_weight: Option<u64>,
  704. /// The vote threshold percentage at the time Proposal was decided
  705. /// It's used to show correct vote results for historical proposals in cases when the threshold
  706. /// was changed for governance config after vote was completed.
  707. pub vote_threshold: Option<VoteThreshold>,
  708. /// Proposal name
  709. pub name: String,
  710. /// Link to proposal's description
  711. pub description_link: String,
  712. }
  713. #[account]
  714. pub struct SignatoryRecordV1 {
  715. /// Governance account type
  716. pub account_type: GovernanceAccountType,
  717. /// Proposal the signatory is assigned for
  718. pub proposal: Pubkey,
  719. /// The account of the signatory who can sign off the proposal
  720. pub signatory: Pubkey,
  721. /// Indicates whether the signatory signed off the proposal
  722. pub signed_off: bool,
  723. }
  724. #[account]
  725. pub struct VoteRecordV1 {
  726. /// Governance account type
  727. pub account_type: GovernanceAccountType,
  728. /// Proposal account
  729. pub proposal: Pubkey,
  730. /// The user who casted this vote
  731. /// This is the Governing Token Owner who deposited governing tokens into the Realm
  732. pub governing_token_owner: Pubkey,
  733. /// Indicates whether the vote was relinquished by voter
  734. pub is_relinquished: bool,
  735. /// Voter's vote: Yes/No and amount
  736. pub vote_weight: VoteWeightV1,
  737. }
  738. #[account]
  739. pub struct GovernanceV2 {
  740. /// Account type. It can be Uninitialized, Governance, ProgramGovernance, TokenGovernance or MintGovernance
  741. pub account_type: GovernanceAccountType,
  742. /// Governance Realm
  743. pub realm: Pubkey,
  744. /// Account governed by this Governance and/or PDA identity seed
  745. /// It can be Program account, Mint account, Token account or any other account
  746. ///
  747. /// Note: The account doesn't have to exist. In that case the field is only a PDA seed
  748. ///
  749. /// Note: Setting governed_account doesn't give any authority over the governed account
  750. /// The relevant authorities for specific account types must still be transferred to the Governance PDA
  751. /// Ex: mint_authority/freeze_authority for a Mint account
  752. /// or upgrade_authority for a Program account should be transferred to the Governance PDA
  753. pub governed_account: Pubkey,
  754. /// Running count of proposals
  755. pub proposals_count: u32,
  756. /// Governance config
  757. pub config: GovernanceConfig,
  758. /// Reserved space for future versions
  759. pub reserved: [u8; 6],
  760. /// The number of proposals in voting state in the Governance
  761. pub voting_proposal_count: u16,
  762. /// Reserved space for versions v2 and onwards
  763. /// Note: This space won't be available to v1 accounts until runtime supports resizing
  764. pub reserved_v2: [u8; 128],
  765. }
  766. #[account]
  767. pub struct VoteRecordV2 {
  768. /// Governance account type
  769. pub account_type: GovernanceAccountType,
  770. /// Proposal account
  771. pub proposal: Pubkey,
  772. /// The user who casted this vote
  773. /// This is the Governing Token Owner who deposited governing tokens into the Realm
  774. pub governing_token_owner: Pubkey,
  775. /// Indicates whether the vote was relinquished by voter
  776. pub is_relinquished: bool,
  777. /// The weight of the user casting the vote
  778. pub voter_weight: u64,
  779. /// Voter's vote
  780. pub vote: Vote,
  781. /// Reserved space for versions v2 and onwards
  782. /// Note: This space won't be available to v1 accounts until runtime supports resizing
  783. pub reserved_v2: [u8; 8],
  784. }
  785. #[account]
  786. pub struct TokenOwnerRecordV2 {
  787. /// Governance account type
  788. pub account_type: GovernanceAccountType,
  789. /// The Realm the TokenOwnerRecord belongs to
  790. pub realm: Pubkey,
  791. /// Governing Token Mint the TokenOwnerRecord holds deposit for
  792. pub governing_token_mint: Pubkey,
  793. /// The owner (either single or multisig) of the deposited governing SPL Tokens
  794. /// This is who can authorize a withdrawal of the tokens
  795. pub governing_token_owner: Pubkey,
  796. /// The amount of governing tokens deposited into the Realm
  797. /// This amount is the voter weight used when voting on proposals
  798. pub governing_token_deposit_amount: u64,
  799. /// The number of votes cast by TokenOwner but not relinquished yet
  800. /// Every time a vote is cast this number is increased and it's always decreased when relinquishing a vote regardless of the vote state
  801. pub unrelinquished_votes_count: u32,
  802. /// The total number of votes cast by the TokenOwner
  803. /// If TokenOwner withdraws vote while voting is still in progress total_votes_count is decreased and the vote doesn't count towards the total
  804. pub total_votes_count: u32,
  805. /// The number of outstanding proposals the TokenOwner currently owns
  806. /// The count is increased when TokenOwner creates a proposal
  807. /// and decreased once it's either voted on (Succeeded or Defeated) or Cancelled
  808. /// By default it's restricted to 1 outstanding Proposal per token owner
  809. pub outstanding_proposal_count: u8,
  810. /// Reserved space for future versions
  811. pub reserved: [u8; 7],
  812. /// A single account that is allowed to operate governance with the deposited governing tokens
  813. /// It can be delegated to by the governing_token_owner or current governance_delegate
  814. pub governance_delegate: Option<Pubkey>,
  815. /// Reserved space for versions v2 and onwards
  816. /// Note: This space won't be available to v1 accounts until runtime supports resizing
  817. pub reserved_v2: [u8; 128],
  818. }
  819. #[account]
  820. pub struct RealmConfigAccount {
  821. /// Governance account type
  822. pub account_type: GovernanceAccountType,
  823. /// The realm the config belong to
  824. pub realm: Pubkey,
  825. /// Addin providing voter weights for community token
  826. pub community_voter_weight_addin: Option<Pubkey>,
  827. /// Addin providing max vote weight for community token
  828. /// Note: This field is not implemented in the current version
  829. pub max_community_voter_weight_addin: Option<Pubkey>,
  830. /// Addin providing voter weights for council token
  831. /// Note: This field is not implemented in the current version
  832. pub council_voter_weight_addin: Option<Pubkey>,
  833. /// Addin providing max vote weight for council token
  834. /// Note: This field is not implemented in the current version
  835. pub council_max_vote_weight_addin: Option<Pubkey>,
  836. /// Reserved
  837. pub reserved: [u8; 128],
  838. }
  839. #[account]
  840. pub struct ProposalTransactionV2 {
  841. /// Governance Account type
  842. pub account_type: GovernanceAccountType,
  843. /// The Proposal the instruction belongs to
  844. pub proposal: Pubkey,
  845. /// The option index the instruction belongs to
  846. pub option_index: u8,
  847. /// Unique transaction index within it's parent Proposal
  848. pub transaction_index: u16,
  849. /// Minimum waiting time in seconds for the instruction to be executed once proposal is voted on
  850. pub hold_up_time: u32,
  851. /// Instructions to execute
  852. /// The instructions will be signed by Governance PDA the Proposal belongs to
  853. // For example for ProgramGovernance the instruction to upgrade program will be signed by ProgramGovernance PDA
  854. // All instructions will be executed within a single transaction
  855. pub instructions: Vec<InstructionData>,
  856. /// Executed at flag
  857. pub executed_at: Option<i64>,
  858. /// Instruction execution status
  859. pub execution_status: TransactionExecutionStatus,
  860. /// Reserved space for versions v2 and onwards
  861. /// Note: This space won't be available to v1 accounts until runtime supports resizing
  862. pub reserved_v2: [u8; 8],
  863. }
  864. #[derive(AnchorSerialize, AnchorDeserialize)]
  865. pub struct NativeTreasury {}
  866. #[derive(AnchorSerialize, AnchorDeserialize)]
  867. pub enum MintMaxVoteWeightSource {
  868. /// Fraction (10^10 precision) of the governing mint supply is used as max vote weight
  869. /// The default is 100% (10^10) to use all available mint supply for voting
  870. SupplyFraction(u64),
  871. /// Absolute value, irrelevant of the actual mint supply, is used as max vote weight
  872. /// Note: this option is not implemented in the current version
  873. Absolute(u64),
  874. }
  875. #[derive(AnchorSerialize, AnchorDeserialize)]
  876. pub struct RealmConfigArgs {
  877. /// Indicates whether council_mint should be used
  878. /// If yes then council_mint account must also be passed to the instruction
  879. pub use_council_mint: bool,
  880. /// Min number of community tokens required to create a governance
  881. pub min_community_weight_to_create_governance: u64,
  882. /// The source used for community mint max vote weight source
  883. pub community_mint_max_vote_weight_source: MintMaxVoteWeightSource,
  884. /// Indicates whether an external addin program should be used to provide community voters weights
  885. /// If yes then the voters weight program account must be passed to the instruction
  886. pub use_community_voter_weight_addin: bool,
  887. /// Indicates whether an external addin program should be used to provide max voters weight for the community mint
  888. /// If yes then the max voter weight program account must be passed to the instruction
  889. pub use_max_community_voter_weight_addin: bool,
  890. }
  891. #[derive(AnchorSerialize, AnchorDeserialize)]
  892. pub struct RealmConfig {
  893. /// Indicates whether an external addin program should be used to provide voters weights for the community mint
  894. pub use_community_voter_weight_addin: bool,
  895. /// Indicates whether an external addin program should be used to provide max voter weight for the community mint
  896. pub use_max_community_voter_weight_addin: bool,
  897. /// Reserved space for future versions
  898. pub reserved: [u8; 6],
  899. /// Min number of voter's community weight required to create a governance
  900. pub min_community_weight_to_create_governance: u64,
  901. /// The source used for community mint max vote weight source
  902. pub community_mint_max_vote_weight_source: MintMaxVoteWeightSource,
  903. /// Optional council mint
  904. pub council_mint: Option<Pubkey>,
  905. }
  906. #[derive(AnchorSerialize, AnchorDeserialize)]
  907. pub enum GovernanceAccountType {
  908. /// Default uninitialized account state
  909. Uninitialized,
  910. /// Top level aggregation for governances with Community Token (and optional Council Token)
  911. RealmV1,
  912. /// Token Owner Record for given governing token owner within a Realm
  913. TokenOwnerRecordV1,
  914. /// Governance account
  915. GovernanceV1,
  916. /// Program Governance account
  917. ProgramGovernanceV1,
  918. /// Proposal account for Governance account. A single Governance account can have multiple Proposal accounts
  919. ProposalV1,
  920. /// Proposal Signatory account
  921. SignatoryRecordV1,
  922. /// Vote record account for a given Proposal. Proposal can have 0..n voting records
  923. VoteRecordV1,
  924. /// ProposalInstruction account which holds an instruction to execute for Proposal
  925. ProposalInstructionV1,
  926. /// Mint Governance account
  927. MintGovernanceV1,
  928. /// Token Governance account
  929. TokenGovernanceV1,
  930. /// Realm config account (introduced in V2)
  931. RealmConfig,
  932. /// Vote record account for a given Proposal. Proposal can have 0..n voting records
  933. /// V2 adds support for multi option votes
  934. VoteRecordV2,
  935. /// ProposalTransaction account which holds instructions to execute for Proposal within a single Transaction
  936. /// V2 replaces ProposalInstruction and adds index for proposal option and multiple instructions
  937. ProposalTransactionV2,
  938. /// Proposal account for Governance account. A single Governance account can have multiple Proposal accounts
  939. /// V2 adds support for multiple vote options
  940. ProposalV2,
  941. /// Program metadata account (introduced in V2)
  942. /// It stores information about the particular SPL-Governance program instance
  943. ProgramMetadata,
  944. /// Top level aggregation for governances with Community Token (and optional Council Token)
  945. /// V2 adds the following fields:
  946. /// 1) use_community_voter_weight_addin and use_max_community_voter_weight_addin to RealmConfig
  947. /// 2) voting_proposal_count
  948. /// 3) extra reserved space reserved_v2
  949. RealmV2,
  950. /// Token Owner Record for given governing token owner within a Realm
  951. /// V2 adds extra reserved space reserved_v2
  952. TokenOwnerRecordV2,
  953. /// Governance account
  954. /// V2 adds extra reserved space reserved_v2
  955. GovernanceV2,
  956. /// Program Governance account
  957. /// V2 adds extra reserved space reserved_v2
  958. ProgramGovernanceV2,
  959. /// Mint Governance account
  960. /// V2 adds extra reserved space reserved_v2
  961. MintGovernanceV2,
  962. /// Token Governance account
  963. /// V2 adds extra reserved space reserved_v2
  964. TokenGovernanceV2,
  965. /// Proposal Signatory account
  966. /// V2 adds extra reserved space reserved_v2
  967. SignatoryRecordV2,
  968. }
  969. #[derive(AnchorSerialize, AnchorDeserialize)]
  970. pub enum OptionVoteResult {
  971. /// Vote on the option is not resolved yet
  972. None,
  973. /// Vote on the option is completed and the option passed
  974. Succeeded,
  975. /// Vote on the option is completed and the option was defeated
  976. Defeated,
  977. }
  978. #[derive(AnchorSerialize, AnchorDeserialize)]
  979. pub struct ProposalOption {
  980. /// Option label
  981. pub label: String,
  982. /// Vote weight for the option
  983. pub vote_weight: u64,
  984. /// Vote result for the option
  985. pub vote_result: OptionVoteResult,
  986. /// The number of the transactions already executed
  987. pub transactions_executed_count: u16,
  988. /// The number of transactions included in the option
  989. pub transactions_count: u16,
  990. /// The index of the the next transaction to be added
  991. pub transactions_next_index: u16,
  992. }
  993. #[derive(AnchorSerialize, AnchorDeserialize)]
  994. pub enum ProposalState {
  995. /// Draft - Proposal enters Draft state when it's created
  996. Draft,
  997. /// SigningOff - The Proposal is being signed off by Signatories
  998. /// Proposal enters the state when first Signatory Sings and leaves it when last Signatory signs
  999. SigningOff,
  1000. /// Taking votes
  1001. Voting,
  1002. /// Voting ended with success
  1003. Succeeded,
  1004. /// Voting on Proposal succeeded and now instructions are being executed
  1005. /// Proposal enter this state when first instruction is executed and leaves when the last instruction is executed
  1006. Executing,
  1007. /// Completed
  1008. Completed,
  1009. /// Cancelled
  1010. Cancelled,
  1011. /// Defeated
  1012. Defeated,
  1013. /// Same as Executing but indicates some instructions failed to execute
  1014. /// Proposal can't be transitioned from ExecutingWithErrors to Completed state
  1015. ExecutingWithErrors,
  1016. /// The Proposal was vetoed
  1017. Vetoed,
  1018. }
  1019. #[derive(AnchorSerialize, AnchorDeserialize)]
  1020. pub enum VoteType {
  1021. /// Single choice vote with mutually exclusive choices
  1022. /// In the SingeChoice mode there can ever be a single winner
  1023. /// If multiple options score the same highest vote then the Proposal is not resolved and considered as Failed
  1024. /// Note: Yes/No vote is a single choice (Yes) vote with the deny option (No)
  1025. SingleChoice,
  1026. /// Multiple options can be selected with up to max_voter_options per voter
  1027. /// and with up to max_winning_options of successful options
  1028. /// Ex. voters are given 5 options, can choose up to 3 (max_voter_options)
  1029. /// and only 1 (max_winning_options) option can win and be executed
  1030. MultiChoice {
  1031. /// The max number of options a voter can choose
  1032. /// By default it equals to the number of available options
  1033. /// Note: In the current version the limit is not supported and not enforced yet
  1034. #[allow(dead_code)]
  1035. max_voter_options: u8,
  1036. /// The max number of wining options
  1037. /// For executable proposals it limits how many options can be executed for a Proposal
  1038. /// By default it equals to the number of available options
  1039. /// Note: In the current version the limit is not supported and not enforced yet
  1040. #[allow(dead_code)]
  1041. max_winning_options: u8,
  1042. },
  1043. }
  1044. #[derive(AnchorSerialize, AnchorDeserialize)]
  1045. pub enum InstructionExecutionFlags {
  1046. /// No execution flags are specified
  1047. /// Instructions can be executed individually, in any order, as soon as they hold_up time expires
  1048. None,
  1049. /// Instructions are executed in a specific order
  1050. /// Note: Ordered execution is not supported in the current version
  1051. /// The implementation requires another account type to track deleted instructions
  1052. Ordered,
  1053. /// Multiple instructions can be executed as a single transaction
  1054. /// Note: Transactions are not supported in the current version
  1055. /// The implementation requires another account type to group instructions within a transaction
  1056. UseTransaction,
  1057. }
  1058. #[derive(AnchorSerialize, AnchorDeserialize)]
  1059. pub enum VoteThreshold {
  1060. /// Voting threshold of Yes votes in % required to tip the vote (Approval Quorum)
  1061. /// It's the percentage of tokens out of the entire pool of governance tokens eligible to vote
  1062. /// Note: If the threshold is below or equal to 50% then an even split of votes ex: 50:50 or 40:40 is always resolved as Defeated
  1063. /// In other words a '+1 vote' tie breaker is always required to have a successful vote
  1064. YesVotePercentage(u8),
  1065. /// The minimum number of votes in % out of the entire pool of governance tokens eligible to vote
  1066. /// which must be cast for the vote to be valid
  1067. /// Once the quorum is achieved a simple majority (50%+1) of Yes votes is required for the vote to succeed
  1068. /// Note: Quorum is not implemented in the current version
  1069. QuorumPercentage(u8),
  1070. /// Disabled vote threshold indicates the given voting population (community or council) is not allowed to vote
  1071. /// on proposals for the given Governance
  1072. Disabled,
  1073. //
  1074. // Absolute vote threshold expressed in the voting mint units
  1075. // It can be implemented once Solana runtime supports accounts resizing to accommodate u64 size extension
  1076. // Alternatively we could use the reserved space if it becomes a priority
  1077. // Absolute(u64)
  1078. //
  1079. // Vote threshold which is always accepted
  1080. // It can be used in a setup where the only security gate is proposal creation
  1081. // and once created it's automatically approved
  1082. // Any
  1083. }
  1084. #[derive(AnchorSerialize, AnchorDeserialize)]
  1085. pub enum VoteTipping {
  1086. /// Tip when there is no way for another option to win and the vote threshold
  1087. /// has been reached. This ignores voters withdrawing their votes.
  1088. ///
  1089. /// Currently only supported for the "yes" option in single choice votes.
  1090. Strict,
  1091. /// Tip when an option reaches the vote threshold and has more vote weight
  1092. /// than any other options.
  1093. ///
  1094. /// Currently only supported for the "yes" option in single choice votes.
  1095. Early,
  1096. /// Never tip the vote early.
  1097. Disabled,
  1098. }
  1099. #[derive(AnchorSerialize, AnchorDeserialize)]
  1100. pub struct GovernanceConfig {
  1101. /// The type of the vote threshold used for community vote
  1102. /// Note: In the current version only YesVotePercentage and Disabled thresholds are supported
  1103. pub community_vote_threshold: VoteThreshold,
  1104. /// Minimum community weight a governance token owner must possess to be able to create a proposal
  1105. pub min_community_weight_to_create_proposal: u64,
  1106. /// Minimum waiting time in seconds for a transaction to be executed after proposal is voted on
  1107. pub min_transaction_hold_up_time: u32,
  1108. /// Time limit in seconds for proposal to be open for voting
  1109. pub max_voting_time: u32,
  1110. /// Conditions under which a vote will complete early
  1111. pub vote_tipping: VoteTipping,
  1112. /// The type of the vote threshold used for council vote
  1113. /// Note: In the current version only YesVotePercentage and Disabled thresholds are supported
  1114. pub council_vote_threshold: VoteThreshold,
  1115. /// The threshold for Council Veto votes
  1116. pub council_veto_vote_threshold: VoteThreshold,
  1117. /// Minimum council weight a governance token owner must possess to be able to create a proposal
  1118. pub min_council_weight_to_create_proposal: u64,
  1119. //
  1120. // The threshold for Community Veto votes
  1121. // Note: Community Veto vote is not supported in the current version
  1122. // In order to use this threshold the space from GovernanceV2.reserved must be taken to expand GovernanceConfig size
  1123. // pub community_veto_vote_threshold: VoteThreshold,
  1124. }
  1125. #[derive(AnchorSerialize, AnchorDeserialize)]
  1126. pub struct AccountMetaData {
  1127. /// An account's public key
  1128. pub pubkey: Pubkey,
  1129. /// True if an Instruction requires a Transaction signature matching `pubkey`.
  1130. pub is_signer: bool,
  1131. /// True if the `pubkey` can be loaded as a read-write account.
  1132. pub is_writable: bool,
  1133. }
  1134. #[derive(AnchorSerialize, AnchorDeserialize)]
  1135. pub struct InstructionData {
  1136. /// Pubkey of the instruction processor that executes this instruction
  1137. pub program_id: Pubkey,
  1138. /// Metadata for what accounts should be passed to the instruction processor
  1139. pub accounts: Vec<AccountMetaData>,
  1140. /// Opaque data passed to the instruction processor
  1141. pub data: Vec<u8>,
  1142. }
  1143. #[derive(AnchorSerialize, AnchorDeserialize)]
  1144. pub enum TransactionExecutionStatus {
  1145. /// Transaction was not executed yet
  1146. None,
  1147. /// Transaction was executed successfully
  1148. Success,
  1149. /// Transaction execution failed
  1150. Error,
  1151. }
  1152. #[derive(AnchorSerialize, AnchorDeserialize)]
  1153. pub struct ProposalInstructionV1 {
  1154. /// Governance Account type
  1155. pub account_type: GovernanceAccountType,
  1156. /// The Proposal the instruction belongs to
  1157. pub proposal: Pubkey,
  1158. /// Unique instruction index within it's parent Proposal
  1159. pub instruction_index: u16,
  1160. /// Minimum waiting time in seconds for the instruction to be executed once proposal is voted on
  1161. pub hold_up_time: u32,
  1162. /// Instruction to execute
  1163. /// The instruction will be signed by Governance PDA the Proposal belongs to
  1164. // For example for ProgramGovernance the instruction to upgrade program will be signed by ProgramGovernance PDA
  1165. pub instruction: InstructionData,
  1166. /// Executed at flag
  1167. pub executed_at: Option<i64>,
  1168. /// Instruction execution status
  1169. pub execution_status: TransactionExecutionStatus,
  1170. }
  1171. #[derive(AnchorSerialize, AnchorDeserialize)]
  1172. pub enum VoteWeightV1 {
  1173. /// Yes vote
  1174. Yes(u64),
  1175. /// No vote
  1176. No(u64),
  1177. }
  1178. #[derive(AnchorSerialize, AnchorDeserialize)]
  1179. pub struct VoteChoice {
  1180. /// The rank given to the choice by voter
  1181. /// Note: The filed is not used in the current version
  1182. pub rank: u8,
  1183. /// The voter's weight percentage given by the voter to the choice
  1184. pub weight_percentage: u8,
  1185. }
  1186. #[derive(AnchorSerialize, AnchorDeserialize)]
  1187. pub enum Vote {
  1188. /// Vote approving choices
  1189. Approve(Vec<VoteChoice>),
  1190. /// Vote rejecting proposal
  1191. Deny,
  1192. /// Declare indifference to proposal
  1193. /// Note: Not supported in the current version
  1194. Abstain,
  1195. /// Veto proposal
  1196. Veto,
  1197. }
  1198. #[derive(AnchorSerialize, AnchorDeserialize)]
  1199. pub enum SetRealmAuthorityAction {
  1200. /// Sets realm authority without any checks
  1201. /// Uncheck option allows to set the realm authority to non governance accounts
  1202. SetUnchecked,
  1203. /// Sets realm authority and checks the new new authority is one of the realm's governances
  1204. // Note: This is not a security feature because governance creation is only gated with min_community_weight_to_create_governance
  1205. // The check is done to prevent scenarios where the authority could be accidentally set to a wrong or none existing account
  1206. SetChecked,
  1207. /// Removes realm authority
  1208. Remove,
  1209. }
  1210. #[error_code]
  1211. pub enum GovernanceError {
  1212. /// Invalid instruction passed to program
  1213. #[msg("Invalid instruction passed to program")]
  1214. InvalidInstruction = 500, // Start Governance custom errors from 500 to avoid conflicts with programs invoked via CPI
  1215. /// Realm with the given name and governing mints already exists
  1216. #[msg("Realm with the given name and governing mints already exists")]
  1217. RealmAlreadyExists,
  1218. /// Invalid Realm
  1219. #[msg("Invalid realm")]
  1220. InvalidRealm,
  1221. /// Invalid Governing Token Mint
  1222. #[msg("Invalid Governing Token Mint")]
  1223. InvalidGoverningTokenMint, // 503
  1224. /// Governing Token Owner must sign transaction
  1225. #[msg("Governing Token Owner must sign transaction")]
  1226. GoverningTokenOwnerMustSign,
  1227. /// Governing Token Owner or Delegate must sign transaction
  1228. #[msg("Governing Token Owner or Delegate must sign transaction")]
  1229. GoverningTokenOwnerOrDelegateMustSign, // 505
  1230. /// All votes must be relinquished to withdraw governing tokens
  1231. #[msg("All votes must be relinquished to withdraw governing tokens")]
  1232. AllVotesMustBeRelinquishedToWithdrawGoverningTokens,
  1233. /// Invalid Token Owner Record account address
  1234. #[msg("Invalid Token Owner Record account address")]
  1235. InvalidTokenOwnerRecordAccountAddress,
  1236. /// Invalid GoverningMint for TokenOwnerRecord
  1237. #[msg("Invalid GoverningMint for TokenOwnerRecord")]
  1238. InvalidGoverningMintForTokenOwnerRecord, // 508
  1239. /// Invalid Realm for TokenOwnerRecord
  1240. #[msg("Invalid Realm for TokenOwnerRecord")]
  1241. InvalidRealmForTokenOwnerRecord, // 509
  1242. /// Invalid Proposal for ProposalTransaction,
  1243. #[msg("Invalid Proposal for ProposalTransaction,")]
  1244. InvalidProposalForProposalTransaction, // 510
  1245. /// Invalid Signatory account address
  1246. #[msg("Invalid Signatory account address")]
  1247. InvalidSignatoryAddress, // 511
  1248. /// Signatory already signed off
  1249. #[msg("Signatory already signed off")]
  1250. SignatoryAlreadySignedOff, // 512
  1251. /// Signatory must sign
  1252. #[msg("Signatory must sign")]
  1253. SignatoryMustSign, // 513
  1254. /// Invalid Proposal Owner
  1255. #[msg("Invalid Proposal Owner")]
  1256. InvalidProposalOwnerAccount, // 514
  1257. /// Invalid Proposal for VoterRecord
  1258. #[msg("Invalid Proposal for VoterRecord")]
  1259. InvalidProposalForVoterRecord, // 515
  1260. /// Invalid GoverningTokenOwner for VoteRecord
  1261. #[msg("Invalid GoverningTokenOwner for VoteRecord")]
  1262. InvalidGoverningTokenOwnerForVoteRecord, // 516
  1263. /// Invalid Governance config: Vote threshold percentage out of range"
  1264. #[msg("Invalid Governance config: Vote threshold percentage out of range")]
  1265. InvalidVoteThresholdPercentage, // 517
  1266. /// Proposal for the given Governance, Governing Token Mint and index already exists
  1267. #[msg("Proposal for the given Governance, Governing Token Mint and index already exists")]
  1268. ProposalAlreadyExists, // 518
  1269. /// Token Owner already voted on the Proposal
  1270. #[msg("Token Owner already voted on the Proposal")]
  1271. VoteAlreadyExists, // 519
  1272. /// Owner doesn't have enough governing tokens to create Proposal
  1273. #[msg("Owner doesn't have enough governing tokens to create Proposal")]
  1274. NotEnoughTokensToCreateProposal, // 520
  1275. /// Invalid State: Can't edit Signatories
  1276. #[msg("Invalid State: Can't edit Signatories")]
  1277. InvalidStateCannotEditSignatories, // 521
  1278. /// Invalid Proposal state
  1279. #[msg("Invalid Proposal state")]
  1280. InvalidProposalState, // 522
  1281. /// Invalid State: Can't edit transactions
  1282. #[msg("Invalid State: Can't edit transactions")]
  1283. InvalidStateCannotEditTransactions, // 523
  1284. /// Invalid State: Can't execute transaction
  1285. #[msg("Invalid State: Can't execute transaction")]
  1286. InvalidStateCannotExecuteTransaction, // 524
  1287. /// Can't execute transaction within its hold up time
  1288. #[msg("Can't execute transaction within its hold up time")]
  1289. CannotExecuteTransactionWithinHoldUpTime, // 525
  1290. /// Transaction already executed
  1291. #[msg("Transaction already executed")]
  1292. TransactionAlreadyExecuted, // 526
  1293. /// Invalid Transaction index
  1294. #[msg("Invalid Transaction index")]
  1295. InvalidTransactionIndex, // 527
  1296. /// Transaction hold up time is below the min specified by Governance
  1297. #[msg("Transaction hold up time is below the min specified by Governance")]
  1298. TransactionHoldUpTimeBelowRequiredMin, // 528
  1299. /// Transaction at the given index for the Proposal already exists
  1300. #[msg("Transaction at the given index for the Proposal already exists")]
  1301. TransactionAlreadyExists, // 529
  1302. /// Invalid State: Can't sign off
  1303. #[msg("Invalid State: Can't sign off")]
  1304. InvalidStateCannotSignOff, // 530
  1305. /// Invalid State: Can't vote
  1306. #[msg("Invalid State: Can't vote")]
  1307. InvalidStateCannotVote,
  1308. /// Invalid State: Can't finalize vote
  1309. #[msg("Invalid State: Can't finalize vote")]
  1310. InvalidStateCannotFinalize,
  1311. /// Invalid State: Can't cancel Proposal
  1312. #[msg("Invalid State: Can't cancel Proposal")]
  1313. InvalidStateCannotCancelProposal,
  1314. /// Vote already relinquished
  1315. #[msg("Vote already relinquished")]
  1316. VoteAlreadyRelinquished,
  1317. /// Can't finalize vote. Voting still in progress
  1318. #[msg("Can't finalize vote. Voting still in progress")]
  1319. CannotFinalizeVotingInProgress,
  1320. /// Proposal voting time expired
  1321. #[msg("Proposal voting time expired")]
  1322. ProposalVotingTimeExpired,
  1323. /// Invalid Signatory Mint
  1324. #[msg("Invalid Signatory Mint")]
  1325. InvalidSignatoryMint,
  1326. /// Proposal does not belong to the given Governance
  1327. #[msg("Proposal does not belong to the given Governance")]
  1328. InvalidGovernanceForProposal, // 538
  1329. /// Proposal does not belong to given Governing Mint"
  1330. #[msg("Proposal does not belong to given Governing Mint")]
  1331. InvalidGoverningMintForProposal, // 539
  1332. /// Current mint authority must sign transaction
  1333. #[msg("Current mint authority must sign transaction")]
  1334. MintAuthorityMustSign, // 540
  1335. /// Invalid mint authority
  1336. #[msg("Invalid mint authority")]
  1337. InvalidMintAuthority, // 542
  1338. /// Mint has no authority
  1339. #[msg("Mint has no authority")]
  1340. MintHasNoAuthority, // 542
  1341. /// ---- SPL Token Tools Errors ----
  1342. /// Invalid Token account owner
  1343. #[msg("Invalid Token account owner")]
  1344. SplTokenAccountWithInvalidOwner, // 543
  1345. /// Invalid Mint account owner
  1346. #[msg("Invalid Mint account owner")]
  1347. SplTokenMintWithInvalidOwner, // 544
  1348. /// Token Account is not initialized
  1349. #[msg("Token Account is not initialized")]
  1350. SplTokenAccountNotInitialized, // 545
  1351. /// Token Account doesn't exist
  1352. #[msg("Token Account doesn't exist")]
  1353. SplTokenAccountDoesNotExist, // 546
  1354. /// Token account data is invalid
  1355. #[msg("Token account data is invalid")]
  1356. SplTokenInvalidTokenAccountData, // 547
  1357. /// Token mint account data is invalid
  1358. #[msg("Token mint account data is invalid")]
  1359. SplTokenInvalidMintAccountData, // 548
  1360. /// Token Mint is not initialized
  1361. #[msg("Token Mint account is not initialized")]
  1362. SplTokenMintNotInitialized, // 549
  1363. /// Token Mint account doesn't exist
  1364. #[msg("Token Mint account doesn't exist")]
  1365. SplTokenMintDoesNotExist, // 550
  1366. /// ---- Bpf Upgradable Loader Tools Errors ----
  1367. /// Invalid ProgramData account Address
  1368. #[msg("Invalid ProgramData account address")]
  1369. InvalidProgramDataAccountAddress, // 551
  1370. /// Invalid ProgramData account data
  1371. #[msg("Invalid ProgramData account Data")]
  1372. InvalidProgramDataAccountData, // 552
  1373. /// Provided upgrade authority doesn't match current program upgrade authority
  1374. #[msg("Provided upgrade authority doesn't match current program upgrade authority")]
  1375. InvalidUpgradeAuthority, // 553
  1376. /// Current program upgrade authority must sign transaction
  1377. #[msg("Current program upgrade authority must sign transaction")]
  1378. UpgradeAuthorityMustSign, // 554
  1379. /// Given program is not upgradable
  1380. #[msg("Given program is not upgradable")]
  1381. ProgramNotUpgradable, // 555
  1382. /// Invalid token owner
  1383. #[msg("Invalid token owner")]
  1384. InvalidTokenOwner, // 556
  1385. /// Current token owner must sign transaction
  1386. #[msg("Current token owner must sign transaction")]
  1387. TokenOwnerMustSign, // 557
  1388. /// Given VoteThresholdType is not supported
  1389. #[msg("Given VoteThresholdType is not supported")]
  1390. VoteThresholdTypeNotSupported, // 558
  1391. /// Given VoteWeightSource is not supported
  1392. #[msg("Given VoteWeightSource is not supported")]
  1393. VoteWeightSourceNotSupported, // 559
  1394. /// GoverningTokenMint not allowed to vote
  1395. #[msg("GoverningTokenMint not allowed to vote")]
  1396. GoverningTokenMintNotAllowedToVote, // 560
  1397. /// Governance PDA must sign
  1398. #[msg("Governance PDA must sign")]
  1399. GovernancePdaMustSign,
  1400. /// Transaction already flagged with error
  1401. #[msg("Transaction already flagged with error")]
  1402. TransactionAlreadyFlaggedWithError,
  1403. /// Invalid Realm for Governance
  1404. #[msg("Invalid Realm for Governance")]
  1405. InvalidRealmForGovernance,
  1406. /// Invalid Authority for Realm
  1407. #[msg("Invalid Authority for Realm")]
  1408. InvalidAuthorityForRealm,
  1409. /// Realm has no authority
  1410. #[msg("Realm has no authority")]
  1411. RealmHasNoAuthority,
  1412. /// Realm authority must sign
  1413. #[msg("Realm authority must sign")]
  1414. RealmAuthorityMustSign, // 566
  1415. /// Invalid governing token holding account
  1416. #[msg("Invalid governing token holding account")]
  1417. InvalidGoverningTokenHoldingAccount,
  1418. /// Realm council mint change is not supported
  1419. #[msg("Realm council mint change is not supported")]
  1420. RealmCouncilMintChangeIsNotSupported,
  1421. /// Not supported mint max vote weight sourcef
  1422. #[msg("Not supported mint max vote weight source")]
  1423. MintMaxVoteWeightSourceNotSupported,
  1424. /// Invalid max vote weight supply fraction
  1425. #[msg("Invalid max vote weight supply fraction")]
  1426. InvalidMaxVoteWeightSupplyFraction,
  1427. /// Owner doesn't have enough governing tokens to create Governance
  1428. #[msg("Owner doesn't have enough governing tokens to create Governance")]
  1429. NotEnoughTokensToCreateGovernance,
  1430. /// Too many outstanding proposals
  1431. #[msg("Too many outstanding proposals")]
  1432. TooManyOutstandingProposals,
  1433. /// All proposals must be finalized to withdraw governing tokens
  1434. #[msg("All proposals must be finalized to withdraw governing tokens")]
  1435. AllProposalsMustBeFinalisedToWithdrawGoverningTokens,
  1436. /// Invalid VoterWeightRecord for Realm
  1437. #[msg("Invalid VoterWeightRecord for Realm")]
  1438. InvalidVoterWeightRecordForRealm,
  1439. /// Invalid VoterWeightRecord for GoverningTokenMint
  1440. #[msg("Invalid VoterWeightRecord for GoverningTokenMint")]
  1441. InvalidVoterWeightRecordForGoverningTokenMint,
  1442. /// Invalid VoterWeightRecord for TokenOwner
  1443. #[msg("Invalid VoterWeightRecord for TokenOwner")]
  1444. InvalidVoterWeightRecordForTokenOwner,
  1445. /// VoterWeightRecord expired
  1446. #[msg("VoterWeightRecord expired")]
  1447. VoterWeightRecordExpired,
  1448. /// Invalid RealmConfig for Realm
  1449. #[msg("Invalid RealmConfig for Realm")]
  1450. InvalidRealmConfigForRealm,
  1451. /// TokenOwnerRecord already exists
  1452. #[msg("TokenOwnerRecord already exists")]
  1453. TokenOwnerRecordAlreadyExists,
  1454. /// Governing token deposits not allowed
  1455. #[msg("Governing token deposits not allowed")]
  1456. GoverningTokenDepositsNotAllowed,
  1457. /// Invalid vote choice weight percentage
  1458. #[msg("Invalid vote choice weight percentage")]
  1459. InvalidVoteChoiceWeightPercentage,
  1460. /// Vote type not supported
  1461. #[msg("Vote type not supported")]
  1462. VoteTypeNotSupported,
  1463. /// InvalidProposalOptions
  1464. #[msg("Invalid proposal options")]
  1465. InvalidProposalOptions,
  1466. /// Proposal is not not executable
  1467. #[msg("Proposal is not not executable")]
  1468. ProposalIsNotExecutable,
  1469. /// Invalid vote
  1470. #[msg("Invalid vote")]
  1471. InvalidVote,
  1472. /// Cannot execute defeated option
  1473. #[msg("Cannot execute defeated option")]
  1474. CannotExecuteDefeatedOption,
  1475. /// VoterWeightRecord invalid action
  1476. #[msg("VoterWeightRecord invalid action")]
  1477. VoterWeightRecordInvalidAction,
  1478. /// VoterWeightRecord invalid action target
  1479. #[msg("VoterWeightRecord invalid action target")]
  1480. VoterWeightRecordInvalidActionTarget,
  1481. /// Invalid MaxVoterWeightRecord for Realm
  1482. #[msg("Invalid MaxVoterWeightRecord for Realm")]
  1483. InvalidMaxVoterWeightRecordForRealm,
  1484. /// Invalid MaxVoterWeightRecord for GoverningTokenMint
  1485. #[msg("Invalid MaxVoterWeightRecord for GoverningTokenMint")]
  1486. InvalidMaxVoterWeightRecordForGoverningTokenMint,
  1487. /// MaxVoterWeightRecord expired
  1488. #[msg("MaxVoterWeightRecord expired")]
  1489. MaxVoterWeightRecordExpired,
  1490. /// Not supported VoteType
  1491. #[msg("Not supported VoteType")]
  1492. NotSupportedVoteType,
  1493. /// RealmConfig change not allowed
  1494. #[msg("RealmConfig change not allowed")]
  1495. RealmConfigChangeNotAllowed,
  1496. /// GovernanceConfig change not allowed
  1497. #[msg("GovernanceConfig change not allowed")]
  1498. GovernanceConfigChangeNotAllowed,
  1499. /// At least one VoteThreshold is required
  1500. #[msg("At least one VoteThreshold is required")]
  1501. AtLeastOneVoteThresholdRequired,
  1502. /// Reserved buffer must be empty
  1503. #[msg("Reserved buffer must be empty")]
  1504. ReservedBufferMustBeEmpty,
  1505. /// Cannot Relinquish in Finalizing state
  1506. #[msg("Cannot Relinquish in Finalizing state")]
  1507. CannotRelinquishInFinalizingState,
  1508. }