Skip to content

Commit 86c1d31

Browse files
authored
Merge pull request #2033 from opentensor/incentive-alpha-emitted-to-miners
Events for Incentive Emitted To Miners
2 parents 7c36b3f + 7a7ab97 commit 86c1d31

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

pallets/subtensor/src/coinbase/run_coinbase.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,14 @@ impl<T: Config> Pallet<T> {
513513

514514
let owner: T::AccountId = Owner::<T>::get(&hotkey);
515515
let destination = AutoStakeDestination::<T>::get(&owner).unwrap_or(hotkey.clone());
516+
517+
Self::deposit_event(Event::<T>::AutoStakeAdded {
518+
netuid,
519+
destination: destination.clone(),
520+
hotkey,
521+
owner: owner.clone(),
522+
incentive,
523+
});
516524
Self::increase_stake_for_hotkey_and_coldkey_on_subnet(
517525
&destination,
518526
&owner,

pallets/subtensor/src/epoch/run_epoch.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,11 @@ impl<T: Config> Pallet<T> {
920920
}
921921
});
922922

923+
Self::deposit_event(Event::IncentiveAlphaEmittedToMiners {
924+
netuid,
925+
emissions: server_emission.clone(),
926+
});
927+
923928
// Emission tuples ( hotkeys, server_emission, validator_emission )
924929
hotkeys
925930
.into_iter()

pallets/subtensor/src/macros/events.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,5 +413,27 @@ mod events {
413413
/// - **netuid**: The network identifier.
414414
/// - **who**: The account ID of the user revealing the weights.
415415
TimelockedWeightsRevealed(NetUid, T::AccountId),
416+
417+
/// Auto-staking hotkey received stake
418+
AutoStakeAdded {
419+
/// Subnet identifier.
420+
netuid: NetUid,
421+
/// Destination account that received the auto-staked funds.
422+
destination: T::AccountId,
423+
/// Hotkey account whose stake was auto-staked.
424+
hotkey: T::AccountId,
425+
/// Owner (coldkey) account associated with the hotkey.
426+
owner: T::AccountId,
427+
/// Amount of alpha auto-staked.
428+
incentive: AlphaCurrency,
429+
},
430+
431+
/// End-of-epoch miner incentive alpha by UID
432+
IncentiveAlphaEmittedToMiners {
433+
/// Subnet identifier.
434+
netuid: NetUid,
435+
/// UID-indexed array of miner incentive alpha; index equals UID.
436+
emissions: Vec<AlphaCurrency>,
437+
},
416438
}
417439
}

0 commit comments

Comments
 (0)