Blocks
Blocks
Uncles
Forked Blocks (Reorgs)
Transactions
Validated
Pending
Tokens
All
CHZ
APIs
GraphQL
RPC
Eth RPC
Ecosystem
Chiliz Legacy Chain
/
Search
/
Search
Connection Lost
New Solidity Smart Contract Verification
Contract Address
The 0x address supplied on contract creation.
Contract Name
Must match the name specified in the code. For example, in
contract MyContract {..}
MyContract
is the contract name.
Include nightly builds
No
Yes
Select yes if you want to show nightly builds.
Compiler
v0.8.28+commit.7893614a
v0.8.27+commit.40a35a09
v0.8.26+commit.8a97fa7a
v0.8.25+commit.b61c2a91
v0.8.24+commit.e11b9ed9
v0.8.23+commit.f704f362
v0.8.22+commit.4fc1097e
v0.8.21+commit.d9974bed
v0.8.20+commit.a1b79de6
v0.8.19+commit.7dd6d404
v0.8.18+commit.87f61d96
v0.8.17+commit.8df45f5f
v0.8.16+commit.07a7930e
v0.8.15+commit.e14f2714
v0.8.14+commit.80d49f37
v0.8.13+commit.abaa5c0e
v0.8.12+commit.f00d7308
v0.8.11+commit.d7f03943
v0.8.10+commit.fc410830
v0.8.9+commit.e5eed63a
v0.8.8+commit.dddeac2f
v0.8.7+commit.e28d00a7
v0.8.6+commit.11564f7e
v0.8.5+commit.a4f2e591
v0.8.4+commit.c7e474f2
v0.8.3+commit.8d00100c
v0.8.2+commit.661d1103
v0.8.1+commit.df193b15
v0.8.0+commit.c7dfd78e
v0.7.6+commit.7338295f
v0.7.5+commit.eb77ed08
v0.7.4+commit.3f05b770
v0.7.3+commit.9bfce1f6
v0.7.2+commit.51b20bc0
v0.7.1+commit.f4a555be
v0.7.0+commit.9e61f92b
v0.6.12+commit.27d51765
v0.6.11+commit.5ef660b1
v0.6.10+commit.00c0fcaf
v0.6.9+commit.3e3065ac
v0.6.8+commit.0bbfe453
v0.6.7+commit.b8d736ae
v0.6.6+commit.6c089d02
v0.6.5+commit.f956cc89
v0.6.4+commit.1dca32f3
v0.6.3+commit.8dda9521
v0.6.2+commit.bacdbe57
v0.6.1+commit.e6f7d5a4
v0.6.0+commit.26b70077
v0.5.17+commit.d19bba13
v0.5.16+commit.9c3226ce
v0.5.15+commit.6a57276f
v0.5.14+commit.01f1aaa4
v0.5.13+commit.5b0b510c
v0.5.12+commit.7709ece9
v0.5.11+commit.22be8592
v0.5.10+commit.5a6ea5b1
v0.5.9+commit.c68bc34e
v0.5.8+commit.23d335f2
v0.5.7+commit.6da8b019
v0.5.6+commit.b259423e
v0.5.5+commit.47a71e8f
v0.5.4+commit.9549d8ff
v0.5.3+commit.10d17f24
v0.5.2+commit.1df8f40c
v0.5.1+commit.c8a2cb62
v0.5.0+commit.1d4f565a
v0.4.26+commit.4563c3fc
v0.4.25+commit.59dbf8f1
v0.4.24+commit.e67f0147
v0.4.23+commit.124ca40d
v0.4.22+commit.4cb486ee
v0.4.21+commit.dfe3193c
v0.4.20+commit.3155dd80
v0.4.19+commit.c4cbbb05
v0.4.18+commit.9cf6e910
v0.4.17+commit.bdeb9e52
v0.4.16+commit.d7661dd9
v0.4.15+commit.8b45bddb
v0.4.14+commit.c2215d46
v0.4.13+commit.0fb4cb1a
v0.4.12+commit.194ff033
v0.4.11+commit.68ef5810
v0.4.10+commit.9e8cc01b
The compiler version is specified in
pragma solidity X.X.X
. Use the compiler version rather than the nightly build. If using the Solidity compiler, run
solc —version
to check.
EVM Version
homestead
tangerineWhistle
spuriousDragon
byzantium
constantinople
petersburg
istanbul
berlin
london
default
The EVM version the contract is written for. If the bytecode does not match the version, we try to verify using the latest EVM version.
EVM version details
.
Optimization
No
Yes
If you enabled optimization during compilation, select yes.
Optimization runs
Enter the Solidity Contract Code
// File: @openzeppelin/upgrades/contracts/Initializable.sol pragma solidity 0.5.1; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the initializer modifier. * WARNING: Unlike constructors, initializer functions must be manually * invoked. This applies both to deploying an Initializable contract, as well * as extending an Initializable contract via inheritance. * WARNING: When used with inheritance, manual care must be taken to not invoke * a parent initializer twice, or ensure that all initializers are idempotent, * because this is not dealt with automatically as with constructors. */ contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private initializing; /** * @dev Modifier to use in the initializer function of a contract. */ modifier initializer() { require( initializing || isConstructor() || !initialized, "Contract instance has already been initialized" ); bool isTopLevelCall = !initializing; if (isTopLevelCall) { initializing = true; initialized = true; } _; if (isTopLevelCall) { initializing = false; } } /// @dev Returns true if and only if the function is running in the constructor function isConstructor() private view returns (bool) { // extcodesize checks the size of the code stored in an address, and // address returns the current address. Since the code is still not // deployed when running a constructor, any checks on its code size will // yield zero, making it an effective way to detect if a contract is // under construction or not. uint256 cs; assembly { cs := extcodesize(address) } return cs == 0; } // Reserved storage space to allow for layout changes in the future. uint256[50] private ______gap; } // File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol pragma solidity 0.5.1; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see ERC20Detailed. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by account. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves amount tokens from the caller's account to recipient. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a Transfer event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that spender will be * allowed to spend on behalf of owner through transferFrom. This is * zero by default. * * This value changes when approve or transferFrom are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets amount as the allowance of spender over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * > Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an Approval event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves amount tokens from sender to recipient using the * allowance mechanism. amount is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a Transfer event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @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: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Detailed.sol pragma solidity 0.5.1; /** * @dev Optional functions from the ERC20 standard. */ contract ERC20Detailed is Initializable, IERC20 { string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for name, symbol, and decimals. All three of * these values are immutable: they can only be set once during * construction. */ function initialize( string memory name, string memory symbol, uint8 decimals ) public initializer { _name = name; _symbol = symbol; _decimals = decimals; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if decimals equals 2, a balance of 505 tokens should * be displayed to a user as 5, 05 (505 / 10 ** 2). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. * * > Note that this information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * IERC20.balanceOf and IERC20.transfer. */ function decimals() public view returns (uint8) { return _decimals; } uint256[50] private ______gap; } // File: @openzeppelin/contracts-ethereum-package/contracts/GSN/Context.sol pragma solidity 0.5.1; /* * @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 not 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, with should be used via inheritance. constructor() internal {} // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address) { return msg.sender; } 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: @openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol pragma solidity 0.5.1; /** * @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) { require(b <= a, "SafeMath: subtraction overflow"); 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-solidity/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) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath: division by zero"); 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) { require(b != 0, "SafeMath: modulo by zero"); return a % b; } } // File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol pragma solidity 0.5.1; /** * @dev Implementation of the IERC20 interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using _mint. * For a generic mechanism see ERC20Mintable. * * *For a detailed writeup see our guide [How to implement supply * mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).* * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning false on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an Approval event is emitted on calls to transferFrom. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard decreaseAllowance and increaseAllowance * functions have been added to mitigate the well-known issues around setting * allowances. See IERC20.approve. */ contract ERC20 is Initializable, Context, IERC20 { using SafeMath for uint256; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See IERC20.totalSupply. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See IERC20.balanceOf. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See IERC20.transfer. * * Requirements: * * - recipient cannot be the zero address. * - the caller must have a balance of at least amount. */ function transfer(address to, uint256 value) public returns (bool) { _transfer(_msgSender(), to, value); return true; } /** * @dev See IERC20.allowance. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See IERC20.approve. * * Requirements: * * - spender cannot be the zero address. */ function approve(address spender, uint256 value) public returns (bool) { _approve(_msgSender(), spender, value); 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 value. * - the caller must have allowance for sender's tokens of at least * amount. */ function transferFrom( address from, address to, uint256 value ) public returns (bool) { _transfer(from, to, value); _approve( from, _msgSender(), _allowances[from][_msgSender()].sub(value) ); 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 spender, uint256 addedValue) public returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue) ); 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 spender, uint256 subtractedValue) public returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue) ); 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"); _balances[sender] = _balances[sender].sub(amount); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, 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"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destoys 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 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Sets amount as the allowance of spender over the owners 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 value ) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); } /** * @dev Destoys amount tokens from account.amount is then deducted * from the caller's allowance. * * See _burn and _approve. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve( account, _msgSender(), _allowances[account][_msgSender()].sub(amount) ); } uint256[50] private ______gap; } // File: @openzeppelin/contracts-ethereum-package/contracts/access/Roles.sol pragma solidity 0.5.1; /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping(address => bool) bearer; } /** * @dev Give an account access to this role. */ function add(Role storage role, address account) internal { require(!has(role, account), "Roles: account already has role"); role.bearer[account] = true; } /** * @dev Remove an account's access to this role. */ function remove(Role storage role, address account) internal { require(has(role, account), "Roles: account does not have role"); role.bearer[account] = false; } /** * @dev Check if an account has this role. * @return bool */ function has(Role storage role, address account) internal view returns (bool) { require(account != address(0), "Roles: account is the zero address"); return role.bearer[account]; } } // File: @openzeppelin/contracts-ethereum-package/contracts/access/roles/MinterRole.sol pragma solidity 0.5.1; contract MinterRole is Initializable, Context { using Roles for Roles.Role; event MinterAdded(address indexed account); event MinterRemoved(address indexed account); Roles.Role private _minters; function initialize(address sender) public initializer { if (!isMinter(sender)) { _addMinter(sender); } } modifier onlyMinter() { require( isMinter(_msgSender()), "MinterRole: caller does not have the Minter role" ); _; } function isMinter(address account) public view returns (bool) { return _minters.has(account); } function addMinter(address account) public onlyMinter { _addMinter(account); } function renounceMinter() public { _removeMinter(_msgSender()); } function _addMinter(address account) internal { _minters.add(account); emit MinterAdded(account); } function _removeMinter(address account) internal { _minters.remove(account); emit MinterRemoved(account); } uint256[50] private ______gap; } // File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Mintable.sol pragma solidity 0.5.1; /** * @dev Extension of ERC20 that adds a set of accounts with the MinterRole, * which have permission to mint (create) new tokens as they see fit. * * At construction, the deployer of the contract is the only minter. */ contract ERC20Mintable is Initializable, ERC20, MinterRole { function initialize(address sender) public initializer { MinterRole.initialize(sender); } uint256[50] private ______gap; } // File: @openzeppelin/contracts-ethereum-package/contracts/access/roles/PauserRole.sol pragma solidity 0.5.1; contract PauserRole is Initializable, Context { using Roles for Roles.Role; event PauserAdded(address indexed account); event PauserRemoved(address indexed account); Roles.Role private _pausers; function initialize(address sender) public initializer { if (!isPauser(sender)) { _addPauser(sender); } } modifier onlyPauser() { require( isPauser(_msgSender()), "PauserRole: caller does not have the Pauser role" ); _; } function isPauser(address account) public view returns (bool) { return _pausers.has(account); } function addPauser(address account) public onlyPauser { _addPauser(account); } function renouncePauser() public { _removePauser(_msgSender()); } function _addPauser(address account) internal { _pausers.add(account); emit PauserAdded(account); } function _removePauser(address account) internal { _pausers.remove(account); emit PauserRemoved(account); } uint256[50] private ______gap; } // File: @openzeppelin/contracts-ethereum-package/contracts/lifecycle/Pausable.sol pragma solidity 0.5.1; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers whenNotPaused and whenPaused, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ contract Pausable is Initializable, Context, PauserRole { /** * @dev Emitted when the pause is triggered by a pauser (account). */ event Paused(address account); /** * @dev Emitted when the pause is lifted by a pauser (account). */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. Assigns the Pauser role * to the deployer. */ function initialize(address sender) public initializer { PauserRole.initialize(sender); _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!_paused, "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(_paused, "Pausable: not paused"); _; } /** * @dev Called by a pauser to pause, triggers stopped state. */ function pause() public onlyPauser whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Called by a pauser to unpause, returns to normal state. */ function unpause() public onlyPauser whenPaused { _paused = false; emit Unpaused(_msgSender()); } uint256[50] private ______gap; } // File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Pausable.sol pragma solidity 0.5.1; /** * @title Pausable token * @dev ERC20 modified with pausable transfers. */ contract ERC20Pausable is Initializable, ERC20, Pausable { function initialize(address sender) public initializer { Pausable.initialize(sender); } function transfer(address to, uint256 value) public whenNotPaused returns (bool) { return super.transfer(to, value); } function transferFrom( address from, address to, uint256 value ) public whenNotPaused returns (bool) { return super.transferFrom(from, to, value); } function approve(address spender, uint256 value) public whenNotPaused returns (bool) { return super.approve(spender, value); } function increaseAllowance(address spender, uint256 addedValue) public whenNotPaused returns (bool) { return super.increaseAllowance(spender, addedValue); } function decreaseAllowance(address spender, uint256 subtractedValue) public whenNotPaused returns (bool) { return super.decreaseAllowance(spender, subtractedValue); } uint256[50] private ______gap; } // File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/StandaloneERC20.sol pragma solidity 0.5.1; /** * @title Standard ERC20 token, with minting and pause functionality. * */ contract StandaloneERC20 is Initializable, ERC20Detailed, ERC20Mintable, ERC20Pausable { function initialize( string memory name, string memory symbol, uint8 decimals, uint256 initialSupply, address initialHolder, address[] memory minters, address[] memory pausers ) public initializer { ERC20Detailed.initialize(name, symbol, decimals); // Mint the initial supply _mint(initialHolder, initialSupply); // Initialize the minter and pauser roles, and renounce them ERC20Mintable.initialize(address(this)); _removeMinter(address(this)); ERC20Pausable.initialize(address(this)); _removePauser(address(this)); // Add the requested minters and pausers (this can be done after renouncing since // these are the internal calls) for (uint256 i = 0; i < minters.length; ++i) { _addMinter(minters[i]); } for (uint256 i = 0; i < pausers.length; ++i) { _addPauser(pausers[i]); } } function initialize( string memory name, string memory symbol, uint8 decimals, address[] memory minters, address[] memory pausers ) public initializer { ERC20Detailed.initialize(name, symbol, decimals); // Initialize the minter and pauser roles, and renounce them ERC20Mintable.initialize(address(this)); _removeMinter(address(this)); ERC20Pausable.initialize(address(this)); _removePauser(address(this)); // Add the requested minters and pausers (this can be done after renouncing since // these are the internal calls) for (uint256 i = 0; i < minters.length; ++i) { _addMinter(minters[i]); } for (uint256 i = 0; i < pausers.length; ++i) { _addPauser(pausers[i]); } } } // File: contracts/ArrayListLib.sol pragma solidity 0.5.1; library ArrayListLib { struct ListItem { uint256 index; address item; } struct StoredList { mapping(address => ListItem) storageMap; bool initialized; address[] storageList; } function add(StoredList storage self, address _address) internal { if (!exists(self, _address)) { ListItem memory item = ListItem( self.storageList.length + 1, _address ); self.storageList.push(_address); self.storageMap[_address] = item; } } function exists(StoredList storage self, address _address) internal view returns (bool) { return self.storageMap[_address].index > 0; } function remove(StoredList storage self, address _address) internal { if (exists(self, _address)) { uint256 lastIndex = self.storageList.length; if (lastIndex != self.storageMap[_address].index) { self.storageMap[self.storageList[lastIndex - 1]].index = self .storageMap[_address] .index; self.storageList[self.storageMap[_address].index - 1] = self .storageList[lastIndex - 1]; } self.storageList.length--; } delete self.storageMap[_address]; } function getItems(StoredList storage self) internal view returns (address[] memory items) { return self.storageList; } } // File: contracts/VoteTokenImplementation.sol pragma solidity 0.5.1; //import './Survey.sol'; contract Survey { function updateQuorum( uint256 _fromNewBalance, uint256 _fromOldBalance, uint256 _toNewBalance, uint256 _toOldBalance ) public; function adjustTotalWeights(address _owner, bool _exclude) external; } contract VoteTokenImplementation is Initializable, StandaloneERC20 { using ArrayListLib for ArrayListLib.StoredList; ArrayListLib.StoredList private surveys; ArrayListLib.StoredList private ownersList; ArrayListLib.StoredList private exclusionList; address private owner; bool private initializedByProxy; modifier onlyOwner { require(msg.sender == owner, 'Not allowed to call this method'); _; } constructor() public { initializedByProxy = true; } function initialize( string memory name, string memory symbol, uint8 decimals, uint256 initialSupply, address initialHolder, address[] memory minters, address[] memory pausers ) public initializer { require(!initializedByProxy, "already initialized"); owner = initialHolder; exclusionList.add(initialHolder); StandaloneERC20.initialize(name, symbol, decimals, initialSupply, initialHolder, minters, pausers); } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { bool transferResult = super.transferFrom(sender, recipient, amount); if( balanceOf(recipient) > 0 && //has positive balance !ownersList.exists(recipient) //not added already to owners list ) { ownersList.add(recipient); } //sender's balance is 0, taking it out from owners' list if(balanceOf(sender) == 0 && ownersList.exists(sender)) { ownersList.remove(sender); } return transferResult; } function transfer(address recipient, uint256 amount) public returns (bool) { address _from = msg.sender; bool transferResult = super.transfer(recipient, amount); if( balanceOf(recipient) > 0 && //has positive balance !ownersList.exists(recipient) && //not added already to owners list recipient != owner //not adding the owner to this list ) { ownersList.add(recipient); } //sender's balance is 0, taking it out from owners' list if(balanceOf(_from) == 0 && ownersList.exists(_from)) { ownersList.remove(_from); } return transferResult; } function registerSurvey(address _survey) public { surveys.add(_survey); } function unregisterSurvey(address _survey) public { surveys.remove(_survey); } function isSurveyRegistered(address _survey) public view returns (bool) { return surveys.exists(_survey); } function batchTransfer(address payable _from, address[] memory _to, uint256[] memory _values) public { uint256 toLength = _to.length; require(toLength == _values.length, "Batches counters do not match"); for (uint index = 0; index < toLength; index++) { if (_from == msg.sender) { transfer(_to[index], _values[index]); } else { transferFrom(_from, _to[index], _values[index]); } } } function getCirculatingSupply(uint256 offset, uint256 count, uint256 cap) public view returns (uint256) { uint256 balance; uint256 circulatingSupply; uint256 totalCount; uint256 adjustSupply; if (offset >= ownersList.storageList.length) { return 0; } totalCount = offset + count > ownersList.storageList.length ? ownersList.storageList.length : offset + count; for (uint256 index = offset; index < totalCount; index++) { balance = balanceOf(ownersList.storageList[index]); adjustSupply = cap > balance ? balance : cap; circulatingSupply = circulatingSupply + adjustSupply; } return circulatingSupply; } function getOwnersCount() external view returns (uint) { return ownersList.storageList.length; } function getOwner() public view returns (address tokenOwner) { return owner; } function burn(address account, uint256 value) public onlyOwner { require(account == owner, 'Not allowed to burn tokens from non-owner'); super._burn(account, value); } function version() public pure returns (uint) { return 8; } }
We recommend using flattened code. This is necessary if your code utilizes a library or inherits dependencies. Use the
POA solidity flattener or the
truffle flattener
.
Try to fetch constructor arguments automatically
No
Yes
ABI-encoded Constructor Arguments (if required by the contract)
Add arguments in
ABI hex encoded form
. Constructor arguments are written right to left, and will be found at the end of the input created bytecode. They may also be
parsed here.
Add Contract Libraries
Contract Libraries
Library Name
A library name called in the .sol file. Multiple libraries (up to 5) may be added for each contract. Click the Add Library button to add an additional one.
Library Address
The 0x library address. This can be found in the generated json file or Truffle output (if using truffle).
Library Name
Library Address
Library Name
Library Address
Library Name
Library Address
Library Name
Library Address
Add Library
Loading...
Verify & publish
Cancel
Ok
Ok
Ok
No
Yes