Pick a depth. Each prompt opens in your AI pre-loaded with the lesson. Click a row to preview the prompt.
These three opcodes look similar but differ in what context they execute against — and that distinction is the source of nearly every proxy-pattern bug, including the famous Parity multisig freeze. Picking the wrong one can either lock funds permanently or silently let a callee mutate the caller's storage.
Three call variants, three context behaviors.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract Callee {
uint256 public x;
function setX(uint256 v) external { x = v; }
}
contract Caller {
uint256 public x;
address public callee;
// CALL: storage writes hit Callee.x
function viaCall(uint256 v) external {
callee.call(abi.encodeWithSignature("setX(uint256)", v));
}
// DELEGATECALL: storage writes hit Caller.x (msg.sender + storage preserved)
function viaDelegate(uint256 v) external {
callee.delegatecall(abi.encodeWithSignature("setX(uint256)", v));
}
// STATICCALL: read-only; setX would revert
function viaStatic() external view returns (bytes memory) {
(, bytes memory data) = callee.staticcall(abi.encodeWithSignature("x()"));
return data;
}
}