AdminVault.sol

Overview

The AdminVault contract is a Solidity smart contract responsible for managing the owner and admin roles within a decentralized application (DApp) or smart contract ecosystem. It allows the admin to change the owner and set a new admin for the contract, enabling flexibility and control over the contract's management.

Contract Information

  • SPDX-License-Identifier: MIT

  • Solidity Version: 0.8.10

State Variables

  • address public owner: This state variable represents the current owner of the contract, who has certain privileges and control over the contract's operations.

  • address public admin: This state variable represents the current admin of the contract, who can change the owner and set a new admin.

Custom Error

The contract defines one custom error that can be thrown during execution:

  1. SenderNotAdmin(): This error is thrown when a function is called that requires the sender to be the admin, but the sender is not the admin according to the admin state variable.

Public Functions

  1. changeOwner(address _owner)

    • Visibility: Public

    • Parameters:

      • _owner: The address of the new owner to be set.

    This function allows the admin to change the owner of the contract. It checks if the sender is the admin and, if so, updates the owner state variable to the provided _owner address.

  2. changeAdmin(address _admin)

    • Visibility: Public

    • Parameters:

      • _admin: The address of the new admin to be set.

    This function allows the admin to set a new admin for the contract. It checks if the sender is the admin and, if so, updates the admin state variable to the provided _admin address.

Last updated