Skip to content

Commit 0103f01

Browse files
committed
Upgradeable Crowdsale
1 parent e7a895f commit 0103f01

10 files changed

+16
-16
lines changed

Contracts/Crowdsale.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.0;
33

4-
import "./ERC20Upgradeable.sol";
5-
import "./SafeMathUpgradeable.sol";
6-
import "./SafeERC20Upgradeable.sol";
4+
import "./ERC20/ERC20Upgradeable.sol";
5+
import "./utils/SafeMathUpgradeable.sol";
6+
import "./ERC20/SafeERC20Upgradeable.sol";
77

88

99
/**
@@ -20,7 +20,7 @@ import "./SafeERC20Upgradeable.sol";
2020
*/
2121
contract Crowdsale {
2222
using SafeMathUpgradeable for uint256;
23-
using SafeERC20UpgradeableUpgradeable for ERC20Upgradeable;
23+
using SafeERC20pgradeable for ERC20Upgradeable;
2424

2525
// The token being sold
2626
ERC20Upgradeable public token;

Contracts/ERC20Upgradeable.sol renamed to Contracts/ERC20/ERC20Upgradeable.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ pragma solidity ^0.8.0;
55

66
import "./IERC20Upgradeable.sol";
77
import "./IERC20MetadataUpgradeable.sol";
8-
import "./ContextUpgradeable.sol";
9-
import "./Initializable.sol";
8+
import ".././utils/ContextUpgradeable.sol";
9+
import ".././utils/Initializable.sol";
1010

1111
/**
1212
* @dev Implementation of the {IERC20Upgradeable} interface.
@@ -33,7 +33,7 @@ import "./Initializable.sol";
3333
* functions have been added to mitigate the well-known issues around setting
3434
* allowances. See {IERC20Upgradeable-approve}.
3535
*/
36-
contract ERC20UpgradeableUpgradeable is Initializable, ContextUpgradeable, IERC20UpgradeableUpgradeable, IERC20UpgradeableMetadataUpgradeable {
36+
contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {
3737
mapping(address => uint256) private _balances;
3838

3939
mapping(address => mapping(address => uint256)) private _allowances;

Contracts/SafeERC20Upgradeable.sol renamed to Contracts/ERC20/SafeERC20Upgradeable.sol

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
pragma solidity ^0.8.0;
55

66
import "./IERC20Upgradeable.sol";
7-
import "./AddressUpgradeable.sol";
7+
import ".././utils/AddressUpgradeable.sol";
88

99
/**
1010
* @title SafeERC20Upgradeable
@@ -15,19 +15,19 @@ import "./AddressUpgradeable.sol";
1515
* To use this library you can add a `using SafeERC20Upgradeable for IERC20Upgradeable;` statement to your contract,
1616
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
1717
*/
18-
library SafeERC20UpgradeableUpgradeable {
18+
library SafeERC20pgradeable {
1919
using AddressUpgradeable for address;
2020

2121
function safeTransfer(
22-
IERC20UpgradeableUpgradeable token,
22+
IERC20Upgradeable token,
2323
address to,
2424
uint256 value
2525
) internal {
2626
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
2727
}
2828

2929
function safeTransferFrom(
30-
IERC20UpgradeableUpgradeable token,
30+
IERC20Upgradeable token,
3131
address from,
3232
address to,
3333
uint256 value
@@ -43,7 +43,7 @@ library SafeERC20UpgradeableUpgradeable {
4343
* {safeDecreaseAllowance} instead.
4444
*/
4545
function safeApprove(
46-
IERC20UpgradeableUpgradeable token,
46+
IERC20Upgradeable token,
4747
address spender,
4848
uint256 value
4949
) internal {
@@ -58,7 +58,7 @@ library SafeERC20UpgradeableUpgradeable {
5858
}
5959

6060
function safeIncreaseAllowance(
61-
IERC20UpgradeableUpgradeable token,
61+
IERC20Upgradeable token,
6262
address spender,
6363
uint256 value
6464
) internal {
@@ -67,7 +67,7 @@ library SafeERC20UpgradeableUpgradeable {
6767
}
6868

6969
function safeDecreaseAllowance(
70-
IERC20UpgradeableUpgradeable token,
70+
IERC20Upgradeable token,
7171
address spender,
7272
uint256 value
7373
) internal {
@@ -85,7 +85,7 @@ library SafeERC20UpgradeableUpgradeable {
8585
* @param token The token targeted by the call.
8686
* @param data The call data (encoded using abi.encode or one of its variants).
8787
*/
88-
function _callOptionalReturn(IERC20UpgradeableUpgradeable token, bytes memory data) private {
88+
function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {
8989
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
9090
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
9191
// the target address contains contract code and also asserts for success in the low-level call.

Contracts/ContextUpgradeable.sol renamed to Contracts/utils/ContextUpgradeable.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: MIT
22

33
pragma solidity ^0.8.0;
4-
import "./Initializable.sol";
4+
import ".././utils/Initializable.sol";
55

66
/**
77
* @dev Provides information about the current execution context, including the
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)