1
+ // SPDX-License-Identifier: MIT
1
2
pragma solidity ^ 0.8.0 ;
2
3
4
+ import "@openzeppelin/contracts/utils/math/SafeMath.sol " ;
5
+
3
6
interface IERC20 {
4
7
5
8
function balanceOf (address account ) external view returns (uint256 );
@@ -14,51 +17,6 @@ interface IERC20 {
14
17
15
18
}
16
19
17
- library SafeMath {
18
- function add (uint256 a , uint256 b ) internal pure returns (uint256 ) {
19
- uint256 c = a + b;
20
- require (c >= a, "SafeMath: addition overflow " );
21
-
22
- return c;
23
- }
24
-
25
- function sub (uint256 a , uint256 b ) internal pure returns (uint256 ) {
26
- require (b <= a, "SafeMath: subtraction overflow " );
27
- uint256 c = a - b;
28
-
29
- return c;
30
- }
31
-
32
- function mul (uint256 a , uint256 b ) internal pure returns (uint256 ) {
33
- // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
34
- // benefit is lost if 'b' is also tested.
35
- // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
36
- if (a == 0 ) {
37
- return 0 ;
38
- }
39
-
40
- uint256 c = a * b;
41
- require (c / a == b, "SafeMath: multiplication overflow " );
42
-
43
- return c;
44
- }
45
-
46
- function div (uint256 a , uint256 b ) internal pure returns (uint256 ) {
47
- // Solidity only automatically asserts when dividing by 0
48
- require (b > 0 , "SafeMath: division by zero " );
49
- uint256 c = a / b;
50
- // assert(a == b * c + a % b); // There is no case in which this doesn't hold
51
-
52
- return c;
53
- }
54
-
55
- function mod (uint256 a , uint256 b ) internal pure returns (uint256 ) {
56
- require (b != 0 , "SafeMath: modulo by zero " );
57
- return a % b;
58
- }
59
-
60
- }
61
-
62
20
contract FinancingTool {
63
21
function safeTransfer (address token , address to , uint256 value ) internal {
64
22
(bool success , bytes memory data ) = token.call (abi.encodeWithSelector (0xa9059cbb , to, value));
0 commit comments