@@ -247,47 +247,6 @@ import bittensor as bt
247
247
import bittensor_wallet
248
248
from bittensor import tao
249
249
250
- <<<<<< < HEAD
251
- ====== =
252
- # Load environmental variables
253
- wallet_name = os.environ.get(' WALLET' )
254
- total_to_unstake = os.environ.get(' TOTAL_TAO_TO_UNSTAKE' )
255
- max_stakes_to_unstake = os.environ.get(' MAX_STAKES_TO_UNSTAKE' )
256
-
257
- # Basic input validation for wallet and TAO amount
258
- if wallet_name is None :
259
- sys.exit(" wallet name not specified. Usage: `TOTAL_TAO_TO_UNSTAKE=1 MAX_STAKES_TO_UNSTAKE=10 WALLET=my-wallet-name ./unstakerscript.py`" )
260
-
261
- if total_to_unstake is None :
262
- print (" Unstaking total not specified, defaulting to 1 TAO." )
263
- total_to_unstake = 1
264
- else :
265
- try :
266
- total_to_unstake = float (total_to_unstake)
267
- except :
268
- sys.exit(" invalid TAO amount!" )
269
-
270
- if max_stakes_to_unstake is None :
271
- max_stakes_to_unstake = 10
272
- else :
273
- try :
274
- max_stakes_to_unstake = int (max_stakes_to_unstake)
275
- except :
276
- sys.exit(" invalid number for MAX_STAKES_TO_UNSTAKE" )
277
-
278
- # Print summary for configuration
279
- print (f " 🔍 Using wallet: { wallet_name} " )
280
- print (f " 🧮 Unstaking a total of { total_to_unstake} TAO across up to { max_stakes_to_unstake} lowest-emission validators " )
281
-
282
- # Initialize Bittensor wallet and balamce object
283
- total_to_unstake = bt.Balance.from_tao(total_to_unstake)
284
- wallet = bt.wallet(wallet_name)
285
- wallet_ck = wallet.coldkeypub.ss58_address
286
-
287
- unstake_minimum = 0.0005 # TAO
288
-
289
- # Async helper to perform the actual unstake call
290
- >>>>>> > 84a50fd (Added commnets throughtout unstaking script)
291
250
async def perform_unstake (subtensor , stake , amount ):
292
251
try :
293
252
print (f " ⏳ Attempting to unstake { amount} from { stake.hotkey_ss58} on subnet { stake.netuid} " )
@@ -351,44 +310,7 @@ async def main():
351
310
success_count = sum (results)
352
311
print (f " \n 🎯 Unstake complete. Success: { success_count} / { len (stakes)} " )
353
312
354
- <<<<<< < HEAD
355
- wallet_name = os.environ.get(' WALLET' )
356
- total_to_unstake = os.environ.get(' TOTAL_TAO_TO_UNSTAKE' )
357
- max_stakes_to_unstake = os.environ.get(' MAX_STAKES_TO_UNSTAKE' )
358
-
359
- if wallet_name is None :
360
- sys.exit(" wallet name not specified. Usage: `TOTAL_TAO_TO_UNSTAKE=1 MAX_STAKES_TO_UNSTAKE=10 WALLET=my-wallet-name ./unstakerscript.py`" )
361
-
362
- if total_to_unstake is None :
363
- print (" Unstaking total not specified, defaulting to 1 TAO." )
364
- total_to_unstake = 1
365
- else :
366
- try :
367
- total_to_unstake = float (total_to_unstake)
368
- except :
369
- sys.exit(" invalid TAO amount!" )
370
-
371
- if max_stakes_to_unstake is None :
372
- max_stakes_to_unstake = 10
373
- else :
374
- try :
375
- max_stakes_to_unstake = int (max_stakes_to_unstake)
376
- except :
377
- sys.exit(" invalid number for MAX_STAKES_TO_UNSTAKE" )
378
-
379
- print (f " 🔍 Using wallet: { wallet_name} " )
380
- print (f " 🧮 Unstaking a total of { total_to_unstake} TAO across up to { max_stakes_to_unstake} lowest-emission validators " )
381
-
382
- total_to_unstake = bt.Balance.from_tao(total_to_unstake)
383
- wallet = bt.wallet(wallet_name)
384
- wallet_ck = wallet.coldkeypub.ss58_address
385
-
386
- # There is a global on-chain minimum balanced allowed for unstaking operations.
387
- unstake_minimum = 0.0005
388
-
389
- ====== =
390
313
# Run the async workflow
391
- >>>>>> > 84a50fd (Added commnets throughtout unstaking script)
392
314
asyncio.run(main())
393
315
394
316
```
0 commit comments