EthereumEthereum
0x14...2069
Energi

Energi

NRGE

代币
市值
$1.00
 
价格
2%
此合同的源代码已经过验证!
合同元数据
编译器
0.5.16+commit.9c3226ce
语言
Solidity
合同源代码
文件 1 的 2:EnergiTokenProxy.sol
// Copyright (C) 2020 Energi Core

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

pragma solidity ^0.5.0;

import './IEnergiTokenProxy.sol';

contract EnergiTokenProxy is IEnergiTokenProxy {

    address public delegate;

    address public proxyOwner;

    modifier onlyProxyOwner {
        require(msg.sender == proxyOwner, 'EnergiTokenProxy: FORBIDDEN');
        _;
    }

    constructor(address _owner, address _delegate) public {
        proxyOwner = _owner;
        delegate = _delegate;
    }

    function setProxyOwner(address _owner) external onlyProxyOwner {
        proxyOwner = _owner;
    }

    function upgradeDelegate(address _delegate) external onlyProxyOwner {
        delegate = _delegate;
    }

    function () external payable {

        address _delegate = delegate;
        require(_delegate != address(0));

        assembly {
            let ptr := mload(0x40)
            calldatacopy(ptr, 0, calldatasize)
            let result := delegatecall(gas, _delegate, ptr, calldatasize, 0, 0)
            let size := returndatasize
            returndatacopy(ptr, 0, size)

            switch result
            case 0 { revert(ptr, size) }
            default { return(ptr, size) }
        }
    }
}
合同源代码
文件 2 的 2:IEnergiTokenProxy.sol
// Copyright (C) 2020 Energi Core

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

pragma solidity ^0.5.0;

interface IEnergiTokenProxy {

    function proxyOwner() external view returns (address);

    function delegate() external view returns (address);

    function setProxyOwner(address _owner) external;

    function upgradeDelegate(address _delegate) external;
}
设置
{
  "compilationTarget": {
    "EnergiTokenProxy.sol": "EnergiTokenProxy"
  },
  "evmVersion": "istanbul",
  "libraries": {},
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": []
}
ABI
[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_delegate","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":true,"inputs":[],"name":"delegate","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"proxyOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setProxyOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_delegate","type":"address"}],"name":"upgradeDelegate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]