Skip to content

luca590/StakingManager

Repository files navigation

StakingManager

Python based CLI tool for staking (nominating) in Polkadot
⚠️ Not production ready ⚠️

Instructions:

run python StakingManager.py dot -h
- NOTE: because only polkadot is supported, you must give dot as the first argument. In the future, when we support additional networks, there will be other options to dot

Testing:

run python test/endToEndTests.py

Features:

  • Pretty intuitive ArgParser (see examples.py) for:
    • Creating a mnemonic, keypair, getting acct info
    • Bonding, unbonding, rebonding, withdrawing
    • Nominating (Staking), setting staker requirements
  • Validations
  • Error handling
    • TODO
  • Tests
    • e2e tests (inclusive of CLI commands) in test/endToEndTests.py
    • Tests are major WIP, may fail and exit
    • TODO: Setting up and testing on local network (see Testing Tools below)

Recommended Reading

Codebase Notes:

Coding Patterns (Ideals):

  • SOLID - https://gist.github.com/dmmeteo/f630fa04c7a79d3c132b9e9e5d037bfd
  • If a filename has a corresponding Utils file, one should not ever need to import the Utils file except in its pair.
    • For example, accountManager.py should import accountManagerUtils.py, but no other files should import accountManagerUtils.py. Instead, all other files should only ever have to import accountManager.py.
  • Pass "generic" arguements first in a function and more unique arguements subsequently
    • For example, in def __init__(self, logger, accountManager), self and logic generic and therefore passed before accountManager

Architecture:

  • TODO
  • Code for parsing CLI commands is in /arg_parser folder
  • The program "logic" is in /fxn_decorator_implementations
    • accountImplementation contains classes related to accounts
    • substrateCallImplementation contains classes related to bonding and nominating

Immediate TODOs:

  • Improved testing
  • Improved validations and error handling, e.g. to avoid existential deposit
  • Adding new substrate based chains to stake on
  • check TODOs in substrateCallImplementationUtils
  • rename code_src > src
  • rename all cases of "bounder" to "bonder"

Releases

No releases published

Packages

No packages published