Skip to content

Commit

Permalink
Merge b1d18e9 into 7b7de70
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] committed Mar 4, 2024
2 parents 7b7de70 + b1d18e9 commit 1c54287
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ packaging>=23.1
prompt_toolkit==3.0.43
pygments==2.17.2
requests==2.31.0
safe-eth-py==6.0.0b16
safe-eth-py==6.0.0b17
tabulate==0.9.0
trezor==0.13.8
web3==6.15.1
28 changes: 18 additions & 10 deletions safe_cli/operators/safe_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
)
from gnosis.eth.eip712 import eip712_encode
from gnosis.eth.utils import get_empty_tx_params
from gnosis.safe import InvalidInternalTx, Safe, SafeOperation, SafeTx
from gnosis.safe import InvalidInternalTx, Safe, SafeOperationEnum, SafeTx
from gnosis.safe.api import TransactionServiceApi
from gnosis.safe.multi_send import MultiSend, MultiSendOperation, MultiSendTx
from gnosis.safe.safe_deployments import safe_deployments
Expand Down Expand Up @@ -478,7 +478,7 @@ def sign_message(
sign_message_lib_address,
0,
sign_message_data,
operation=SafeOperation.DELEGATE_CALL,
operation=SafeOperationEnum.DELEGATE_CALL,
):
print_formatted_text(
HTML(f"Message was signed correctly: {safe_message_hash.hex()}")
Expand Down Expand Up @@ -533,7 +533,9 @@ def send_custom(
safe_balance = self.ethereum_client.get_balance(self.address)
if safe_balance < value:
raise NotEnoughEtherToSend(safe_balance)
operation = SafeOperation.DELEGATE_CALL if delegate_call else SafeOperation.CALL
operation = (
SafeOperationEnum.DELEGATE_CALL if delegate_call else SafeOperationEnum.CALL
)
return self.prepare_and_execute_safe_transaction(
to, value, data, operation, safe_nonce=safe_nonce
)
Expand Down Expand Up @@ -667,7 +669,10 @@ def update_version(self) -> Optional[bool]:
multisend_data = multisend.build_tx_data(multisend_txs)

if self.prepare_and_execute_safe_transaction(
multisend.address, 0, multisend_data, operation=SafeOperation.DELEGATE_CALL
multisend.address,
0,
multisend_data,
operation=SafeOperationEnum.DELEGATE_CALL,
):
self.safe_cli_info.master_copy = self.last_safe_contract_address
self.safe_cli_info.fallback_handler = (
Expand Down Expand Up @@ -726,7 +731,10 @@ def update_version_to_l2(
)

if self.prepare_and_execute_safe_transaction(
migration_contract_address, 0, data, operation=SafeOperation.DELEGATE_CALL
migration_contract_address,
0,
data,
operation=SafeOperationEnum.DELEGATE_CALL,
):
self.safe_cli_info.master_copy = safe_l2_singleton
self.safe_cli_info.fallback_handler = fallback_handler
Expand Down Expand Up @@ -888,7 +896,7 @@ def prepare_safe_transaction(
to: str,
value: int,
data: bytes,
operation: SafeOperation = SafeOperation.CALL,
operation: SafeOperationEnum = SafeOperationEnum.CALL,
safe_nonce: Optional[int] = None,
) -> SafeTx:
safe_tx = self.safe.build_multisig_tx(
Expand All @@ -902,7 +910,7 @@ def prepare_and_execute_safe_transaction(
to: str,
value: int,
data: bytes,
operation: SafeOperation = SafeOperation.CALL,
operation: SafeOperationEnum = SafeOperationEnum.CALL,
safe_nonce: Optional[int] = None,
) -> bool:
safe_tx = self.prepare_safe_transaction(
Expand Down Expand Up @@ -1011,7 +1019,7 @@ def batch_safe_txs(
multisend.address,
0,
multisend.build_tx_data(multisend_txs),
SafeOperation.DELEGATE_CALL.value,
SafeOperationEnum.DELEGATE_CALL.value,
0,
0,
0,
Expand Down Expand Up @@ -1133,7 +1141,7 @@ def drain(self, to: str):
token_address,
0,
HexBytes(transaction["data"]),
SafeOperation.CALL,
SafeOperationEnum.CALL,
safe_nonce=None,
)
safe_txs.append(safe_tx)
Expand All @@ -1145,7 +1153,7 @@ def drain(self, to: str):
to,
balance_eth,
b"",
SafeOperation.CALL,
SafeOperationEnum.CALL,
safe_nonce=None,
)
safe_txs.append(safe_tx)
Expand Down
10 changes: 5 additions & 5 deletions safe_cli/operators/safe_tx_service_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from gnosis.eth.contracts import get_erc20_contract
from gnosis.eth.eip712 import eip712_encode_hash
from gnosis.safe import SafeOperation, SafeTx
from gnosis.safe import SafeOperationEnum, SafeTx
from gnosis.safe.api import SafeAPIException
from gnosis.safe.api.transaction_service_api.transaction_service_messages import (
get_remove_transaction_message,
Expand Down Expand Up @@ -226,7 +226,7 @@ def batch_txs(self, safe_nonce: int, safe_tx_hashes: Sequence[bytes]) -> bool:
multisend.address,
0,
multisend.build_tx_data(multisend_txs),
SafeOperation.DELEGATE_CALL.value,
SafeOperationEnum.DELEGATE_CALL.value,
0,
0,
0,
Expand Down Expand Up @@ -337,7 +337,7 @@ def prepare_and_execute_safe_transaction(
to: str,
value: int,
data: bytes,
operation: SafeOperation = SafeOperation.CALL,
operation: SafeOperationEnum = SafeOperationEnum.CALL,
safe_nonce: Optional[int] = None,
) -> bool:
safe_tx = self.prepare_safe_transaction(
Expand Down Expand Up @@ -386,7 +386,7 @@ def drain(self, to: ChecksumAddress):
to,
amount,
b"",
SafeOperation.CALL,
SafeOperationEnum.CALL,
safe_nonce=None,
)
else:
Expand All @@ -399,7 +399,7 @@ def drain(self, to: ChecksumAddress):
balance["tokenAddress"],
0,
HexBytes(transaction["data"]),
SafeOperation.CALL,
SafeOperationEnum.CALL,
safe_nonce=None,
)
if safe_tx:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"prompt_toolkit>=3",
"pygments>=2",
"requests>=2",
"safe-eth-py==6.0.0b16",
"safe-eth-py==6.0.0b17",
"tabulate>=0.8",
],
extras_require={"ledger": ["ledgereth==0.9.1"], "trezor": ["trezor==0.13.8"]},
Expand Down

0 comments on commit 1c54287

Please sign in to comment.