{ "language": "Solidity", "sources": { "/workspace/GSN/Context.sol": { "content": "pragma solidity ^0.5.0;\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with GSN meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\ncontract Context {\n // Empty internal constructor, to prevent people from mistakenly deploying\n // an instance of this contract, which should be used via inheritance.\n constructor () internal { }\n // solhint-disable-previous-line no-empty-blocks\n\n function _msgSender() internal view returns (address payable) {\n return msg.sender;\n }\n\n function _msgData() internal view returns (bytes memory) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n}\n" }, "/workspace/access/Roles.sol": { "content": "pragma solidity ^0.5.0;\n\n/**\n * @title Roles\n * @dev Library for managing addresses assigned to a Role.\n */\nlibrary Roles {\n struct Role {\n mapping (address => bool) bearer;\n }\n\n /**\n * @dev Give an account access to this role.\n */\n function add(Role storage role, address account) internal {\n require(!has(role, account), \"Roles: account already has role\");\n role.bearer[account] = true;\n }\n\n /**\n * @dev Remove an account's access to this role.\n */\n function remove(Role storage role, address account) internal {\n require(has(role, account), \"Roles: account does not have role\");\n role.bearer[account] = false;\n }\n\n /**\n * @dev Check if an account has this role.\n * @return bool\n */\n function has(Role storage role, address account) internal view returns (bool) {\n require(account != address(0), \"Roles: account is the zero address\");\n return role.bearer[account];\n }\n}\n" }, "/workspace/access/roles/MinterRole.sol": { "content": "pragma solidity ^0.5.0;\n\nimport \"../Roles.sol\";\n\ncontract MinterRole {\n using Roles for Roles.Role;\n\n event MinterAdded(address indexed account);\n event MinterRemoved(address indexed account);\n\n Roles.Role private _minters;\n\n constructor () internal {\n _addMinter(msg.sender);\n }\n\n modifier onlyMinter() {\n require(isMinter(msg.sender), \"MinterRole: caller does not have the Minter role\");\n _;\n }\n\n function isMinter(address account) public view returns (bool) {\n return _minters.has(account);\n }\n\n function addMinter(address account) public onlyMinter {\n _addMinter(account);\n }\n\n function renounceMinter() public {\n _removeMinter(msg.sender);\n }\n\n function _addMinter(address account) internal {\n _minters.add(account);\n emit MinterAdded(account);\n }\n\n function _removeMinter(address account) internal {\n _minters.remove(account);\n emit MinterRemoved(account);\n }\n}\n" }, "/workspace/access/roles/PauserRole.sol": { "content": "pragma solidity ^0.5.0;\n\nimport \"../Roles.sol\";\n\ncontract PauserRole {\n using Roles for Roles.Role;\n\n event PauserAdded(address indexed account);\n event PauserRemoved(address indexed account);\n\n Roles.Role private _pausers;\n\n constructor () internal {\n _addPauser(msg.sender);\n }\n\n modifier onlyPauser() {\n require(isPauser(msg.sender), \"PauserRole: caller does not have the Pauser role\");\n _;\n }\n\n function isPauser(address account) public view returns (bool) {\n return _pausers.has(account);\n }\n\n function addPauser(address account) public onlyPauser {\n _addPauser(account);\n }\n\n function renouncePauser() public {\n _removePauser(msg.sender);\n }\n\n function _addPauser(address account) internal {\n _pausers.add(account);\n emit PauserAdded(account);\n }\n\n function _removePauser(address account) internal {\n _pausers.remove(account);\n emit PauserRemoved(account);\n }\n}\n" }, "/workspace/introspection/IKIP13.sol": { "content": "pragma solidity ^0.5.0;\n\n/**\n * @dev Interface of the KIP-13 standard, as defined in the\n * [KIP-13](http://kips.klaytn.com/KIPs/kip-13-interface_query_standard).\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others.\n *\n * For an implementation, see `KIP13`.\n */\ninterface IKIP13 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * [KIP-13 section](http://kips.klaytn.com/KIPs/kip-13-interface_query_standard#how-interface-identifiers-are-defined)\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "/workspace/introspection/KIP13.sol": { "content": "pragma solidity ^0.5.0;\n\nimport \"./IKIP13.sol\";\n\n/**\n * @dev Implementation of the `IKIP13` interface.\n *\n * Contracts may inherit from this and call `_registerInterface` to declare\n * their support of an interface.\n */\ncontract KIP13 is IKIP13 {\n /*\n * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7\n */\n bytes4 private constant _INTERFACE_ID_KIP13 = 0x01ffc9a7;\n\n /**\n * @dev Mapping of interface ids to whether or not it's supported.\n */\n mapping(bytes4 => bool) private _supportedInterfaces;\n\n constructor () internal {\n // Derived contracts need only register support for their own interfaces,\n // we register support for KIP13 itself here\n _registerInterface(_INTERFACE_ID_KIP13);\n }\n\n /**\n * @dev See `IKIP13.supportsInterface`.\n *\n * Time complexity O(1), guaranteed to always use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool) {\n return _supportedInterfaces[interfaceId];\n }\n\n /**\n * @dev Registers the contract as an implementer of the interface defined by\n * `interfaceId`. Support of the actual KIP13 interface is automatic and\n * registering its interface id is not required.\n *\n * See `IKIP13.supportsInterface`.\n *\n * Requirements:\n *\n * - `interfaceId` cannot be the KIP13 invalid interface (`0xffffffff`).\n */\n function _registerInterface(bytes4 interfaceId) internal {\n require(interfaceId != 0xffffffff, \"KIP13: invalid interface id\");\n _supportedInterfaces[interfaceId] = true;\n }\n}\n" }, "/workspace/lifecycle/Pausable.sol": { "content": "pragma solidity ^0.5.0;\n\nimport \"../access/roles/PauserRole.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\ncontract Pausable is PauserRole {\n /**\n * @dev Emitted when the pause is triggered by a pauser (`account`).\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by a pauser (`account`).\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state. Assigns the Pauser role\n * to the deployer.\n */\n constructor () internal {\n _paused = false;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n */\n modifier whenNotPaused() {\n require(!_paused, \"Pausable: paused\");\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n */\n modifier whenPaused() {\n require(_paused, \"Pausable: not paused\");\n _;\n }\n\n /**\n * @dev Called by a pauser to pause, triggers stopped state.\n */\n function pause() public onlyPauser whenNotPaused {\n _paused = true;\n emit Paused(msg.sender);\n }\n\n /**\n * @dev Called by a pauser to unpause, returns to normal state.\n */\n function unpause() public onlyPauser whenPaused {\n _paused = false;\n emit Unpaused(msg.sender);\n }\n}\n" }, "/workspace/math/SafeMath.sol": { "content": "pragma solidity ^0.5.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\n * checks.\n *\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\n * in bugs, because programmers usually assume that an overflow raises an\n * error, which is the standard behavior in high level programming languages.\n * `SafeMath` restores this intuition by reverting the transaction when an\n * operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n * - Subtraction cannot overflow.\n *\n * _Available since v2.4.0._\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers. Reverts on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n *\n * _Available since v2.4.0._\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0, errorMessage);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return mod(a, b, \"SafeMath: modulo by zero\");\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts with custom message when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n *\n * _Available since v2.4.0._\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b != 0, errorMessage);\n return a % b;\n }\n}\n" }, "/workspace/ownership/Ownable.sol": { "content": "pragma solidity ^0.5.0;\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be aplied to your functions to restrict their use to\n * the owner.\n */\ncontract Ownable {\n address payable private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor () internal {\n _owner = msg.sender;\n emit OwnershipTransferred(address(0), _owner);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view returns (address payable) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(isOwner(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Returns true if the caller is the current owner.\n */\n function isOwner() public view returns (bool) {\n return msg.sender == _owner;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * > Note: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address payable newOwner) public onlyOwner {\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n */\n function _transferOwnership(address payable newOwner) internal {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n" }, "/workspace/token/KIP37/IERC1155Receiver.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.5.0;\n\nimport \"../../introspection/IKIP13.sol\";\n\ncontract IERC1155Receiver is IKIP13 {\n /**\n @dev Handles the receipt of a single ERC1155 token type. This function is\n called at the end of a `safeTransferFrom` after the balance has been updated.\n To accept the transfer, this must return\n `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n (i.e. 0xf23a6e61, or its own function selector).\n @param operator The address which initiated the transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param id The ID of the token being transferred\n @param value The amount of tokens being transferred\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n @dev Handles the receipt of a multiple ERC1155 token types. This function\n is called at the end of a `safeBatchTransferFrom` after the balances have\n been updated. To accept the transfer(s), this must return\n `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n (i.e. 0xbc197c81, or its own function selector).\n @param operator The address which initiated the batch transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param ids An array containing ids of each token being transferred (order and length must match values array)\n @param values An array containing amounts of each token being transferred (order and length must match ids array)\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" }, "/workspace/token/KIP37/IKIP37.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.5.2;\n\nimport \"../../introspection/IKIP13.sol\";\n\n/**\n * @dev Required interface of an KIP37 compliant contract, as defined in the\n * https://kips.klaytn.com/KIPs/kip-37\n */\ncontract IKIP37 is IKIP13 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transfered from `from` to `to` by `operator`.\n */\n event TransferSingle(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 id,\n uint256 value\n );\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(\n address indexed account,\n address indexed operator,\n bool approved\n );\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id)\n external\n view\n returns (uint256);\n\n /**\n * @dev Batch-operations version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator)\n external\n view\n returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IKIP37Receiver-onKIP37Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev Batch-operations version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IKIP37Receiver-onKIP37BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" }, "/workspace/token/KIP37/IKIP37MetadataURI.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.5.0;\n\nimport \"./IKIP37.sol\";\n\n/**\n * @dev Interface of the optional KIP37MetadataExtension interface\n */\ncontract IKIP37MetadataURI is IKIP37 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" }, "/workspace/token/KIP37/IKIP37Receiver.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.5.0;\n\nimport \"../../introspection/IKIP13.sol\";\n\ncontract IKIP37Receiver is IKIP13 {\n /**\n @dev Handles the receipt of a single KIP37 token type. This function is\n called at the end of a `safeTransferFrom` after the balance has been updated.\n To accept the transfer, this must return\n `bytes4(keccak256(\"onKIP37Received(address,address,uint256,uint256,bytes)\"))`\n (i.e. 0xe78b3325, or its own function selector).\n @param operator The address which initiated the transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param id The ID of the token being transferred\n @param value The amount of tokens being transferred\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onKIP37Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onKIP37Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n @dev Handles the receipt of a multiple KIP37 token types. This function\n is called at the end of a `safeBatchTransferFrom` after the balances have\n been updated. To accept the transfer(s), this must return\n `bytes4(keccak256(\"onKIP37BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n (i.e. 0x9b49e332, or its own function selector).\n @param operator The address which initiated the batch transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param ids An array containing ids of each token being transferred (order and length must match values array)\n @param values An array containing amounts of each token being transferred (order and length must match ids array)\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onKIP37BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onKIP37BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" }, "/workspace/token/KIP37/KIP37.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.5.0;\n\nimport \"./IKIP37.sol\";\nimport \"./IKIP37MetadataURI.sol\";\nimport \"./IKIP37Receiver.sol\";\nimport \"./IERC1155Receiver.sol\";\nimport \"../../GSN/Context.sol\";\nimport \"../../introspection/KIP13.sol\";\nimport \"../../math/SafeMath.sol\";\nimport \"../../utils/Address.sol\";\n\n/**\n *\n * @dev Implementation of the basic standard multi-token.\n * Originally based on code by Enjin: https://github.com/enjin/erc-1155\n */\ncontract KIP37 is Context, KIP13, IKIP37, IKIP37MetadataURI {\n using SafeMath for uint256;\n using Address for address;\n\n // Mapping from token ID to account balances\n mapping(uint256 => mapping(address => uint256)) private _balances;\n\n // Mapping from account to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Mapping from token ID to the total supply of the token\n mapping(uint256 => uint256) private _totalSupply;\n\n // Used as the URI for all token types by relying on ID substition, e.g. https://token-cdn-domain/{id}.json\n string internal _uri;\n\n /*\n * bytes4(keccak256('balanceOf(address,uint256)')) == 0x00fdd58e\n * bytes4(keccak256('balanceOfBatch(address[],uint256[])')) == 0x4e1273f4\n * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465\n * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5\n * bytes4(keccak256('safeTransferFrom(address,address,uint256,uint256,bytes)')) == 0xf242432a\n * bytes4(keccak256('safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)')) == 0x2eb2c2d6\n * bytes4(keccak256('totalSupply(uint256)')) == 0xbd85b039\n *\n * => 0x00fdd58e ^ 0x4e1273f4 ^ 0xa22cb465 ^\n * 0xe985e9c5 ^ 0xf242432a ^ 0x2eb2c2d6 ^ 0xbd85b039 == 0x6433ca1f\n */\n bytes4 private constant _INTERFACE_ID_KIP37 = 0x6433ca1f;\n\n /*\n * bytes4(keccak256('uri(uint256)')) == 0x0e89341c\n */\n bytes4 private constant _INTERFACE_ID_KIP37_METADATA_URI = 0x0e89341c;\n\n bytes4 private constant _INTERFACE_ID_KIP37_TOKEN_RECEIVER = 0x7cc2d017;\n\n bytes4 private constant _INTERFACE_ID_ERC1155_TOKEN_RECEIVER = 0x4e2312e0;\n\n // Equals to `bytes4(keccak256(\"onKIP37Received(address,address,uint256,uint256,bytes)\"))`\n // which can be also obtained as `IKIP37Receiver(0).onKIP37Received.selector`\n bytes4 private constant _KIP37_RECEIVED = 0xe78b3325;\n\n // Equals to `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n // which can be also obtained as `IERC1155Receiver(0).onERC1155Received.selector`\n bytes4 private constant _ERC1155_RECEIVED = 0xf23a6e61;\n\n // Equals to `bytes4(keccak256(\"onKIP37BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n // which can be also obtained as `IKIP37Receiver(0).onKIP37BatchReceived.selector`\n bytes4 private constant _KIP37_BATCH_RECEIVED = 0x9b49e332;\n\n // Equals to `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n // which can be also obtained as `IERC1155Receiver(0).onERC1155BatchReceived.selector`\n bytes4 private constant _ERC1155_BATCH_RECEIVED = 0xbc197c81;\n\n /**\n * @dev See {_setURI}.\n */\n constructor(string memory uri) public {\n _setURI(uri);\n\n // register the supported interfaces to conform to KIP37 via KIP13\n _registerInterface(_INTERFACE_ID_KIP37);\n\n // register the supported interfaces to conform to KIP37MetadataURI via KIP13\n _registerInterface(_INTERFACE_ID_KIP37_METADATA_URI);\n }\n\n /**\n * @dev See {IKIP37MetadataURI-uri}.\n *\n * This implementation returns the same URI for *all* token types. It relies\n * on the token type ID substituion mechanism\n * http://kips.klaytn.com/KIPs/kip-37#metadata\n *\n * Clients calling this function must replace the `\\{id\\}` substring with the\n * actual token type ID.\n */\n function uri(uint256) external view returns (string memory) {\n return _uri;\n }\n\n /**\n * @dev See {IKIP37-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id)\n public\n view\n returns (uint256)\n {\n require(\n account != address(0),\n \"KIP37: balance query for the zero address\"\n );\n return _balances[id][account];\n }\n\n /**\n * @dev See {IKIP37-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] memory accounts, uint256[] memory ids)\n public\n view\n returns (uint256[] memory)\n {\n require(\n accounts.length == ids.length,\n \"KIP37: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n require(\n accounts[i] != address(0),\n \"KIP37: batch balance query for the zero address\"\n );\n batchBalances[i] = _balances[ids[i]][accounts[i]];\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IKIP37-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public {\n require(\n _msgSender() != operator,\n \"KIP37: setting approval status for self\"\n );\n\n _operatorApprovals[_msgSender()][operator] = approved;\n emit ApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IKIP37-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator)\n public\n view\n returns (bool)\n {\n return _operatorApprovals[account][operator];\n }\n\n function totalSupply(uint256 _tokenId) public view returns (uint256) {\n return _totalSupply[_tokenId];\n }\n\n /**\n * @dev See {IKIP37-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public {\n require(to != address(0), \"KIP37: transfer to the zero address\");\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"KIP37: caller is not owner nor approved\"\n );\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(\n operator,\n from,\n to,\n _asSingletonArray(id),\n _asSingletonArray(amount),\n data\n );\n\n _balances[id][from] = _balances[id][from].sub(\n amount,\n \"KIP37: insufficient balance for transfer\"\n );\n _balances[id][to] = _balances[id][to].add(amount);\n\n emit TransferSingle(operator, from, to, id, amount);\n\n require(\n _doSafeTransferAcceptanceCheck(\n operator,\n from,\n to,\n id,\n amount,\n data\n ),\n \"KIP37: transfer to non KIP37Receiver implementer\"\n );\n }\n\n /**\n * @dev See {IKIP37-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public {\n require(\n ids.length == amounts.length,\n \"KIP37: ids and amounts length mismatch\"\n );\n require(to != address(0), \"KIP37: transfer to the zero address\");\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"KIP37: transfer caller is not owner nor approved\"\n );\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n _balances[id][from] = _balances[id][from].sub(\n amount,\n \"KIP37: insufficient balance for transfer\"\n );\n _balances[id][to] = _balances[id][to].add(amount);\n }\n\n emit TransferBatch(operator, from, to, ids, amounts);\n\n require(\n _doSafeBatchTransferAcceptanceCheck(\n operator,\n from,\n to,\n ids,\n amounts,\n data\n ),\n \"KIP37: batch transfer to non KIP37Receiver implementer\"\n );\n }\n\n /**\n * @dev Sets a new URI for all token types, by relying on the token type ID\n * substituion mechanism\n * http://kips.klaytn.com/KIPs/kip-37#metadata.\n *\n * By this mechanism, any occurence of the `\\{id\\}` substring in either the\n * URI or any of the amounts in the JSON file at said URI will be replaced by\n * clients with the token type ID.\n *\n * For example, the `https://token-cdn-domain/\\{id\\}.json` URI would be\n * interpreted by clients as\n * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`\n * for token type ID 0x4cce0.\n *\n * See {uri}.\n *\n * Because these URIs cannot be meaningfully represented by the {URI} event,\n * this function emits no events.\n */\n function _setURI(string memory newuri) internal {\n _uri = newuri;\n }\n\n /**\n * @dev Creates `amount` tokens of token type `id`, and assigns them to `account`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - If `to` refers to a smart contract, it must implement {IKIP37Receiver-onKIP37Received} and return the\n * acceptance magic value.\n */\n function _mint(\n address account,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n require(account != address(0), \"KIP37: mint to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(\n operator,\n address(0),\n account,\n _asSingletonArray(id),\n _asSingletonArray(amount),\n data\n );\n\n _balances[id][account] = _balances[id][account].add(amount);\n _totalSupply[id] = _totalSupply[id].add(amount);\n emit TransferSingle(operator, address(0), account, id, amount);\n\n require(\n _doSafeTransferAcceptanceCheck(\n operator,\n address(0),\n account,\n id,\n amount,\n data\n ),\n \"KIP37: transfer to non KIP37Receiver implementer\"\n );\n }\n\n /**\n * @dev Batch-operations version of {_mint}.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IKIP37Receiver-onKIP37BatchReceived} and return the\n * acceptance magic value.\n */\n function _mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal {\n require(to != address(0), \"KIP37: mint to the zero address\");\n require(\n ids.length == amounts.length,\n \"KIP37: ids and amounts length mismatch\"\n );\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; i++) {\n _balances[ids[i]][to] = amounts[i].add(_balances[ids[i]][to]);\n _totalSupply[ids[i]] = amounts[i].add(_totalSupply[ids[i]]);\n }\n\n emit TransferBatch(operator, address(0), to, ids, amounts);\n\n require(\n _doSafeBatchTransferAcceptanceCheck(\n operator,\n address(0),\n to,\n ids,\n amounts,\n data\n ),\n \"KIP37: batch transfer to non KIP37Receiver implementer\"\n );\n }\n\n /**\n * @dev Destroys `amount` tokens of token type `id` from `account`\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens of token type `id`.\n */\n function _burn(\n address account,\n uint256 id,\n uint256 amount\n ) internal {\n require(account != address(0), \"KIP37: burn from the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(\n operator,\n account,\n address(0),\n _asSingletonArray(id),\n _asSingletonArray(amount),\n \"\"\n );\n\n _balances[id][account] = _balances[id][account].sub(\n amount,\n \"KIP37: burn amount exceeds balance\"\n );\n\n _totalSupply[id] = _totalSupply[id].sub(\n amount,\n \"KIP37: burn amount exceeds total supply\"\n );\n\n emit TransferSingle(operator, account, address(0), id, amount);\n }\n\n /**\n * @dev Batch-operations version of {_burn}.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n */\n function _burnBatch(\n address account,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal {\n require(account != address(0), \"KIP37: burn from the zero address\");\n require(\n ids.length == amounts.length,\n \"KIP37: ids and amounts length mismatch\"\n );\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, account, address(0), ids, amounts, \"\");\n\n for (uint256 i = 0; i < ids.length; i++) {\n _balances[ids[i]][account] = _balances[ids[i]][account].sub(\n amounts[i],\n \"KIP37: burn amount exceeds balance\"\n );\n\n _totalSupply[ids[i]] = _totalSupply[ids[i]].sub(\n amounts[i],\n \"KIP37: burn amount exceeds total supply\"\n );\n }\n\n emit TransferBatch(operator, account, address(0), ids, amounts);\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `id` and `amount` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal {}\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private returns (bool) {\n bool success;\n bytes memory returndata;\n\n if (!to.isContract()) {\n return true;\n }\n\n (success, returndata) = to.call(\n abi.encodeWithSelector(\n _ERC1155_RECEIVED,\n operator,\n from,\n id,\n amount,\n data\n )\n );\n if (\n returndata.length != 0 &&\n abi.decode(returndata, (bytes4)) == _ERC1155_RECEIVED\n ) {\n return true;\n }\n\n (success, returndata) = to.call(\n abi.encodeWithSelector(\n _KIP37_RECEIVED,\n operator,\n from,\n id,\n amount,\n data\n )\n );\n if (\n returndata.length != 0 &&\n abi.decode(returndata, (bytes4)) == _KIP37_RECEIVED\n ) {\n return true;\n }\n\n return false;\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private returns (bool) {\n bool success;\n bytes memory returndata;\n\n if (!to.isContract()) {\n return true;\n }\n\n (success, returndata) = to.call(\n abi.encodeWithSelector(\n _ERC1155_BATCH_RECEIVED,\n operator,\n from,\n ids,\n amounts,\n data\n )\n );\n if (\n returndata.length != 0 &&\n abi.decode(returndata, (bytes4)) == _ERC1155_BATCH_RECEIVED\n ) {\n return true;\n }\n\n (success, returndata) = to.call(\n abi.encodeWithSelector(\n _KIP37_BATCH_RECEIVED,\n operator,\n from,\n ids,\n amounts,\n data\n )\n );\n if (\n returndata.length != 0 &&\n abi.decode(returndata, (bytes4)) == _KIP37_BATCH_RECEIVED\n ) {\n return true;\n }\n\n return false;\n }\n\n function _asSingletonArray(uint256 element)\n private\n pure\n returns (uint256[] memory)\n {\n uint256[] memory array = new uint256[](1);\n array[0] = element;\n\n return array;\n }\n}\n" }, "/workspace/token/KIP37/KIP37Burnable.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.5.0;\n\nimport \"./KIP37.sol\";\n\n/**\n * @dev Extension of {KIP37} that allows token holders to destroy both their\n * own tokens and those that they have been approved to use.\n */\ncontract KIP37Burnable is KIP37 {\n /*\n * bytes4(keccak256('burn(address,uint256,uint256)')) == 0xf5298aca\n * bytes4(keccak256('burnBatch(address,uint256[],uint256[])')) == 0x6b20c454\n *\n * => 0xf5298aca ^ 0x6b20c454 == 0x9e094e9e\n */\n bytes4 private constant _INTERFACE_ID_KIP37_BURNABLE = 0x9e094e9e;\n\n constructor() public {\n _registerInterface(_INTERFACE_ID_KIP37_BURNABLE);\n }\n\n function burn(\n address account,\n uint256 id,\n uint256 value\n ) public {\n require(\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\n \"KIP37: caller is not owner nor approved\"\n );\n\n _burn(account, id, value);\n }\n\n function burnBatch(\n address account,\n uint256[] memory ids,\n uint256[] memory values\n ) public {\n require(\n account == _msgSender() || isApprovedForAll(account, _msgSender()),\n \"KIP37: caller is not owner nor approved\"\n );\n\n _burnBatch(account, ids, values);\n }\n}\n" }, "/workspace/token/KIP37/KIP37Mintable.sol": { "content": "pragma solidity ^0.5.0;\n\nimport \"./KIP37.sol\";\nimport \"../../access/roles/MinterRole.sol\";\n\n/**\n * @dev Extension of {KIP37} that allows token holders to destroy both their\n * own tokens and those that they have been approved to use.\n */\ncontract KIP37Mintable is KIP37, MinterRole {\n /*\n * bytes4(keccak256('create(uint256,uint256,string)')) == 0x4b068c78\n * bytes4(keccak256('mint(uint256,address,uint256)')) == 0x836a1040\n * bytes4(keccak256('mint(uint256,address[],uint256[])')) == 0xcfa84fc1\n * bytes4(keccak256('mintBatch(address,uint256[],uint256[])')) == 0xd81d0a15\n *\n * => 0x4b068c78 ^ 0x836a1040 ^ 0xcfa84fc1 ^ 0xd81d0a15 == 0xdfd9d9ec\n */\n bytes4 private constant _INTERFACE_ID_KIP37_MINTABLE = 0xdfd9d9ec;\n\n // id => creators\n mapping(uint256 => address) public creators;\n\n mapping(uint256 => string) _uris;\n\n constructor() public {\n _registerInterface(_INTERFACE_ID_KIP37_MINTABLE);\n }\n\n function _exists(uint256 tokenId) internal view returns (bool) {\n address creator = creators[tokenId];\n return creator != address(0);\n }\n\n /**\n * @dev See {IKIP37MetadataURI-uri}.\n *\n * This implementation returns the same URI for *all* token types. It relies\n * on the token type ID substituion mechanism\n * http://kips.klaytn.com/KIPs/kip-37#metadata\n *\n * Clients calling this function must replace the `\\{id\\}` substring with the\n * actual token type ID.\n */\n function uri(uint256 tokenId) external view returns (string memory) {\n string memory customURI = string(_uris[tokenId]);\n if(bytes(customURI).length != 0) {\n return customURI;\n }\n\n return _uri;\n }\n\n /// @notice Creates a new token type and assigns _initialSupply to the minter.\n /// @dev Throws if `msg.sender` is not allowed to create.\n /// Throws if the token id is already used.\n /// @param _id The token id to create.\n /// @param _initialSupply The amount of tokens being minted.\n /// @param _uri The token URI of the created token.\n /// @return A boolean that indicates if the operation was successful.\n function create(\n uint256 _id,\n uint256 _initialSupply,\n string memory _uri\n ) public onlyMinter returns (bool) {\n require(!_exists(_id), \"KIP37: token already created\");\n\n creators[_id] = msg.sender;\n _mint(msg.sender, _id, _initialSupply, \"\");\n\n if (bytes(_uri).length > 0) {\n _uris[_id] = _uri;\n emit URI(_uri, _id);\n }\n }\n\n /// @notice Mints tokens of the specific token type `_id` and assigns the tokens according to the variables `_to` and `_value`.\n /// @dev Throws if `msg.sender` is not allowed to mint.\n /// MUST emit an event `TransferSingle`.\n /// @param _id The token id to mint.\n /// @param _to The address that will receive the minted tokens.\n /// @param _value The quantity of tokens being minted.\n function mint(\n uint256 _id,\n address _to,\n uint256 _value\n ) public onlyMinter {\n require(_exists(_id), \"KIP37: nonexistent token\");\n _mint(_to, _id, _value, \"\");\n }\n\n /// @notice Mints tokens of the specific token type `_id` in a batch and assigns the tokens according to the variables `_toList` and `_values`.\n /// @dev Throws if `msg.sender` is not allowed to mint.\n /// MUST emit one or more `TransferSingle` events.\n /// MUST revert if the length of `_toList` is not the same as the length of `_values`.\n /// @param _id The token id to mint.\n /// @param _toList The list of addresses that will receive the minted tokens.\n /// @param _values The list of quantities of tokens being minted.\n function mint(\n uint256 _id,\n address[] memory _toList,\n uint256[] memory _values\n ) public onlyMinter {\n require(_exists(_id), \"KIP37: nonexistent token\");\n require(\n _toList.length == _values.length,\n \"KIP37: toList and _values length mismatch\"\n );\n for (uint256 i = 0; i < _toList.length; ++i) {\n address to = _toList[i];\n uint256 value = _values[i];\n _mint(to, _id, value, \"\");\n }\n }\n\n /// @notice Mints multiple KIP37 tokens of the specific token types `_ids` in a batch and assigns the tokens according to the variables `_to` and `_values`.\n /// @dev Throws if `msg.sender` is not allowed to mint.\n /// MUST emit one or more `TransferSingle` events or a single `TransferBatch` event.\n /// MUST revert if the length of `_ids` is not the same as the length of `_values`.\n /// @param _to The address that will receive the minted tokens.\n /// @param _ids The list of the token ids to mint.\n /// @param _values The list of quantities of tokens being minted.\n function mintBatch(\n address _to,\n uint256[] memory _ids,\n uint256[] memory _values\n ) public onlyMinter {\n for (uint256 i = 0; i < _ids.length; ++i) {\n require(_exists(_ids[i]), \"KIP37: nonexistent token\");\n }\n _mintBatch(_to, _ids, _values, \"\");\n }\n}\n" }, "/workspace/token/KIP37/KIP37Pausable.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.5.0;\n\nimport \"./KIP37.sol\";\nimport \"../../lifecycle/Pausable.sol\";\n\n/**\n * @dev KIP37 token with pausable token transfers, minting and burning.\n *\n * Useful for scenarios such as preventing trades until the end of an evaluation\n * period, or having an emergency switch for freezing all token transfers in the\n * event of a large bug.\n *\n * _Available since v3.1._\n */\ncontract KIP37Pausable is KIP37, Pausable {\n mapping(uint256 => bool) private _tokenPaused;\n\n /*\n * bytes4(keccak256('pause()')) == 0x8456cb59\n * bytes4(keccak256('pause(uint256)')) == 0x136439dd\n * bytes4(keccak256('paused()')) == 0x5c975abb\n * bytes4(keccak256('paused(uint256)')) == 0x00dde10e\n * bytes4(keccak256('unpause()')) == 0x3f4ba83a\n * bytes4(keccak256('unpause(uint256)')) == 0xfabc1cbc\n *\n * => 0x8456cb59 ^ 0x136439dd ^ 0x5c975abb ^\n * 0x00dde10e ^ 0x3f4ba83a ^ 0xfabc1cbc == 0x0e8ffdb7\n */\n bytes4 private constant _INTERFACE_ID_KIP37_PAUSABLE = 0x0e8ffdb7;\n\n constructor() public {\n _registerInterface(_INTERFACE_ID_KIP37_PAUSABLE);\n }\n\n /**\n * @dev Emitted when the pause is triggered by a pauser (`account`) with token ID.\n */\n event Paused(uint256 tokenId, address account);\n\n /**\n * @dev Emitted when the pause is lifted by a pauser (`account`) with token ID.\n */\n event Unpaused(uint256 tokenId, address account);\n\n /// @notice Checks whether the specific token is paused.\n /// @return True if the specific token is paused, false otherwise\n function paused(uint256 _id) public view returns (bool) {\n return _tokenPaused[_id];\n }\n\n /// @notice Pauses actions related to transfer and approval of the specific token.\n /// @dev Throws if `msg.sender` is not allowed to pause.\n /// Throws if the specific token is paused.\n function pause(uint256 _id) public onlyPauser {\n require(_tokenPaused[_id] == false, \"KIP37Pausable: already paused\");\n _tokenPaused[_id] = true;\n emit Paused(_id, msg.sender);\n }\n\n /// @notice Resumes from the paused state of the specific token.\n /// @dev Throws if `msg.sender` is not allowed to unpause.\n /// Throws if the specific token is not paused.\n function unpause(uint256 _id) public onlyPauser {\n require(_tokenPaused[_id] == true, \"KIP37Pausable: already unpaused\");\n _tokenPaused[_id] = false;\n emit Unpaused(_id, msg.sender);\n }\n\n /**\n * @dev See {KIP37-_beforeTokenTransfer}.\n *\n * Requirements:\n *\n * - the contract must not be paused.\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal {\n require(!paused(), \"KIP37Pausable: token transfer while paused\");\n for (uint256 i = 0; i < ids.length; i++) {\n require(\n _tokenPaused[ids[i]] == false,\n \"KIP37Pausable: the token is paused\"\n );\n }\n }\n}\n" }, "/workspace/token/KIP37/KIP37Token.sol": { "content": "pragma solidity ^0.5.0;\r\n\r\nimport \"./KIP37.sol\";\r\nimport \"./KIP37Burnable.sol\";\r\nimport \"./KIP37Pausable.sol\";\r\nimport \"./KIP37Mintable.sol\";\r\n\r\ncontract KIP37Token is KIP37, KIP37Burnable, KIP37Pausable, KIP37Mintable {\r\n constructor(string memory uri) public KIP37(uri) {}\r\n}\r\n" }, "/workspace/token/KIP37/KIP37TokenOwnable.sol": { "content": "pragma solidity ^0.5.0;\r\n\r\nimport \"./KIP37Token.sol\";\r\nimport \"../../ownership/Ownable.sol\";\r\n\r\ncontract KIP37TokenOwnable is KIP37Token, Ownable {\r\n // Contract name\r\n string public name;\r\n // Contract symbol\r\n string public symbol;\r\n\r\n constructor(\r\n string memory _name,\r\n string memory _symbol,\r\n string memory uri,\r\n address payable newOwner\r\n ) public KIP37Token(uri) {\r\n transferOwnership(newOwner);\r\n name = _name;\r\n symbol = _symbol;\r\n }\r\n}\r\n" }, "/workspace/utils/Address.sol": { "content": "pragma solidity ^0.5.0;\n\n/**\n * @dev Collection of functions related to the address type,\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * This test is non-exhaustive, and there may be false-negatives: during the\n * execution of a contract's constructor, its address will be reported as\n * not containing a contract.\n *\n * > It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies in extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n // solhint-disable-next-line no-inline-assembly\n assembly { size := extcodesize(account) }\n return size > 0;\n }\n}\n" } }, "settings": { "remappings": [], "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "constantinople", "outputSelection": { "*": { "*": [ "metadata", "evm.bytecode", "evm.bytecode.sourceMap" ], "": [ "ast" ] }, "def": { "MyContract": [ "abi", "evm.bytecode.opcodes" ] } } } }