Q: Create 3 smart contracts with the below functions
Level: Medium
- First smart contract
Create a function to check if the “msg.sender” is a contract address or a non-smart contract address by using “extcodesize” function. This is to protect the smart contract from being interacted by other smart contract.
- Second smart contract
Create a smart contract to interact with the first contract but it will fail due to the check function of the first contract.
- Third smart contract
Create a smart contract to interact with first smart contract and successfully passes the check function of the first contract.
Deploy all the smart contracts to the Ethereum Testnet (Ropsten/Rinkeby)
Verify the source code in Etherscan.
An example has been deployed and Verified on the Ethereum Testnet (Ropsten).
- First smart contract: 0xB09464f86D042d6caEf0D42B9965c1136855Af6C
- Second smart contract: 0x0C4137CB28aAd5d694AB9469b6956807Dfec442c
- Third smart contract: 0x321ab8D72bf692FD073D727379068139c2ae19b9