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-25 20:15:39.930122Z
Constructor Arguments
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030500000000000000000000000079f10487a8c0ed4e09045841160d01a7ecb9624400000000000000000000000079f10487a8c0ed4e09045841160d01a7ecb9624400000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000f537461747573204020456e6572676900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003534e540000000000000000000000000000000000000000000000000000000000
Arg [0] (address) : 0x0000000000000000000000000000000000000000
Arg [1] (address) : 0x0000000000000000000000000000000000000305
Arg [2] (address) : 0x79f10487a8c0ed4e09045841160d01a7ecb96244
Arg [3] (address) : 0x79f10487a8c0ed4e09045841160d01a7ecb96244
Arg [4] (string) : Status @ Energi
Arg [5] (string) : SNT
Arg [6] (uint8) : 18
Contract source code
pragma solidity 0.5.16;
// File: interfaces/IGovernedContract.sol
// Copyright 2021 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 2021 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, "EAssetToken: FORBIDDEN - 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 2021 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 2021 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 2021 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 2021 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
// Copyright 2021 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.
/**
* 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 - Not proxy!');
_;
}
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
0x608060405234801561001057600080fd5b50600436106101725760003560e01c80638da5cb5b116100de578063ce5494bb11610097578063e1f21c6711610071578063e1f21c6714610562578063ec55688914610598578063ec949758146105a0578063fca3b5aa146105a857610172565b8063ce5494bb146104d8578063d73b1dc9146104fe578063dd62ed3e1461053457610172565b80638da5cb5b1461038657806395d89b411461038e5780639dc29fac14610396578063b84c8246146103c2578063beabacc814610432578063c47f00271461046857610172565b806321825e671161013057806321825e67146102d0578063313ce567146102d857806340c10f19146102f65780634bc597b9146103225780636c43a2ca1461032a57806370a082311461036057610172565b8062f55d9d1461017757806306fdde031461019f578063075461721461021c57806313af40351461024057806315dacbea1461026657806318160ddd146102b6575b600080fd5b61019d6004803603602081101561018d57600080fd5b50356001600160a01b03166105ce565b005b6101a761062c565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101e15781810151838201526020016101c9565b50505050905090810190601f16801561020e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610224610763565b604080516001600160a01b039092168252519081900360200190f35b61019d6004803603602081101561025657600080fd5b50356001600160a01b03166107d9565b6102a26004803603608081101561027c57600080fd5b506001600160a01b03813581169160208101358216916040820135169060600135610916565b604080519115158252519081900360200190f35b6102be610a43565b60408051918252519081900360200190f35b610224610a88565b6102e0610a97565b6040805160ff9092168252519081900360200190f35b61019d6004803603604081101561030c57600080fd5b506001600160a01b038135169060200135610adc565b610224610c5a565b6102a26004803603606081101561034057600080fd5b506001600160a01b03813581169160208101359091169060400135610c69565b6102be6004803603602081101561037657600080fd5b50356001600160a01b0316610d72565b610224610df5565b6101a7610e3a565b61019d600480360360408110156103ac57600080fd5b506001600160a01b038135169060200135610e7f565b61019d600480360360208110156103d857600080fd5b8101906020810181356401000000008111156103f357600080fd5b82018360208201111561040557600080fd5b8035906020019184600183028401116401000000008311171561042757600080fd5b509092509050610ff9565b6102a26004803603606081101561044857600080fd5b506001600160a01b03813581169160208101359091169060400135611160565b61019d6004803603602081101561047e57600080fd5b81019060208101813564010000000081111561049957600080fd5b8201836020820111156104ab57600080fd5b803590602001918460018302840111640100000000831117156104cd57600080fd5b5090925090506111d1565b61019d600480360360208110156104ee57600080fd5b50356001600160a01b031661131c565b6102a26004803603606081101561051457600080fd5b506001600160a01b0381358116916020810135909116906040013561136d565b6102be6004803603604081101561054a57600080fd5b506001600160a01b038135811691602001351661143d565b6102a26004803603606081101561057857600080fd5b506001600160a01b038135811691602081013590911690604001356114c9565b610224611530565b61022461153f565b61019d600480360360208110156105be57600080fd5b50356001600160a01b031661154e565b6000546001600160a01b031633146106175760405162461bcd60e51b8152600401808060200182810382526023815260200180611f7b6023913960400191505060405180910390fd5b61062081611670565b806001600160a01b0316ff5b600354604080516305f5f79f60e21b815290516060926001600160a01b0316916317d7de7c916004808301926000929190829003018186803b15801561067157600080fd5b505afa158015610685573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156106ae57600080fd5b81019080805160405193929190846401000000008211156106ce57600080fd5b9083019060208201858111156106e357600080fd5b82516401000000008111828201881017156106fd57600080fd5b82525081516020918201929091019080838360005b8381101561072a578181015183820152602001610712565b50505050905090810190601f1680156107575780820380516001836020036101000a031916815260200191505b50604052505050905090565b600354604080516301ea063d60e31b815290516000926001600160a01b031691630f5031e8916004808301926020929190829003018186803b1580156107a857600080fd5b505afa1580156107bc573d6000803e3d6000fd5b505050506040513d60208110156107d257600080fd5b5051919050565b600360009054906101000a90046001600160a01b03166001600160a01b031663fc8a8cc16040518163ffffffff1660e01b815260040160206040518083038186803b15801561082757600080fd5b505afa15801561083b573d6000803e3d6000fd5b505050506040513d602081101561085157600080fd5b50516001600160a01b03166108646116c7565b6001600160a01b0316146108ad576040805162461bcd60e51b81526020600482015260166024820152600080516020611f9e833981519152604482015290519081900360640190fd5b6003546040805163dc1085ff60e01b81526001600160a01b0384811660048301529151919092169163dc1085ff91602480830192600092919082900301818387803b1580156108fb57600080fd5b505af115801561090f573d6000803e3d6000fd5b5050505050565b6002546000906001600160a01b031661092d6116cb565b6001600160a01b0316146109725760405162461bcd60e51b8152600401808060200182810382526023815260200180611f7b6023913960400191505060405180910390fd5b61097d8484846116cf565b6000610a2a83604051806060016040528060288152602001611fe46028913960015460408051630af4187d60e01b81526001600160a01b038b811660048301528c8116602483015291519190921691630af4187d916044808301926020929190829003018186803b1580156109f157600080fd5b505afa158015610a05573d6000803e3d6000fd5b505050506040513d6020811015610a1b57600080fd5b5051919063ffffffff61190c16565b9050610a378587836119a3565b50600195945050505050565b600154604080516362720d9160e11b815290516000926001600160a01b03169163c4e41b22916004808301926020929190829003018186803b1580156107a857600080fd5b6002546001600160a01b031681565b60035460408051633c05076160e21b815290516000926001600160a01b03169163f0141d84916004808301926020929190829003018186803b1580156107a857600080fd5b600360009054906101000a90046001600160a01b03166001600160a01b031663fc8a8cc16040518163ffffffff1660e01b815260040160206040518083038186803b158015610b2a57600080fd5b505afa158015610b3e573d6000803e3d6000fd5b505050506040513d6020811015610b5457600080fd5b50516001600160a01b0316610b676116c7565b6001600160a01b03161480610c0d5750600360009054906101000a90046001600160a01b03166001600160a01b0316630f5031e86040518163ffffffff1660e01b815260040160206040518083038186803b158015610bc557600080fd5b505afa158015610bd9573d6000803e3d6000fd5b505050506040513d6020811015610bef57600080fd5b50516001600160a01b0316610c026116c7565b6001600160a01b0316145b610c4c576040805162461bcd60e51b81526020600482015260166024820152600080516020611f9e833981519152604482015290519081900360640190fd5b610c568282611a8a565b5050565b6001546001600160a01b031681565b6002546000906001600160a01b0316610c806116cb565b6001600160a01b031614610cc55760405162461bcd60e51b8152600401808060200182810382526023815260200180611f7b6023913960400191505060405180910390fd5b60015460408051630af4187d60e01b81526001600160a01b03878116600483015286811660248301529151600093610d5a938793911691630af4187d91604480820192602092909190829003018186803b158015610d2257600080fd5b505afa158015610d36573d6000803e3d6000fd5b505050506040513d6020811015610d4c57600080fd5b50519063ffffffff611c3316565b9050610d678585836119a3565b506001949350505050565b6001546040805163f8b2cb4f60e01b81526001600160a01b0384811660048301529151600093929092169163f8b2cb4f91602480820192602092909190829003018186803b158015610dc357600080fd5b505afa158015610dd7573d6000803e3d6000fd5b505050506040513d6020811015610ded57600080fd5b505192915050565b6003546040805163fc8a8cc160e01b815290516000926001600160a01b03169163fc8a8cc1916004808301926020929190829003018186803b1580156107a857600080fd5b60035460408051631507040160e01b815290516060926001600160a01b0316916315070401916004808301926000929190829003018186803b15801561067157600080fd5b600360009054906101000a90046001600160a01b03166001600160a01b031663fc8a8cc16040518163ffffffff1660e01b815260040160206040518083038186803b158015610ecd57600080fd5b505afa158015610ee1573d6000803e3d6000fd5b505050506040513d6020811015610ef757600080fd5b50516001600160a01b0316610f0a6116c7565b6001600160a01b03161480610fb05750600360009054906101000a90046001600160a01b03166001600160a01b0316630f5031e86040518163ffffffff1660e01b815260040160206040518083038186803b158015610f6857600080fd5b505afa158015610f7c573d6000803e3d6000fd5b505050506040513d6020811015610f9257600080fd5b50516001600160a01b0316610fa56116c7565b6001600160a01b0316145b610fef576040805162461bcd60e51b81526020600482015260166024820152600080516020611f9e833981519152604482015290519081900360640190fd5b610c568282611c94565b600360009054906101000a90046001600160a01b03166001600160a01b031663fc8a8cc16040518163ffffffff1660e01b815260040160206040518083038186803b15801561104757600080fd5b505afa15801561105b573d6000803e3d6000fd5b505050506040513d602081101561107157600080fd5b50516001600160a01b03166110846116c7565b6001600160a01b0316146110cd576040805162461bcd60e51b81526020600482015260166024820152600080516020611f9e833981519152604482015290519081900360640190fd5b600354604051635c26412360e11b8152602060048201908152602482018490526001600160a01b039092169163b84c824691859185918190604401848480828437600081840152601f19601f8201169050808301925050509350505050600060405180830381600087803b15801561114457600080fd5b505af1158015611158573d6000803e3d6000fd5b505050505050565b6002546000906001600160a01b03166111776116cb565b6001600160a01b0316146111bc5760405162461bcd60e51b8152600401808060200182810382526023815260200180611f7b6023913960400191505060405180910390fd5b6111c78484846116cf565b5060019392505050565b600360009054906101000a90046001600160a01b03166001600160a01b031663fc8a8cc16040518163ffffffff1660e01b815260040160206040518083038186803b15801561121f57600080fd5b505afa158015611233573d6000803e3d6000fd5b505050506040513d602081101561124957600080fd5b50516001600160a01b031661125c6116c7565b6001600160a01b0316146112a5576040805162461bcd60e51b81526020600482015260166024820152600080516020611f9e833981519152604482015290519081900360640190fd5b60035460405163c47f002760e01b8152602060048201908152602482018490526001600160a01b039092169163c47f002791859185918190604401848480828437600081840152601f19601f8201169050808301925050509350505050600060405180830381600087803b15801561114457600080fd5b6000546001600160a01b031633146113655760405162461bcd60e51b8152600401808060200182810382526023815260200180611f7b6023913960400191505060405180910390fd5b61136a815b50565b6002546000906001600160a01b03166113846116cb565b6001600160a01b0316146113c95760405162461bcd60e51b8152600401808060200182810382526023815260200180611f7b6023913960400191505060405180910390fd5b6000610d5a836040518060600160405280602581526020016120766025913960015460408051630af4187d60e01b81526001600160a01b038b811660048301528a8116602483015291519190921691630af4187d916044808301926020929190829003018186803b1580156109f157600080fd5b60015460408051630af4187d60e01b81526001600160a01b038581166004830152848116602483015291516000939290921691630af4187d91604480820192602092909190829003018186803b15801561149657600080fd5b505afa1580156114aa573d6000803e3d6000fd5b505050506040513d60208110156114c057600080fd5b50519392505050565b6002546000906001600160a01b03166114e06116cb565b6001600160a01b0316146115255760405162461bcd60e51b8152600401808060200182810382526023815260200180611f7b6023913960400191505060405180910390fd5b6111c78484846119a3565b6000546001600160a01b031681565b6003546001600160a01b031681565b600360009054906101000a90046001600160a01b03166001600160a01b031663fc8a8cc16040518163ffffffff1660e01b815260040160206040518083038186803b15801561159c57600080fd5b505afa1580156115b0573d6000803e3d6000fd5b505050506040513d60208110156115c657600080fd5b50516001600160a01b03166115d96116c7565b6001600160a01b031614611622576040805162461bcd60e51b81526020600482015260166024820152600080516020611f9e833981519152604482015290519081900360640190fd5b6003546040805163c2bd4b5f60e01b81526001600160a01b0384811660048301529151919092169163c2bd4b5f91602480830192600092919082900301818387803b1580156108fb57600080fd5b61167981611e83565b600354604080516313af403560e01b81526001600160a01b038481166004830152915191909216916313af403591602480830192600092919082900301818387803b1580156108fb57600080fd5b3290565b3390565b6001600160a01b0383166117145760405162461bcd60e51b815260040180806020018281038252602581526020018061202d6025913960400191505060405180910390fd5b6001600160a01b0382166117595760405162461bcd60e51b8152600401808060200182810382526023815260200180611f146023913960400191505060405180910390fd5b600154604080516060810190915260268082526001600160a01b039092169163e30443bc9186916117db918691611fbe60208301396001546040805163f8b2cb4f60e01b81526001600160a01b038c811660048301529151919092169163f8b2cb4f916024808301926020929190829003018186803b1580156109f157600080fd5b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561182a57600080fd5b505af115801561183e573d6000803e3d6000fd5b50506001546040805163f8b2cb4f60e01b81526001600160a01b038781166004830152915191909216935063e30443bc925085916118a0918691869163f8b2cb4f91602480820192602092909190829003018186803b158015610d2257600080fd5b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156118ef57600080fd5b505af1158015611903573d6000803e3d6000fd5b50505050505050565b6000818484111561199b5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611960578181015183820152602001611948565b50505050905090810190601f16801561198d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b0383166119e85760405162461bcd60e51b81526004018080602001828103825260248152602001806120526024913960400191505060405180910390fd5b6001600160a01b038216611a2d5760405162461bcd60e51b8152600401808060200182810382526022815260200180611f596022913960400191505060405180910390fd5b60015460408051633691826360e21b81526001600160a01b0386811660048301528581166024830152604482018590529151919092169163da46098c91606480830192600092919082900301818387803b1580156118ef57600080fd5b6001600160a01b038216611ae5576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600154604080516362720d9160e11b815290516001600160a01b039092169163f7ea7a3d91611b38918591859163c4e41b2291600480820192602092909190829003018186803b158015610d2257600080fd5b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015611b6e57600080fd5b505af1158015611b82573d6000803e3d6000fd5b50506001546040805163f8b2cb4f60e01b81526001600160a01b038781166004830152915191909216935063e30443bc92508591611be4918691869163f8b2cb4f91602480820192602092909190829003018186803b158015610d2257600080fd5b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561114457600080fd5b600082820183811015611c8d576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6001600160a01b038216611cd95760405162461bcd60e51b815260040180806020018281038252602181526020018061200c6021913960400191505060405180910390fd5b600154604080516060810190915260228082526001600160a01b039092169163e30443bc918591611d5b918691611f3760208301396001546040805163f8b2cb4f60e01b81526001600160a01b038b811660048301529151919092169163f8b2cb4f916024808301926020929190829003018186803b1580156109f157600080fd5b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611daa57600080fd5b505af1158015611dbe573d6000803e3d6000fd5b5050600154604080516362720d9160e11b815290516001600160a01b03909216935063f7ea7a3d9250611e4d918591859163c4e41b2291600480820192602092909190829003018186803b158015611e1557600080fd5b505afa158015611e29573d6000803e3d6000fd5b505050506040513d6020811015611e3f57600080fd5b50519063ffffffff611ed116565b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561114457600080fd5b600154604080516313af403560e01b81526001600160a01b038481166004830152915191909216916313af403591602480830192600092919082900301818387803b1580156108fb57600080fd5b6000611c8d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061190c56fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f2061646472657373454173736574546f6b656e3a20464f5242494444454e202d204e6f742070726f787921454173736574546f6b656e3a20464f5242494444454e0000000000000000000045524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a72315820eca5b115263a3e302d302a77325bc4763e21af39eb800311a86e20bb231eedb364736f6c63430005100032