cairo-contracts icon indicating copy to clipboard operation
cairo-contracts copied to clipboard

A Multicall Contract for View Functions?

Open dhruvkelawala opened this issue 2 years ago • 2 comments

Currently, I see #20 as work-in-progress and it will take a while till Starknet supports pointer in Array of struct. However, I believe it's only required for executing external functions. Is it possible to make a multicall function which is similar to multicall2 in solidity which can aggregate multiple view function calls?

dhruvkelawala avatar Jan 31 '22 09:01 dhruvkelawala

I think there's no technical difference between @view and @external functions in Cairo, there's no enforcement of the state immutability for view functions, and both decorators expose them to outside calls where the Array of struct limitation lies. Therefore, I don't think this could be done.

martriay avatar Jan 31 '22 20:01 martriay

I am referring to something like this https://github.com/argentlabs/argent-contracts-starknet/blob/main/contracts/Multicall.cairo

dhruvkelawala avatar Jan 31 '22 20:01 dhruvkelawala