TransWikia.com

Call few contract methods from another contract consistently

Ethereum Asked by Dmytro Zarezenko on August 26, 2021

Can I call a few contract methods from another contract consistently in one block? The order of methods calls is important!

if (contract.method1.value(msg.value)()) {
   contract.method2(someValue);
}

One Answer

Yes.

The single call to your outer contract will send messages to your inner contracts in exactly the order you expect, every time. They will always execute in the same block because the whole thing is encapsulated in the single transaction to your outer contract, which must be mined in a single block.

Although there is a mining delay before the outer transaction is included in a block, the inner messages are part of it and their execution can be thought of as roughly instantanious.

Hope it helps.

Answered by Rob Hitchens on August 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP