Search code examples
ethereumblockchainsoliditysmartcontractsremix

Is it possible to change two states of different smart contract simultaneously in Ethereum?


For example I have two contracts from two different car company.

The first contract World state looks like this.

Car_name: Volkswagen
Ownership: xxxxxxxxxxxxxxxx

And the second contract World state looks like this.

Car_name: Ferrari
Ownership: null

What I want to do is I want to change the first contact and second contract as below simultaneously.

First contract world state after changes:

Car_name: Volkswagen
Ownership: null

Second contract world state after changes:

Car_name: Ferrari
Ownership: xxxxxxxxxxxxxxxx

Is it possible to do this and if it is can you tell me the name of this technique or some references that I can refer to in order to realize this?


Solution

  • It is possible.

    Try to search keyword such as

    「access data from another contract solidity」or 「update data from another contract solidity」,etc

    Below Youtube Channel helps me greatly in understanding what I want to do.

    https://www.youtube.com/watch?v=YxU87o4U5iw

    This website below also helps in my understanding.

    https://www.zupzup.org/smart-contract-interaction/