Skip to content

Commit

Permalink
Refactor Safe.py
Browse files Browse the repository at this point in the history
- Add version property to every Safe class
- Remove Creation V1. It was used on the Safe Relay when CREATE2 did not exist
  • Loading branch information
Uxio0 committed Sep 7, 2023
1 parent abaf38c commit 45f097f
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 1,118 deletions.
301 changes: 125 additions & 176 deletions gnosis/safe/safe.py

Large diffs are not rendered by default.

337 changes: 0 additions & 337 deletions gnosis/safe/safe_creation_tx.py

This file was deleted.

2 changes: 1 addition & 1 deletion gnosis/safe/safe_tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(
refund_receiver: Optional[str],
signatures: Optional[bytes] = None,
safe_nonce: Optional[int] = None,
safe_version: str = None,
safe_version: Optional[str] = None,
chain_id: Optional[int] = None,
):
"""
Expand Down
41 changes: 0 additions & 41 deletions gnosis/safe/tests/test_proxy_factory/test_proxy_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,47 +98,6 @@ def test_check_proxy_code_mainnet(self):
with self.subTest(safe=safe):
self.assertTrue(proxy_factory.check_proxy_code(safe))

def test_deploy_proxy_contract(self):
s = 15
owners = [Account.create().address for _ in range(2)]
threshold = 2
payment_token = None
safe_creation_tx = Safe.build_safe_creation_tx(
self.ethereum_client,
self.safe_contract_V0_0_1_address,
s,
owners,
threshold,
self.gas_price,
payment_token,
payment_receiver=self.ethereum_test_account.address,
)
# Send ether for safe deploying costs
self.send_tx(
{"to": safe_creation_tx.safe_address, "value": safe_creation_tx.payment},
self.ethereum_test_account,
)

proxy_factory = ProxyFactory(
self.proxy_factory_contract_address, self.ethereum_client, version="1.1.1"
)
ethereum_tx_sent = proxy_factory.deploy_proxy_contract(
self.ethereum_test_account,
safe_creation_tx.master_copy,
safe_creation_tx.safe_setup_data,
safe_creation_tx.gas,
gas_price=self.gas_price,
)
receipt = self.ethereum_client.get_transaction_receipt(
ethereum_tx_sent.tx_hash, timeout=20
)
self.assertEqual(receipt.status, 1)
safe = Safe(ethereum_tx_sent.contract_address, self.ethereum_client)
self.assertEqual(
safe.retrieve_master_copy_address(), safe_creation_tx.master_copy
)
self.assertEqual(set(safe.retrieve_owners()), set(owners))

def test_deploy_proxy_contract_with_nonce(self):
salt_nonce = generate_salt_nonce()
owners = [Account.create().address for _ in range(2)]
Expand Down
Loading

0 comments on commit 45f097f

Please sign in to comment.