def handle(self, *args, **options): ethereum_client = EthereumClientProvider() proxy_factory_address = settings.SAFE_PROXY_FACTORY_ADDRESS deployer_key = options['deployer_key'] deployer_account = Account.privateKeyToAccount( deployer_key) if deployer_key else self.DEFAULT_ACCOUNT self.stdout.write( self.style.SUCCESS( 'Checking if proxy factory was already deployed on %s' % proxy_factory_address)) if ethereum_client.is_contract(proxy_factory_address): self.stdout.write( self.style.NOTICE('Proxy factory was already deployed on %s' % proxy_factory_address)) else: self.stdout.write( self.style.SUCCESS( 'Deploying proxy factory using deployer account, ' 'proxy factory %s not found' % proxy_factory_address)) proxy_factory_address = ProxyFactory.deploy_proxy_factory_contract( ethereum_client, deployer_account=deployer_account).contract_address self.stdout.write( self.style.SUCCESS('Proxy factory has been deployed on %s' % proxy_factory_address))
def setUpClass(cls) -> None: cls.ethereum_node_url = cls.ETHEREUM_NODE_URL cls.ethereum_client = EthereumClient(cls.ethereum_node_url) cls.w3 = cls.ethereum_client.w3 cls.ethereum_test_account = Account.from_key(cls.ETHEREUM_ACCOUNT_KEY) cls.safe_contract_address = Safe.deploy_master_contract(cls.ethereum_client, cls.ethereum_test_account).contract_address cls.safe_old_contract_address = Safe.deploy_master_contract_v1_0_0(cls.ethereum_client, cls.ethereum_test_account).contract_address cls.proxy_factory = ProxyFactory( ProxyFactory.deploy_proxy_factory_contract(cls.ethereum_client, cls.ethereum_test_account).contract_address, cls.ethereum_client)