Transaction Hash:
Block:
11862976 at Feb-15-2021 06:26:00 PM +UTC
Transaction Fee:
0.007951485 ETH
$19.44
Gas Used:
71,635 Gas / 111 Gwei
Emitted Events:
119 |
AdAstraIOT.Transfer( from=[Receiver] Swapper, to=[Sender] 0xf8e275e55372afe87c2169abbe2a35e1f3d9485e, value=2402523200000000000000 )
|
120 |
Swapper.Swap( receivedEth=212625233000000020, expectedTokens=2402523200000000000000, slippage=10, ethFeeAdd=637875699000000, actualTokens=2402523200000000000000, tokensSold=14192330243084131631980168 )
|
Account State Difference:
Address | Before | After | State Difference | ||
---|---|---|---|---|---|
0x5A0b54D5...D3E029c4c
Miner
| (Spark Pool) | 108.340068360369961708 Eth | 108.348019845369961708 Eth | 0.007951485 | |
0x99A1350F...0fDC4Af2A | 0 Eth | 0.21262523300000002 Eth | 0.21262523300000002 | ||
0xB0dfcE22...D9f08d596 | |||||
0xf8e275e5...1f3D9485E |
0.236481233 Eth
Nonce: 2
|
0.01590451499999998 Eth
Nonce: 3
| 0.22057671800000002 |
Execution Trace
ETH 0.21262523300000002
Swapper.swap( _expectedTokensAmount=2402523200000000000000, _slippage=10, _excludeFee=False )
0x2d2ea5c114442738cf545d5f6350d07eba0388a9.72b5e81f( )
-
AdAstraIOT.balanceOf( account=0x99A1350F5cE2290Ca375Fa9eCA87e180fDC4Af2A ) => ( 575810072280115868368019832 )
-
-
AdAstraIOT.transfer( recipient=0xf8e275e55372aFE87c2169Abbe2A35e1f3D9485E, amount=2402523200000000000000 ) => ( True )
File 1 of 2: Swapper
File 2 of 2: AdAstraIOT
{"SwapperSimple.sol":{"content":"// SPDX-License-Identifier: UNLICENSED\r\n\r\npragma solidity 0.6.12;\r\n\r\nimport \"SwapperSimpleBase.sol\";\r\nimport \"SwapPriceCalculatorInterface.sol\";\r\n\r\ncontract Swapper\r\n{\r\n using SafeMath for uint256;\r\n \r\n address private admin;\r\n IERC20 private token;\r\n ISwapPriceCalculator private priceCalculator;\r\n \r\n uint256 private ethReserve;\r\n uint256 private ethReserveTaken;\r\n uint256 private ethFee;\r\n uint256 private ethFeeTaken;\r\n uint256 private tokensSold;\r\n \r\n string private constant ERR_MSG_SENDER = \"ERR_MSG_SENDER\";\r\n string private constant ERR_AMOUNT = \"ERR_AMOUNT\";\r\n string private constant ERR_ZERO_ETH = \"ERR_ZERO_ETH\";\r\n \r\n event Swap(uint256 receivedEth,\r\n uint256 expectedTokens,\r\n uint16 slippage,\r\n uint256 ethFeeAdd,\r\n uint256 actualTokens,\r\n uint256 tokensSold);\r\n \r\n // constructor:\r\n //--------------------------------------------------------------------------------------------------------------------------\r\n constructor(address _admin, address _token, address _priceCalculator) public\r\n {\r\n admin = _admin;\r\n token = IERC20(_token);\r\n priceCalculator = ISwapPriceCalculator(_priceCalculator);\r\n }\r\n \r\n function getAdmin() external view returns (address)\r\n {\r\n return admin;\r\n }\r\n \r\n function getToken() external view returns (address)\r\n {\r\n return address(token);\r\n }\r\n //--------------------------------------------------------------------------------------------------------------------------\r\n \r\n // ETH balance methods:\r\n //--------------------------------------------------------------------------------------------------------------------------\r\n function getTotalEthBalance() external view returns (uint256)\r\n {\r\n return address(this).balance;\r\n }\r\n \r\n function sendEth(address payable _to) external returns (uint256 ethReserveTaken_, uint256 ethFeeTaken_)\r\n {\r\n require(msg.sender == admin, ERR_MSG_SENDER);\r\n \r\n _to.transfer(address(this).balance);\r\n \r\n ethReserveTaken_ = ethReserve - ethReserveTaken;\r\n ethFeeTaken_ = ethFee - ethFeeTaken;\r\n \r\n ethReserveTaken = ethReserve;\r\n ethFeeTaken = ethFee;\r\n }\r\n //--------------------------------------------------------------------------------------------------------------------------\r\n \r\n // Tokens balance methods:\r\n //--------------------------------------------------------------------------------------------------------------------------\r\n function getTotalTokensBalance() external view returns (uint256)\r\n {\r\n return token.balanceOf(address(this));\r\n }\r\n \r\n function sendTokens(address _to, uint256 _amount) external\r\n {\r\n require(msg.sender == admin, ERR_MSG_SENDER);\r\n \r\n if(_amount == 0)\r\n {\r\n token.transfer(_to, token.balanceOf(address(this)));\r\n }\r\n else\r\n {\r\n token.transfer(_to, _amount);\r\n }\r\n }\r\n //--------------------------------------------------------------------------------------------------------------------------\r\n \r\n // Price calculator:\r\n //--------------------------------------------------------------------------------------------------------------------------\r\n function getPriceCalculator() external view returns (address)\r\n {\r\n return address(priceCalculator);\r\n }\r\n \r\n function setPriceCalculator(address _priceCalculator) external\r\n {\r\n require(msg.sender == admin, ERR_MSG_SENDER);\r\n \r\n priceCalculator = ISwapPriceCalculator(_priceCalculator);\r\n }\r\n \r\n function calcPrice(uint256 _ethAmount, bool _excludeFee) external view returns (uint256, uint256, uint256)\r\n {\r\n require(_ethAmount \u003e 0, ERR_ZERO_ETH);\r\n \r\n return priceCalculator.calc(_ethAmount, 0, 0, ethReserve, tokensSold, _excludeFee);\r\n }\r\n //--------------------------------------------------------------------------------------------------------------------------\r\n \r\n // Current state:\r\n //--------------------------------------------------------------------------------------------------------------------------\r\n function getState() external view returns (uint256 ethReserve_,\r\n uint256 ethReserveTaken_,\r\n uint256 ethFee_,\r\n uint256 ethFeeTaken_,\r\n uint256 tokensSold_)\r\n {\r\n ethReserve_ = ethReserve;\r\n ethReserveTaken_ = ethReserveTaken;\r\n ethFee_ = ethFee;\r\n ethFeeTaken_ = ethFeeTaken;\r\n tokensSold_ = tokensSold;\r\n }\r\n //--------------------------------------------------------------------------------------------------------------------------\r\n \r\n // Swap logic methods:\r\n //--------------------------------------------------------------------------------------------------------------------------\r\n function swap(uint256 _expectedTokensAmount, uint16 _slippage, bool _excludeFee) external payable\r\n {\r\n require(msg.value \u003e 0, ERR_ZERO_ETH);\r\n require(_expectedTokensAmount \u003e 0, \"ERR_ZERO_EXP_AMOUNT\");\r\n require(_slippage \u003c= 500, \"ERR_SLIPPAGE_TOO_BIG\");\r\n \r\n (uint256 actualTokensAmount, uint256 ethFeeAdd, uint256 actualEthAmount)\r\n = priceCalculator.calc(msg.value, _expectedTokensAmount, _slippage, ethReserve, tokensSold, _excludeFee);\r\n \r\n require(actualTokensAmount \u003e 0, \"ERR_ZERO_ACTUAL_TOKENS\");\r\n require(msg.value == actualEthAmount, \"ERR_WRONG_ETH_AMOUNT\");\r\n \r\n ethFee = ethFee.add(ethFeeAdd);\r\n ethReserve = ethReserve.add(msg.value.sub(ethFeeAdd));\r\n tokensSold = tokensSold.add(actualTokensAmount);\r\n \r\n token.transfer(msg.sender, actualTokensAmount);\r\n \r\n emit Swap(msg.value, _expectedTokensAmount, _slippage, ethFeeAdd, actualTokensAmount, tokensSold);\r\n }\r\n //--------------------------------------------------------------------------------------------------------------------------\r\n}"},"SwapperSimpleBase.sol":{"content":"// SPDX-License-Identifier: UNLICENSED\r\n\r\npragma solidity \u003e=0.6.0 \u003c0.8.0; // use 0.6.12 to compile this file\r\n\r\n/**\r\n * @dev Wrappers over Solidity\u0027s arithmetic operations with added overflow\r\n * checks.\r\n *\r\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\r\n * in bugs, because programmers usually assume that an overflow raises an\r\n * error, which is the standard behavior in high level programming languages.\r\n * `SafeMath` restores this intuition by reverting the transaction when an\r\n * operation overflows.\r\n *\r\n * Using this library instead of the unchecked operations eliminates an entire\r\n * class of bugs, so it\u0027s recommended to use it always.\r\n */\r\nlibrary SafeMath {\r\n /**\r\n * @dev Returns the addition of two unsigned integers, reverting on\r\n * overflow.\r\n *\r\n * Counterpart to Solidity\u0027s `+` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Addition cannot overflow.\r\n */\r\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\r\n uint256 c = a + b;\r\n require(c \u003e= a, \"SafeMath: addition overflow\");\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the subtraction of two unsigned integers, reverting on\r\n * overflow (when the result is negative).\r\n *\r\n * Counterpart to Solidity\u0027s `-` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Subtraction cannot overflow.\r\n */\r\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return sub(a, b, \"SafeMath: subtraction overflow\");\r\n }\r\n\r\n /**\r\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\r\n * overflow (when the result is negative).\r\n *\r\n * Counterpart to Solidity\u0027s `-` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Subtraction cannot overflow.\r\n */\r\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\r\n require(b \u003c= a, errorMessage);\r\n uint256 c = a - b;\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the multiplication of two unsigned integers, reverting on\r\n * overflow.\r\n *\r\n * Counterpart to Solidity\u0027s `*` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Multiplication cannot overflow.\r\n */\r\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\r\n // Gas optimization: this is cheaper than requiring \u0027a\u0027 not being zero, but the\r\n // benefit is lost if \u0027b\u0027 is also tested.\r\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\r\n if (a == 0) {\r\n return 0;\r\n }\r\n\r\n uint256 c = a * b;\r\n require(c / a == b, \"SafeMath: multiplication overflow\");\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the integer division of two unsigned integers. Reverts on\r\n * division by zero. The result is rounded towards zero.\r\n *\r\n * Counterpart to Solidity\u0027s `/` operator. Note: this function uses a\r\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\r\n * uses an invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return div(a, b, \"SafeMath: division by zero\");\r\n }\r\n\r\n /**\r\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\r\n * division by zero. The result is rounded towards zero.\r\n *\r\n * Counterpart to Solidity\u0027s `/` operator. Note: this function uses a\r\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\r\n * uses an invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\r\n require(b \u003e 0, errorMessage);\r\n uint256 c = a / b;\r\n // assert(a == b * c + a % b); // There is no case in which this doesn\u0027t hold\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\r\n * Reverts when dividing by zero.\r\n *\r\n * Counterpart to Solidity\u0027s `%` operator. This function uses a `revert`\r\n * opcode (which leaves remaining gas untouched) while Solidity uses an\r\n * invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return mod(a, b, \"SafeMath: modulo by zero\");\r\n }\r\n\r\n /**\r\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\r\n * Reverts with custom message when dividing by zero.\r\n *\r\n * Counterpart to Solidity\u0027s `%` operator. This function uses a `revert`\r\n * opcode (which leaves remaining gas untouched) while Solidity uses an\r\n * invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\r\n require(b != 0, errorMessage);\r\n return a % b;\r\n }\r\n}\r\n\r\n/**\r\n * @dev Interface of the ERC20 standard as defined in the EIP.\r\n */\r\ninterface IERC20 {\r\n /**\r\n * @dev Returns the amount of tokens in existence.\r\n */\r\n function totalSupply() external view returns (uint256);\r\n\r\n /**\r\n * @dev Returns the amount of tokens owned by `account`.\r\n */\r\n function balanceOf(address account) external view returns (uint256);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from the caller\u0027s account to `recipient`.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transfer(address recipient, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Returns the remaining number of tokens that `spender` will be\r\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\r\n * zero by default.\r\n *\r\n * This value changes when {approve} or {transferFrom} are called.\r\n */\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over the caller\u0027s tokens.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\r\n * that someone may use both the old and the new allowance by unfortunate\r\n * transaction ordering. One possible solution to mitigate this race\r\n * condition is to first reduce the spender\u0027s allowance to 0 and set the\r\n * desired value afterwards:\r\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\r\n *\r\n * Emits an {Approval} event.\r\n */\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\r\n * allowance mechanism. `amount` is then deducted from the caller\u0027s\r\n * allowance.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\r\n * another (`to`).\r\n *\r\n * Note that `value` may be zero.\r\n */\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n /**\r\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\r\n * a call to {approve}. `value` is the new allowance.\r\n */\r\n event Approval(address indexed owner, address indexed spender, uint256 value);\r\n}"},"SwapPriceCalculatorInterface.sol":{"content":"// SPDX-License-Identifier: UNLICENSED\r\n\r\npragma solidity 0.6.12;\r\n\r\ninterface ISwapPriceCalculator\r\n{\r\n function calc(uint256 receivedEthAmount,\r\n uint256 expectedTokensAmount,\r\n uint16 slippage,\r\n uint256 ethReserve,\r\n uint256 tokensSold,\r\n bool \t excludeFee) external view returns (uint256 actualTokensAmount,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t uint256 ethFeeAdd,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t uint256 actualEthAmount);\r\n}"}}
File 2 of 2: AdAstraIOT
{"SwapToken.sol":{"content":"// SPDX-License-Identifier: UNLICENSED\r\n\r\npragma solidity 0.6.12;\r\n\r\nimport \"SwapTokenBase.sol\";\r\n\r\ncontract AdAstraIOT is ERC1363\r\n{\r\n address private owner;\r\n \r\n constructor(address _owner) public ERC1363(\"AdAstraIOT\", \"aIOT\")\r\n {\r\n owner = _owner;\r\n }\r\n \r\n function getOwner() external view returns (address)\r\n {\r\n return owner;\r\n }\r\n \r\n function mint(address _to, uint256 _amount) external\r\n {\r\n require(msg.sender == owner);\r\n \r\n _mint(_to, _amount);\r\n }\r\n}"},"SwapTokenBase.sol":{"content":"// SPDX-License-Identifier: UNLICENSED\r\n\r\npragma solidity \u003e=0.6.0 \u003c0.8.0; // use 0.6.12 to compile this file\r\n\r\n/**\r\n * @dev Wrappers over Solidity\u0027s arithmetic operations with added overflow\r\n * checks.\r\n *\r\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\r\n * in bugs, because programmers usually assume that an overflow raises an\r\n * error, which is the standard behavior in high level programming languages.\r\n * `SafeMath` restores this intuition by reverting the transaction when an\r\n * operation overflows.\r\n *\r\n * Using this library instead of the unchecked operations eliminates an entire\r\n * class of bugs, so it\u0027s recommended to use it always.\r\n */\r\nlibrary SafeMath {\r\n /**\r\n * @dev Returns the addition of two unsigned integers, reverting on\r\n * overflow.\r\n *\r\n * Counterpart to Solidity\u0027s `+` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Addition cannot overflow.\r\n */\r\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\r\n uint256 c = a + b;\r\n require(c \u003e= a, \"SafeMath: addition overflow\");\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the subtraction of two unsigned integers, reverting on\r\n * overflow (when the result is negative).\r\n *\r\n * Counterpart to Solidity\u0027s `-` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Subtraction cannot overflow.\r\n */\r\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return sub(a, b, \"SafeMath: subtraction overflow\");\r\n }\r\n\r\n /**\r\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\r\n * overflow (when the result is negative).\r\n *\r\n * Counterpart to Solidity\u0027s `-` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Subtraction cannot overflow.\r\n */\r\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\r\n require(b \u003c= a, errorMessage);\r\n uint256 c = a - b;\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the multiplication of two unsigned integers, reverting on\r\n * overflow.\r\n *\r\n * Counterpart to Solidity\u0027s `*` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Multiplication cannot overflow.\r\n */\r\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\r\n // Gas optimization: this is cheaper than requiring \u0027a\u0027 not being zero, but the\r\n // benefit is lost if \u0027b\u0027 is also tested.\r\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\r\n if (a == 0) {\r\n return 0;\r\n }\r\n\r\n uint256 c = a * b;\r\n require(c / a == b, \"SafeMath: multiplication overflow\");\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the integer division of two unsigned integers. Reverts on\r\n * division by zero. The result is rounded towards zero.\r\n *\r\n * Counterpart to Solidity\u0027s `/` operator. Note: this function uses a\r\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\r\n * uses an invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return div(a, b, \"SafeMath: division by zero\");\r\n }\r\n\r\n /**\r\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\r\n * division by zero. The result is rounded towards zero.\r\n *\r\n * Counterpart to Solidity\u0027s `/` operator. Note: this function uses a\r\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\r\n * uses an invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\r\n require(b \u003e 0, errorMessage);\r\n uint256 c = a / b;\r\n // assert(a == b * c + a % b); // There is no case in which this doesn\u0027t hold\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\r\n * Reverts when dividing by zero.\r\n *\r\n * Counterpart to Solidity\u0027s `%` operator. This function uses a `revert`\r\n * opcode (which leaves remaining gas untouched) while Solidity uses an\r\n * invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return mod(a, b, \"SafeMath: modulo by zero\");\r\n }\r\n\r\n /**\r\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\r\n * Reverts with custom message when dividing by zero.\r\n *\r\n * Counterpart to Solidity\u0027s `%` operator. This function uses a `revert`\r\n * opcode (which leaves remaining gas untouched) while Solidity uses an\r\n * invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\r\n require(b != 0, errorMessage);\r\n return a % b;\r\n }\r\n}\r\n\r\n/**\r\n * @dev Interface of the ERC20 standard as defined in the EIP.\r\n */\r\ninterface IERC20 {\r\n /**\r\n * @dev Returns the amount of tokens in existence.\r\n */\r\n function totalSupply() external view returns (uint256);\r\n\r\n /**\r\n * @dev Returns the amount of tokens owned by `account`.\r\n */\r\n function balanceOf(address account) external view returns (uint256);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from the caller\u0027s account to `recipient`.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transfer(address recipient, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Returns the remaining number of tokens that `spender` will be\r\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\r\n * zero by default.\r\n *\r\n * This value changes when {approve} or {transferFrom} are called.\r\n */\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over the caller\u0027s tokens.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\r\n * that someone may use both the old and the new allowance by unfortunate\r\n * transaction ordering. One possible solution to mitigate this race\r\n * condition is to first reduce the spender\u0027s allowance to 0 and set the\r\n * desired value afterwards:\r\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\r\n *\r\n * Emits an {Approval} event.\r\n */\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\r\n * allowance mechanism. `amount` is then deducted from the caller\u0027s\r\n * allowance.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\r\n * another (`to`).\r\n *\r\n * Note that `value` may be zero.\r\n */\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n /**\r\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\r\n * a call to {approve}. `value` is the new allowance.\r\n */\r\n event Approval(address indexed owner, address indexed spender, uint256 value);\r\n}\r\n\r\n/**\r\n * @dev Interface of the ERC165 standard, as defined in the\r\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\r\n *\r\n * Implementers can declare support of contract interfaces, which can then be\r\n * queried by others ({ERC165Checker}).\r\n *\r\n * For an implementation, see {ERC165}.\r\n */\r\ninterface IERC165 {\r\n /**\r\n * @dev Returns true if this contract implements the interface defined by\r\n * `interfaceId`. See the corresponding\r\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\r\n * to learn more about how these ids are created.\r\n *\r\n * This function call must use less than 30 000 gas.\r\n */\r\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\r\n}\r\n\r\n/**\r\n * @title IERC1363Receiver Interface\r\n * @author Vittorio Minacori (https://github.com/vittominacori)\r\n * @dev Interface for any contract that wants to support transferAndCall or transferFromAndCall\r\n * from ERC1363 token contracts as defined in\r\n * https://eips.ethereum.org/EIPS/eip-1363\r\n */\r\ninterface IERC1363Receiver {\r\n /*\r\n * Note: the ERC-165 identifier for this interface is 0x88a7ca5c.\r\n * 0x88a7ca5c === bytes4(keccak256(\"onTransferReceived(address,address,uint256,bytes)\"))\r\n */\r\n\r\n /**\r\n * @notice Handle the receipt of ERC1363 tokens\r\n * @dev Any ERC1363 smart contract calls this function on the recipient\r\n * after a `transfer` or a `transferFrom`. This function MAY throw to revert and reject the\r\n * transfer. Return of other than the magic value MUST result in the\r\n * transaction being reverted.\r\n * Note: the token contract address is always the message sender.\r\n * @param operator address The address which called `transferAndCall` or `transferFromAndCall` function\r\n * @param sender address The address which are token transferred from\r\n * @param amount uint256 The amount of tokens transferred\r\n * @param data bytes Additional data with no specified format\r\n * @return `bytes4(keccak256(\"onTransferReceived(address,address,uint256,bytes)\"))` unless throwing\r\n */\r\n function onTransferReceived(address operator, address sender, uint256 amount, bytes calldata data) external returns (bytes4);\r\n}\r\n\r\n/**\r\n * @title IERC1363Spender Interface\r\n * @author Vittorio Minacori (https://github.com/vittominacori)\r\n * @dev Interface for any contract that wants to support approveAndCall\r\n * from ERC1363 token contracts as defined in\r\n * https://eips.ethereum.org/EIPS/eip-1363\r\n */\r\ninterface IERC1363Spender {\r\n /*\r\n * Note: the ERC-165 identifier for this interface is 0x7b04a2d0.\r\n * 0x7b04a2d0 === bytes4(keccak256(\"onApprovalReceived(address,uint256,bytes)\"))\r\n */\r\n\r\n /**\r\n * @notice Handle the approval of ERC1363 tokens\r\n * @dev Any ERC1363 smart contract calls this function on the recipient\r\n * after an `approve`. This function MAY throw to revert and reject the\r\n * approval. Return of other than the magic value MUST result in the\r\n * transaction being reverted.\r\n * Note: the token contract address is always the message sender.\r\n * @param sender address The address which called `approveAndCall` function\r\n * @param amount uint256 The amount of tokens to be spent\r\n * @param data bytes Additional data with no specified format\r\n * @return `bytes4(keccak256(\"onApprovalReceived(address,uint256,bytes)\"))` unless throwing\r\n */\r\n function onApprovalReceived(address sender, uint256 amount, bytes calldata data) external returns (bytes4);\r\n}\r\n\r\n/**\r\n * @title IERC1363 Interface\r\n * @author Vittorio Minacori (https://github.com/vittominacori)\r\n * @dev Interface for a Payable Token contract as defined in\r\n * https://eips.ethereum.org/EIPS/eip-1363\r\n */\r\ninterface IERC1363 is IERC20, IERC165 {\r\n /*\r\n * Note: the ERC-165 identifier for this interface is 0x4bbee2df.\r\n * 0x4bbee2df ===\r\n * bytes4(keccak256(\u0027transferAndCall(address,uint256)\u0027)) ^\r\n * bytes4(keccak256(\u0027transferAndCall(address,uint256,bytes)\u0027)) ^\r\n * bytes4(keccak256(\u0027transferFromAndCall(address,address,uint256)\u0027)) ^\r\n * bytes4(keccak256(\u0027transferFromAndCall(address,address,uint256,bytes)\u0027))\r\n */\r\n\r\n /*\r\n * Note: the ERC-165 identifier for this interface is 0xfb9ec8ce.\r\n * 0xfb9ec8ce ===\r\n * bytes4(keccak256(\u0027approveAndCall(address,uint256)\u0027)) ^\r\n * bytes4(keccak256(\u0027approveAndCall(address,uint256,bytes)\u0027))\r\n */\r\n\r\n /**\r\n * @notice Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver\r\n * @param recipient address The address which you want to transfer to\r\n * @param amount uint256 The amount of tokens to be transferred\r\n * @return true unless throwing\r\n */\r\n function transferAndCall(address recipient, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @notice Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver\r\n * @param recipient address The address which you want to transfer to\r\n * @param amount uint256 The amount of tokens to be transferred\r\n * @param data bytes Additional data with no specified format, sent in call to `recipient`\r\n * @return true unless throwing\r\n */\r\n function transferAndCall(address recipient, uint256 amount, bytes calldata data) external returns (bool);\r\n\r\n /**\r\n * @notice Transfer tokens from one address to another and then call `onTransferReceived` on receiver\r\n * @param sender address The address which you want to send tokens from\r\n * @param recipient address The address which you want to transfer to\r\n * @param amount uint256 The amount of tokens to be transferred\r\n * @return true unless throwing\r\n */\r\n function transferFromAndCall(address sender, address recipient, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @notice Transfer tokens from one address to another and then call `onTransferReceived` on receiver\r\n * @param sender address The address which you want to send tokens from\r\n * @param recipient address The address which you want to transfer to\r\n * @param amount uint256 The amount of tokens to be transferred\r\n * @param data bytes Additional data with no specified format, sent in call to `recipient`\r\n * @return true unless throwing\r\n */\r\n function transferFromAndCall(address sender, address recipient, uint256 amount, bytes calldata data) external returns (bool);\r\n\r\n /**\r\n * @notice Approve the passed address to spend the specified amount of tokens on behalf of msg.sender\r\n * and then call `onApprovalReceived` on spender.\r\n * Beware that changing an allowance with this method brings the risk that someone may use both the old\r\n * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this\r\n * race condition is to first reduce the spender\u0027s allowance to 0 and set the desired value afterwards:\r\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\r\n * @param spender address The address which will spend the funds\r\n * @param amount uint256 The amount of tokens to be spent\r\n */\r\n function approveAndCall(address spender, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @notice Approve the passed address to spend the specified amount of tokens on behalf of msg.sender\r\n * and then call `onApprovalReceived` on spender.\r\n * Beware that changing an allowance with this method brings the risk that someone may use both the old\r\n * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this\r\n * race condition is to first reduce the spender\u0027s allowance to 0 and set the desired value afterwards:\r\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\r\n * @param spender address The address which will spend the funds\r\n * @param amount uint256 The amount of tokens to be spent\r\n * @param data bytes Additional data with no specified format, sent in call to `spender`\r\n */\r\n function approveAndCall(address spender, uint256 amount, bytes calldata data) external returns (bool);\r\n}\r\n\r\n/**\r\n * @dev Collection of functions related to the address type\r\n */\r\nlibrary Address {\r\n /**\r\n * @dev Returns true if `account` is a contract.\r\n *\r\n * [IMPORTANT]\r\n * ====\r\n * It is unsafe to assume that an address for which this function returns\r\n * false is an externally-owned account (EOA) and not a contract.\r\n *\r\n * Among others, `isContract` will return false for the following\r\n * types of addresses:\r\n *\r\n * - an externally-owned account\r\n * - a contract in construction\r\n * - an address where a contract will be created\r\n * - an address where a contract lived, but was destroyed\r\n * ====\r\n */\r\n function isContract(address account) internal view returns (bool) {\r\n // This method relies on extcodesize, which returns 0 for contracts in\r\n // construction, since the code is only stored at the end of the\r\n // constructor execution.\r\n\r\n uint256 size;\r\n // solhint-disable-next-line no-inline-assembly\r\n assembly { size := extcodesize(account) }\r\n return size \u003e 0;\r\n }\r\n\r\n /**\r\n * @dev Replacement for Solidity\u0027s `transfer`: sends `amount` wei to\r\n * `recipient`, forwarding all available gas and reverting on errors.\r\n *\r\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\r\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\r\n * imposed by `transfer`, making them unable to receive funds via\r\n * `transfer`. {sendValue} removes this limitation.\r\n *\r\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\r\n *\r\n * IMPORTANT: because control is transferred to `recipient`, care must be\r\n * taken to not create reentrancy vulnerabilities. Consider using\r\n * {ReentrancyGuard} or the\r\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\r\n */\r\n function sendValue(address payable recipient, uint256 amount) internal {\r\n require(address(this).balance \u003e= amount, \"Address: insufficient balance\");\r\n\r\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\r\n (bool success, ) = recipient.call{ value: amount }(\"\");\r\n require(success, \"Address: unable to send value, recipient may have reverted\");\r\n }\r\n\r\n /**\r\n * @dev Performs a Solidity function call using a low level `call`. A\r\n * plain`call` is an unsafe replacement for a function call: use this\r\n * function instead.\r\n *\r\n * If `target` reverts with a revert reason, it is bubbled up by this\r\n * function (like regular Solidity function calls).\r\n *\r\n * Returns the raw returned data. To convert to the expected return value,\r\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\r\n *\r\n * Requirements:\r\n *\r\n * - `target` must be a contract.\r\n * - calling `target` with `data` must not revert.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\r\n return functionCall(target, data, \"Address: low-level call failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\r\n * `errorMessage` as a fallback revert reason when `target` reverts.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, 0, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but also transferring `value` wei to `target`.\r\n *\r\n * Requirements:\r\n *\r\n * - the calling contract must have an ETH balance of at least `value`.\r\n * - the called Solidity function must be `payable`.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\r\n * with `errorMessage` as a fallback revert reason when `target` reverts.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\r\n require(address(this).balance \u003e= value, \"Address: insufficient balance for call\");\r\n require(isContract(target), \"Address: call to non-contract\");\r\n\r\n // solhint-disable-next-line avoid-low-level-calls\r\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\r\n return _verifyCallResult(success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but performing a static call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\r\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\r\n * but performing a static call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\r\n require(isContract(target), \"Address: static call to non-contract\");\r\n\r\n // solhint-disable-next-line avoid-low-level-calls\r\n (bool success, bytes memory returndata) = target.staticcall(data);\r\n return _verifyCallResult(success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but performing a delegate call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\r\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\r\n * but performing a delegate call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\r\n require(isContract(target), \"Address: delegate call to non-contract\");\r\n\r\n // solhint-disable-next-line avoid-low-level-calls\r\n (bool success, bytes memory returndata) = target.delegatecall(data);\r\n return _verifyCallResult(success, returndata, errorMessage);\r\n }\r\n\r\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\r\n if (success) {\r\n return returndata;\r\n } else {\r\n // Look for revert reason and bubble it up if present\r\n if (returndata.length \u003e 0) {\r\n // The easiest way to bubble the revert reason is using memory via assembly\r\n\r\n // solhint-disable-next-line no-inline-assembly\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * @dev Library used to query support of an interface declared via {IERC165}.\r\n *\r\n * Note that these functions return the actual result of the query: they do not\r\n * `revert` if an interface is not supported. It is up to the caller to decide\r\n * what to do in these cases.\r\n */\r\nlibrary ERC165Checker {\r\n // As per the EIP-165 spec, no interface should ever match 0xffffffff\r\n bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;\r\n\r\n /*\r\n * bytes4(keccak256(\u0027supportsInterface(bytes4)\u0027)) == 0x01ffc9a7\r\n */\r\n bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;\r\n\r\n /**\r\n * @dev Returns true if `account` supports the {IERC165} interface,\r\n */\r\n function supportsERC165(address account) internal view returns (bool) {\r\n // Any contract that implements ERC165 must explicitly indicate support of\r\n // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid\r\n return _supportsERC165Interface(account, _INTERFACE_ID_ERC165) \u0026\u0026\r\n !_supportsERC165Interface(account, _INTERFACE_ID_INVALID);\r\n }\r\n\r\n /**\r\n * @dev Returns true if `account` supports the interface defined by\r\n * `interfaceId`. Support for {IERC165} itself is queried automatically.\r\n *\r\n * See {IERC165-supportsInterface}.\r\n */\r\n function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {\r\n // query support of both ERC165 as per the spec and support of _interfaceId\r\n return supportsERC165(account) \u0026\u0026\r\n _supportsERC165Interface(account, interfaceId);\r\n }\r\n\r\n /**\r\n * @dev Returns true if `account` supports all the interfaces defined in\r\n * `interfaceIds`. Support for {IERC165} itself is queried automatically.\r\n *\r\n * Batch-querying can lead to gas savings by skipping repeated checks for\r\n * {IERC165} support.\r\n *\r\n * See {IERC165-supportsInterface}.\r\n */\r\n function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {\r\n // query support of ERC165 itself\r\n if (!supportsERC165(account)) {\r\n return false;\r\n }\r\n\r\n // query support of each interface in _interfaceIds\r\n for (uint256 i = 0; i \u003c interfaceIds.length; i++) {\r\n if (!_supportsERC165Interface(account, interfaceIds[i])) {\r\n return false;\r\n }\r\n }\r\n\r\n // all interfaces supported\r\n return true;\r\n }\r\n\r\n /**\r\n * @notice Query if a contract implements an interface, does not check ERC165 support\r\n * @param account The address of the contract to query for support of an interface\r\n * @param interfaceId The interface identifier, as specified in ERC-165\r\n * @return true if the contract at account indicates support of the interface with\r\n * identifier interfaceId, false otherwise\r\n * @dev Assumes that account contains a contract that supports ERC165, otherwise\r\n * the behavior of this method is undefined. This precondition can be checked\r\n * with {supportsERC165}.\r\n * Interface identification is specified in ERC-165.\r\n */\r\n function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {\r\n // success determines whether the staticcall succeeded and result determines\r\n // whether the contract at account indicates support of _interfaceId\r\n (bool success, bool result) = _callERC165SupportsInterface(account, interfaceId);\r\n\r\n return (success \u0026\u0026 result);\r\n }\r\n\r\n /**\r\n * @notice Calls the function with selector 0x01ffc9a7 (ERC165) and suppresses throw\r\n * @param account The address of the contract to query for support of an interface\r\n * @param interfaceId The interface identifier, as specified in ERC-165\r\n * @return success true if the STATICCALL succeeded, false otherwise\r\n * @return result true if the STATICCALL succeeded and the contract at account\r\n * indicates support of the interface with identifier interfaceId, false otherwise\r\n */\r\n function _callERC165SupportsInterface(address account, bytes4 interfaceId)\r\n private\r\n view\r\n returns (bool, bool)\r\n {\r\n bytes memory encodedParams = abi.encodeWithSelector(_INTERFACE_ID_ERC165, interfaceId);\r\n (bool success, bytes memory result) = account.staticcall{ gas: 30000 }(encodedParams);\r\n if (result.length \u003c 32) return (false, false);\r\n return (success, abi.decode(result, (bool)));\r\n }\r\n}\r\n\r\n/*\r\n * @dev Provides information about the current execution context, including the\r\n * sender of the transaction and its data. While these are generally available\r\n * via msg.sender and msg.data, they should not be accessed in such a direct\r\n * manner, since when dealing with GSN meta-transactions the account sending and\r\n * paying for execution may not be the actual sender (as far as an application\r\n * is concerned).\r\n *\r\n * This contract is only required for intermediate, library-like contracts.\r\n */\r\nabstract contract Context {\r\n function _msgSender() internal view virtual returns (address payable) {\r\n return msg.sender;\r\n }\r\n\r\n function _msgData() internal view virtual returns (bytes memory) {\r\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\r\n return msg.data;\r\n }\r\n}\r\n\r\n/**\r\n * @dev Implementation of the {IERC20} interface.\r\n *\r\n * This implementation is agnostic to the way tokens are created. This means\r\n * that a supply mechanism has to be added in a derived contract using {_mint}.\r\n * For a generic mechanism see {ERC20PresetMinterPauser}.\r\n *\r\n * TIP: For a detailed writeup see our guide\r\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\r\n * to implement supply mechanisms].\r\n *\r\n * We have followed general OpenZeppelin guidelines: functions revert instead\r\n * of returning `false` on failure. This behavior is nonetheless conventional\r\n * and does not conflict with the expectations of ERC20 applications.\r\n *\r\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\r\n * This allows applications to reconstruct the allowance for all accounts just\r\n * by listening to said events. Other implementations of the EIP may not emit\r\n * these events, as it isn\u0027t required by the specification.\r\n *\r\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\r\n * functions have been added to mitigate the well-known issues around setting\r\n * allowances. See {IERC20-approve}.\r\n */\r\ncontract ERC20 is Context, IERC20 {\r\n using SafeMath for uint256;\r\n\r\n mapping (address =\u003e uint256) private _balances;\r\n\r\n mapping (address =\u003e mapping (address =\u003e uint256)) private _allowances;\r\n\r\n uint256 private _totalSupply;\r\n\r\n string private _name;\r\n string private _symbol;\r\n uint8 private _decimals;\r\n\r\n /**\r\n * @dev Sets the values for {name} and {symbol}, initializes {decimals} with\r\n * a default value of 18.\r\n *\r\n * To select a different value for {decimals}, use {_setupDecimals}.\r\n *\r\n * All three of these values are immutable: they can only be set once during\r\n * construction.\r\n */\r\n constructor (string memory name_, string memory symbol_) public {\r\n _name = name_;\r\n _symbol = symbol_;\r\n _decimals = 18;\r\n }\r\n\r\n /**\r\n * @dev Returns the name of the token.\r\n */\r\n function name() public view returns (string memory) {\r\n return _name;\r\n }\r\n\r\n /**\r\n * @dev Returns the symbol of the token, usually a shorter version of the\r\n * name.\r\n */\r\n function symbol() public view returns (string memory) {\r\n return _symbol;\r\n }\r\n\r\n /**\r\n * @dev Returns the number of decimals used to get its user representation.\r\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\r\n * be displayed to a user as `5,05` (`505 / 10 ** 2`).\r\n *\r\n * Tokens usually opt for a value of 18, imitating the relationship between\r\n * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is\r\n * called.\r\n *\r\n * NOTE: This information is only used for _display_ purposes: it in\r\n * no way affects any of the arithmetic of the contract, including\r\n * {IERC20-balanceOf} and {IERC20-transfer}.\r\n */\r\n function decimals() public view returns (uint8) {\r\n return _decimals;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-totalSupply}.\r\n */\r\n function totalSupply() public view override returns (uint256) {\r\n return _totalSupply;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-balanceOf}.\r\n */\r\n function balanceOf(address account) public view override returns (uint256) {\r\n return _balances[account];\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-transfer}.\r\n *\r\n * Requirements:\r\n *\r\n * - `recipient` cannot be the zero address.\r\n * - the caller must have a balance of at least `amount`.\r\n */\r\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\r\n _transfer(_msgSender(), recipient, amount);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-allowance}.\r\n */\r\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\r\n return _allowances[owner][spender];\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-approve}.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n */\r\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\r\n _approve(_msgSender(), spender, amount);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-transferFrom}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance. This is not\r\n * required by the EIP. See the note at the beginning of {ERC20}.\r\n *\r\n * Requirements:\r\n *\r\n * - `sender` and `recipient` cannot be the zero address.\r\n * - `sender` must have a balance of at least `amount`.\r\n * - the caller must have allowance for ``sender``\u0027s tokens of at least\r\n * `amount`.\r\n */\r\n function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {\r\n _transfer(sender, recipient, amount);\r\n _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, \"ERC20: transfer amount exceeds allowance\"));\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Atomically increases the allowance granted to `spender` by the caller.\r\n *\r\n * This is an alternative to {approve} that can be used as a mitigation for\r\n * problems described in {IERC20-approve}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n */\r\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\r\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\r\n *\r\n * This is an alternative to {approve} that can be used as a mitigation for\r\n * problems described in {IERC20-approve}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n * - `spender` must have allowance for the caller of at least\r\n * `subtractedValue`.\r\n */\r\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\r\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, \"ERC20: decreased allowance below zero\"));\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Moves tokens `amount` from `sender` to `recipient`.\r\n *\r\n * This is internal function is equivalent to {transfer}, and can be used to\r\n * e.g. implement automatic token fees, slashing mechanisms, etc.\r\n *\r\n * Emits a {Transfer} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `sender` cannot be the zero address.\r\n * - `recipient` cannot be the zero address.\r\n * - `sender` must have a balance of at least `amount`.\r\n */\r\n function _transfer(address sender, address recipient, uint256 amount) internal virtual {\r\n require(sender != address(0), \"ERC20: transfer from the zero address\");\r\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\r\n\r\n _beforeTokenTransfer(sender, recipient, amount);\r\n\r\n _balances[sender] = _balances[sender].sub(amount, \"ERC20: transfer amount exceeds balance\");\r\n _balances[recipient] = _balances[recipient].add(amount);\r\n emit Transfer(sender, recipient, amount);\r\n }\r\n\r\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\r\n * the total supply.\r\n *\r\n * Emits a {Transfer} event with `from` set to the zero address.\r\n *\r\n * Requirements:\r\n *\r\n * - `to` cannot be the zero address.\r\n */\r\n function _mint(address account, uint256 amount) internal virtual {\r\n require(account != address(0), \"ERC20: mint to the zero address\");\r\n\r\n _beforeTokenTransfer(address(0), account, amount);\r\n\r\n _totalSupply = _totalSupply.add(amount);\r\n _balances[account] = _balances[account].add(amount);\r\n emit Transfer(address(0), account, amount);\r\n }\r\n\r\n /**\r\n * @dev Destroys `amount` tokens from `account`, reducing the\r\n * total supply.\r\n *\r\n * Emits a {Transfer} event with `to` set to the zero address.\r\n *\r\n * Requirements:\r\n *\r\n * - `account` cannot be the zero address.\r\n * - `account` must have at least `amount` tokens.\r\n */\r\n function _burn(address account, uint256 amount) internal virtual {\r\n require(account != address(0), \"ERC20: burn from the zero address\");\r\n\r\n _beforeTokenTransfer(account, address(0), amount);\r\n\r\n _balances[account] = _balances[account].sub(amount, \"ERC20: burn amount exceeds balance\");\r\n _totalSupply = _totalSupply.sub(amount);\r\n emit Transfer(account, address(0), amount);\r\n }\r\n\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\r\n *\r\n * This internal function is equivalent to `approve`, and can be used to\r\n * e.g. set automatic allowances for certain subsystems, etc.\r\n *\r\n * Emits an {Approval} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `owner` cannot be the zero address.\r\n * - `spender` cannot be the zero address.\r\n */\r\n function _approve(address owner, address spender, uint256 amount) internal virtual {\r\n require(owner != address(0), \"ERC20: approve from the zero address\");\r\n require(spender != address(0), \"ERC20: approve to the zero address\");\r\n\r\n _allowances[owner][spender] = amount;\r\n emit Approval(owner, spender, amount);\r\n }\r\n\r\n /**\r\n * @dev Sets {decimals} to a value other than the default one of 18.\r\n *\r\n * WARNING: This function should only be called from the constructor. Most\r\n * applications that interact with token contracts will not expect\r\n * {decimals} to ever change, and may work incorrectly if it does.\r\n */\r\n function _setupDecimals(uint8 decimals_) internal {\r\n _decimals = decimals_;\r\n }\r\n\r\n /**\r\n * @dev Hook that is called before any transfer of tokens. This includes\r\n * minting and burning.\r\n *\r\n * Calling conditions:\r\n *\r\n * - when `from` and `to` are both non-zero, `amount` of ``from``\u0027s tokens\r\n * will be to transferred to `to`.\r\n * - when `from` is zero, `amount` tokens will be minted for `to`.\r\n * - when `to` is zero, `amount` of ``from``\u0027s tokens will be burned.\r\n * - `from` and `to` are never both zero.\r\n *\r\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\r\n */\r\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }\r\n}\r\n\r\n/**\r\n * @dev Implementation of the {IERC165} interface.\r\n *\r\n * Contracts may inherit from this and call {_registerInterface} to declare\r\n * their support of an interface.\r\n */\r\nabstract contract ERC165 is IERC165 {\r\n /*\r\n * bytes4(keccak256(\u0027supportsInterface(bytes4)\u0027)) == 0x01ffc9a7\r\n */\r\n bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;\r\n\r\n /**\r\n * @dev Mapping of interface ids to whether or not it\u0027s supported.\r\n */\r\n mapping(bytes4 =\u003e bool) private _supportedInterfaces;\r\n\r\n constructor () internal {\r\n // Derived contracts need only register support for their own interfaces,\r\n // we register support for ERC165 itself here\r\n _registerInterface(_INTERFACE_ID_ERC165);\r\n }\r\n\r\n /**\r\n * @dev See {IERC165-supportsInterface}.\r\n *\r\n * Time complexity O(1), guaranteed to always use less than 30 000 gas.\r\n */\r\n function supportsInterface(bytes4 interfaceId) public view override returns (bool) {\r\n return _supportedInterfaces[interfaceId];\r\n }\r\n\r\n /**\r\n * @dev Registers the contract as an implementer of the interface defined by\r\n * `interfaceId`. Support of the actual ERC165 interface is automatic and\r\n * registering its interface id is not required.\r\n *\r\n * See {IERC165-supportsInterface}.\r\n *\r\n * Requirements:\r\n *\r\n * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).\r\n */\r\n function _registerInterface(bytes4 interfaceId) internal virtual {\r\n require(interfaceId != 0xffffffff, \"ERC165: invalid interface id\");\r\n _supportedInterfaces[interfaceId] = true;\r\n }\r\n}\r\n\r\n/**\r\n * @title ERC1363\r\n * @author Vittorio Minacori (https://github.com/vittominacori)\r\n * @dev Implementation of an ERC1363 interface\r\n */\r\ncontract ERC1363 is ERC20, IERC1363, ERC165 {\r\n using Address for address;\r\n\r\n /*\r\n * Note: the ERC-165 identifier for this interface is 0x4bbee2df.\r\n * 0x4bbee2df ===\r\n * bytes4(keccak256(\u0027transferAndCall(address,uint256)\u0027)) ^\r\n * bytes4(keccak256(\u0027transferAndCall(address,uint256,bytes)\u0027)) ^\r\n * bytes4(keccak256(\u0027transferFromAndCall(address,address,uint256)\u0027)) ^\r\n * bytes4(keccak256(\u0027transferFromAndCall(address,address,uint256,bytes)\u0027))\r\n */\r\n bytes4 internal constant _INTERFACE_ID_ERC1363_TRANSFER = 0x4bbee2df;\r\n\r\n /*\r\n * Note: the ERC-165 identifier for this interface is 0xfb9ec8ce.\r\n * 0xfb9ec8ce ===\r\n * bytes4(keccak256(\u0027approveAndCall(address,uint256)\u0027)) ^\r\n * bytes4(keccak256(\u0027approveAndCall(address,uint256,bytes)\u0027))\r\n */\r\n bytes4 internal constant _INTERFACE_ID_ERC1363_APPROVE = 0xfb9ec8ce;\r\n\r\n // Equals to `bytes4(keccak256(\"onTransferReceived(address,address,uint256,bytes)\"))`\r\n // which can be also obtained as `IERC1363Receiver(0).onTransferReceived.selector`\r\n bytes4 private constant _ERC1363_RECEIVED = 0x88a7ca5c;\r\n\r\n // Equals to `bytes4(keccak256(\"onApprovalReceived(address,uint256,bytes)\"))`\r\n // which can be also obtained as `IERC1363Spender(0).onApprovalReceived.selector`\r\n bytes4 private constant _ERC1363_APPROVED = 0x7b04a2d0;\r\n\r\n /**\r\n * @param name Name of the token\r\n * @param symbol A symbol to be used as ticker\r\n */\r\n constructor (string memory name, string memory symbol) public ERC20(name, symbol) {\r\n // register the supported interfaces to conform to ERC1363 via ERC165\r\n _registerInterface(_INTERFACE_ID_ERC1363_TRANSFER);\r\n _registerInterface(_INTERFACE_ID_ERC1363_APPROVE);\r\n }\r\n\r\n /**\r\n * @dev Transfer tokens to a specified address and then execute a callback on recipient.\r\n * @param recipient The address to transfer to.\r\n * @param amount The amount to be transferred.\r\n * @return A boolean that indicates if the operation was successful.\r\n */\r\n function transferAndCall(address recipient, uint256 amount) public virtual override returns (bool) {\r\n return transferAndCall(recipient, amount, \"\");\r\n }\r\n\r\n /**\r\n * @dev Transfer tokens to a specified address and then execute a callback on recipient.\r\n * @param recipient The address to transfer to\r\n * @param amount The amount to be transferred\r\n * @param data Additional data with no specified format\r\n * @return A boolean that indicates if the operation was successful.\r\n */\r\n function transferAndCall(address recipient, uint256 amount, bytes memory data) public virtual override returns (bool) {\r\n transfer(recipient, amount);\r\n require(_checkAndCallTransfer(_msgSender(), recipient, amount, data), \"ERC1363: _checkAndCallTransfer reverts\");\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Transfer tokens from one address to another and then execute a callback on recipient.\r\n * @param sender The address which you want to send tokens from\r\n * @param recipient The address which you want to transfer to\r\n * @param amount The amount of tokens to be transferred\r\n * @return A boolean that indicates if the operation was successful.\r\n */\r\n function transferFromAndCall(address sender, address recipient, uint256 amount) public virtual override returns (bool) {\r\n return transferFromAndCall(sender, recipient, amount, \"\");\r\n }\r\n\r\n /**\r\n * @dev Transfer tokens from one address to another and then execute a callback on recipient.\r\n * @param sender The address which you want to send tokens from\r\n * @param recipient The address which you want to transfer to\r\n * @param amount The amount of tokens to be transferred\r\n * @param data Additional data with no specified format\r\n * @return A boolean that indicates if the operation was successful.\r\n */\r\n function transferFromAndCall(address sender, address recipient, uint256 amount, bytes memory data) public virtual override returns (bool) {\r\n transferFrom(sender, recipient, amount);\r\n require(_checkAndCallTransfer(sender, recipient, amount, data), \"ERC1363: _checkAndCallTransfer reverts\");\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Approve spender to transfer tokens and then execute a callback on recipient.\r\n * @param spender The address allowed to transfer to\r\n * @param amount The amount allowed to be transferred\r\n * @return A boolean that indicates if the operation was successful.\r\n */\r\n function approveAndCall(address spender, uint256 amount) public virtual override returns (bool) {\r\n return approveAndCall(spender, amount, \"\");\r\n }\r\n\r\n /**\r\n * @dev Approve spender to transfer tokens and then execute a callback on recipient.\r\n * @param spender The address allowed to transfer to.\r\n * @param amount The amount allowed to be transferred.\r\n * @param data Additional data with no specified format.\r\n * @return A boolean that indicates if the operation was successful.\r\n */\r\n function approveAndCall(address spender, uint256 amount, bytes memory data) public virtual override returns (bool) {\r\n approve(spender, amount);\r\n require(_checkAndCallApprove(spender, amount, data), \"ERC1363: _checkAndCallApprove reverts\");\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Internal function to invoke `onTransferReceived` on a target address\r\n * The call is not executed if the target address is not a contract\r\n * @param sender address Representing the previous owner of the given token value\r\n * @param recipient address Target address that will receive the tokens\r\n * @param amount uint256 The amount mount of tokens to be transferred\r\n * @param data bytes Optional data to send along with the call\r\n * @return whether the call correctly returned the expected magic value\r\n */\r\n function _checkAndCallTransfer(address sender, address recipient, uint256 amount, bytes memory data) internal virtual returns (bool) {\r\n if (!recipient.isContract()) {\r\n return false;\r\n }\r\n bytes4 retval = IERC1363Receiver(recipient).onTransferReceived(\r\n _msgSender(), sender, amount, data\r\n );\r\n return (retval == _ERC1363_RECEIVED);\r\n }\r\n\r\n /**\r\n * @dev Internal function to invoke `onApprovalReceived` on a target address\r\n * The call is not executed if the target address is not a contract\r\n * @param spender address The address which will spend the funds\r\n * @param amount uint256 The amount of tokens to be spent\r\n * @param data bytes Optional data to send along with the call\r\n * @return whether the call correctly returned the expected magic value\r\n */\r\n function _checkAndCallApprove(address spender, uint256 amount, bytes memory data) internal virtual returns (bool) {\r\n if (!spender.isContract()) {\r\n return false;\r\n }\r\n bytes4 retval = IERC1363Spender(spender).onApprovalReceived(\r\n _msgSender(), amount, data\r\n );\r\n return (retval == _ERC1363_APPROVED);\r\n }\r\n}\r\n \r\n/**\r\n * @title ERC1363Payable\r\n * @author Vittorio Minacori (https://github.com/vittominacori)\r\n * @dev Implementation proposal of a contract that wants to accept ERC1363 payments\r\n */\r\ncontract ERC1363Payable is IERC1363Receiver, IERC1363Spender, ERC165, Context {\r\n using ERC165Checker for address;\r\n\r\n /**\r\n * @dev Magic value to be returned upon successful reception of ERC1363 tokens\r\n * Equals to `bytes4(keccak256(\"onTransferReceived(address,address,uint256,bytes)\"))`,\r\n * which can be also obtained as `IERC1363Receiver(0).onTransferReceived.selector`\r\n */\r\n bytes4 internal constant _INTERFACE_ID_ERC1363_RECEIVER = 0x88a7ca5c;\r\n\r\n /**\r\n * @dev Magic value to be returned upon successful approval of ERC1363 tokens.\r\n * Equals to `bytes4(keccak256(\"onApprovalReceived(address,uint256,bytes)\"))`,\r\n * which can be also obtained as `IERC1363Spender(0).onApprovalReceived.selector`\r\n */\r\n bytes4 internal constant _INTERFACE_ID_ERC1363_SPENDER = 0x7b04a2d0;\r\n\r\n /*\r\n * Note: the ERC-165 identifier for the ERC1363 token transfer\r\n * 0x4bbee2df ===\r\n * bytes4(keccak256(\u0027transferAndCall(address,uint256)\u0027)) ^\r\n * bytes4(keccak256(\u0027transferAndCall(address,uint256,bytes)\u0027)) ^\r\n * bytes4(keccak256(\u0027transferFromAndCall(address,address,uint256)\u0027)) ^\r\n * bytes4(keccak256(\u0027transferFromAndCall(address,address,uint256,bytes)\u0027))\r\n */\r\n bytes4 private constant _INTERFACE_ID_ERC1363_TRANSFER = 0x4bbee2df;\r\n\r\n /*\r\n * Note: the ERC-165 identifier for the ERC1363 token approval\r\n * 0xfb9ec8ce ===\r\n * bytes4(keccak256(\u0027approveAndCall(address,uint256)\u0027)) ^\r\n * bytes4(keccak256(\u0027approveAndCall(address,uint256,bytes)\u0027))\r\n */\r\n bytes4 private constant _INTERFACE_ID_ERC1363_APPROVE = 0xfb9ec8ce;\r\n\r\n /**\r\n * @dev Emitted when `amount` tokens are moved from one account (`sender`) to\r\n * this by operator (`operator`) using {transferAndCall} or {transferFromAndCall}.\r\n */\r\n event TokensReceived(\r\n address indexed operator,\r\n address indexed sender,\r\n uint256 amount,\r\n bytes data\r\n );\r\n\r\n /**\r\n * @dev Emitted when the allowance of this for a `sender` is set by\r\n * a call to {approveAndCall}. `amount` is the new allowance.\r\n */\r\n event TokensApproved(\r\n address indexed sender,\r\n uint256 amount,\r\n bytes data\r\n );\r\n\r\n // The ERC1363 token accepted\r\n IERC1363 private _acceptedToken;\r\n\r\n /**\r\n * @param acceptedToken_ Address of the token being accepted\r\n */\r\n constructor(IERC1363 acceptedToken_) public {\r\n require(address(acceptedToken_) != address(0), \"ERC1363Payable: acceptedToken is zero address\");\r\n require(\r\n acceptedToken_.supportsInterface(_INTERFACE_ID_ERC1363_TRANSFER) \u0026\u0026\r\n acceptedToken_.supportsInterface(_INTERFACE_ID_ERC1363_APPROVE)\r\n );\r\n\r\n _acceptedToken = acceptedToken_;\r\n\r\n // register the supported interface to conform to IERC1363Receiver and IERC1363Spender via ERC165\r\n _registerInterface(_INTERFACE_ID_ERC1363_RECEIVER);\r\n _registerInterface(_INTERFACE_ID_ERC1363_SPENDER);\r\n }\r\n\r\n /*\r\n * @dev Note: remember that the token contract address is always the message sender.\r\n * @param operator The address which called `transferAndCall` or `transferFromAndCall` function\r\n * @param sender The address which are token transferred from\r\n * @param amount The amount of tokens transferred\r\n * @param data Additional data with no specified format\r\n */\r\n function onTransferReceived(address operator, address sender, uint256 amount, bytes memory data) public override returns (bytes4) {\r\n require(_msgSender() == address(_acceptedToken), \"ERC1363Payable: acceptedToken is not message sender\");\r\n\r\n emit TokensReceived(operator, sender, amount, data);\r\n\r\n _transferReceived(operator, sender, amount, data);\r\n\r\n return _INTERFACE_ID_ERC1363_RECEIVER;\r\n }\r\n\r\n /*\r\n * @dev Note: remember that the token contract address is always the message sender.\r\n * @param sender The address which called `approveAndCall` function\r\n * @param amount The amount of tokens to be spent\r\n * @param data Additional data with no specified format\r\n */\r\n function onApprovalReceived(address sender, uint256 amount, bytes memory data) public override returns (bytes4) {\r\n require(_msgSender() == address(_acceptedToken), \"ERC1363Payable: acceptedToken is not message sender\");\r\n\r\n emit TokensApproved(sender, amount, data);\r\n\r\n _approvalReceived(sender, amount, data);\r\n\r\n return _INTERFACE_ID_ERC1363_SPENDER;\r\n }\r\n\r\n /**\r\n * @dev The ERC1363 token accepted\r\n */\r\n function acceptedToken() public view returns (IERC1363) {\r\n return _acceptedToken;\r\n }\r\n\r\n /**\r\n * @dev Called after validating a `onTransferReceived`. Override this method to\r\n * make your stuffs within your contract.\r\n * @param operator The address which called `transferAndCall` or `transferFromAndCall` function\r\n * @param sender The address which are token transferred from\r\n * @param amount The amount of tokens transferred\r\n * @param data Additional data with no specified format\r\n */\r\n function _transferReceived(address operator, address sender, uint256 amount, bytes memory data) internal virtual {\r\n // optional override\r\n }\r\n\r\n /**\r\n * @dev Called after validating a `onApprovalReceived`. Override this method to\r\n * make your stuffs within your contract.\r\n * @param sender The address which called `approveAndCall` function\r\n * @param amount The amount of tokens to be spent\r\n * @param data Additional data with no specified format\r\n */\r\n function _approvalReceived(address sender, uint256 amount, bytes memory data) internal virtual {\r\n // optional override\r\n }\r\n}"}}