I am new to Vyper and am trying to use the raw_call built in function as defined in the official documentation. I am getting the error where the vyper compiler says that the raw_call function expects 2 arguments and not 5. Is the official documentation wrong here or am I missing something? Would greatly appreciate some help Please find the output and code screenshots attached.
Well there appears to be a difference between regular arguments and arguments with defaults (namely assigned arguments). I did not find documentation about it (maybe its pythonian^^) So this answer is rather based on experience on how it appears to work:
The definition is this:
raw_call(to: address, data: Bytes, max_outsize: int = 0, gas: uint256 = gasLeft, value: uint256 = 0, is_delegate_call: bool = False, is_static_call: bool = False) → Bytes[max_outsize]
Here you may see:
to: address, data: Bytes, max_outsize: int = 0, gas: uint256 = gasLeft, value: uint256 = 0, is_delegate_call: bool = False, is_static_call: bool = False
It appears that these arguments with defaults like
max_outsize do not appear to count in the arguments count. Only the 2 arguments without default are being counted.
Funnily this also means you have to pass them differently - otherwise you get the the error you're having like
expects 2 arguments and not 5.
To fix this you have to pass them like this:
_result:Bytes = raw_call( _target_address, _call_data, max_outsize=32, gas=_max_gas, value=msg.value )