If I call another contract in a function and it reverts, is that call also reverted?

If you call another contract in a function and it reverts, the storage / state changes made for the other contract are also reverted. The entire transaction is atomic, meaning that if the call to the other contract fails, the entire transaction reverts and it will be as if the state updates never happened.

In general, when a contract call is made the called contract may itself call multiple other contracts, updating state and/or sending coins to different contracts, addresses, etc. If at any point in this transaction there is a failing line of code which results in Revert, the entire chain of calls, state-updates, transfers, etc rolls back to the state it was in before the call. Or rather, these changes are never finalized and propagated to the network in the first place because the transaction reverted.

1 Like

Thanks for sharing. i am not a tech guy but I am trying to learn