Skip to content

Commit

Permalink
feat: support lowercase addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
banteg committed Sep 15, 2021
1 parent 6afa1d7 commit 5f3b98c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions ape_safe.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from brownie.network.account import LocalAccount
from brownie.network.transaction import TransactionReceipt
from eth_abi import encode_abi
from eth_utils import is_address, to_checksum_address
from gnosis.eth import EthereumClient
from gnosis.safe import Safe, SafeOperation
from gnosis.safe.multi_send import MultiSend, MultiSendOperation, MultiSendTx
Expand Down Expand Up @@ -47,8 +48,7 @@ def __init__(self, address, base_url=None, multisend=None):
"""
Create an ApeSafe from an address or a ENS name and use a default connection.
"""
if not web3.isChecksumAddress(address):
address = web3.ens.resolve(address)
address = to_checksum_address(address) if is_address(address) else web3.ens.resolve(address)
ethereum_client = EthereumClient(web3.provider.endpoint_uri)
self.base_url = base_url or transaction_service[chain.id]
self.multisend = multisend or multisends.get(chain.id, MULTISEND_CALL_ONLY)
Expand All @@ -57,6 +57,9 @@ def __init__(self, address, base_url=None, multisend=None):
def __str__(self):
return EthAddress(self.address)

def __repr__(self):
return f'ApeSafe("{self.address}")'

@property
def account(self) -> LocalAccount:
"""
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ape-safe"
version = "0.2.1"
version = "0.2.2"
description = "Build complex Gnosis Safe transactions and safely preview them in a forked environment."
authors = ["banteg <banteeg@gmail.com>"]
license = "MIT"
Expand Down

0 comments on commit 5f3b98c

Please sign in to comment.