Why do I need to use admin to call admin()?

:computer: Environment

:memo:Details

:1234: Code to reproduce

// BaseAdminUpgradeabilityProxy.sol
  /**
   * @dev Modifier to check whether the `msg.sender` is the admin.
   * If it is, it will run the function. Otherwise, it will delegate the call
   * to the implementation.
   */
  modifier ifAdmin() {
    if (msg.sender == _admin()) {
      _;
    } else {
      _fallback();
    }
  }
 /**
 * @return The address of the proxy admin.
 */
 function admin() external ifAdmin returns (address) {
      return _admin();
 }
1 Like

Good question, I think they want to ensure that the admin can only call the functions in the proxy rather than in the implementation, cause sometimes there will be function name clashing.

2 Likes

Hi @Miracle_Chan,

@Skyge is exactly right. :pray:

See the documentation on Transparent Proxies and Function Clashes for more details:

ok, I might understand.

1 Like

Hi @Miracle_Chan,

Feel free to ask all the questions that you need.
Suggestions on how to improve the documentation appreciated.