Crates.io | buddy-link |
lib.rs | buddy-link |
version | 0.4.0 |
source | src |
created_at | 2023-08-03 21:57:09.140701 |
updated_at | 2024-12-04 17:44:51.855275 |
description | Library to interact with the BuddyLink on-chain referral system |
homepage | |
repository | |
max_upload_size | |
id | 934528 |
size | 4,488,358 |
Here the transfer is made by the signer directly, if your "from account" is owned by a PDA, then transfer seeds would need to be provided.
let cpi_context = CpiContext::new(
buddy_link_program.to_account_info(),
buddy_link::cpi::TransferCheckedGlobalOnlyReward {
buddy_link_program: buddy_link_program.to_account_info(),
authority: authority.to_account_info(),
system_program: None,
mint: Some(mint.to_account_info()),
token_program: Some(token_program.to_account_info()),
from_token_account: Some(user_token_account.to_account_info()),
referrer_token_account: Some(remaining_accounts[0].to_account_info()),
global_referrer_treasury: referrer_treasury.to_account_info(),
global_referrer_treasury_for_reward: referrer_treasury_for_reward.to_account_info(),
referee_buddy_profile: buddy_profile.to_account_info(),
referee_buddy: buddy.to_account_info(),
},
);
buddy_link::cpi::transfer_checked_global_only_reward(
cpi_context,
amount_referral,
& [],
);
Here the transfer is made by the signer directly, if your "from account" is owned by a PDA, then transfer seeds would need to be provided.
let cpi_context = CpiContext::new(
buddy_link_program.to_account_info(),
buddy_link::cpi::TransferCheckedGlobalOnlyReward {
buddy_link_program: buddy_link_program.to_account_info(),
authority: authority.to_account_info(),
system_program: Some(system_program.to_account_info()),
mint: None,
token_program: None,
from_token_account: None,
referrer_token_account: None,
global_referrer_treasury: referrer_treasury.to_account_info(),
global_referrer_treasury_for_reward: referrer_treasury_for_reward.to_account_info(),
referee_buddy_profile: buddy_profile.to_account_info(),
referee_buddy: buddy.to_account_info(),
},
);
buddy_link::cpi::transfer_checked_global_only_reward(
cpi_context,
amount_referral,
&[],
)