def fee_range(general_config, registry_options): """Provide information on the global fee range – the range into which the minimum fee rate must fall.""" emitter, registry, blockchain = registry_options.setup( general_config=general_config) policy_agent = ContractAgency.get_agent(PolicyManagerAgent, registry=registry) paint_fee_rate_range(emitter=emitter, policy_agent=policy_agent)
def paint_deployer_contract_inspection(emitter, registry, deployer_address) -> None: blockchain = BlockchainInterfaceFactory.get_interface() sep = '-' * 45 emitter.echo(sep) provider_info = f""" * Web3 Provider ==================================================================== Provider URI ............. {blockchain.provider_uri} Registry ................ {registry.filepath} * Standard Deployments ===================================================================== """ emitter.echo(provider_info) try: token_agent = ContractAgency.get_agent(NucypherTokenAgent, registry=registry) token_contract_info = f""" {token_agent.contract_name} ........... {token_agent.contract_address} ~ Ethers ............ {Web3.fromWei(blockchain.client.get_balance(token_agent.contract_address), 'ether')} ETH ~ Tokens ............ {NU.from_nunits(token_agent.get_balance(token_agent.contract_address))}""" except BaseContractRegistry.UnknownContract: message = f"\n{NucypherTokenAgent.contract_name} is not enrolled in {registry.filepath}" emitter.echo(message, color='yellow') emitter.echo(sep, nl=False) else: emitter.echo(token_contract_info) banner = """ * Proxy-Contract Deployments =====================================================================""" emitter.echo(banner) from nucypher.blockchain.eth.actors import ContractAdministrator for contract_deployer_class in ContractAdministrator.dispatched_upgradeable_deployer_classes: try: bare_contract = blockchain.get_contract_by_name( contract_name=contract_deployer_class.contract_name, proxy_name=DispatcherDeployer.contract_name, registry=registry, use_proxy_address=False) dispatcher_deployer = DispatcherDeployer( registry=registry, target_contract=bare_contract, deployer_address=deployer_address, bare=True) # acquire agency for the dispatcher itself. agent = contract_deployer_class.agency(registry=registry, contract=bare_contract) proxy_payload = f""" {agent.contract_name} .... {bare_contract.address} ~ Owner .............. {bare_contract.functions.owner().call()} ~ Ethers ............. {Web3.fromWei(blockchain.client.get_balance(bare_contract.address), 'ether')} ETH ~ Tokens ............. {NU.from_nunits(token_agent.get_balance(bare_contract.address))} ~ Dispatcher ......... {dispatcher_deployer.contract_address} ~ Owner .......... {dispatcher_deployer.contract.functions.owner().call()} ~ Target ......... {dispatcher_deployer.contract.functions.target().call()} ~ Ethers ......... {Web3.fromWei(blockchain.client.get_balance(dispatcher_deployer.contract_address), 'ether')} ETH ~ Tokens ......... {NU.from_nunits(token_agent.get_balance(dispatcher_deployer.contract_address))}""" emitter.echo(proxy_payload) emitter.echo(sep, nl=False) except BaseContractRegistry.UnknownContract: message = f"\n{contract_deployer_class.contract_name} is not enrolled in {registry.filepath}" emitter.echo(message, color='yellow') emitter.echo(sep, nl=False) try: # # StakingInterface # staking_interface_agent = PreallocationEscrowAgent.StakingInterfaceAgent( registry=registry) bare_contract = blockchain.get_contract_by_name( contract_name=staking_interface_agent.contract_name, proxy_name=StakingInterfaceRouterDeployer.contract_name, use_proxy_address=False, registry=registry) router_deployer = StakingInterfaceRouterDeployer( registry=registry, target_contract=bare_contract, deployer_address=deployer_address, bare=True) # acquire agency for the dispatcher itself. preallocation_escrow_payload = f""" {staking_interface_agent.contract_name} ......... {bare_contract.address} ~ Ethers ............... {Web3.fromWei(blockchain.client.get_balance(bare_contract.address), 'ether')} ETH ~ Tokens ............... {NU.from_nunits(token_agent.get_balance(bare_contract.address))} ~ StakingInterfaceRouter {router_deployer.contract.address} ~ Owner .......... {router_deployer.contract.functions.owner().call()} ~ Target ......... {router_deployer.contract.functions.target().call()} ~ Ethers ......... {Web3.fromWei(blockchain.client.get_balance(router_deployer.contract_address), 'ether')} ETH ~ Tokens ......... {NU.from_nunits(token_agent.get_balance(router_deployer.contract_address))}""" emitter.echo(preallocation_escrow_payload) emitter.echo(sep) except BaseContractRegistry.UnknownContract: message = f"\nStakingInterface is not enrolled in {registry.filepath}" emitter.echo(message, color='yellow') try: policy_agent = ContractAgency.get_agent(PolicyManagerAgent, registry=registry) paint_fee_rate_range(emitter, policy_agent) emitter.echo(sep, nl=False) except BaseContractRegistry.UnknownContract: message = f"\n{PolicyManagerDeployer.contract_name} is not enrolled in {registry.filepath}" emitter.echo(message, color='yellow') emitter.echo(sep, nl=False)