|
1 | 1 | use super::*; |
2 | 2 | use sp_core::Get; |
3 | 3 | use subtensor_runtime_common::{NetUid, TaoCurrency}; |
| 4 | +use subtensor_swap_interface::SwapHandler; |
4 | 5 |
|
5 | 6 | impl<T: Config> Pallet<T> { |
6 | 7 | /// Fetches the total count of subnets. |
@@ -101,23 +102,23 @@ impl<T: Config> Pallet<T> { |
101 | 102 | /// Facilitates user registration of a new subnetwork. |
102 | 103 | /// |
103 | 104 | /// ### Args |
104 | | - /// * **`origin`** – `T::RuntimeOrigin` Must be **signed** by the coldkey. |
105 | | - /// * **`hotkey`** – `&T::AccountId` First neuron of the new subnet. |
106 | | - /// * **`mechid`** – `u16` Only the dynamic mechanism (`1`) is currently supported. |
| 105 | + /// * **`origin`** – `T::RuntimeOrigin` Must be **signed** by the coldkey. |
| 106 | + /// * **`hotkey`** – `&T::AccountId` First neuron of the new subnet. |
| 107 | + /// * **`mechid`** – `u16` Only the dynamic mechanism (`1`) is currently supported. |
107 | 108 | /// * **`identity`** – `Option<SubnetIdentityOfV3>` Optional metadata for the subnet. |
108 | 109 | /// |
109 | 110 | /// ### Events |
110 | | - /// * `NetworkAdded(netuid, mechid)` – always. |
111 | | - /// * `SubnetIdentitySet(netuid)` – when a custom identity is supplied. |
| 111 | + /// * `NetworkAdded(netuid, mechid)` – always. |
| 112 | + /// * `SubnetIdentitySet(netuid)` – when a custom identity is supplied. |
112 | 113 | /// * `NetworkRemoved(netuid)` – when a subnet is pruned to make room. |
113 | 114 | /// |
114 | 115 | /// ### Errors |
115 | | - /// * `NonAssociatedColdKey` – `hotkey` already belongs to another coldkey. |
116 | | - /// * `MechanismDoesNotExist` – unsupported `mechid`. |
117 | | - /// * `NetworkTxRateLimitExceeded` – caller hit the register-network rate limit. |
118 | | - /// * `SubnetLimitReached` – limit hit **and** no eligible subnet to prune. |
119 | | - /// * `CannotAffordLockCost` – caller lacks the lock cost. |
120 | | - /// * `BalanceWithdrawalError` – failed to lock balance. |
| 116 | + /// * `NonAssociatedColdKey` – `hotkey` already belongs to another coldkey. |
| 117 | + /// * `MechanismDoesNotExist` – unsupported `mechid`. |
| 118 | + /// * `NetworkTxRateLimitExceeded` – caller hit the register-network rate limit. |
| 119 | + /// * `SubnetLimitReached` – limit hit **and** no eligible subnet to prune. |
| 120 | + /// * `CannotAffordLockCost` – caller lacks the lock cost. |
| 121 | + /// * `BalanceWithdrawalError` – failed to lock balance. |
121 | 122 | /// * `InvalidIdentity` – supplied `identity` failed validation. |
122 | 123 | /// |
123 | 124 | pub fn do_register_network( |
@@ -255,6 +256,8 @@ impl<T: Config> Pallet<T> { |
255 | 256 | Self::deposit_event(Event::SubnetIdentitySet(netuid_to_register)); |
256 | 257 | } |
257 | 258 |
|
| 259 | + T::SwapInterface::try_initialize_v3(netuid_to_register)?; |
| 260 | + |
258 | 261 | // --- 18. Emit the NetworkAdded event. |
259 | 262 | log::info!("NetworkAdded( netuid:{netuid_to_register:?}, mechanism:{mechid:?} )"); |
260 | 263 | Self::deposit_event(Event::NetworkAdded(netuid_to_register, mechid)); |
|
0 commit comments