You've answered 0 of 46 questions correctly. (Clear)

Question #22 Difficulty: 2

According to the Solidity 0.8.17 compiler (200 optimization runs)

    // What is the value of state variable x after calling Proxy.setX(3)?

contract C {
  address a;
  uint x;

  function setX(uint _x) external {
    x = _x;
  }
}

contract Proxy {

  address public a;
  uint public x;
  address c;

  constructor (address _c) {
    c = _c;
  }

  function setX(uint _x) external {
    (bool success,) = c.delegatecall(abi.encodeWithSignature("setX(uint256)", _x));
    require(success);
  }
}

Answer:

Problems? View a hint or try another question.

I give up, show me the answer (make 3 more attempts first).

Mode : Training

You are currently in training mode, answering random questions. Why not Start a new quiz? Then you can boast about your score, and invite your friends.

Contribute

Create your own!