gpl_core/
lib.rs

1use anchor_lang::prelude::*;
2use solana_security_txt::security_txt;
3
4pub mod constants;
5pub mod errors;
6pub mod events;
7pub mod instructions;
8pub mod state;
9
10use instructions::*;
11
12declare_id!("CDDMdCAWB5AXgvEy7XJRggAu37QPG1b9aJXndZoPUkkm");
13
14#[cfg(not(feature = "no-entrypoint"))]
15security_txt! {
16    name: "gpl_core",
17    project_url: "https://gum.fun",
18    contacts: "email:hello@gum.fun,twitter:@gumisfunn",
19    policy: "",
20    preferred_languages: "en",
21    source_code: "https://github.com/gumhq/gpl"
22}
23
24#[program]
25pub mod gpl_core {
26
27    use super::*;
28
29    // Create a new user account
30    pub fn create_user(ctx: Context<CreateUser>, random_hash: [u8; 32]) -> Result<()> {
31        create_user_handler(ctx, random_hash)
32    }
33
34    // Update a user account with new authority
35    pub fn update_user(ctx: Context<UpdateUser>) -> Result<()> {
36        update_user_handler(ctx)
37    }
38
39    // Delete a user account
40    pub fn delete_user(ctx: Context<DeleteUser>) -> Result<()> {
41        delete_user_handler(ctx)
42    }
43
44    // Create a new profile account
45    pub fn create_profile(ctx: Context<CreateProfile>, namespace: String) -> Result<()> {
46        create_profile_handler(ctx, namespace)
47    }
48
49    // Delete a profile account
50    pub fn delete_profile(ctx: Context<DeleteProfile>) -> Result<()> {
51        delete_profile_handler(ctx)
52    }
53
54    // create a new profile_metadata account
55    pub fn create_profile_metadata(
56        ctx: Context<CreateProfileMetadata>,
57        metadata_uri: String,
58    ) -> Result<()> {
59        create_profile_metadata_handler(ctx, metadata_uri)
60    }
61
62    // update a profile_metadata
63    pub fn update_profile_metadata(
64        ctx: Context<UpdateProfileMetadata>,
65        metadata_uri: String,
66    ) -> Result<()> {
67        update_profile_metadata_handler(ctx, metadata_uri)
68    }
69
70    // delete a profile_metadata
71    pub fn delete_profile_metadata(ctx: Context<DeleteProfileMetadata>) -> Result<()> {
72        delete_profile_metadata_handler(ctx)
73    }
74
75    // create a new post account
76    pub fn create_post(
77        ctx: Context<CreatePost>,
78        metadata_uri: String,
79        random_hash: [u8; 32],
80    ) -> Result<()> {
81        create_post_handler(ctx, metadata_uri, random_hash)
82    }
83
84    // update a post
85    pub fn update_post(ctx: Context<UpdatePost>, metadata_uri: String) -> Result<()> {
86        update_post_handler(ctx, metadata_uri)
87    }
88
89    // create a comment
90    pub fn create_comment(
91        ctx: Context<CreateComment>,
92        metadata_uri: String,
93        random_hash: [u8; 32],
94    ) -> Result<()> {
95        create_comment_handler(ctx, metadata_uri, random_hash)
96    }
97
98    // delete a post
99    pub fn delete_post(ctx: Context<DeletePost>) -> Result<()> {
100        delete_post_handler(ctx)
101    }
102
103    // create a connection account
104    pub fn create_connection(ctx: Context<CreateConnection>) -> Result<()> {
105        create_connection_handler(ctx)
106    }
107
108    // delete a connection account
109    pub fn delete_connection(ctx: Context<DeleteConnection>) -> Result<()> {
110        delete_connection_handler(ctx)
111    }
112
113    // create a reaction account with reaction type
114    pub fn create_reaction(ctx: Context<CreateReaction>, reaction_type: String) -> Result<()> {
115        create_reaction_handler(ctx, reaction_type)
116    }
117
118    // delete a reaction account
119    pub fn delete_reaction(ctx: Context<DeleteReaction>) -> Result<()> {
120        delete_reaction_handler(ctx)
121    }
122}