Address Details
contract

0x463c8fB937dAf0E67017e720431CF2275fb9Bc56

Contract Name
AddressProvider
Creator
0x421c68ā€“95b17d at 0xe33e5eā€“54849b
Balance
0 CELO ( )
Tokens
Fetching tokens...
Transactions
3 Transactions
Transfers
0 Transfers
Gas Used
70,095
Last Balance Update
17027740
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
AddressProvider




Optimization enabled
true
Compiler version
v0.8.6+commit.11564f7e




Optimization runs
200
EVM Version
berlin




Verified at
2022-04-20T00:46:35.365448Z

src/contracts/AddressProvider.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;

import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { IAddressProvider } from "./interfaces/IAddressProvider.sol";

// import { IAddressProvider } from "../interfaces/IAddressProvider.sol";
contract AddressProvider is Ownable, IAddressProvider {
	event DAOSet(address indexed dao_);
	event EmergencyAdminSet(address indexed newAddr_);
	event AddressSet(bytes32 id, address indexed newAddr_);

	mapping(bytes32 => address) private _addresses;
	bytes32 private constant DAO = "DAO";
	bytes32 private constant EMERGENCY_ADMIN = "EMERGENCY_ADMIN";
	bytes32 private constant ORACLE_MASTER = "ORACLE_MASTER";

	function getAddress(bytes32 id_) external view returns (address) {
		return _addresses[id_];
	}

	function setAddress(bytes32 id_, address newAddress_) external onlyOwner {
		require(bytes32(id_).length != 0, "AP: ZR INP");
		require(newAddress_ != address(0), "AP: ZR ADDR");
		_addresses[id_] = newAddress_;
		emit AddressSet(id_, newAddress_);
	}

	/// @dev get & set emergency admin
	function getEmergencyAdmin() external view override returns (address) {
		return _addresses[EMERGENCY_ADMIN];
	}

	function setEmergencyAdmin(address emergencyAdmin_) external onlyOwner {
		require(emergencyAdmin_ != address(0), "AP: ZR ADDR");
		_addresses[EMERGENCY_ADMIN] = emergencyAdmin_;
		emit EmergencyAdminSet(emergencyAdmin_);
	}

	/// @dev get & set dao
	function getDAO() external view override returns (address) {
		return _addresses[DAO];
	}

	function setDAO(address dao_) external onlyOwner {
		require(dao_ != address(0), "AP: ZR ADDR");
		_addresses[DAO] = dao_;
		emit DAOSet(dao_);
	}

	/// @dev get & set dao
	function getOracleMaster() external view override returns (address) {
		return _addresses[ORACLE_MASTER];
	}

	function setOracleMaster(address newAddr_) external onlyOwner {
		require(newAddr_ != address(0), "AP: ZR ADDR");
		_addresses[ORACLE_MASTER] = newAddr_;
		emit AddressSet(ORACLE_MASTER, newAddr_);
	}
}
        

/_openzeppelin/contracts/access/Ownable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
          

/_openzeppelin/contracts/utils/Context.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}
          

/src/contracts/interfaces/IAddressProvider.sol

// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;

interface IAddressProvider {
	function getDAO() external view returns (address);

	function getOracleMaster() external view returns (address);

	function getEmergencyAdmin() external view returns (address);
}
          

Contract ABI

