├── .gitignore ├── migrations ├── 2_deploy_contracts.js └── 1_initial_migration.js ├── contracts ├── Migrations.sol └── AnyswapToken.sol ├── truffle-config.js ├── AnyswapToken.sol ├── README.md ├── package.json ├── LICENSE ├── abi └── AnyswapToken.json └── bytecode └── AnyswapToken.txt /.gitignore: -------------------------------------------------------------------------------- 1 | contracts/.placeholder 2 | test/.placeholder 3 | build 4 | node_modules 5 | -------------------------------------------------------------------------------- /migrations/2_deploy_contracts.js: -------------------------------------------------------------------------------- 1 | var token = artifacts.require("AnyswapToken"); 2 | 3 | module.exports = function(deployer) { 4 | deployer.deploy(token); 5 | }; 6 | -------------------------------------------------------------------------------- /migrations/1_initial_migration.js: -------------------------------------------------------------------------------- 1 | const Migrations = artifacts.require("Migrations"); 2 | 3 | module.exports = function(deployer) { 4 | deployer.deploy(Migrations); 5 | }; 6 | -------------------------------------------------------------------------------- /contracts/Migrations.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.4.21 <0.7.0; 3 | 4 | contract Migrations { 5 | address public owner; 6 | uint public last_completed_migration; 7 | 8 | constructor() public { 9 | owner = msg.sender; 10 | } 11 | 12 | modifier restricted() { 13 | if (msg.sender == owner) _; 14 | } 15 | 16 | function setCompleted(uint completed) public restricted { 17 | last_completed_migration = completed; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /truffle-config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 3 | networks: { 4 | development: { 5 | host: "127.0.0.1", 6 | port: 12001, 7 | network_id: 55555, 8 | gas: 4000000, 9 | gasPrice: 1000000000, 10 | }, 11 | }, 12 | 13 | compilers: { 14 | solc: { 15 | version: "0.5.4", 16 | evmVersion: "byzantium", 17 | settings: { 18 | optimizer: { 19 | enabled: true, 20 | runs: 1500, 21 | } 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /AnyswapToken.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.5.0; 4 | 5 | import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol"; 6 | import "@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol"; 7 | 8 | contract AnyswapToken is ERC20Detailed, ERC20Burnable { 9 | address payable public owner; 10 | constructor() ERC20Detailed("Anyswap", "ANY", 18) public { 11 | owner = msg.sender; 12 | _mint(msg.sender, 1e26); 13 | } 14 | function destroy() public { 15 | require(msg.sender == owner, "only owner"); 16 | selfdestruct(owner); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # anyswap-token 2 | any swap ERC20 token 3 | 4 | ## install @openzeppelin/contracts 5 | 6 | ```shell 7 | npm install 8 | ``` 9 | 10 | ## flatten contract 11 | 12 | This has been already done. 13 | 14 | Mention here only for re-flatten if modified later. 15 | 16 | ```shell 17 | mpm install -g truffle-flattener 18 | truffle-flattener AnyswapToken.sol | sed '/SPDX-License-Identifier:/d' | sed 1i'// SPDX-License-Identifier: MIT' > contracts/AnyswapToken.sol 19 | ``` 20 | 21 | ## compile 22 | 23 | ```shell 24 | truffle compile 25 | ``` 26 | 27 | ## deploy 28 | 29 | ```shell 30 | truffle migrate 31 | ``` 32 | 33 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "anyswap-token", 3 | "version": "1.0.0", 4 | "description": "any swap ERC20 token", 5 | "main": "", 6 | "directories": { 7 | "test": "test" 8 | }, 9 | "scripts": { 10 | "test": "echo \"Error: no test specified\" && exit 1" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/anyswap/anyswap-token.git" 15 | }, 16 | "author": "jowneshaw", 17 | "license": "MIT", 18 | "bugs": { 19 | "url": "https://github.com/anyswap/anyswap-token/issues" 20 | }, 21 | "homepage": "https://github.com/anyswap/anyswap-token#readme", 22 | "dependencies": { 23 | "@openzeppelin/contracts": "2.5.0" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Anyswap 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /abi/AnyswapToken.json: -------------------------------------------------------------------------------- 1 | [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"amount","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"sender","type":"address"},{"name":"recipient","type":"address"},{"name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"},{"name":"amount","type":"uint256"}],"name":"burnFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"recipient","type":"address"},{"name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"constant":false,"inputs":[],"name":"destroy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] 2 | -------------------------------------------------------------------------------- /bytecode/AnyswapToken.txt: -------------------------------------------------------------------------------- 1 | 0x60806040523480156200001157600080fd5b50604080518082018252600781527f416e79737761700000000000000000000000000000000000000000000000000060208083019182528351808501909452600384527f414e59000000000000000000000000000000000000000000000000000000000090840152815191929160129162000090916000919062000298565b508151620000a690600190602085019062000298565b506002805460ff90921660ff19909216919091179055505060068054600160a060020a03191633908117909155620000f3906a52b7d2dcc80cd2e4000000640100000000620000f9810204565b6200033d565b600160a060020a03821615156200017157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6005546200018e908264010000000062000be06200021c82021704565b600555600160a060020a038216600090815260036020526040902054620001c4908264010000000062000be06200021c82021704565b600160a060020a03831660008181526003602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000828201838110156200029157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620002db57805160ff19168380011785556200030b565b828001600101855582156200030b579182015b828111156200030b578251825591602001919060010190620002ee565b50620003199291506200031d565b5090565b6200033a91905b8082111562000319576000815560010162000324565b90565b610fe0806200034d6000396000f3fe608060405234801561001057600080fd5b5060043610610112576000357c01000000000000000000000000000000000000000000000000000000009004806370a08231116100b457806395d89b411161008357806395d89b4114610359578063a457c2d714610361578063a9059cbb1461039a578063dd62ed3e146103d357610112565b806370a08231146102b457806379cc6790146102e757806383197ef0146103205780638da5cb5b1461032857610112565b806323b872dd116100f057806323b872dd146101fb578063313ce5671461023e578063395093511461025c57806342966c681461029557610112565b806306fdde0314610117578063095ea7b31461019457806318160ddd146101e1575b600080fd5b61011f61040e565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610159578181015183820152602001610141565b50505050905090810190601f1680156101865780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101cd600480360360408110156101aa57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356104a4565b604080519115158252519081900360200190f35b6101e96104c1565b60408051918252519081900360200190f35b6101cd6004803603606081101561021157600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013590911690604001356104c7565b61024661056f565b6040805160ff9092168252519081900360200190f35b6101cd6004803603604081101561027257600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610578565b6102b2600480360360208110156102ab57600080fd5b50356105d9565b005b6101e9600480360360208110156102ca57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166105ed565b6102b2600480360360408110156102fd57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610615565b6102b2610623565b6103306106c4565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61011f6106e0565b6101cd6004803603604081101561037757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610740565b6101cd600480360360408110156103b057600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356107bc565b6101e9600480360360408110156103e957600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160200135166107d0565b60008054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561049a5780601f1061046f5761010080835404028352916020019161049a565b820191906000526020600020905b81548152906001019060200180831161047d57829003601f168201915b5050505050905090565b60006104b86104b1610808565b848461080c565b50600192915050565b60055490565b60006104d4848484610957565b610565846104e0610808565b6105608560606040519081016040528060288152602001610eda6028913973ffffffffffffffffffffffffffffffffffffffff8a1660009081526004602052604081209061052c610808565b73ffffffffffffffffffffffffffffffffffffffff168152602081019190915260400160002054919063ffffffff610b2f16565b61080c565b5060019392505050565b60025460ff1690565b60006104b8610585610808565b846105608560046000610596610808565b73ffffffffffffffffffffffffffffffffffffffff908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff610be016565b6105ea6105e4610808565b82610c5b565b50565b73ffffffffffffffffffffffffffffffffffffffff1660009081526003602052604090205490565b61061f8282610da8565b5050565b60065473ffffffffffffffffffffffffffffffffffffffff1633146106a957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f6f6e6c79206f776e657200000000000000000000000000000000000000000000604482015290519081900360640190fd5b60065473ffffffffffffffffffffffffffffffffffffffff16ff5b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526060939092909183018282801561049a5780601f1061046f5761010080835404028352916020019161049a565b60006104b861074d610808565b846105608560606040519081016040528060258152602001610f906025913960046000610778610808565b73ffffffffffffffffffffffffffffffffffffffff908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff610b2f16565b60006104b86107c9610808565b8484610957565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260046020908152604080832093909416825291909152205490565b3390565b73ffffffffffffffffffffffffffffffffffffffff8316151561087a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180610f6c6024913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821615156108e8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180610e926022913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff831615156109c5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180610f476025913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82161515610a33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180610e4d6023913960400191505060405180910390fd5b610a848160606040519081016040528060268152602001610eb46026913973ffffffffffffffffffffffffffffffffffffffff8616600090815260036020526040902054919063ffffffff610b2f16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600360205260408082209390935590841681522054610ac6908263ffffffff610be016565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526003602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008184841115610bd8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610b9d578181015183820152602001610b85565b50505050905090810190601f168015610bca5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610c5457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82161515610cc9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180610f266021913960400191505060405180910390fd5b610d1a8160606040519081016040528060228152602001610e706022913973ffffffffffffffffffffffffffffffffffffffff8516600090815260036020526040902054919063ffffffff610b2f16565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260036020526040902055600554610d53908263ffffffff610e0a16565b60055560408051828152905160009173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b610db28282610c5b565b61061f82610dbe610808565b6105608460606040519081016040528060248152602001610f026024913973ffffffffffffffffffffffffffffffffffffffff881660009081526004602052604081209061052c610808565b6000610c5483836040805190810160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610b2f56fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa165627a7a723058203774d842d36ead975a31c8adaef53492a6ba0d577f9a29019a5c5f610f46c13c0029 2 | -------------------------------------------------------------------------------- /contracts/AnyswapToken.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | // File: @openzeppelin/contracts/token/ERC20/IERC20.sol 4 | 5 | pragma solidity ^0.5.0; 6 | 7 | /** 8 | * @dev Interface of the ERC20 standard as defined in the EIP. Does not include 9 | * the optional functions; to access them see {ERC20Detailed}. 10 | */ 11 | interface IERC20 { 12 | /** 13 | * @dev Returns the amount of tokens in existence. 14 | */ 15 | function totalSupply() external view returns (uint256); 16 | 17 | /** 18 | * @dev Returns the amount of tokens owned by `account`. 19 | */ 20 | function balanceOf(address account) external view returns (uint256); 21 | 22 | /** 23 | * @dev Moves `amount` tokens from the caller's account to `recipient`. 24 | * 25 | * Returns a boolean value indicating whether the operation succeeded. 26 | * 27 | * Emits a {Transfer} event. 28 | */ 29 | function transfer(address recipient, uint256 amount) external returns (bool); 30 | 31 | /** 32 | * @dev Returns the remaining number of tokens that `spender` will be 33 | * allowed to spend on behalf of `owner` through {transferFrom}. This is 34 | * zero by default. 35 | * 36 | * This value changes when {approve} or {transferFrom} are called. 37 | */ 38 | function allowance(address owner, address spender) external view returns (uint256); 39 | 40 | /** 41 | * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. 42 | * 43 | * Returns a boolean value indicating whether the operation succeeded. 44 | * 45 | * IMPORTANT: Beware that changing an allowance with this method brings the risk 46 | * that someone may use both the old and the new allowance by unfortunate 47 | * transaction ordering. One possible solution to mitigate this race 48 | * condition is to first reduce the spender's allowance to 0 and set the 49 | * desired value afterwards: 50 | * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 51 | * 52 | * Emits an {Approval} event. 53 | */ 54 | function approve(address spender, uint256 amount) external returns (bool); 55 | 56 | /** 57 | * @dev Moves `amount` tokens from `sender` to `recipient` using the 58 | * allowance mechanism. `amount` is then deducted from the caller's 59 | * allowance. 60 | * 61 | * Returns a boolean value indicating whether the operation succeeded. 62 | * 63 | * Emits a {Transfer} event. 64 | */ 65 | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); 66 | 67 | /** 68 | * @dev Emitted when `value` tokens are moved from one account (`from`) to 69 | * another (`to`). 70 | * 71 | * Note that `value` may be zero. 72 | */ 73 | event Transfer(address indexed from, address indexed to, uint256 value); 74 | 75 | /** 76 | * @dev Emitted when the allowance of a `spender` for an `owner` is set by 77 | * a call to {approve}. `value` is the new allowance. 78 | */ 79 | event Approval(address indexed owner, address indexed spender, uint256 value); 80 | } 81 | 82 | // File: @openzeppelin/contracts/token/ERC20/ERC20Detailed.sol 83 | 84 | pragma solidity ^0.5.0; 85 | 86 | 87 | /** 88 | * @dev Optional functions from the ERC20 standard. 89 | */ 90 | contract ERC20Detailed is IERC20 { 91 | string private _name; 92 | string private _symbol; 93 | uint8 private _decimals; 94 | 95 | /** 96 | * @dev Sets the values for `name`, `symbol`, and `decimals`. All three of 97 | * these values are immutable: they can only be set once during 98 | * construction. 99 | */ 100 | constructor (string memory name, string memory symbol, uint8 decimals) public { 101 | _name = name; 102 | _symbol = symbol; 103 | _decimals = decimals; 104 | } 105 | 106 | /** 107 | * @dev Returns the name of the token. 108 | */ 109 | function name() public view returns (string memory) { 110 | return _name; 111 | } 112 | 113 | /** 114 | * @dev Returns the symbol of the token, usually a shorter version of the 115 | * name. 116 | */ 117 | function symbol() public view returns (string memory) { 118 | return _symbol; 119 | } 120 | 121 | /** 122 | * @dev Returns the number of decimals used to get its user representation. 123 | * For example, if `decimals` equals `2`, a balance of `505` tokens should 124 | * be displayed to a user as `5,05` (`505 / 10 ** 2`). 125 | * 126 | * Tokens usually opt for a value of 18, imitating the relationship between 127 | * Ether and Wei. 128 | * 129 | * NOTE: This information is only used for _display_ purposes: it in 130 | * no way affects any of the arithmetic of the contract, including 131 | * {IERC20-balanceOf} and {IERC20-transfer}. 132 | */ 133 | function decimals() public view returns (uint8) { 134 | return _decimals; 135 | } 136 | } 137 | 138 | // File: @openzeppelin/contracts/GSN/Context.sol 139 | 140 | pragma solidity ^0.5.0; 141 | 142 | /* 143 | * @dev Provides information about the current execution context, including the 144 | * sender of the transaction and its data. While these are generally available 145 | * via msg.sender and msg.data, they should not be accessed in such a direct 146 | * manner, since when dealing with GSN meta-transactions the account sending and 147 | * paying for execution may not be the actual sender (as far as an application 148 | * is concerned). 149 | * 150 | * This contract is only required for intermediate, library-like contracts. 151 | */ 152 | contract Context { 153 | // Empty internal constructor, to prevent people from mistakenly deploying 154 | // an instance of this contract, which should be used via inheritance. 155 | constructor () internal { } 156 | // solhint-disable-previous-line no-empty-blocks 157 | 158 | function _msgSender() internal view returns (address payable) { 159 | return msg.sender; 160 | } 161 | 162 | function _msgData() internal view returns (bytes memory) { 163 | this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 164 | return msg.data; 165 | } 166 | } 167 | 168 | // File: @openzeppelin/contracts/math/SafeMath.sol 169 | 170 | pragma solidity ^0.5.0; 171 | 172 | /** 173 | * @dev Wrappers over Solidity's arithmetic operations with added overflow 174 | * checks. 175 | * 176 | * Arithmetic operations in Solidity wrap on overflow. This can easily result 177 | * in bugs, because programmers usually assume that an overflow raises an 178 | * error, which is the standard behavior in high level programming languages. 179 | * `SafeMath` restores this intuition by reverting the transaction when an 180 | * operation overflows. 181 | * 182 | * Using this library instead of the unchecked operations eliminates an entire 183 | * class of bugs, so it's recommended to use it always. 184 | */ 185 | library SafeMath { 186 | /** 187 | * @dev Returns the addition of two unsigned integers, reverting on 188 | * overflow. 189 | * 190 | * Counterpart to Solidity's `+` operator. 191 | * 192 | * Requirements: 193 | * - Addition cannot overflow. 194 | */ 195 | function add(uint256 a, uint256 b) internal pure returns (uint256) { 196 | uint256 c = a + b; 197 | require(c >= a, "SafeMath: addition overflow"); 198 | 199 | return c; 200 | } 201 | 202 | /** 203 | * @dev Returns the subtraction of two unsigned integers, reverting on 204 | * overflow (when the result is negative). 205 | * 206 | * Counterpart to Solidity's `-` operator. 207 | * 208 | * Requirements: 209 | * - Subtraction cannot overflow. 210 | */ 211 | function sub(uint256 a, uint256 b) internal pure returns (uint256) { 212 | return sub(a, b, "SafeMath: subtraction overflow"); 213 | } 214 | 215 | /** 216 | * @dev Returns the subtraction of two unsigned integers, reverting with custom message on 217 | * overflow (when the result is negative). 218 | * 219 | * Counterpart to Solidity's `-` operator. 220 | * 221 | * Requirements: 222 | * - Subtraction cannot overflow. 223 | * 224 | * _Available since v2.4.0._ 225 | */ 226 | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { 227 | require(b <= a, errorMessage); 228 | uint256 c = a - b; 229 | 230 | return c; 231 | } 232 | 233 | /** 234 | * @dev Returns the multiplication of two unsigned integers, reverting on 235 | * overflow. 236 | * 237 | * Counterpart to Solidity's `*` operator. 238 | * 239 | * Requirements: 240 | * - Multiplication cannot overflow. 241 | */ 242 | function mul(uint256 a, uint256 b) internal pure returns (uint256) { 243 | // Gas optimization: this is cheaper than requiring 'a' not being zero, but the 244 | // benefit is lost if 'b' is also tested. 245 | // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 246 | if (a == 0) { 247 | return 0; 248 | } 249 | 250 | uint256 c = a * b; 251 | require(c / a == b, "SafeMath: multiplication overflow"); 252 | 253 | return c; 254 | } 255 | 256 | /** 257 | * @dev Returns the integer division of two unsigned integers. Reverts on 258 | * division by zero. The result is rounded towards zero. 259 | * 260 | * Counterpart to Solidity's `/` operator. Note: this function uses a 261 | * `revert` opcode (which leaves remaining gas untouched) while Solidity 262 | * uses an invalid opcode to revert (consuming all remaining gas). 263 | * 264 | * Requirements: 265 | * - The divisor cannot be zero. 266 | */ 267 | function div(uint256 a, uint256 b) internal pure returns (uint256) { 268 | return div(a, b, "SafeMath: division by zero"); 269 | } 270 | 271 | /** 272 | * @dev Returns the integer division of two unsigned integers. Reverts with custom message on 273 | * division by zero. The result is rounded towards zero. 274 | * 275 | * Counterpart to Solidity's `/` operator. Note: this function uses a 276 | * `revert` opcode (which leaves remaining gas untouched) while Solidity 277 | * uses an invalid opcode to revert (consuming all remaining gas). 278 | * 279 | * Requirements: 280 | * - The divisor cannot be zero. 281 | * 282 | * _Available since v2.4.0._ 283 | */ 284 | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { 285 | // Solidity only automatically asserts when dividing by 0 286 | require(b > 0, errorMessage); 287 | uint256 c = a / b; 288 | // assert(a == b * c + a % b); // There is no case in which this doesn't hold 289 | 290 | return c; 291 | } 292 | 293 | /** 294 | * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), 295 | * Reverts when dividing by zero. 296 | * 297 | * Counterpart to Solidity's `%` operator. This function uses a `revert` 298 | * opcode (which leaves remaining gas untouched) while Solidity uses an 299 | * invalid opcode to revert (consuming all remaining gas). 300 | * 301 | * Requirements: 302 | * - The divisor cannot be zero. 303 | */ 304 | function mod(uint256 a, uint256 b) internal pure returns (uint256) { 305 | return mod(a, b, "SafeMath: modulo by zero"); 306 | } 307 | 308 | /** 309 | * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), 310 | * Reverts with custom message when dividing by zero. 311 | * 312 | * Counterpart to Solidity's `%` operator. This function uses a `revert` 313 | * opcode (which leaves remaining gas untouched) while Solidity uses an 314 | * invalid opcode to revert (consuming all remaining gas). 315 | * 316 | * Requirements: 317 | * - The divisor cannot be zero. 318 | * 319 | * _Available since v2.4.0._ 320 | */ 321 | function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { 322 | require(b != 0, errorMessage); 323 | return a % b; 324 | } 325 | } 326 | 327 | // File: @openzeppelin/contracts/token/ERC20/ERC20.sol 328 | 329 | pragma solidity ^0.5.0; 330 | 331 | 332 | 333 | 334 | /** 335 | * @dev Implementation of the {IERC20} interface. 336 | * 337 | * This implementation is agnostic to the way tokens are created. This means 338 | * that a supply mechanism has to be added in a derived contract using {_mint}. 339 | * For a generic mechanism see {ERC20Mintable}. 340 | * 341 | * TIP: For a detailed writeup see our guide 342 | * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How 343 | * to implement supply mechanisms]. 344 | * 345 | * We have followed general OpenZeppelin guidelines: functions revert instead 346 | * of returning `false` on failure. This behavior is nonetheless conventional 347 | * and does not conflict with the expectations of ERC20 applications. 348 | * 349 | * Additionally, an {Approval} event is emitted on calls to {transferFrom}. 350 | * This allows applications to reconstruct the allowance for all accounts just 351 | * by listening to said events. Other implementations of the EIP may not emit 352 | * these events, as it isn't required by the specification. 353 | * 354 | * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} 355 | * functions have been added to mitigate the well-known issues around setting 356 | * allowances. See {IERC20-approve}. 357 | */ 358 | contract ERC20 is Context, IERC20 { 359 | using SafeMath for uint256; 360 | 361 | mapping (address => uint256) private _balances; 362 | 363 | mapping (address => mapping (address => uint256)) private _allowances; 364 | 365 | uint256 private _totalSupply; 366 | 367 | /** 368 | * @dev See {IERC20-totalSupply}. 369 | */ 370 | function totalSupply() public view returns (uint256) { 371 | return _totalSupply; 372 | } 373 | 374 | /** 375 | * @dev See {IERC20-balanceOf}. 376 | */ 377 | function balanceOf(address account) public view returns (uint256) { 378 | return _balances[account]; 379 | } 380 | 381 | /** 382 | * @dev See {IERC20-transfer}. 383 | * 384 | * Requirements: 385 | * 386 | * - `recipient` cannot be the zero address. 387 | * - the caller must have a balance of at least `amount`. 388 | */ 389 | function transfer(address recipient, uint256 amount) public returns (bool) { 390 | _transfer(_msgSender(), recipient, amount); 391 | return true; 392 | } 393 | 394 | /** 395 | * @dev See {IERC20-allowance}. 396 | */ 397 | function allowance(address owner, address spender) public view returns (uint256) { 398 | return _allowances[owner][spender]; 399 | } 400 | 401 | /** 402 | * @dev See {IERC20-approve}. 403 | * 404 | * Requirements: 405 | * 406 | * - `spender` cannot be the zero address. 407 | */ 408 | function approve(address spender, uint256 amount) public returns (bool) { 409 | _approve(_msgSender(), spender, amount); 410 | return true; 411 | } 412 | 413 | /** 414 | * @dev See {IERC20-transferFrom}. 415 | * 416 | * Emits an {Approval} event indicating the updated allowance. This is not 417 | * required by the EIP. See the note at the beginning of {ERC20}; 418 | * 419 | * Requirements: 420 | * - `sender` and `recipient` cannot be the zero address. 421 | * - `sender` must have a balance of at least `amount`. 422 | * - the caller must have allowance for `sender`'s tokens of at least 423 | * `amount`. 424 | */ 425 | function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { 426 | _transfer(sender, recipient, amount); 427 | _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); 428 | return true; 429 | } 430 | 431 | /** 432 | * @dev Atomically increases the allowance granted to `spender` by the caller. 433 | * 434 | * This is an alternative to {approve} that can be used as a mitigation for 435 | * problems described in {IERC20-approve}. 436 | * 437 | * Emits an {Approval} event indicating the updated allowance. 438 | * 439 | * Requirements: 440 | * 441 | * - `spender` cannot be the zero address. 442 | */ 443 | function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { 444 | _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); 445 | return true; 446 | } 447 | 448 | /** 449 | * @dev Atomically decreases the allowance granted to `spender` by the caller. 450 | * 451 | * This is an alternative to {approve} that can be used as a mitigation for 452 | * problems described in {IERC20-approve}. 453 | * 454 | * Emits an {Approval} event indicating the updated allowance. 455 | * 456 | * Requirements: 457 | * 458 | * - `spender` cannot be the zero address. 459 | * - `spender` must have allowance for the caller of at least 460 | * `subtractedValue`. 461 | */ 462 | function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { 463 | _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); 464 | return true; 465 | } 466 | 467 | /** 468 | * @dev Moves tokens `amount` from `sender` to `recipient`. 469 | * 470 | * This is internal function is equivalent to {transfer}, and can be used to 471 | * e.g. implement automatic token fees, slashing mechanisms, etc. 472 | * 473 | * Emits a {Transfer} event. 474 | * 475 | * Requirements: 476 | * 477 | * - `sender` cannot be the zero address. 478 | * - `recipient` cannot be the zero address. 479 | * - `sender` must have a balance of at least `amount`. 480 | */ 481 | function _transfer(address sender, address recipient, uint256 amount) internal { 482 | require(sender != address(0), "ERC20: transfer from the zero address"); 483 | require(recipient != address(0), "ERC20: transfer to the zero address"); 484 | 485 | _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); 486 | _balances[recipient] = _balances[recipient].add(amount); 487 | emit Transfer(sender, recipient, amount); 488 | } 489 | 490 | /** @dev Creates `amount` tokens and assigns them to `account`, increasing 491 | * the total supply. 492 | * 493 | * Emits a {Transfer} event with `from` set to the zero address. 494 | * 495 | * Requirements 496 | * 497 | * - `to` cannot be the zero address. 498 | */ 499 | function _mint(address account, uint256 amount) internal { 500 | require(account != address(0), "ERC20: mint to the zero address"); 501 | 502 | _totalSupply = _totalSupply.add(amount); 503 | _balances[account] = _balances[account].add(amount); 504 | emit Transfer(address(0), account, amount); 505 | } 506 | 507 | /** 508 | * @dev Destroys `amount` tokens from `account`, reducing the 509 | * total supply. 510 | * 511 | * Emits a {Transfer} event with `to` set to the zero address. 512 | * 513 | * Requirements 514 | * 515 | * - `account` cannot be the zero address. 516 | * - `account` must have at least `amount` tokens. 517 | */ 518 | function _burn(address account, uint256 amount) internal { 519 | require(account != address(0), "ERC20: burn from the zero address"); 520 | 521 | _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); 522 | _totalSupply = _totalSupply.sub(amount); 523 | emit Transfer(account, address(0), amount); 524 | } 525 | 526 | /** 527 | * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. 528 | * 529 | * This is internal function is equivalent to `approve`, and can be used to 530 | * e.g. set automatic allowances for certain subsystems, etc. 531 | * 532 | * Emits an {Approval} event. 533 | * 534 | * Requirements: 535 | * 536 | * - `owner` cannot be the zero address. 537 | * - `spender` cannot be the zero address. 538 | */ 539 | function _approve(address owner, address spender, uint256 amount) internal { 540 | require(owner != address(0), "ERC20: approve from the zero address"); 541 | require(spender != address(0), "ERC20: approve to the zero address"); 542 | 543 | _allowances[owner][spender] = amount; 544 | emit Approval(owner, spender, amount); 545 | } 546 | 547 | /** 548 | * @dev Destroys `amount` tokens from `account`.`amount` is then deducted 549 | * from the caller's allowance. 550 | * 551 | * See {_burn} and {_approve}. 552 | */ 553 | function _burnFrom(address account, uint256 amount) internal { 554 | _burn(account, amount); 555 | _approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance")); 556 | } 557 | } 558 | 559 | // File: @openzeppelin/contracts/token/ERC20/ERC20Burnable.sol 560 | 561 | pragma solidity ^0.5.0; 562 | 563 | 564 | 565 | /** 566 | * @dev Extension of {ERC20} that allows token holders to destroy both their own 567 | * tokens and those that they have an allowance for, in a way that can be 568 | * recognized off-chain (via event analysis). 569 | */ 570 | contract ERC20Burnable is Context, ERC20 { 571 | /** 572 | * @dev Destroys `amount` tokens from the caller. 573 | * 574 | * See {ERC20-_burn}. 575 | */ 576 | function burn(uint256 amount) public { 577 | _burn(_msgSender(), amount); 578 | } 579 | 580 | /** 581 | * @dev See {ERC20-_burnFrom}. 582 | */ 583 | function burnFrom(address account, uint256 amount) public { 584 | _burnFrom(account, amount); 585 | } 586 | } 587 | 588 | // File: AnyswapToken.sol 589 | 590 | 591 | pragma solidity ^0.5.0; 592 | 593 | 594 | 595 | contract AnyswapToken is ERC20Detailed, ERC20Burnable { 596 | address payable public owner; 597 | constructor() ERC20Detailed("Anyswap", "ANY", 18) public { 598 | owner = msg.sender; 599 | _mint(msg.sender, 1e26); 600 | } 601 | function destroy() public { 602 | require(msg.sender == owner, "only owner"); 603 | selfdestruct(owner); 604 | } 605 | } 606 | --------------------------------------------------------------------------------