1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
pub mod attribution;
pub mod constants;
pub mod errors;
pub mod events;
pub mod listings;
pub mod metaplex_cpi;
pub mod offers;
pub mod pda;
pub mod reward_centers;
pub mod state;
pub mod withdraw;

use anchor_lang::prelude::*;

use crate::{
    attribution::attribute::*,
    listings::{buy::*, close::*, create::*, update::*},
    offers::{accept::*, close::*, create::*},
    reward_centers::{create::*, edit::*},
    withdraw::reward_center::*,
};

declare_id!("rwdD3F6CgoCAoVaxcitXAeWRjQdiGc5AVABKCpQSMfd");

#[program]
pub mod reward_center {
    use super::*;

    pub fn create_reward_center(
        ctx: Context<CreateRewardCenter>,
        create_reward_center_params: CreateRewardCenterParams,
    ) -> Result<()> {
        reward_centers::create::handler(ctx, create_reward_center_params)
    }

    pub fn edit_reward_center(
        ctx: Context<EditRewardCenter>,
        edit_reward_center_params: EditRewardCenterParams,
    ) -> Result<()> {
        reward_centers::edit::handler(ctx, edit_reward_center_params)
    }

    pub fn withdraw_reward_center_funds(
        ctx: Context<WithdrawRewardCenterFunds>,
        withdraw_reward_center_funds_params: WithdrawRewardCenterFundsParams,
    ) -> Result<()> {
        withdraw::reward_center::handler(ctx, withdraw_reward_center_funds_params)
    }

    pub fn create_listing<'info>(
        ctx: Context<'_, '_, '_, 'info, CreateListing<'info>>,
        create_listing_params: CreateListingParams,
    ) -> Result<()> {
        listings::create::handler(ctx, create_listing_params)
    }

    pub fn update_listing(
        ctx: Context<UpdateListing>,
        update_listing_params: UpdateListingParams,
    ) -> Result<()> {
        listings::update::handler(ctx, update_listing_params)
    }

    pub fn close_listing<'info>(
        ctx: Context<'_, '_, '_, 'info, CloseListing<'info>>,
    ) -> Result<()> {
        listings::close::handler(ctx)
    }

    pub fn create_offer(
        ctx: Context<CreateOffer>,
        create_offer_params: CreateOfferParams,
    ) -> Result<()> {
        offers::create::handler(ctx, create_offer_params)
    }

    pub fn close_offer(
        ctx: Context<CloseOffer>,
        close_offer_params: CloseOfferParams,
    ) -> Result<()> {
        offers::close::handler(ctx, close_offer_params)
    }

    pub fn buy_listing<'info>(
        ctx: Context<'_, '_, '_, 'info, BuyListing<'info>>,
        buy_listing_params: BuyListingParams,
    ) -> Result<()> {
        listings::buy::handler(ctx, buy_listing_params)
    }

    pub fn accept_offer<'info>(
        ctx: Context<'_, '_, '_, 'info, AcceptOffer<'info>>,
        accept_offer_params: AcceptOfferParams,
    ) -> Result<()> {
        offers::accept::handler(ctx, accept_offer_params)
    }

    pub fn attribute<'info>(
        ctx: Context<Attribute>,
        attribute_params: AttributeParams,
    ) -> Result<()> {
        attribution::attribute::handler(ctx, attribute_params)
    }
}