Skip to content

Commit d29be5c

Browse files
committed
hopfully fixed file locality so it can be used as package
1 parent 7de36e4 commit d29be5c

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

IceCreamSwapWeb3/Multicall.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,11 @@ def main(
326326
):
327327
w3 = Web3Advanced(node_url=node_url)
328328

329-
with open("./abi/Counter.abi") as f:
329+
with files("IceCreamSwapWeb3").joinpath("./abi/Counter.abi").open('r') as f:
330330
counter_contract_abi = f.read()
331-
with open("./bytecode/Counter.bytecode") as f:
331+
with files("IceCreamSwapWeb3").joinpath("./bytecode/Counter.bytecode").open('r') as f:
332332
counter_contract_bytecode = f.read()
333-
with open("./abi/ERC20.abi") as f:
333+
with files("IceCreamSwapWeb3").joinpath("./abi/ERC20.abi").open('r') as f:
334334
erc20_abi = f.read()
335335

336336
counter_contract = w3.eth.contract(bytecode=counter_contract_bytecode, abi=counter_contract_abi)

IceCreamSwapWeb3/Web3Advanced.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from importlib.resources import files
2+
13
from web3 import Web3
24
from web3.exceptions import ContractLogicError
35
from web3.main import get_default_modules
@@ -83,9 +85,9 @@ def _find_max_filter_range(self):
8385
return 0
8486

8587
def _check_revert_reason_available(self):
86-
with open("abi/RevertTester.abi") as f:
88+
with files("IceCreamSwapWeb3").joinpath("./abi/RevertTester.abi").open('r') as f:
8789
revert_tester_abi = f.read()
88-
with open("bytecode/RevertTester.bytecode") as f:
90+
with files("IceCreamSwapWeb3").joinpath("./bytecode/RevertTester.bytecode").open('r') as f:
8991
revert_tester_bytecode = f.read()
9092
revert_tester_contract = self.eth.contract(abi=revert_tester_abi, bytecode=revert_tester_bytecode)
9193
try:

0 commit comments

Comments
 (0)