Privacy preferences

Choose separately whether we may use analytics and advertising measurement. Both stay off unless you turn them on. You can change these choices any time.

All challenges

Challenge 19

Missing ownership check

MediumAccess control

Challenge

A function can change the admin address without any authorization check. Which guard is missing?

Starter code

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract AdminVault {
  address public admin;

  constructor() {
    admin = msg.sender;
  }

  function transferAdmin(address newAdmin) public {
    admin = newAdmin;
  }
}
Show hint

Only authorized callers should be able to reassign critical roles.