makerdao / multicall

Multicall: Aggregate multiple constant function call results into one
MIT License
854 stars 461 forks source link

Multicall supports writing function calls? #40

Open fqlx opened 2 years ago

fqlx commented 2 years ago

In the multicall.sol contract: https://github.com/makerdao/multicall/blob/master/src/Multicall.sol#L7

Aggregate results from multiple read-only function calls

As far as I'm aware, it supports writing to function calls. Is this correct? I believe this comment is wrong where it says read-only? And it does not support payable or passing msg.value?

brian-man commented 2 years ago

Agreed. There needs to be multistaticcall() with view. Right?

On Heco, you can see someone added massGetBalance():

    function massGetBalance(IERC20 _token,address[] memory _addressList) public view returns (returnItem memory tokenInfo,balanceItem[] memory balanceList ){
        tokenInfo.decimals = _token.decimals();
        tokenInfo.symbol = _token.symbol();
        tokenInfo.name = _token.name();
        balanceList = new balanceItem[](_addressList.length);
        for (uint256 i=0;i<_addressList.length;i++) {
            balanceList[i] = balanceItem(_addressList[i],_token.balanceOf(_addressList[i]),_addressList[i].balance,isContract(_addressList[i]));
        }
    }

https://hecoinfo.com/address/0x7991A60f01078c451FD6FdA821459B6585a55994#code

Note the view.