[{"type":"event","name":"AddressSet","inputs":[{"type":"bytes32","name":"id","internalType":"bytes32","indexed":false},{"type":"address","name":"newAddr_","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"DAOSet","inputs":[{"type":"address","name":"dao_","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"EmergencyAdminSet","inputs":[{"type":"address","name":"newAddr_","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getAddress","inputs":[{"type":"bytes32","name":"id_","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getDAO","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getEmergencyAdmin","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getOracleMaster","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setAddress","inputs":[{"type":"bytes32","name":"id_","internalType":"bytes32"},{"type":"address","name":"newAddress_","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setDAO","inputs":[{"type":"address","name":"dao_","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setEmergencyAdmin","inputs":[{"type":"address","name":"emergencyAdmin_","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setOracleMaster","inputs":[{"type":"address","name":"newAddr_","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
            

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063985da72611610071578063985da7261461016a578063ca446dd9146101a9578063d83df4e7146101bc578063ddcaa9ea146101cf578063e73a914c1461021a578063f2fde38b1461022d57600080fd5b806321f8a721146100ae57806335da3394146100f3578063648d0d3314610108578063715018a6146101515780638da5cb5b14610159575b600080fd5b6100d76100bc3660046106d7565b6000908152600160205260409020546001600160a01b031690565b6040516001600160a01b03909116815260200160405180910390f35b6101066101013660046106b5565b610240565b005b6c27a920a1a622afa6a0a9aa22a960991b60005260016020527f808664342989bf0bdb8eeb6fdb2dd1366d7abbd4f9b626fe94a4da18541cf3ee546001600160a01b03166100d7565b61010661031e565b6000546001600160a01b03166100d7565b6244414f60e81b60005260016020527f7938b59dc5bbe4dbc8f12a494ef358143acdde5d46f3aaab2917f7519017bc17546001600160a01b03166100d7565b6101066101b73660046106f0565b610354565b6101066101ca3660046106b5565b610406565b6e22a6a2a923a2a721acafa0a226a4a760891b60005260016020527f5d6349683d5b9a7cf2466354ee0f4c33202478c8fcd33e3291d912a0457d9b38546001600160a01b03166100d7565b6101066102283660046106b5565b6104e5565b61010661023b3660046106b5565b6105ae565b6000546001600160a01b031633146102735760405162461bcd60e51b815260040161026a9061071c565b60405180910390fd5b6001600160a01b0381166102995760405162461bcd60e51b815260040161026a90610751565b6e22a6a2a923a2a721acafa0a226a4a760891b600090815260016020527f5d6349683d5b9a7cf2466354ee0f4c33202478c8fcd33e3291d912a0457d9b3880546001600160a01b0319166001600160a01b03841690811790915560405190917f0ac62e32eb89f41a00a732a8404fe496bce591755fcb1265fbdbfb6e66e65e7e91a250565b6000546001600160a01b031633146103485760405162461bcd60e51b815260040161026a9061071c565b6103526000610649565b565b6000546001600160a01b0316331461037e5760405162461bcd60e51b815260040161026a9061071c565b6001600160a01b0381166103a45760405162461bcd60e51b815260040161026a90610751565b60008281526001602090815260409182902080546001600160a01b0319166001600160a01b03851690811790915591518481527fb37614c7d254ea8d16eb81fa11dddaeb266aa8ba4917980859c7740aff30c691910160405180910390a25050565b6000546001600160a01b031633146104305760405162461bcd60e51b815260040161026a9061071c565b6001600160a01b0381166104565760405162461bcd60e51b815260040161026a90610751565b6c27a920a1a622afa6a0a9aa22a960991b6000819052600160209081527f808664342989bf0bdb8eeb6fdb2dd1366d7abbd4f9b626fe94a4da18541cf3ee80546001600160a01b0319166001600160a01b038516908117909155604051928352917fb37614c7d254ea8d16eb81fa11dddaeb266aa8ba4917980859c7740aff30c691910160405180910390a250565b6000546001600160a01b0316331461050f5760405162461bcd60e51b815260040161026a9061071c565b6001600160a01b0381166105355760405162461bcd60e51b815260040161026a90610751565b6244414f60e81b600090815260016020527f7938b59dc5bbe4dbc8f12a494ef358143acdde5d46f3aaab2917f7519017bc1780546001600160a01b0319166001600160a01b03841690811790915560405190917f8aad84fcad50e723fa3bcf0fb32c5bea4c71078b77b9aedfa638f146f3a3f7b991a250565b6000546001600160a01b031633146105d85760405162461bcd60e51b815260040161026a9061071c565b6001600160a01b03811661063d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161026a565b61064681610649565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b03811681146106b057600080fd5b919050565b6000602082840312156106c757600080fd5b6106d082610699565b9392505050565b6000602082840312156106e957600080fd5b5035919050565b6000806040838503121561070357600080fd5b8235915061071360208401610699565b90509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600b908201526a20a81d102d291020a2222960a91b60408201526060019056fea26469706673582212208021334f13c63f310446b2b859bbff30f938a66a977ecf76b6f3879dfeb2d76864736f6c63430008060033