Skip to content

Commit fd980b1

Browse files
author
Samuel Dare
committed
chore: add event
1 parent 6daad1e commit fd980b1

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

pallets/subtensor/src/events.rs

+9
Original file line numberDiff line numberDiff line change
@@ -150,5 +150,14 @@ mod events {
150150
<T as frame_system::Config>::AccountId,
151151
>>::Balance,
152152
},
153+
/// A coldkey swap has been scheduled
154+
ColdkeySwapScheduled {
155+
/// The account ID of the old coldkey
156+
old_coldkey: T::AccountId,
157+
/// The account ID of the new coldkey
158+
new_coldkey: T::AccountId,
159+
/// The arbitration block for the coldkey swap
160+
arbitration_block: u64,
161+
},
153162
}
154163
}

pallets/subtensor/src/swap.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ impl<T: Config> Pallet<T> {
204204
///
205205
/// # Arguments
206206
///
207-
/// * `origin` - The origin of the call, which must be signed by the old coldkey.
207+
/// * `old_coldkey` - The account ID of the old coldkey.
208208
/// * `new_coldkey` - The account ID of the new coldkey.
209209
/// * `work` - The proof of work submitted by the caller.
210210
/// * `block_number` - The block number at which the work was performed.
@@ -289,6 +289,13 @@ impl<T: Config> Pallet<T> {
289289
ColdkeysToSwapAtBlock::<T>::insert(arbitration_block, key_to_arbitrate_on_this_block);
290290
}
291291

292+
// Emit an event indicating that a coldkey swap has been scheduled
293+
Self::deposit_event(Event::ColdkeySwapScheduled {
294+
old_coldkey: old_coldkey.clone(),
295+
new_coldkey: new_coldkey.clone(),
296+
arbitration_block: ColdkeyArbitrationBlock::<T>::get(old_coldkey),
297+
});
298+
292299
Ok(())
293300
}
294301

0 commit comments

Comments
 (0)