reward event

This commit is contained in:
Hardhat Chad
2025-06-13 15:37:20 -07:00
parent 2f1b99ceac
commit 1d9b0ebd42
3 changed files with 63 additions and 15 deletions

View File

@@ -57,7 +57,10 @@ pub fn process_close(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul
// Payout block reward.
if block.reward.lode_reward > 0 && block.reward.lode_authority != Pubkey::default() {
// Load recipient.
recipient_info.as_associated_token_account(&block.reward.lode_authority, &MINT_ADDRESS)?;
// Mint reward to recipient.
mint_to_signed(
mint_quote_info,
recipient_info,
@@ -66,6 +69,15 @@ pub fn process_close(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul
block.reward.lode_reward,
&[TREASURY],
)?;
// Emit event.
RewardEvent {
amount: block.reward.lode_reward,
authority: block.reward.lode_authority,
block_id: block.id,
rewards_type: RewardsType::Lode as u64,
}
.log();
}
// Burn base liquidity.