Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- EAssetToken_2
- Optimization enabled
- true
- Compiler version
- v0.5.16+commit.9c3226ce
- Optimization runs
- 200
- EVM Version
- petersburg
- Verified at
- 2021-09-27 19:35:26.330431Z
Constructor Arguments
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030500000000000000000000000079f10487a8c0ed4e09045841160d01a7ecb9624400000000000000000000000079f10487a8c0ed4e09045841160d01a7ecb9624400000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000013456e6a696e20436f696e204020456e65726769000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003454e4a0000000000000000000000000000000000000000000000000000000000
Arg [0] (address) : 0x0000000000000000000000000000000000000000
Arg [1] (address) : 0x0000000000000000000000000000000000000305
Arg [2] (address) : 0x79f10487a8c0ed4e09045841160d01a7ecb96244
Arg [3] (address) : 0x79f10487a8c0ed4e09045841160d01a7ecb96244
Arg [4] (string) : Enjin Coin @ Energi
Arg [5] (string) : ENJ
Arg [6] (uint8) : 18
Contract source code
pragma solidity 0.5.16;
// File: interfaces/IGovernedContract.sol
// Copyright 2019 The Energi Core Authors
// This file is part of Energi Core.
//
// Energi Core 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.
//
// Energi Core 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 Energi Core. If not, see <http://www.gnu.org/licenses/>.
// Energi Governance system is the fundamental part of Energi Core.
// NOTE: It's not allowed to change the compiler due to byte-to-byte
// match requirement.
/**
* Genesis version of GovernedContract interface.
*
* Base Consensus interface for upgradable contracts.
* Unlike common approach, the implementation is NOT expected to be
* called through delegatecall() to minimize risks of shared storage.
*
* NOTE: it MUST NOT change after blockchain launch!
*/
interface IGovernedContract {
// Return actual proxy address for secure validation
function proxy() external returns(address);
// It must check that the caller is the proxy
// and copy all required data from the old address.
function migrate(IGovernedContract _oldImpl) external;
// It must check that the caller is the proxy
// and self destruct to the new address.
function destroy(IGovernedContract _newImpl) external;
// function () external payable; // This line (from original Energi IGovernedContract) is commented because it
// makes truffle migrations fail
}
// File: GovernedContract.sol
// Copyright 2019 The Energi Core Authors
// This file is part of Energi Core.
//
// Energi Core 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.
//
// Energi Core 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 Energi Core. If not, see <http://www.gnu.org/licenses/>.
// Energi Governance system is the fundamental part of Energi Core.
// NOTE: It's not allowed to change the compiler due to byte-to-byte
// match requirement.
/**
* Genesis version of GovernedContract common base.
*
* Base Consensus interface for upgradable contracts.
* Unlike common approach, the implementation is NOT expected to be
* called through delegatecall() to minimize risks of shared storage.
*
* NOTE: it MUST NOT change after blockchain launch!
*/
contract GovernedContract is IGovernedContract {
address public proxy;
constructor(address _proxy) public {
proxy = _proxy;
}
modifier requireProxy {
require(msg.sender == proxy, "Not proxy");
_;
}
function migrate(IGovernedContract _oldImpl) external requireProxy {
_migrate(_oldImpl);
}
function destroy(IGovernedContract _newImpl) external requireProxy {
_destroy(_newImpl);
selfdestruct(address(uint160(address(_newImpl))));
}
// solium-disable-next-line no-empty-blocks
function _migrate(IGovernedContract) internal {}
// solium-disable-next-line no-empty-blocks
function _destroy(IGovernedContract) internal {}
function _callerAddress()
internal view
returns (address payable)
{
if (msg.sender == proxy) {
// This is guarantee of the GovernedProxy
// solium-disable-next-line security/no-tx-origin
return tx.origin;
} else {
return msg.sender;
}
}
}
// File: interfaces/IProposal.sol
// Copyright 2019 The Energi Core Authors
// This file is part of Energi Core.
//
// Energi Core 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.
//
// Energi Core 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 Energi Core. If not, see <http://www.gnu.org/licenses/>.
// Energi Governance system is the fundamental part of Energi Core.
// NOTE: It's not allowed to change the compiler due to byte-to-byte
// match requirement.
interface IProposal {
function parent() external view returns(address);
function created_block() external view returns(uint);
function deadline() external view returns(uint);
function fee_payer() external view returns(address payable);
function fee_amount() external view returns(uint);
function accepted_weight() external view returns(uint);
function rejected_weight() external view returns(uint);
function total_weight() external view returns(uint);
function quorum_weight() external view returns(uint);
function isFinished() external view returns(bool);
function isAccepted() external view returns(bool);
function withdraw() external;
function destroy() external;
function collect() external;
function voteAccept() external;
function voteReject() external;
function setFee() external payable;
function canVote(address owner) external view returns(bool);
}
// File: interfaces/IUpgradeProposal.sol
// Copyright 2019 The Energi Core Authors
// This file is part of Energi Core.
//
// Energi Core 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.
//
// Energi Core 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 Energi Core. If not, see <http://www.gnu.org/licenses/>.
// Energi Governance system is the fundamental part of Energi Core.
// NOTE: It's not allowed to change the compiler due to byte-to-byte
// match requirement.
/**
* Interface of UpgradeProposal
*/
contract IUpgradeProposal is IProposal {
function impl() external view returns(IGovernedContract);
}
// File: interfaces/IGovernedProxy.sol
// Copyright 2019 The Energi Core Authors
// This file is part of Energi Core.
//
// Energi Core 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.
//
// Energi Core 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 Energi Core. If not, see <http://www.gnu.org/licenses/>.
// Energi Governance system is the fundamental part of Energi Core.
// NOTE: It's not allowed to change the compiler due to byte-to-byte
// match requirement.
//pragma experimental SMTChecker;
/**
* Genesis version of IGovernedProxy interface.
*
* Base Consensus interface for upgradable contracts proxy.
* Unlike common approach, the implementation is NOT expected to be
* called through delegatecall() to minimize risks of shared storage.
*
* NOTE: it MUST NOT change after blockchain launch!
*/
interface IGovernedProxy {
event UpgradeProposal(
IGovernedContract indexed impl,
IUpgradeProposal proposal
);
event Upgraded(
IGovernedContract indexed impl,
IUpgradeProposal proposal
);
function impl() external view returns(IGovernedContract);
function proposeUpgrade(IGovernedContract _newImpl, uint _period)
external payable returns(IUpgradeProposal);
function upgrade(IUpgradeProposal _proposal) external;
function upgradeProposalImpl(IUpgradeProposal _proposal) external view returns(IGovernedContract new_impl);
function listUpgradeProposals() external view returns(IUpgradeProposal[] memory proposals);
function collectUpgradeProposal(IUpgradeProposal _proposal) external;
function () external payable;
}
// File: interfaces/IGovernedERC20Proxy.sol
// Copyright 2019 The Energi Core Authors
// This file is part of Energi Core.
//
// Energi Core 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.
//
// Energi Core 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 Energi Core. If not, see <http://www.gnu.org/licenses/>.
// Energi Governance system is the fundamental part of Energi Core.
// NOTE: It's not allowed to change the compiler due to byte-to-byte
// match requirement.
/**
* Genesis version of IGovernedProxy interface.
*
* Base Consensus interface for upgradable contracts proxy.
* Unlike common approach, the implementation is NOT expected to be
* called through delegatecall() to minimize risks of shared storage.
*
* NOTE: it MUST NOT change after blockchain launch!
*/
interface IGovernedERC20Proxy {
event UpgradeProposal(
IGovernedContract indexed impl,
IUpgradeProposal proposal
);
event Upgraded(
IGovernedContract indexed impl,
IUpgradeProposal proposal
);
// ERC20 standard interface
function name() external view returns(string memory _name);
function symbol() external view returns(string memory _symbol);
function decimals() external view returns(uint _decimals);
function balanceOf(address account) external view returns(uint _balance);
function allowance(address owner, address spender) external view returns(uint _allowance);
function totalSupply() external view returns(uint _totalSupply);
function approve(address spender, uint value) external returns (bool result);
function transfer(address to, uint value) external returns (bool result);
function transferFrom(address from, address to, uint value) external returns (bool result);
function increaseAllowance(address spender, uint256 addedValue) external returns (bool result);
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool result);
// Energi governance interface
function impl() external view returns(IGovernedContract);
function proposeUpgrade(IGovernedContract _newImpl, uint _period) external payable returns(IUpgradeProposal);
function upgrade(IUpgradeProposal _proposal) external;
function upgradeProposalImpl(IUpgradeProposal _proposal) external view returns(IGovernedContract new_impl);
function listUpgradeProposals() external view returns(IUpgradeProposal[] memory proposals);
function collectUpgradeProposal(IUpgradeProposal _proposal) external;
function () external payable;
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed _owner, address indexed spender, uint256 value);
}
// File: interfaces/ISporkRegistry.sol
// Copyright 2019 The Energi Core Authors
// This file is part of Energi Core.
//
// Energi Core 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.
//
// Energi Core 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 Energi Core. If not, see <http://www.gnu.org/licenses/>.
// Energi Governance system is the fundamental part of Energi Core.
// NOTE: It's not allowed to change the compiler due to byte-to-byte
// match requirement.
interface ISporkRegistry {
function createUpgradeProposal(
IGovernedContract _impl,
uint _period,
address payable _fee_payer
)
external payable
returns (IUpgradeProposal);
function consensusGasLimits()
external view
returns(uint callGas, uint xferGas);
}
// File: NonReentrant.sol
// Copyright 2019 The Energi Core Authors
// This file is part of Energi Core.
//
// Energi Core 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.
//
// Energi Core 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 Energi Core. If not, see <http://www.gnu.org/licenses/>.
// Energi Governance system is the fundamental part of Energi Core.
// NOTE: It's not allowed to change the compiler due to byte-to-byte
// match requirement.
/**
* A little helper to protect contract from being re-entrant in state
* modifying functions.
*/
contract NonReentrant {
uint private entry_guard;
modifier noReentry {
require(entry_guard == 0, "Reentry");
entry_guard = 1;
_;
entry_guard = 0;
}
}
// File: interfaces/IGovernedERC20.sol
// Copyright (C) 2021 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/>.
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IGovernedERC20 {
function governedERC20Proxy() external view returns(address _governedERC20Proxy);
function erc20Storage() external view returns(address _erc20Storage);
function name() external view returns(string memory _name);
function symbol() external view returns(string memory _symbol);
function decimals() external view returns(uint8 _decimals);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address sender, address recipient, uint256 amount) external returns (bool);
function approve(address owner, address spender, uint256 amount) external returns (bool);
function transferFrom(address spender, address sender, address recipient, uint256 amount) external returns (bool);
function increaseAllowance(address sender, address spender, uint256 addedValue) external returns (bool);
function decreaseAllowance(address sender, address spender, uint256 subtractedValue) external returns (bool);
}
// File: interfaces/IOwnedERC20.sol
interface IOwnedERC20 {
function owner() external view returns(address _owner);
function mint(address recipient, uint amount) external;
function burn(address recipient, uint amount) external;
function setOwner(address _owner) external;
}
// File: libraries/SafeMath.sol
// Copyright (C) 2021 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/>.
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
// File: GovernedERC20Proxy.sol
// Copyright 2019 The Energi Core Authors
// This file is part of Energi Core.
//
// Energi Core 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.
//
// Energi Core 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 Energi Core. If not, see <http://www.gnu.org/licenses/>.
// Energi Governance system is the fundamental part of Energi Core.
// NOTE: It's not allowed to change the compiler due to byte-to-byte
// match requirement.
/**
* SC-9: This contract has no chance of being updated. It must be stupid simple.
*
* If another upgrade logic is required in the future - it can be done as proxy stage II.
*/
contract GovernedERC20Proxy is IGovernedERC20Proxy, NonReentrant {
using SafeMath for uint;
IGovernedContract public impl;
IGovernedProxy public spork_proxy;
mapping(address => IGovernedContract) public upgrade_proposals;
IUpgradeProposal[] public upgrade_proposal_list;
modifier senderOrigin {
// Internal calls are expected to use impl directly.
// That's due to use of call() instead of delegatecall() on purpose.
// solium-disable-next-line security/no-tx-origin
require(tx.origin == msg.sender, "Only direct calls are allowed!");
_;
}
modifier onlyImpl {
require(msg.sender == address(impl), "Only calls from impl are allowed!");
_;
}
constructor(IGovernedContract _impl, IGovernedProxy _sporkProxy) public {
impl = _impl;
spork_proxy = _sporkProxy;
}
// ERC20 standard functions
function name() external view returns(string memory _name) {
_name = IGovernedERC20(address(uint160(address(impl)))).name();
}
function symbol() external view returns(string memory _symbol) {
_symbol = IGovernedERC20(address(uint160(address(impl)))).symbol();
}
function decimals() external view returns(uint _decimals) {
_decimals = IGovernedERC20(address(uint160(address(impl)))).decimals();
}
function balanceOf(address account) external view returns(uint _balance) {
_balance = IGovernedERC20(address(uint160(address(impl)))).balanceOf(account);
}
function allowance(address owner, address spender) external view returns(uint _allowance) {
_allowance = IGovernedERC20(address(uint160(address(impl)))).allowance(owner, spender);
}
function totalSupply() external view returns(uint _totalSupply) {
_totalSupply = IGovernedERC20(address(uint160(address(impl)))).totalSupply();
}
function approve(address spender, uint value) external returns (bool result) {
result = IGovernedERC20(address(uint160(address(impl)))).approve(msg.sender, spender, value);
emit Approval(msg.sender, spender, value);
}
function transfer(address to, uint value) external returns (bool result) {
result = IGovernedERC20(address(uint160(address(impl)))).transfer(msg.sender, to, value);
emit Transfer(msg.sender, to, value);
}
function transferFrom(address from, address to, uint value) external returns (bool result) {
result = IGovernedERC20(address(uint160(address(impl)))).transferFrom(msg.sender, from, to, value);
emit Transfer(from, to, value);
uint newApproveAmount = IGovernedERC20(address(uint160(address(impl)))).allowance(from, msg.sender);
emit Approval(from, msg.sender, newApproveAmount);
}
function increaseAllowance(address spender, uint256 addedValue) external returns (bool result) {
result = IGovernedERC20(address(uint160(address(impl)))).increaseAllowance(msg.sender, spender, addedValue);
uint newApproveAmount = IGovernedERC20(address(uint160(address(impl)))).allowance(msg.sender, spender);
emit Approval(msg.sender, spender, newApproveAmount);
}
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool result) {
result = IGovernedERC20(address(uint160(address(impl)))).decreaseAllowance(msg.sender, spender, subtractedValue);
uint newApproveAmount = IGovernedERC20(address(uint160(address(impl)))).allowance(msg.sender, spender);
emit Approval(msg.sender, spender, newApproveAmount);
}
// OwnedERC20 funtions
function mint(address recipient, uint amount) external {
IOwnedERC20(address(uint160(address(impl)))).mint(recipient, amount);
emit Transfer(address(0), recipient, amount);
}
function burn(address recipient, uint amount) external {
IOwnedERC20(address(uint160(address(impl)))).burn(recipient, amount);
emit Transfer(recipient, address(0), amount);
}
// Governance functions
/**
* Pre-create a new contract first.
* Then propose upgrade based on that.
*/
function proposeUpgrade(IGovernedContract _newImpl, uint _period)
external payable
senderOrigin
noReentry
returns(IUpgradeProposal)
{
require(_newImpl != impl, "Already active!");
require(_newImpl.proxy() == address(this), "Wrong proxy!");
ISporkRegistry spork_reg = ISporkRegistry(address(spork_proxy.impl()));
IUpgradeProposal proposal = spork_reg.createUpgradeProposal.value(msg.value)(_newImpl, _period, msg.sender);
upgrade_proposals[address(proposal)] = _newImpl;
upgrade_proposal_list.push(proposal);
emit UpgradeProposal(_newImpl, proposal);
return proposal;
}
/**
* Once proposal is accepted, anyone can activate that.
*/
function upgrade(IUpgradeProposal _proposal)
external
noReentry
{
IGovernedContract new_impl = upgrade_proposals[address(_proposal)];
require(new_impl != impl, "Already active!"); // in case it changes in the flight
require(address(new_impl) != address(0), "Not registered!");
require(_proposal.isAccepted(), "Not accepted!");
IGovernedContract old_impl = impl;
new_impl.migrate(old_impl);
impl = new_impl;
old_impl.destroy(new_impl);
// SECURITY: prevent downgrade attack
_cleanupProposal(_proposal);
// Return fee ASAP
_proposal.destroy();
emit Upgraded(new_impl, _proposal);
}
/**
* Map proposal to implementation
*/
function upgradeProposalImpl(IUpgradeProposal _proposal)
external view
returns(IGovernedContract new_impl)
{
new_impl = upgrade_proposals[address(_proposal)];
}
/**
* Lists all available upgrades
*/
function listUpgradeProposals()
external view
returns(IUpgradeProposal[] memory proposals)
{
uint len = upgrade_proposal_list.length;
proposals = new IUpgradeProposal[](len);
for (uint i = 0; i < len; ++i) {
proposals[i] = upgrade_proposal_list[i];
}
return proposals;
}
/**
* Once proposal is reject, anyone can start collect procedure.
*/
function collectUpgradeProposal(IUpgradeProposal _proposal)
external
noReentry
{
IGovernedContract new_impl = upgrade_proposals[address(_proposal)];
require(address(new_impl) != address(0), "Not registered!");
_proposal.collect();
delete upgrade_proposals[address(_proposal)];
_cleanupProposal(_proposal);
}
function _cleanupProposal(IUpgradeProposal _proposal) internal {
delete upgrade_proposals[address(_proposal)];
uint len = upgrade_proposal_list.length;
for (uint i = 0; i < len; ++i) {
if (upgrade_proposal_list[i] == _proposal) {
upgrade_proposal_list[i] = upgrade_proposal_list[len - 1];
upgrade_proposal_list.pop();
break;
}
}
}
/**
* Related to above
*/
function proxy() external view returns (address) {
return address(this);
}
/**
* SECURITY: prevent on-behalf-of calls
*/
function migrate(IGovernedContract) external pure {
revert("Good try");
}
/**
* SECURITY: prevent on-behalf-of calls
*/
function destroy(IGovernedContract) external pure {
revert("Good try");
}
/**
* Proxy all other calls to implementation.
*/
function ()
external payable
senderOrigin
{
// SECURITY: senderOrigin() modifier is mandatory
IGovernedContract impl_m = impl;
// solium-disable-next-line security/no-inline-assembly
assembly {
let ptr := mload(0x40)
calldatacopy(ptr, 0, calldatasize)
let res := call(sub(gas, 10000), impl_m, callvalue, ptr, calldatasize, 0, 0)
// NOTE: returndatasize should allow repeatable calls
// what should save one opcode.
returndatacopy(ptr, 0, returndatasize)
switch res
case 0 {
revert(ptr, returndatasize)
}
default {
return(ptr, returndatasize)
}
}
}
}
// File: GovernedEAssetTokenAutoProxy.sol
// Copyright (C) 2021 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/>.
contract GovernedEAssetTokenAutoProxy is GovernedContract {
constructor (
address _proxy,
IGovernedProxy _sporkProxy,
IGovernedContract _impl
) public GovernedContract(_proxy) {
if(_proxy == address(0)){
_proxy = address(new GovernedERC20Proxy(_impl, _sporkProxy));
}
proxy = _proxy;
}
}
// File: interfaces/IEAssetToken_2.sol
// Copyright (C) 2021 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/>.
interface IEAssetToken_2 {
function eAssetTokenStorage() external view returns(address _eAssetTokenStorage);
function owner() external view returns(address _owner);
function minter() external view returns(address _minter);
function setOwner(address _eAssetTokenOwner) external;
function setMinter(address _eAssetTokenMinter) external;
function setName(string calldata _name) external;
function setSymbol(string calldata _name) external;
function name() external view returns(string memory _name);
function symbol() external view returns(string memory _symbol);
function decimals() external view returns(uint8 _decimals);
function mint(address recipient, uint amount) external;
function burn(address recipient, uint amount) external;
}
// File: interfaces/IEAssetTokenStorage_2.sol
// Copyright (C) 2021 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/>.
interface IEAssetTokenStorage_2 {
function setEAssetTokenOwner(address _eAssetTokenOwner) external;
function setEAssetTokenMinter(address _eAssetTokenMinter) external;
function setName(string calldata _name) external;
function setSymbol(string calldata _symbol) external;
function getEAssetTokenOwner() external view returns(address _owner);
function getEAssetTokenMinter() external view returns(address _minter);
function getName() external view returns(string memory _name);
function getSymbol() external view returns(string memory _symbol);
function getDecimals() external view returns(uint8 _decimals);
}
// File: StorageBase.sol
// This file is part of Energi Core.
//
// Energi Core 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.
//
// Energi Core 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 Energi Core. If not, see <http://www.gnu.org/licenses/>.
// Energi Governance system is the fundamental part of Energi Core.
// NOTE: It's not allowed to change the compiler due to byte-to-byte
// match requirement.
/**
* Base for contract storage (SC-14).
*
* NOTE: it MUST NOT change after blockchain launch!
*/
contract StorageBase {
address payable internal owner;
modifier requireOwner {
require(msg.sender == address(owner), "Not owner!");
_;
}
constructor() public {
owner = msg.sender;
}
function setOwner(IGovernedContract _newOwner) external requireOwner {
owner = address(uint160(address(_newOwner)));
}
function kill() external requireOwner {
selfdestruct(msg.sender);
}
}
// File: Context.sol
// Copyright (C) 2021 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/>.
/*
* @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 GSN 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.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _txOrigin() internal view returns (address payable) {
return tx.origin;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: interfaces/IGovernedERC20Storage.sol
// Copyright (C) 2021 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/>.
interface IGovernedERC20Storage {
function setBalance(address _owner, uint256 _amount) external;
function setAllowance(address _owner, address _spender, uint256 _amount) external;
function setTotalSupply(uint256 _amount) external;
function getBalance(address _account) external view returns(uint256 balance);
function getAllowance(address _owner, address _spender) external view returns(uint256 allowance);
function getTotalSupply() external view returns(uint256 totalSupply);
}
// File: GovernedERC20.sol
// Copyright (C) 2021 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/>.
/**
* Permanent storage of GovernedERC20 data.
*/
contract GovernedERC20Storage is StorageBase, IGovernedERC20Storage {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
function setBalance(address _owner, uint256 _amount) external requireOwner {
_balances[_owner] = _amount;
}
function setAllowance(address _owner, address _spender, uint256 _amount) external requireOwner {
_allowances[_owner][_spender] = _amount;
}
function setTotalSupply(uint256 _amount) external requireOwner {
_totalSupply = _amount;
}
function getBalance(address _account) external view returns(uint256 balance) {
balance = _balances[_account];
}
function getAllowance(address _owner, address _spender) external view returns(uint256 allowance) {
allowance = _allowances[_owner][_spender];
}
function getTotalSupply() external view returns(uint256 totalSupply){
totalSupply = _totalSupply;
}
}
contract GovernedERC20 is Context, IGovernedERC20 {
using SafeMath for uint256;
// Data for migration
//---------------------------------
GovernedERC20Storage public erc20Storage;
//---------------------------------
address public governedERC20Proxy;
modifier onlyProxy {
require(_msgSender() == governedERC20Proxy, 'EAssetToken: FORBIDDEN');
_;
}
constructor() public {
erc20Storage = new GovernedERC20Storage();
}
function setProxy(address _proxy) internal {
governedERC20Proxy = _proxy;
}
// IGovernedContract
//---------------------------------
// This function would be called by GovernedProxy on an old implementation to be replaced by a new one
function _destroyERC20(IGovernedContract _newImpl) internal {
erc20Storage.setOwner(_newImpl);
}
//---------------------------------
// ERC20
//---------------------------------
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() external view returns (uint256) {
return erc20Storage.getTotalSupply();
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) external view returns (uint256) {
return erc20Storage.getBalance(account);
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) external view returns (uint256) {
return erc20Storage.getAllowance(owner, spender);
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address sender, address recipient, uint256 amount) external onlyProxy returns (bool) {
_transfer(sender, recipient, amount);
return true;
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address owner, address spender, uint256 amount) external onlyProxy returns (bool) {
_approve(owner, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address spender, address sender, address recipient, uint256 amount) external onlyProxy returns (bool) {
_transfer(sender, recipient, amount);
uint approveAmount = erc20Storage.getAllowance(sender, spender).sub(amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, spender, approveAmount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address owner, address spender, uint256 addedValue) external onlyProxy returns (bool) {
uint approveAmount = erc20Storage.getAllowance(owner, spender).add(addedValue);
_approve(owner, spender, approveAmount);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address owner, address spender, uint256 subtractedValue) external onlyProxy returns (bool) {
uint approveAmount = erc20Storage.getAllowance(owner, spender).sub(subtractedValue, "ERC20: decreased allowance below zero");
_approve(owner, spender, approveAmount);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
erc20Storage.setBalance(sender, erc20Storage.getBalance(sender).sub(amount, "ERC20: transfer amount exceeds balance"));
erc20Storage.setBalance(recipient, erc20Storage.getBalance(recipient).add(amount));
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
erc20Storage.setTotalSupply(erc20Storage.getTotalSupply().add(amount));
erc20Storage.setBalance(account, erc20Storage.getBalance(account).add(amount));
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
erc20Storage.setBalance(account, erc20Storage.getBalance(account).sub(amount, "ERC20: burn amount exceeds balance"));
erc20Storage.setTotalSupply(erc20Storage.getTotalSupply().sub(amount));
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
erc20Storage.setAllowance(owner, spender, amount);
}
}
// File: eAssetToken_2.sol
// Copyright (C) 2021 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/>.
/**
* Permanent storage of Masternode Token V1 data.
*/
contract EAssetTokenStorage_2 is StorageBase, IEAssetTokenStorage_2 {
address private eAssetTokenOwner; // Can mint and burn EAssetToken, and set name and symbol
address private eAssetTokenMinter; // Can mint and burn EAssetToken
string private name;
string private symbol;
uint8 private decimals;
constructor(
address _eAssetTokenOwner,
address _eAssetTokenMinter,
string memory _name,
string memory _symbol,
uint8 _decimals
) public {
eAssetTokenOwner = _eAssetTokenOwner;
eAssetTokenMinter = _eAssetTokenMinter;
name = _name;
symbol = _symbol;
decimals = _decimals;
}
function setEAssetTokenOwner(address _eAssetTokenOwner) external requireOwner {
eAssetTokenOwner = _eAssetTokenOwner;
}
function setEAssetTokenMinter(address _eAssetTokenMinter) external requireOwner {
eAssetTokenMinter = _eAssetTokenMinter;
}
function setName(string calldata _name) external requireOwner {
name = _name;
}
function setSymbol(string calldata _symbol) external requireOwner {
symbol = _symbol;
}
function getEAssetTokenOwner() external view returns(address _owner) {
_owner = eAssetTokenOwner;
}
function getEAssetTokenMinter() external view returns(address _minter) {
_minter = eAssetTokenMinter;
}
function getName() external view returns(string memory _name) {
_name = name;
}
function getSymbol() external view returns(string memory _symbol) {
_symbol = symbol;
}
function getDecimals() external view returns(uint8 _decimals) {
_decimals = decimals;
}
}
contract EAssetToken_2 is GovernedEAssetTokenAutoProxy, GovernedERC20, IEAssetToken_2 {
// Data for migration
//---------------------------------
EAssetTokenStorage_2 public eAssetTokenStorage;
//---------------------------------
modifier onlyEAssetTokenOwner {
require(_txOrigin() == eAssetTokenStorage.getEAssetTokenOwner(), 'EAssetToken: FORBIDDEN');
_;
}
modifier onlyEAssetTokenOwnerOrMinter {
require(
_txOrigin() == eAssetTokenStorage.getEAssetTokenOwner()
|| _txOrigin() == eAssetTokenStorage.getEAssetTokenMinter(),
'EAssetToken: FORBIDDEN'
);
_;
}
constructor(
address _proxy, // If set to address(0), GovernedProxy will be deployed by GovernedContractAutoProxy
IGovernedProxy _sporkProxy,
address _eAssetTokenOwner,
address _eAssetTokenMinter,
string memory _name,
string memory _symbol,
uint8 _decimals
) public GovernedEAssetTokenAutoProxy(_proxy, _sporkProxy, this) {
eAssetTokenStorage = new EAssetTokenStorage_2(_eAssetTokenOwner, _eAssetTokenMinter, _name, _symbol, _decimals);
setProxy(proxy);
}
function owner() external view returns(address _owner) {
_owner = eAssetTokenStorage.getEAssetTokenOwner();
}
function minter() external view returns(address _minter) {
_minter = eAssetTokenStorage.getEAssetTokenMinter();
}
function setOwner(address _eAssetTokenOwner) external onlyEAssetTokenOwner {
eAssetTokenStorage.setEAssetTokenOwner(_eAssetTokenOwner);
}
function setMinter(address _eAssetTokenMinter) external onlyEAssetTokenOwner {
eAssetTokenStorage.setEAssetTokenMinter(_eAssetTokenMinter);
}
function setName(string calldata _name) external onlyEAssetTokenOwner {
eAssetTokenStorage.setName(_name);
}
function setSymbol(string calldata _symbol) external onlyEAssetTokenOwner {
eAssetTokenStorage.setSymbol(_symbol);
}
function name() external view returns(string memory _name) {
_name = eAssetTokenStorage.getName();
}
function symbol() external view returns(string memory _symbol) {
_symbol = eAssetTokenStorage.getSymbol();
}
function decimals() external view returns(uint8 _decimals) {
_decimals = eAssetTokenStorage.getDecimals();
}
// IGovernedContract
//---------------------------------
function _destroy(IGovernedContract _newImpl) internal {
_destroyERC20(_newImpl);
eAssetTokenStorage.setOwner(_newImpl);
}
//---------------------------------
function mint(address recipient, uint amount) external onlyEAssetTokenOwnerOrMinter {
_mint(recipient, amount);
}
function burn(address recipient, uint amount) external onlyEAssetTokenOwnerOrMinter {
_burn(recipient, amount);
}
}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[{"type":"address","name":"_proxy","internalType":"address"},{"type":"address","name":"_sporkProxy","internalType":"contract IGovernedProxy"},{"type":"address","name":"_eAssetTokenOwner","internalType":"address"},{"type":"address","name":"_eAssetTokenMinter","internalType":"address"},{"type":"string","name":"_name","internalType":"string"},{"type":"string","name":"_symbol","internalType":"string"},{"type":"uint8","name":"_decimals","internalType":"uint8"}]},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"allowance","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"spender","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"approve","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"burn","inputs":[{"type":"address","name":"recipient","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint8","name":"_decimals","internalType":"uint8"}],"name":"decimals","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"decreaseAllowance","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"subtractedValue","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"destroy","inputs":[{"type":"address","name":"_newImpl","internalType":"contract IGovernedContract"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"contract EAssetTokenStorage_2"}],"name":"eAssetTokenStorage","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"contract GovernedERC20Storage"}],"name":"erc20Storage","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"governedERC20Proxy","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"increaseAllowance","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"addedValue","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"migrate","inputs":[{"type":"address","name":"_oldImpl","internalType":"contract IGovernedContract"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"mint","inputs":[{"type":"address","name":"recipient","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"_minter","internalType":"address"}],"name":"minter","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"string","name":"_name","internalType":"string"}],"name":"name","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"_owner","internalType":"address"}],"name":"owner","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"proxy","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setMinter","inputs":[{"type":"address","name":"_eAssetTokenMinter","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setName","inputs":[{"type":"string","name":"_name","internalType":"string"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setOwner","inputs":[{"type":"address","name":"_eAssetTokenOwner","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setSymbol","inputs":[{"type":"string","name":"_symbol","internalType":"string"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"string","name":"_symbol","internalType":"string"}],"name":"symbol","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transfer","inputs":[{"type":"address","name":"sender","internalType":"address"},{"type":"address","name":"recipient","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transferFrom","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"address","name":"sender","internalType":"address"},{"type":"address","name":"recipient","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}],"constant":false}]
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106101725760003560e01c80638da5cb5b116100de578063ce5494bb11610097578063e1f21c6711610071578063e1f21c6714610562578063ec55688914610598578063ec949758146105a0578063fca3b5aa146105a857610172565b8063ce5494bb146104d8578063d73b1dc9146104fe578063dd62ed3e1461053457610172565b80638da5cb5b1461038657806395d89b411461038e5780639dc29fac14610396578063b84c8246146103c2578063beabacc814610432578063c47f00271461046857610172565b806321825e671161013057806321825e67146102d0578063313ce567146102d857806340c10f19146102f65780634bc597b9146103225780636c43a2ca1461032a57806370a082311461036057610172565b8062f55d9d1461017757806306fdde031461019f578063075461721461021c57806313af40351461024057806315dacbea1461026657806318160ddd146102b6575b600080fd5b61019d6004803603602081101561018d57600080fd5b50356001600160a01b03166105ce565b005b6101a761062e565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101e15781810151838201526020016101c9565b50505050905090810190601f16801561020e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610224610765565b604080516001600160a01b039092168252519081900360200190f35b61019d6004803603602081101561025657600080fd5b50356001600160a01b03166107db565b6102a26004803603608081101561027c57600080fd5b506001600160a01b03813581169160208101358216916040820135169060600135610918565b604080519115158252519081900360200190f35b6102be610a49565b60408051918252519081900360200190f35b610224610a8e565b6102e0610a9d565b6040805160ff9092168252519081900360200190f35b61019d6004803603604081101561030c57600080fd5b506001600160a01b038135169060200135610ae2565b610224610c60565b6102a26004803603606081101561034057600080fd5b506001600160a01b03813581169160208101359091169060400135610c6f565b6102be6004803603602081101561037657600080fd5b50356001600160a01b0316610d7c565b610224610dff565b6101a7610e44565b61019d600480360360408110156103ac57600080fd5b506001600160a01b038135169060200135610e89565b61019d600480360360208110156103d857600080fd5b8101906020810181356401000000008111156103f357600080fd5b82018360208201111561040557600080fd5b8035906020019184600183028401116401000000008311171561042757600080fd5b509092509050611003565b6102a26004803603606081101561044857600080fd5b506001600160a01b0381358116916020810135909116906040013561116a565b61019d6004803603602081101561047e57600080fd5b81019060208101813564010000000081111561049957600080fd5b8201836020820111156104ab57600080fd5b803590602001918460018302840111640100000000831117156104cd57600080fd5b5090925090506111df565b61019d600480360360208110156104ee57600080fd5b50356001600160a01b031661132a565b6102a26004803603606081101561051457600080fd5b506001600160a01b0381358116916020810135909116906040013561137d565b6102be6004803603604081101561054a57600080fd5b506001600160a01b0381358116916020013516611451565b6102a26004803603606081101561057857600080fd5b506001600160a01b038135811691602081013590911690604001356114dd565b610224611548565b610224611557565b61019d600480360360208110156105be57600080fd5b50356001600160a01b0316611566565b6000546001600160a01b03163314610619576040805162461bcd60e51b81526020600482015260096024820152684e6f742070726f787960b81b604482015290519081900360640190fd5b61062281611688565b806001600160a01b0316ff5b600354604080516305f5f79f60e21b815290516060926001600160a01b0316916317d7de7c916004808301926000929190829003018186803b15801561067357600080fd5b505afa158015610687573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156106b057600080fd5b81019080805160405193929190846401000000008211156106d057600080fd5b9083019060208201858111156106e557600080fd5b82516401000000008111828201881017156106ff57600080fd5b82525081516020918201929091019080838360005b8381101561072c578181015183820152602001610714565b50505050905090810190601f1680156107595780820380516001836020036101000a031916815260200191505b50604052505050905090565b600354604080516301ea063d60e31b815290516000926001600160a01b031691630f5031e8916004808301926020929190829003018186803b1580156107aa57600080fd5b505afa1580156107be573d6000803e3d6000fd5b505050506040513d60208110156107d457600080fd5b5051919050565b600360009054906101000a90046001600160a01b03166001600160a01b031663fc8a8cc16040518163ffffffff1660e01b815260040160206040518083038186803b15801561082957600080fd5b505afa15801561083d573d6000803e3d6000fd5b505050506040513d602081101561085357600080fd5b50516001600160a01b03166108666116df565b6001600160a01b0316146108af576040805162461bcd60e51b81526020600482015260166024820152600080516020611f93833981519152604482015290519081900360640190fd5b6003546040805163dc1085ff60e01b81526001600160a01b0384811660048301529151919092169163dc1085ff91602480830192600092919082900301818387803b1580156108fd57600080fd5b505af1158015610911573d6000803e3d6000fd5b5050505050565b6002546000906001600160a01b031661092f6116e3565b6001600160a01b031614610978576040805162461bcd60e51b81526020600482015260166024820152600080516020611f93833981519152604482015290519081900360640190fd5b6109838484846116e7565b6000610a3083604051806060016040528060288152602001611fd96028913960015460408051630af4187d60e01b81526001600160a01b038b811660048301528c8116602483015291519190921691630af4187d916044808301926020929190829003018186803b1580156109f757600080fd5b505afa158015610a0b573d6000803e3d6000fd5b505050506040513d6020811015610a2157600080fd5b5051919063ffffffff61192416565b9050610a3d8587836119bb565b50600195945050505050565b600154604080516362720d9160e11b815290516000926001600160a01b03169163c4e41b22916004808301926020929190829003018186803b1580156107aa57600080fd5b6002546001600160a01b031681565b60035460408051633c05076160e21b815290516000926001600160a01b03169163f0141d84916004808301926020929190829003018186803b1580156107aa57600080fd5b600360009054906101000a90046001600160a01b03166001600160a01b031663fc8a8cc16040518163ffffffff1660e01b815260040160206040518083038186803b158015610b3057600080fd5b505afa158015610b44573d6000803e3d6000fd5b505050506040513d6020811015610b5a57600080fd5b50516001600160a01b0316610b6d6116df565b6001600160a01b03161480610c135750600360009054906101000a90046001600160a01b03166001600160a01b0316630f5031e86040518163ffffffff1660e01b815260040160206040518083038186803b158015610bcb57600080fd5b505afa158015610bdf573d6000803e3d6000fd5b505050506040513d6020811015610bf557600080fd5b50516001600160a01b0316610c086116df565b6001600160a01b0316145b610c52576040805162461bcd60e51b81526020600482015260166024820152600080516020611f93833981519152604482015290519081900360640190fd5b610c5c8282611aa2565b5050565b6001546001600160a01b031681565b6002546000906001600160a01b0316610c866116e3565b6001600160a01b031614610ccf576040805162461bcd60e51b81526020600482015260166024820152600080516020611f93833981519152604482015290519081900360640190fd5b60015460408051630af4187d60e01b81526001600160a01b03878116600483015286811660248301529151600093610d64938793911691630af4187d91604480820192602092909190829003018186803b158015610d2c57600080fd5b505afa158015610d40573d6000803e3d6000fd5b505050506040513d6020811015610d5657600080fd5b50519063ffffffff611c4b16565b9050610d718585836119bb565b506001949350505050565b6001546040805163f8b2cb4f60e01b81526001600160a01b0384811660048301529151600093929092169163f8b2cb4f91602480820192602092909190829003018186803b158015610dcd57600080fd5b505afa158015610de1573d6000803e3d6000fd5b505050506040513d6020811015610df757600080fd5b505192915050565b6003546040805163fc8a8cc160e01b815290516000926001600160a01b03169163fc8a8cc1916004808301926020929190829003018186803b1580156107aa57600080fd5b60035460408051631507040160e01b815290516060926001600160a01b0316916315070401916004808301926000929190829003018186803b15801561067357600080fd5b600360009054906101000a90046001600160a01b03166001600160a01b031663fc8a8cc16040518163ffffffff1660e01b815260040160206040518083038186803b158015610ed757600080fd5b505afa158015610eeb573d6000803e3d6000fd5b505050506040513d6020811015610f0157600080fd5b50516001600160a01b0316610f146116df565b6001600160a01b03161480610fba5750600360009054906101000a90046001600160a01b03166001600160a01b0316630f5031e86040518163ffffffff1660e01b815260040160206040518083038186803b158015610f7257600080fd5b505afa158015610f86573d6000803e3d6000fd5b505050506040513d6020811015610f9c57600080fd5b50516001600160a01b0316610faf6116df565b6001600160a01b0316145b610ff9576040805162461bcd60e51b81526020600482015260166024820152600080516020611f93833981519152604482015290519081900360640190fd5b610c5c8282611cac565b600360009054906101000a90046001600160a01b03166001600160a01b031663fc8a8cc16040518163ffffffff1660e01b815260040160206040518083038186803b15801561105157600080fd5b505afa158015611065573d6000803e3d6000fd5b505050506040513d602081101561107b57600080fd5b50516001600160a01b031661108e6116df565b6001600160a01b0316146110d7576040805162461bcd60e51b81526020600482015260166024820152600080516020611f93833981519152604482015290519081900360640190fd5b600354604051635c26412360e11b8152602060048201908152602482018490526001600160a01b039092169163b84c824691859185918190604401848480828437600081840152601f19601f8201169050808301925050509350505050600060405180830381600087803b15801561114e57600080fd5b505af1158015611162573d6000803e3d6000fd5b505050505050565b6002546000906001600160a01b03166111816116e3565b6001600160a01b0316146111ca576040805162461bcd60e51b81526020600482015260166024820152600080516020611f93833981519152604482015290519081900360640190fd5b6111d58484846116e7565b5060019392505050565b600360009054906101000a90046001600160a01b03166001600160a01b031663fc8a8cc16040518163ffffffff1660e01b815260040160206040518083038186803b15801561122d57600080fd5b505afa158015611241573d6000803e3d6000fd5b505050506040513d602081101561125757600080fd5b50516001600160a01b031661126a6116df565b6001600160a01b0316146112b3576040805162461bcd60e51b81526020600482015260166024820152600080516020611f93833981519152604482015290519081900360640190fd5b60035460405163c47f002760e01b8152602060048201908152602482018490526001600160a01b039092169163c47f002791859185918190604401848480828437600081840152601f19601f8201169050808301925050509350505050600060405180830381600087803b15801561114e57600080fd5b6000546001600160a01b03163314611375576040805162461bcd60e51b81526020600482015260096024820152684e6f742070726f787960b81b604482015290519081900360640190fd5b61137a815b50565b6002546000906001600160a01b03166113946116e3565b6001600160a01b0316146113dd576040805162461bcd60e51b81526020600482015260166024820152600080516020611f93833981519152604482015290519081900360640190fd5b6000610d648360405180606001604052806025815260200161206b6025913960015460408051630af4187d60e01b81526001600160a01b038b811660048301528a8116602483015291519190921691630af4187d916044808301926020929190829003018186803b1580156109f757600080fd5b60015460408051630af4187d60e01b81526001600160a01b038581166004830152848116602483015291516000939290921691630af4187d91604480820192602092909190829003018186803b1580156114aa57600080fd5b505afa1580156114be573d6000803e3d6000fd5b505050506040513d60208110156114d457600080fd5b50519392505050565b6002546000906001600160a01b03166114f46116e3565b6001600160a01b03161461153d576040805162461bcd60e51b81526020600482015260166024820152600080516020611f93833981519152604482015290519081900360640190fd5b6111d58484846119bb565b6000546001600160a01b031681565b6003546001600160a01b031681565b600360009054906101000a90046001600160a01b03166001600160a01b031663fc8a8cc16040518163ffffffff1660e01b815260040160206040518083038186803b1580156115b457600080fd5b505afa1580156115c8573d6000803e3d6000fd5b505050506040513d60208110156115de57600080fd5b50516001600160a01b03166115f16116df565b6001600160a01b03161461163a576040805162461bcd60e51b81526020600482015260166024820152600080516020611f93833981519152604482015290519081900360640190fd5b6003546040805163c2bd4b5f60e01b81526001600160a01b0384811660048301529151919092169163c2bd4b5f91602480830192600092919082900301818387803b1580156108fd57600080fd5b61169181611e9b565b600354604080516313af403560e01b81526001600160a01b038481166004830152915191909216916313af403591602480830192600092919082900301818387803b1580156108fd57600080fd5b3290565b3390565b6001600160a01b03831661172c5760405162461bcd60e51b81526004018080602001828103825260258152602001806120226025913960400191505060405180910390fd5b6001600160a01b0382166117715760405162461bcd60e51b8152600401808060200182810382526023815260200180611f2c6023913960400191505060405180910390fd5b600154604080516060810190915260268082526001600160a01b039092169163e30443bc9186916117f3918691611fb360208301396001546040805163f8b2cb4f60e01b81526001600160a01b038c811660048301529151919092169163f8b2cb4f916024808301926020929190829003018186803b1580156109f757600080fd5b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561184257600080fd5b505af1158015611856573d6000803e3d6000fd5b50506001546040805163f8b2cb4f60e01b81526001600160a01b038781166004830152915191909216935063e30443bc925085916118b8918691869163f8b2cb4f91602480820192602092909190829003018186803b158015610d2c57600080fd5b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561190757600080fd5b505af115801561191b573d6000803e3d6000fd5b50505050505050565b600081848411156119b35760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611978578181015183820152602001611960565b50505050905090810190601f1680156119a55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038316611a005760405162461bcd60e51b81526004018080602001828103825260248152602001806120476024913960400191505060405180910390fd5b6001600160a01b038216611a455760405162461bcd60e51b8152600401808060200182810382526022815260200180611f716022913960400191505060405180910390fd5b60015460408051633691826360e21b81526001600160a01b0386811660048301528581166024830152604482018590529151919092169163da46098c91606480830192600092919082900301818387803b15801561190757600080fd5b6001600160a01b038216611afd576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600154604080516362720d9160e11b815290516001600160a01b039092169163f7ea7a3d91611b50918591859163c4e41b2291600480820192602092909190829003018186803b158015610d2c57600080fd5b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015611b8657600080fd5b505af1158015611b9a573d6000803e3d6000fd5b50506001546040805163f8b2cb4f60e01b81526001600160a01b038781166004830152915191909216935063e30443bc92508591611bfc918691869163f8b2cb4f91602480820192602092909190829003018186803b158015610d2c57600080fd5b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561114e57600080fd5b600082820183811015611ca5576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6001600160a01b038216611cf15760405162461bcd60e51b81526004018080602001828103825260218152602001806120016021913960400191505060405180910390fd5b600154604080516060810190915260228082526001600160a01b039092169163e30443bc918591611d73918691611f4f60208301396001546040805163f8b2cb4f60e01b81526001600160a01b038b811660048301529151919092169163f8b2cb4f916024808301926020929190829003018186803b1580156109f757600080fd5b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611dc257600080fd5b505af1158015611dd6573d6000803e3d6000fd5b5050600154604080516362720d9160e11b815290516001600160a01b03909216935063f7ea7a3d9250611e65918591859163c4e41b2291600480820192602092909190829003018186803b158015611e2d57600080fd5b505afa158015611e41573d6000803e3d6000fd5b505050506040513d6020811015611e5757600080fd5b50519063ffffffff611ee916565b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561114e57600080fd5b600154604080516313af403560e01b81526001600160a01b038481166004830152915191909216916313af403591602480830192600092919082900301818387803b1580156108fd57600080fd5b6000611ca583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061192456fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f2061646472657373454173736574546f6b656e3a20464f5242494444454e0000000000000000000045524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a723158204b67f82d3d3c5afa2925e4691415bf3bc7da751e20f10c18859bb28f71030ce864736f6c63430005100032