DApp low-level or high-level calls among contracts

Hi there, a DApp I’m working on has quite a bunch of smart contracts that make (high-level) calls to each other quite frequently. I’m just wondering if these calls should be made low-level calls or high-level calls are fine. What is the guideline of making such decisions? Thanks.

What do you mean by high level or low level calls?

We normally use “low level call” to mean the .call syntax in Solidity. If this is what you mean, you generally want to avoid using this kind of call.

Is it true that the reason a low-level call for transferFrom and transfer is used is a bool value of whether the call is successful or not can be returned? I asked this question in this post before.

Does that also imply whenever a bool value is required, a low-level call can be implemented to ensure a bool value can be returned no matter if the function in the called contract returns a bool or not?

I think this is the same logic. Any other concerns?

A related question is if a private or internal function should return a bool value. I think I asked this question before but have not got an answer. Please take a look and any in-depth answer is highly appreciated. :coffee:

Sorry I did not understand this question fully.

The fact that ERC20 transfer and transferFrom return bool is unrelated to low-level calls returning bool. I actually am not sure of the historical reasons why they have a bool return value.

.call returns a boolean to symbolize whether the function call reverts. If ERC20 operations return a boolean, they definitely did not revert, otherwise they could not have returned a value.

1 Like