-
Notifications
You must be signed in to change notification settings - Fork 319
Record miner burn as TAO outflow in coinbase #2692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devnet-ready
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -617,6 +617,17 @@ impl<T: Config> Pallet<T> { | |
| log::debug!( | ||
| "incentives: hotkey: {hotkey:?} is SN owner hotkey or associated hotkey, skipping {incentive:?}" | ||
| ); | ||
|
|
||
| // Record the miner burn as a TAO outflow. The incentive is | ||
| // denominated in alpha, so convert to its TAO equivalent at | ||
| // the current spot price (no slippage, since no swap occurs). | ||
| let current_price: U96F32 = T::SwapInterface::current_alpha_price(netuid.into()); | ||
| let tao_equivalent: TaoBalance = current_price | ||
| .saturating_mul(asfloat!(incentive)) | ||
| .saturating_to_num::<u64>() | ||
| .min(i64::MAX as u64) | ||
| .into(); | ||
| Self::record_tao_outflow(netuid, tao_equivalent); | ||
|
Comment on lines
+621
to
+630
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [HIGH] Avoid per-hotkey SubnetTaoFlow writes in on_initialize
Aggregate the TAO equivalent into a local total and call |
||
| // Check if we should recycle or burn the incentive | ||
| match RecycleOrBurn::<T>::try_get(netuid) { | ||
| Ok(RecycleOrBurnEnum::Recycle) => { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.