OpenZeppelin / cairo-contracts

OpenZeppelin Contracts written in Cairo for Starknet, a decentralized ZK Rollup
https://docs.openzeppelin.com/contracts-cairo
MIT License
823 stars 335 forks source link

A Multicall Contract for View Functions? #173

Open dhruvkelawala opened 2 years ago

dhruvkelawala commented 2 years ago

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?

martriay commented 2 years ago

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.

dhruvkelawala commented 2 years ago

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