Low-Level Calls

close button

Part I

Using call()

Download quests in Questplay

View the contracts and any other additional content from your IDE.

How does call() work?

Your Task

  1. Set harvestedCrops value to 100

  2. Set fedCows[8] to 10000

Contract Code

// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; contract Farm1 { Tractor public tractor; uint256 public harvestedCrops; mapping(uint32 => uint32) public fedCows; constructor() { tractor = new Tractor(); } /// @dev Can only be called by tractor function harvestCrops(uint256 count) external { require(msg.sender == address(tractor)); harvestedCrops = count; } /// @dev Can only be called by tractor function feedCow(uint32 cowId, uint32 amount) external { require(msg.sender == address(tractor)); fedCows[cowId] = amount; } } contract Tractor { function drive( bytes calldata _instructions, address _target ) external { (bool result, ) =; require(result, "Call failed"); } }

Help Old Man Otto use the mechanized farm wagon to feed his favorite cow and harvest his crops.