Comments (2)
You have a couple of issues in your invocation:
First, the signature is incorrect; not only are you making a tuple out of the entire return with your extra parentheses, the individual return types are not denoted as []
. You can build the function signature from the ABI:
{
"inputs": [
{
"internalType": "bytes32",
"name": "poolId",
"type": "bytes32"
}
],
"name": "getPoolTokens",
"outputs": [
{
"internalType": "contract IERC20[]",
"name": "tokens",
"type": "address[]"
},
{
"internalType": "uint256[]",
"name": "balances",
"type": "uint256[]"
},
{
"internalType": "uint256",
"name": "lastChangeBlock",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
This gives us getPoolTokens(bytes32)(address[],uint256[],uint256)
Second, because this method has three return values, you should be listing three keys for the return dict (unless you really do only care about the first one, of course)
Taking the first Pool ID I found in event logs, the following call (edited for readability) yielded the same data that etherscan's UI provided:
Call(
'0xBA12222222228d8Ba445958a75a0704d566BF2C8',
['getPoolTokens(bytes32)(address[],uint256[],uint256)', HexBytes('0x8eb6c82c3081bbbd45dcac5afa631aac53478b7c000100000000000000000270')],
[['tokens', None], ['balances', None], ['lastChangeBlock', None]],
_w3=eth
)()
{'tokens': ('0x2260fac5e5542a773aa44fbcfedf7c193bc2c599',
'0x798d1be841a82a273720ce31c822c61a67a601c3',
'0xba485b556399123261a5f9c95d413b4f93107407'),
'balances': (16480387972, 323875735362, 581643160963723873429632),
'lastChangeBlock': 15293254}
from multicall.py.
Thanks @DefiDebauchery! I think I did not understand the way to use the library properly. Indeed, in the end, I ended up with exactly the same solution as you have written.
I remember going through the examples but couldn't find a nice one where the return types are multiple lists. Maybe this could be added to the example usages.
from multicall.py.
Related Issues (20)
- Ganache BSC Incorrect number of arguments. HOT 1
- add multicall v3 support HOT 6
- Unable to use Multicall with threads in docker. HOT 4
- Strange issues using Multicall with Fuse RPCs
- Making Multicall3 mapping naive
- Utilizing `[async_]simple_cache_middleware` to remove chainids mapping HOT 2
- Fixing typehinting in Call's `returns` argument HOT 1
- How to call a function from web3.eth.* HOT 1
- Support switching off state overrides via an environment variable HOT 1
- Getting Unauthorized while calling multicall with node provider secured with username & password HOT 2
- 403 Client Error when using Multicall on Avalanche Mainnet. HOT 6
- Getting 'message': 'invalid opcode: SHR' Error while doing mutlicall with historical block number HOT 2
- Error with ThreadPool 'Timeout context manager should be used inside a task'
- web3 version 6+ support? HOT 5
- Multicall() does not work in pip version 0.7.9 HOT 3
- support python 3.11, 3.12 HOT 2
- Stucked at _get_semaphore() while using python to execute the script directly HOT 1
- Add Support for Polygon ZKEVM HOT 2
- The latest version has a deadlock HOT 2
- Update Web3 dependency HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from multicall.py.