账户
0x53...b8d3
0x53...b8D3

0x53...b8D3

$500
此合同的源代码已经过验证!
合同元数据
编译器
0.8.10+commit.fc410830
语言
Solidity
合同源代码
文件 1 的 2:IOwnership.sol
pragma solidity 0.8.10;

//SPDX-License-Identifier: MIT

interface IOwnership {
    function owner() external view returns (address);

    function futureOwner() external view returns (address);

    function commitTransferOwnership(address newOwner) external;

    function acceptTransferOwnership() external;
}
合同源代码
文件 2 的 2:Ownership.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

import "./interfaces/pool/IOwnership.sol";

contract Ownership is IOwnership {
    address private _owner;
    address private _futureOwner;

    event CommitNewOwnership(address indexed futureOwner);
    event AcceptNewOwnership(address indexed owner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _owner = msg.sender;
        emit AcceptNewOwnership(msg.sender);
    }

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

    function futureOwner() external view override returns (address) {
        return _futureOwner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(_owner == msg.sender, "Caller is not allowed to operate");
        _;
    }

    modifier onlyFutureOwner() {
        require(_futureOwner == msg.sender, "Caller is not allowed to operate");
        _;
    }

    /***
     *@notice Transfer ownership of GaugeController to `newOwner`
     *@param newOwner Address to have ownership transferred to
     */
    function commitTransferOwnership(address newOwner)
        external
        override
        onlyOwner
    {
        _futureOwner = newOwner;
        emit CommitNewOwnership(newOwner);
    }

    /***
     *@notice Accept a transfer of ownership
     */
    function acceptTransferOwnership() external override onlyFutureOwner {
        _owner = msg.sender;
        _futureOwner = address(0);
        emit AcceptNewOwnership(msg.sender);
    }
}
设置
{
  "compilationTarget": {
    "contracts/Ownership.sol": "Ownership"
  },
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": []
}
ABI
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"}],"name":"AcceptNewOwnership","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"futureOwner","type":"address"}],"name":"CommitNewOwnership","type":"event"},{"inputs":[],"name":"acceptTransferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"commitTransferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"futureOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]