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
- Optimization enabled
- true
- Compiler version
- v0.5.16+commit.9c3226ce
- Optimization runs
- 200
- EVM Version
- petersburg
- Verified at
- 2022-01-16 22:43:56.386196Z
Constructor Arguments
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030500000000000000000000000079f10487a8c0ed4e09045841160d01a7ecb9624400000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000a456e6572676920534e5800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000465534e5800000000000000000000000000000000000000000000000000000000
Arg [0] (address) : 0x0000000000000000000000000000000000000000
Arg [1] (address) : 0x0000000000000000000000000000000000000305
Arg [2] (address) : 0x79f10487a8c0ed4e09045841160d01a7ecb96244
Arg [3] (string) : Energi SNX
Arg [4] (string) : eSNX
Arg [5] (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.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 {
function eAssetTokenStorage() external view returns(address _eAssetTokenStorage);
function owner() external view returns(address _owner);
function setOwner(address _eAssetTokenOwner) 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.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 {
function setEAssetTokenOwner(address _eAssetTokenOwner) external;
function getEAssetTokenOwner() external view returns(address _owner);
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.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 is StorageBase, IEAssetTokenStorage {
address private eAssetTokenOwner; // Can mint and burn EAssetToken
string private name;
string private symbol;
uint8 private decimals;
constructor(
address _eAssetTokenOwner,
string memory _name,
string memory _symbol,
uint8 _decimals
) public {
eAssetTokenOwner = _eAssetTokenOwner;
name = _name;
symbol = _symbol;
decimals = _decimals;
}
function setEAssetTokenOwner(address _eAssetTokenOwner) external requireOwner {
eAssetTokenOwner = _eAssetTokenOwner;
}
function getEAssetTokenOwner() external view returns(address _owner) {
_owner = eAssetTokenOwner;
}
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 is GovernedEAssetTokenAutoProxy, GovernedERC20, IEAssetToken {
// Data for migration
//---------------------------------
EAssetTokenStorage public eAssetTokenStorage;
//---------------------------------
modifier onlyEAssetTokenOwner {
require(_txOrigin() == eAssetTokenStorage.getEAssetTokenOwner(), 'EAssetToken: FORBIDDEN');
_;
}
constructor(
address _proxy, // If set to address(0), GovernedProxy will be deployed by GovernedContractAutoProxy
IGovernedProxy _sporkProxy,
address _eAssetTokenOwner,
string memory _name,
string memory _symbol,
uint8 _decimals
) public GovernedEAssetTokenAutoProxy(_proxy, _sporkProxy, this) {
eAssetTokenStorage = new EAssetTokenStorage(_eAssetTokenOwner, _name, _symbol, _decimals);
setProxy(proxy);
}
function owner() external view returns(address _owner) {
_owner = eAssetTokenStorage.getEAssetTokenOwner();
}
function setOwner(address _eAssetTokenOwner) external onlyEAssetTokenOwner {
eAssetTokenStorage.setEAssetTokenOwner(_eAssetTokenOwner);
}
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 onlyEAssetTokenOwner {
_mint(recipient, amount);
}
function burn(address recipient, uint amount) external onlyEAssetTokenOwner {
_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":"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"}],"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":"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":"setOwner","inputs":[{"type":"address","name":"_eAssetTokenOwner","internalType":"address"}],"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
0x608060405234801561001057600080fd5b50600436106101365760003560e01c806370a08231116100b8578063ce5494bb1161007c578063ce5494bb146103b4578063d73b1dc9146103da578063dd62ed3e14610410578063e1f21c671461043e578063ec55688914610474578063ec9497581461047c57610136565b806370a082311461031c5780638da5cb5b1461034257806395d89b411461034a5780639dc29fac14610352578063beabacc81461037e57610136565b806321825e67116100ff57806321825e6714610270578063313ce5671461029457806340c10f19146102b25780634bc597b9146102de5780636c43a2ca146102e657610136565b8062f55d9d1461013b57806306fdde031461016357806313af4035146101e057806315dacbea1461020657806318160ddd14610256575b600080fd5b6101616004803603602081101561015157600080fd5b50356001600160a01b0316610484565b005b61016b6104e4565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101a557818101518382015260200161018d565b50505050905090810190601f1680156101d25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610161600480360360208110156101f657600080fd5b50356001600160a01b031661061b565b6102426004803603608081101561021c57600080fd5b506001600160a01b03813581169160208101358216916040820135169060600135610758565b604080519115158252519081900360200190f35b61025e610889565b60408051918252519081900360200190f35b6102786108ff565b604080516001600160a01b039092168252519081900360200190f35b61029c61090e565b6040805160ff9092168252519081900360200190f35b610161600480360360408110156102c857600080fd5b506001600160a01b038135169060200135610953565b610278610a35565b610242600480360360608110156102fc57600080fd5b506001600160a01b03813581169160208101359091169060400135610a44565b61025e6004803603602081101561033257600080fd5b50356001600160a01b0316610b51565b610278610bd4565b61016b610c19565b6101616004803603604081101561036857600080fd5b506001600160a01b038135169060200135610c5e565b6102426004803603606081101561039457600080fd5b506001600160a01b03813581169160208101359091169060400135610d3c565b610161600480360360208110156103ca57600080fd5b50356001600160a01b0316610db1565b610242600480360360608110156103f057600080fd5b506001600160a01b03813581169160208101359091169060400135610e04565b61025e6004803603604081101561042657600080fd5b506001600160a01b0381358116916020013516610ed8565b6102426004803603606081101561045457600080fd5b506001600160a01b03813581169160208101359091169060400135610f64565b610278610fcf565b610278610fde565b6000546001600160a01b031633146104cf576040805162461bcd60e51b81526020600482015260096024820152684e6f742070726f787960b81b604482015290519081900360640190fd5b6104d881610fed565b806001600160a01b0316ff5b600354604080516305f5f79f60e21b815290516060926001600160a01b0316916317d7de7c916004808301926000929190829003018186803b15801561052957600080fd5b505afa15801561053d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561056657600080fd5b810190808051604051939291908464010000000082111561058657600080fd5b90830190602082018581111561059b57600080fd5b82516401000000008111828201881017156105b557600080fd5b82525081516020918201929091019080838360005b838110156105e25781810151838201526020016105ca565b50505050905090810190601f16801561060f5780820380516001836020036101000a031916815260200191505b50604052505050905090565b600360009054906101000a90046001600160a01b03166001600160a01b031663fc8a8cc16040518163ffffffff1660e01b815260040160206040518083038186803b15801561066957600080fd5b505afa15801561067d573d6000803e3d6000fd5b505050506040513d602081101561069357600080fd5b50516001600160a01b03166106a6611044565b6001600160a01b0316146106ef576040805162461bcd60e51b81526020600482015260166024820152600080516020611914833981519152604482015290519081900360640190fd5b6003546040805163dc1085ff60e01b81526001600160a01b0384811660048301529151919092169163dc1085ff91602480830192600092919082900301818387803b15801561073d57600080fd5b505af1158015610751573d6000803e3d6000fd5b5050505050565b6002546000906001600160a01b031661076f611048565b6001600160a01b0316146107b8576040805162461bcd60e51b81526020600482015260166024820152600080516020611914833981519152604482015290519081900360640190fd5b6107c384848461104c565b60006108708360405180606001604052806028815260200161195a6028913960015460408051630af4187d60e01b81526001600160a01b038b811660048301528c8116602483015291519190921691630af4187d916044808301926020929190829003018186803b15801561083757600080fd5b505afa15801561084b573d6000803e3d6000fd5b505050506040513d602081101561086157600080fd5b5051919063ffffffff61128916565b905061087d858783611320565b50600195945050505050565b600154604080516362720d9160e11b815290516000926001600160a01b03169163c4e41b22916004808301926020929190829003018186803b1580156108ce57600080fd5b505afa1580156108e2573d6000803e3d6000fd5b505050506040513d60208110156108f857600080fd5b5051905090565b6002546001600160a01b031681565b60035460408051633c05076160e21b815290516000926001600160a01b03169163f0141d84916004808301926020929190829003018186803b1580156108ce57600080fd5b600360009054906101000a90046001600160a01b03166001600160a01b031663fc8a8cc16040518163ffffffff1660e01b815260040160206040518083038186803b1580156109a157600080fd5b505afa1580156109b5573d6000803e3d6000fd5b505050506040513d60208110156109cb57600080fd5b50516001600160a01b03166109de611044565b6001600160a01b031614610a27576040805162461bcd60e51b81526020600482015260166024820152600080516020611914833981519152604482015290519081900360640190fd5b610a318282611407565b5050565b6001546001600160a01b031681565b6002546000906001600160a01b0316610a5b611048565b6001600160a01b031614610aa4576040805162461bcd60e51b81526020600482015260166024820152600080516020611914833981519152604482015290519081900360640190fd5b60015460408051630af4187d60e01b81526001600160a01b03878116600483015286811660248301529151600093610b39938793911691630af4187d91604480820192602092909190829003018186803b158015610b0157600080fd5b505afa158015610b15573d6000803e3d6000fd5b505050506040513d6020811015610b2b57600080fd5b50519063ffffffff6115cc16565b9050610b46858583611320565b506001949350505050565b6001546040805163f8b2cb4f60e01b81526001600160a01b0384811660048301529151600093929092169163f8b2cb4f91602480820192602092909190829003018186803b158015610ba257600080fd5b505afa158015610bb6573d6000803e3d6000fd5b505050506040513d6020811015610bcc57600080fd5b505192915050565b6003546040805163fc8a8cc160e01b815290516000926001600160a01b03169163fc8a8cc1916004808301926020929190829003018186803b1580156108ce57600080fd5b60035460408051631507040160e01b815290516060926001600160a01b0316916315070401916004808301926000929190829003018186803b15801561052957600080fd5b600360009054906101000a90046001600160a01b03166001600160a01b031663fc8a8cc16040518163ffffffff1660e01b815260040160206040518083038186803b158015610cac57600080fd5b505afa158015610cc0573d6000803e3d6000fd5b505050506040513d6020811015610cd657600080fd5b50516001600160a01b0316610ce9611044565b6001600160a01b031614610d32576040805162461bcd60e51b81526020600482015260166024820152600080516020611914833981519152604482015290519081900360640190fd5b610a31828261162d565b6002546000906001600160a01b0316610d53611048565b6001600160a01b031614610d9c576040805162461bcd60e51b81526020600482015260166024820152600080516020611914833981519152604482015290519081900360640190fd5b610da784848461104c565b5060019392505050565b6000546001600160a01b03163314610dfc576040805162461bcd60e51b81526020600482015260096024820152684e6f742070726f787960b81b604482015290519081900360640190fd5b610e01815b50565b6002546000906001600160a01b0316610e1b611048565b6001600160a01b031614610e64576040805162461bcd60e51b81526020600482015260166024820152600080516020611914833981519152604482015290519081900360640190fd5b6000610b39836040518060600160405280602581526020016119ec6025913960015460408051630af4187d60e01b81526001600160a01b038b811660048301528a8116602483015291519190921691630af4187d916044808301926020929190829003018186803b15801561083757600080fd5b60015460408051630af4187d60e01b81526001600160a01b038581166004830152848116602483015291516000939290921691630af4187d91604480820192602092909190829003018186803b158015610f3157600080fd5b505afa158015610f45573d6000803e3d6000fd5b505050506040513d6020811015610f5b57600080fd5b50519392505050565b6002546000906001600160a01b0316610f7b611048565b6001600160a01b031614610fc4576040805162461bcd60e51b81526020600482015260166024820152600080516020611914833981519152604482015290519081900360640190fd5b610da7848484611320565b6000546001600160a01b031681565b6003546001600160a01b031681565b610ff68161181c565b600354604080516313af403560e01b81526001600160a01b038481166004830152915191909216916313af403591602480830192600092919082900301818387803b15801561073d57600080fd5b3290565b3390565b6001600160a01b0383166110915760405162461bcd60e51b81526004018080602001828103825260258152602001806119a36025913960400191505060405180910390fd5b6001600160a01b0382166110d65760405162461bcd60e51b81526004018080602001828103825260238152602001806118ad6023913960400191505060405180910390fd5b600154604080516060810190915260268082526001600160a01b039092169163e30443bc91869161115891869161193460208301396001546040805163f8b2cb4f60e01b81526001600160a01b038c811660048301529151919092169163f8b2cb4f916024808301926020929190829003018186803b15801561083757600080fd5b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156111a757600080fd5b505af11580156111bb573d6000803e3d6000fd5b50506001546040805163f8b2cb4f60e01b81526001600160a01b038781166004830152915191909216935063e30443bc9250859161121d918691869163f8b2cb4f91602480820192602092909190829003018186803b158015610b0157600080fd5b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561126c57600080fd5b505af1158015611280573d6000803e3d6000fd5b50505050505050565b600081848411156113185760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156112dd5781810151838201526020016112c5565b50505050905090810190601f16801561130a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b0383166113655760405162461bcd60e51b81526004018080602001828103825260248152602001806119c86024913960400191505060405180910390fd5b6001600160a01b0382166113aa5760405162461bcd60e51b81526004018080602001828103825260228152602001806118f26022913960400191505060405180910390fd5b60015460408051633691826360e21b81526001600160a01b0386811660048301528581166024830152604482018590529151919092169163da46098c91606480830192600092919082900301818387803b15801561126c57600080fd5b6001600160a01b038216611462576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600154604080516362720d9160e11b815290516001600160a01b039092169163f7ea7a3d916114b5918591859163c4e41b2291600480820192602092909190829003018186803b158015610b0157600080fd5b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156114eb57600080fd5b505af11580156114ff573d6000803e3d6000fd5b50506001546040805163f8b2cb4f60e01b81526001600160a01b038781166004830152915191909216935063e30443bc92508591611561918691869163f8b2cb4f91602480820192602092909190829003018186803b158015610b0157600080fd5b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156115b057600080fd5b505af11580156115c4573d6000803e3d6000fd5b505050505050565b600082820183811015611626576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6001600160a01b0382166116725760405162461bcd60e51b81526004018080602001828103825260218152602001806119826021913960400191505060405180910390fd5b600154604080516060810190915260228082526001600160a01b039092169163e30443bc9185916116f49186916118d060208301396001546040805163f8b2cb4f60e01b81526001600160a01b038b811660048301529151919092169163f8b2cb4f916024808301926020929190829003018186803b15801561083757600080fd5b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561174357600080fd5b505af1158015611757573d6000803e3d6000fd5b5050600154604080516362720d9160e11b815290516001600160a01b03909216935063f7ea7a3d92506117e6918591859163c4e41b2291600480820192602092909190829003018186803b1580156117ae57600080fd5b505afa1580156117c2573d6000803e3d6000fd5b505050506040513d60208110156117d857600080fd5b50519063ffffffff61186a16565b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156115b057600080fd5b600154604080516313af403560e01b81526001600160a01b038481166004830152915191909216916313af403591602480830192600092919082900301818387803b15801561073d57600080fd5b600061162683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061128956fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f2061646472657373454173736574546f6b656e3a20464f5242494444454e0000000000000000000045524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a72315820de256cb6640d1dcd1aebc30536eac259775c57b509f2307358071252b2d39f5064736f6c63430005100032