Fees & Rev Share

Fees associated with utilizing Makoto and Rev share to holders

A 1% flat rate fee will be charged per snipe. Fees will be distributed proportionally to the following token holdings as seen below:

Fees distributed can be claimed once per month as defined here:

use anchor_lang::prelude::*;
use anchor_lang::solana_program::{clock, system_instruction};
use std::collections::HashMap;

declare_id!("YourProgramIdHere");

#[program]
mod fee_distribution {
    use super::*;

    pub fn distribute_fees(ctx: Context, total_fees: u64) -> Result<()> {
        let current_time = clock::Clock::get()?.unix_timestamp;
        let state = &mut ctx.accounts.state;

        const THIRTY_DAYS_IN_SECONDS: i64 = 30 * 24 * 60 * 60;
        if current_time < state.last_distribution + THIRTY_DAYS_IN_SECONDS {
            return Err(ErrorCode::TooSoon.into());
        }

        state.last_distribution = current_time;

        let distributions: HashMap<&str, u8> = HashMap::from([
            ("holders_1m", 25),
            ("holders_500k", 10),
            ("holders_less_500k", 5),
            ("team", 5),
        ]);

        let mut total_allocated: u64 = 0;

        let holders_1m_amount = (total_fees * distributions["holders_1m"] as u64) / 100;
        let holders_500k_amount = (total_fees * distributions["holders_500k"] as u64) / 100;
        let holders_less_500k_amount = (total_fees * distributions["holders_less_500k"] as u64) / 100;
        let team_amount = (total_fees * distributions["team"] as u64) / 100;

        total_allocated += holders_1m_amount + holders_500k_amount + holders_less_500k_amount + team_amount;

        require!(total_allocated <= total_fees, ErrorCode::ExceedsTotalFees);

        invoke(
            &system_instruction::transfer(&ctx.accounts.payer.key(), &ctx.accounts.holders_1m.key(), holders_1m_amount),
            &[
                ctx.accounts.payer.to_account_info(),
                ctx.accounts.holders_1m.to_account_info(),
                ctx.accounts.system_program.to_account_info(),
            ],
        )?;

        invoke(
            &system_instruction::transfer(&ctx.accounts.payer.key(), &ctx.accounts.holders_500k.key(), holders_500k_amount),
            &[
                ctx.accounts.payer.to_account_info(),
                ctx.accounts.holders_500k.to_account_info(),
                ctx.accounts.system_program.to_account_info(),
            ],
        )?;

        invoke(
            &system_instruction::transfer(&ctx.accounts.payer.key(), &ctx.accounts.team_wallet.key(), team_amount),
            &[
                ctx.accounts.payer.to_account_info(),
                ctx.accounts.team_wallet.to_account_info(),
                ctx.accounts.system_program.to_account_info(),
            ],
        )?;

        Ok(())
    }

    pub fn claim(ctx: Context) -> Result<()> {
        let state = &mut ctx.accounts.state;
        let holder = &ctx.accounts.holder;
        let category_account = &mut ctx.accounts.category_account;

        if !is_eligible_claimer(holder.key(), &ctx.accounts.category) {
            return err!(ErrorCode::NotEligible);
        }

        let amount_to_claim = calculate_claim_amount(holder.key(), category_account.lamports());
        // Transfer the claim amount from the category account to the holder
    }
}

Last updated