Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

fix(contract): allow 16 calls in multicall #1934

Merged
merged 1 commit into from
Dec 15, 2022
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
between its right shift operator and standard library numeric types.
- [#842](https://github.com/gakonst/ethers-rs/issues/842) Add support for I256 types in `parse_units` and `format_units`.
Added `twos_complement` function for I256.
- [#1934](https://github.com/gakonst/ethers-rs/pull/1934) Allow 16 calls in multicall.

## ethers-contract-abigen

Expand Down
2 changes: 1 addition & 1 deletion ethers-contract/src/multicall/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ impl<M: Middleware> Multicall<M> {
/// # }
/// ```
pub async fn call<D: Detokenize>(&self) -> Result<D, M> {
assert!(self.calls.len() < 16, "Cannot decode more than 16 calls");
assert!(self.calls.len() <= 16, "Cannot decode more than 16 calls");
Copy link
Owner

@gakonst gakonst Dec 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK this should be fine due to this line https://github.com/gakonst/ethers-rs/blob/master/ethers-core/src/abi/tokens.rs#L130 and this https://github.com/gakonst/ethers-rs/blob/master/ethers-core/src/abi/tokens.rs#L341. Would be nicer if we did this with a const generic somehow so we're not bound to any number of tokens. Even better if we had an ability to return things of unknown length.

Copy link
Contributor Author

@onsails onsails Dec 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have propotypes for both, will prepare another PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let tokens = self.call_raw().await?;
let tokens = vec![Token::Tuple(tokens)];
let data = D::from_tokens(tokens).map_err(ContractError::DetokenizationError)?;
Expand Down