Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make Calls reusable at different block heights #87

Merged
merged 2 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions multicall/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ def decode_output(
return decoded if len(decoded) > 1 else decoded[0]

@eth_retry.auto_retry
def __call__(self, args: Optional[Any] = None, _w3: Optional[Web3] = None) -> Any:
def __call__(self, args: Optional[Any] = None, _w3: Optional[Web3] = None, *, block_id: Optional[int] = None) -> Any:
_w3 = self.w3 or _w3 or w3
args = prep_args(
self.target,
self.signature,
args or self.args,
self.block_id,
block_id or self.block_id,
self.gas_limit,
self.state_override_code,
)
Expand All @@ -106,7 +106,7 @@ def __await__(self) -> Any:
return self.coroutine().__await__()

@eth_retry.auto_retry
async def coroutine(self, args: Optional[Any] = None, _w3: Optional[Web3] = None) -> Any:
async def coroutine(self, args: Optional[Any] = None, _w3: Optional[Web3] = None, *, block_id: Optional[int] = None) -> Any:
_w3 = self.w3 or _w3 or w3

if self.state_override_code and not state_override_supported(_w3):
Expand All @@ -119,7 +119,7 @@ async def coroutine(self, args: Optional[Any] = None, _w3: Optional[Web3] = None
self.target,
self.signature,
args or self.args,
self.block_id,
block_id or self.block_id,
self.gas_limit,
self.state_override_code,
)
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 = "multicall"
version = "0.7.9"
version = "0.8.0"
description = "aggregate results from multiple ethereum contract calls"
authors = ["banteg"]

Expand Down