![](https://cdn.nodeguardians.io/backend-production/solidity_bg_fc76a87eed/solidity_bg_fc76a87eed.webp)
Standalone
Static Call Detection
![](https://cdn.nodeguardians.io/backend-production/Static_Call_Detection_02_part1_2d86705981/Static_Call_Detection_02_part1_2d86705981.webp)
Sound the Alarms
Download quests in Questplay
View the contracts and any other additional content from your IDE.
The tower guards have recently been complaining about the town's faulty alarm system. It is difficult to distinguish false alarms from real ones, and the guards are getting tired of running to the tower when as much as a bird flies by.
Can you help the guards discern false alarms from real ones?
Your Task
Set solved
in GuardAlarm
to true!
Contract Code
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
contract GuardAlarm {
bool public solved;
function trigger(address _guard) external {
bytes memory _calldata = abi.encodeWithSignature("activate()");
// Trigger false alarm.
(bool success, bytes memory data) = _guard.staticcall(_calldata);
require(success, "False alarm failed");
bool result = abi.decode(data, (bool));
require(!result, "Guard shouldn't activate!");
// Trigger real alarm. This is not a drill!
(success, data) = _guard.call(_calldata);
require(success, "Real alarm failed");
result = abi.decode(data, (bool));
require(result, "Guard shouldn't activate!");
solved = true;
}
}
![](https://cdn.nodeguardians.io/backend-production/Static_Call_Detection_02_part1_2d86705981/Static_Call_Detection_02_part1_2d86705981.webp)
Find a way for the guards to tell the difference between a false alarm and a pirate attack...