|
1 | | -// Sources flattened with hardhat v2.1.2 https://hardhat.org |
| 1 | +// Sources flattened with hardhat v2.2.1 https://hardhat.org |
2 | 2 |
|
3 | | -// File @openzeppelin/contracts/utils/Context.sol@v3.4.1 |
| 3 | +// File vendor/OpenZeppelin/openzeppelin-contracts/contracts/utils/Context.sol |
4 | 4 |
|
5 | 5 | // SPDX-License-Identifier: MIT |
6 | 6 |
|
@@ -28,7 +28,7 @@ abstract contract Context { |
28 | 28 | } |
29 | 29 |
|
30 | 30 |
|
31 | | -// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v3.4.1 |
| 31 | +// File vendor/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol |
32 | 32 |
|
33 | 33 | // SPDX-License-Identifier: MIT |
34 | 34 |
|
@@ -109,7 +109,7 @@ interface IERC20 { |
109 | 109 | } |
110 | 110 |
|
111 | 111 |
|
112 | | -// File @openzeppelin/contracts/math/SafeMath.sol@v3.4.1 |
| 112 | +// File vendor/OpenZeppelin/openzeppelin-contracts/contracts/math/SafeMath.sol |
113 | 113 |
|
114 | 114 | // SPDX-License-Identifier: MIT |
115 | 115 |
|
@@ -327,7 +327,7 @@ library SafeMath { |
327 | 327 | } |
328 | 328 |
|
329 | 329 |
|
330 | | -// File @openzeppelin/contracts/token/ERC20/ERC20.sol@v3.4.1 |
| 330 | +// File vendor/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol |
331 | 331 |
|
332 | 332 | // SPDX-License-Identifier: MIT |
333 | 333 |
|
@@ -635,73 +635,99 @@ contract ERC20 is Context, IERC20 { |
635 | 635 | } |
636 | 636 |
|
637 | 637 |
|
638 | | -// File contracts/v0.6/token/ERC677.sol |
| 638 | +// File contracts/v0.6/token/IERC677.sol |
639 | 639 |
|
640 | 640 | // SPDX-License-Identifier: MIT |
641 | 641 | pragma solidity >0.6.0 <0.8.0; |
642 | 642 |
|
643 | | -interface ERC677 is IERC20 { |
644 | | - function transferAndCall(address to, uint value, bytes memory data) external returns (bool success); |
645 | | - |
646 | | - event Transfer(address indexed from, address indexed to, uint value, bytes data); |
| 643 | +interface IERC677 is IERC20 { |
| 644 | + function transferAndCall( |
| 645 | + address to, |
| 646 | + uint value, |
| 647 | + bytes memory data |
| 648 | + ) |
| 649 | + external |
| 650 | + returns (bool success); |
| 651 | + |
| 652 | + event Transfer( |
| 653 | + address indexed from, |
| 654 | + address indexed to, |
| 655 | + uint value, |
| 656 | + bytes data |
| 657 | + ); |
647 | 658 | } |
648 | 659 |
|
649 | 660 |
|
650 | | -// File contracts/v0.6/token/ERC677Receiver.sol |
| 661 | +// File contracts/v0.6/token/IERC677Receiver.sol |
651 | 662 |
|
652 | 663 | // SPDX-License-Identifier: MIT |
653 | 664 | pragma solidity >0.6.0 <0.8.0; |
654 | 665 |
|
655 | | -interface ERC677Receiver { |
656 | | - function onTokenTransfer(address _sender, uint _value, bytes memory _data) external; |
| 666 | +interface IERC677Receiver { |
| 667 | + function onTokenTransfer( |
| 668 | + address sender, |
| 669 | + uint value, |
| 670 | + bytes memory data |
| 671 | + ) |
| 672 | + external; |
657 | 673 | } |
658 | 674 |
|
659 | 675 |
|
660 | | -// File contracts/v0.6/ERC677Token.sol |
| 676 | +// File contracts/v0.6/ERC677.sol |
661 | 677 |
|
662 | 678 | // SPDX-License-Identifier: MIT |
663 | 679 | pragma solidity >0.6.0 <0.8.0; |
664 | 680 |
|
665 | 681 |
|
666 | 682 |
|
667 | | -abstract contract ERC677Token is ERC20, ERC677 { |
| 683 | +abstract contract ERC677 is IERC677, ERC20 { |
668 | 684 | /** |
669 | 685 | * @dev transfer token to a contract address with additional data if the recipient is a contact. |
670 | | - * @param _to The address to transfer to. |
671 | | - * @param _value The amount to be transferred. |
672 | | - * @param _data The extra data to be passed to the receiving contract. |
| 686 | + * @param to The address to transfer to. |
| 687 | + * @param value The amount to be transferred. |
| 688 | + * @param data The extra data to be passed to the receiving contract. |
673 | 689 | */ |
674 | | - function transferAndCall(address _to, uint _value, bytes memory _data) |
| 690 | + function transferAndCall( |
| 691 | + address to, |
| 692 | + uint value, |
| 693 | + bytes memory data |
| 694 | + ) |
675 | 695 | public |
676 | 696 | override |
677 | 697 | virtual |
678 | 698 | returns (bool success) |
679 | 699 | { |
680 | | - super.transfer(_to, _value); |
681 | | - emit Transfer(msg.sender, _to, _value, _data); |
682 | | - if (isContract(_to)) { |
683 | | - contractFallback(_to, _value, _data); |
| 700 | + super.transfer(to, value); |
| 701 | + emit Transfer(msg.sender, to, value, data); |
| 702 | + if (isContract(to)) { |
| 703 | + contractFallback(to, value, data); |
684 | 704 | } |
685 | 705 | return true; |
686 | 706 | } |
687 | 707 |
|
688 | 708 |
|
689 | 709 | // PRIVATE |
690 | 710 |
|
691 | | - function contractFallback(address _to, uint _value, bytes memory _data) |
| 711 | + function contractFallback( |
| 712 | + address to, |
| 713 | + uint value, |
| 714 | + bytes memory data |
| 715 | + ) |
692 | 716 | private |
693 | 717 | { |
694 | | - ERC677Receiver receiver = ERC677Receiver(_to); |
695 | | - receiver.onTokenTransfer(msg.sender, _value, _data); |
| 718 | + IERC677Receiver receiver = IERC677Receiver(to); |
| 719 | + receiver.onTokenTransfer(msg.sender, value, data); |
696 | 720 | } |
697 | 721 |
|
698 | | - function isContract(address _addr) |
| 722 | + function isContract( |
| 723 | + address addr |
| 724 | + ) |
699 | 725 | private |
700 | 726 | view |
701 | 727 | returns (bool hasCode) |
702 | 728 | { |
703 | 729 | uint length; |
704 | | - assembly { length := extcodesize(_addr) } |
| 730 | + assembly { length := extcodesize(addr) } |
705 | 731 | return length > 0; |
706 | 732 | } |
707 | 733 | } |
0 commit comments