Skip to content

Commit

Permalink
Revert deploy_contract_with_deploy_function
Browse files Browse the repository at this point in the history
  • Loading branch information
moisses89 committed Sep 5, 2023
1 parent df0fe83 commit d714c04
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 33 deletions.
24 changes: 0 additions & 24 deletions gnosis/eth/contracts/contract_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from eth_account.signers.local import LocalAccount
from web3.contract import Contract
from web3.contract.contract import ContractFunction
from web3.types import TxParams

from gnosis.eth import EthereumClient, EthereumTxSent
Expand Down Expand Up @@ -38,29 +37,6 @@ def deploy_contract(
)
return EthereumTxSent(tx_hash, tx, contract_address)

@staticmethod
def deploy_contract_with_deploy_function(
ethereum_client: EthereumClient,
deployer_account: LocalAccount,
deploy_function: ContractFunction,
gas: Optional[int] = None,
gas_price: Optional[int] = None,
nonce: Optional[int] = None,
):

tx_parameters = ContractCommon.configure_tx_parameters(
deployer_account.address, gas, gas_price, nonce
)

contract_address = deploy_function.call(tx_parameters)

tx = deploy_function.build_transaction(tx_parameters)

tx_hash = ethereum_client.send_unsigned_transaction(
tx, private_key=deployer_account.key
)
return EthereumTxSent(tx_hash, tx, contract_address)

@staticmethod
def configure_tx_parameters(
from_address: str,
Expand Down
32 changes: 23 additions & 9 deletions gnosis/safe/proxy_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,20 @@ def deploy_proxy_contract(
master_copy, initializer
)

return self.deploy_contract_with_deploy_function(
self.ethereum_client, deployer_account, create_proxy_fn, gas, gas_price
tx_parameters = self.configure_tx_parameters(
deployer_account.address, gas, gas_price
)

contract_address = create_proxy_fn.call(tx_parameters)

tx = create_proxy_fn.build_transaction(tx_parameters)

tx_hash = self.ethereum_client.send_unsigned_transaction(
tx, private_key=deployer_account.key
)

return EthereumTxSent(tx_hash, tx, contract_address)

def deploy_proxy_contract_with_nonce(
self,
deployer_account: LocalAccount,
Expand Down Expand Up @@ -103,14 +113,18 @@ def deploy_proxy_contract_with_nonce(
master_copy, initializer, salt_nonce
)

return self.deploy_contract_with_deploy_function(
self.ethereum_client,
deployer_account,
create_proxy_fn,
gas,
gas_price,
nonce,
tx_parameters = self.configure_tx_parameters(
deployer_account.address, gas, gas_price, nonce
)

contract_address = create_proxy_fn.call(tx_parameters)

tx = create_proxy_fn.build_transaction(tx_parameters)

tx_hash = self.ethereum_client.send_unsigned_transaction(
tx, private_key=deployer_account.key
)
return EthereumTxSent(tx_hash, tx, contract_address)

def get_contract(self, address: Optional[ChecksumAddress] = None):
address = address or self.address
Expand Down

0 comments on commit d714c04

Please sign in to comment.