Replies: 1 comment
-
You can read more about the Human-Readable ABIs. As until now how it is, you have to write those variables in function form. (Though I think it can make sense to make the work easier by adding support to For the pool info case, you need to know what PoolInfo is. // considering a dummy struct for example purposes
struct PoolInfo {
uint128 accPerShare;
uint64 lastRewardBlock;
uint64 allocPoint;
} Taking the above struct as PoolInfo for example purposes const contract = new ethers.Contract(address, [
'function totalAllocPoint() public view returns (uint256)',
'function poolInfo(uint256 index) public view returns (tuple(uint128 accPerShare, uint64 lastRewardBlock, uint64 allocPoint))'
], provider); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to read public property from contract on chain using ethers.js.
Calling the methods work but I could not manage to read public property (without getter).
The methods works like this:
However, if I try accessing public property, it doesn't work. In fact, I receive error with the ABI.
poolInfo
is even different because it needs a parameter.How can I read
totalAllocPoint
andpoolInfo
from the contract?Shouldn't it be like something like this:
Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions