lib.rs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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_feature_proposal {
  6. use super::*;
  7. pub fn propose(
  8. ctx: Context<Propose>,
  9. tokens_to_mint: u64,
  10. acceptance_criteria: AcceptanceCriteria,
  11. ) -> Result<()> {
  12. Ok(())
  13. }
  14. pub fn tally(ctx: Context<Tally>) -> Result<()> {
  15. Ok(())
  16. }
  17. }
  18. #[derive(Accounts)]
  19. pub struct Propose<'info> {
  20. #[account(mut)]
  21. funding_address: Signer<'info>,
  22. #[account(mut)]
  23. feature_proposal_address: Signer<'info>,
  24. #[account(mut)]
  25. mint_address: AccountInfo<'info>,
  26. #[account(mut)]
  27. distributor_token_address: AccountInfo<'info>,
  28. #[account(mut)]
  29. acceptance_token_address: AccountInfo<'info>,
  30. #[account(mut)]
  31. feature: AccountInfo<'info>,
  32. system_program: Program<'info, System>,
  33. token_program: Program<'info, Token>,
  34. rent: Sysvar<'info, Rent>,
  35. }
  36. #[derive(Accounts)]
  37. pub struct Tally<'info> {
  38. #[account(mut)]
  39. feature_proposal_address: AccountInfo<'info>,
  40. acceptance_token_address: AccountInfo<'info>,
  41. #[account(mut)]
  42. feature: AccountInfo<'info>,
  43. system_program: Program<'info, System>,
  44. clock: Sysvar<'info, Clock>,
  45. }
  46. #[account]
  47. pub enum FeatureProposal {
  48. /// Default account state after creating it
  49. Uninitialized,
  50. /// Feature proposal is now pending
  51. Pending(AcceptanceCriteria),
  52. /// Feature proposal was accepted and the feature is now active
  53. Accepted {
  54. /// The balance of the feature proposal's token account at the time of activation.
  55. #[allow(dead_code)] // not dead code..
  56. tokens_upon_acceptance: u64,
  57. },
  58. /// Feature proposal was not accepted before the deadline
  59. Expired,
  60. }
  61. #[derive(AnchorSerialize, AnchorDeserialize)]
  62. pub struct AcceptanceCriteria {
  63. /// The balance of the feature proposal's token account must be greater than this amount, and
  64. /// tallied before the deadline for the feature to be accepted.
  65. pub tokens_required: u64,
  66. /// If the required tokens are not tallied by this deadline then the proposal will expire.
  67. pub deadline: i64,
  68. }