1. | pragma solidity 0.6.12; |
2. |
3. | interface IERC20 { |
4. | function totalSupply() external view returns (uint256); |
5. | function balanceOf(address account) external view returns (uint256); |
6. | function transfer(address recipient, uint256 amount) external returns (bool); |
7. | function allowance(address owner, address spender) external view returns (uint256); |
8. | function approve(address spender, uint256 amount) external returns (bool); |
9. | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); |
10. |
11. | event Transfer(address indexed from, address indexed to, uint256 value); |
12. | event Approval(address indexed owner, address indexed spender, uint256 value); |
13. | } |
14. |
15. | library SafeMath { |
16. | function add(uint256 a, uint256 b) internal pure returns (uint256) { |
17. | uint256 c = a + b; |
18. | require(c >= a, "SafeMath: addition overflow"); |
19. | return c; |
20. | } |
21. |
22. | function sub(uint256 a, uint256 b) internal pure returns (uint256) { |
23. | return sub(a, b, "SafeMath: subtraction overflow"); |
24. | } |
25. |
26. | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { |
27. | require(b <= a, errorMessage); |
28. | uint256 c = a - b; |
29. | return c; |
30. | } |
31. |
32. | function mul(uint256 a, uint256 b) internal pure returns (uint256) { |
33. | if (a == 0) { |
34. | return 0; |
35. | } |
36. | uint256 c = a * b; |
37. | require(c / a == b, "SafeMath: multiplication overflow"); |
38. | return c; |
39. | } |
40. |
41. | function div(uint256 a, uint256 b) internal pure returns (uint256) { |
42. | return div(a, b, "SafeMath: division by zero"); |
43. | } |
44. |
45. | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { |
46. | require(b > 0, errorMessage); |
47. | uint256 c = a / b; |
48. | return c; |
49. | } |
50. |
51. | function mod(uint256 a, uint256 b) internal pure returns (uint256) { |
52. | return mod(a, b, "SafeMath: modulo by zero"); |
53. | } |
54. |
55. | function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { |
56. | require(b != 0, errorMessage); |
57. | return a % b; |
58. | } |
59. | } |
60. |
61. | abstract contract Context { |
62. | function _msgSender() internal view virtual returns (address payable) { |
63. | return msg.sender; |
64. | } |
65. |
66. | function _msgData() internal view virtual returns (bytes memory) { |
67. | this; |
68. | return msg.data; |
69. | } |
70. | } |
71. |