Skip to content

Commit 3ae9cd3

Browse files
Revert "Add interfaces to ERC20 base contracts" (#387)
Revert "Add interfaces to ERC20 base contracts (#371)" This reverts commit ddc540a.
1 parent ddc540a commit 3ae9cd3

File tree

3 files changed

+3
-71
lines changed

3 files changed

+3
-71
lines changed

contracts/base/ERC20Base.sol

+1-24
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import "../openzeppelin-presets/token/ERC20/extensions/ERC20Permit.sol";
88
import "../extension/ContractMetadata.sol";
99
import "../extension/Multicall.sol";
1010
import "../extension/Ownable.sol";
11-
import "../extension/interface/IMintableERC20.sol";
12-
import "../extension/interface/IBurnableERC20.sol";
1311

1412
/**
1513
* The `ERC20Base` smart contract implements the ERC20 standard.
@@ -26,7 +24,7 @@ import "../extension/interface/IBurnableERC20.sol";
2624
* presenting a message signed by the account.
2725
*/
2826

29-
contract ERC20Base is ContractMetadata, Multicall, Ownable, ERC20Permit, IMintableERC20, IBurnableERC20 {
27+
contract ERC20Base is ContractMetadata, Multicall, Ownable, ERC20Permit {
3028
/*//////////////////////////////////////////////////////////////
3129
Constructor
3230
//////////////////////////////////////////////////////////////*/
@@ -64,22 +62,6 @@ contract ERC20Base is ContractMetadata, Multicall, Ownable, ERC20Permit, IMintab
6462
_burn(msg.sender, _amount);
6563
}
6664

67-
/**
68-
* @notice Lets an owner burn a given amount of an account's tokens.
69-
* @dev `_account` should own the `_amount` of tokens.
70-
*
71-
* @param _account The account to burn tokens from.
72-
* @param _amount The number of tokens to burn.
73-
*/
74-
function burnFrom(address _account, uint256 _amount) external virtual override {
75-
require(_canBurn(), "Not authorized to burn.");
76-
require(balanceOf(_account) >= _amount, "not enough balance");
77-
uint256 decreasedAllowance = allowance(_account, msg.sender) - _amount;
78-
_approve(_account, msg.sender, 0);
79-
_approve(_account, msg.sender, decreasedAllowance);
80-
_burn(_account, _amount);
81-
}
82-
8365
/*//////////////////////////////////////////////////////////////
8466
Internal (overrideable) functions
8567
//////////////////////////////////////////////////////////////*/
@@ -94,11 +76,6 @@ contract ERC20Base is ContractMetadata, Multicall, Ownable, ERC20Permit, IMintab
9476
return msg.sender == owner();
9577
}
9678

97-
/// @dev Returns whether tokens can be burned in the given execution context.
98-
function _canBurn() internal view virtual returns (bool) {
99-
return msg.sender == owner();
100-
}
101-
10279
/// @dev Returns whether owner can be set in the given execution context.
10380
function _canSetOwner() internal view virtual override returns (bool) {
10481
return msg.sender == owner();

contracts/base/ERC20Drop.sol

+1-23
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import "../extension/Multicall.sol";
1010
import "../extension/Ownable.sol";
1111
import "../extension/PrimarySale.sol";
1212
import "../extension/DropSinglePhase.sol";
13-
import "../extension/interface/IBurnableERC20.sol";
1413

1514
import "../lib/CurrencyTransferLib.sol";
1615

@@ -34,7 +33,7 @@ import "../lib/CurrencyTransferLib.sol";
3433
*
3534
*/
3635

37-
contract ERC20Drop is ContractMetadata, Multicall, Ownable, ERC20Permit, PrimarySale, DropSinglePhase, IBurnableERC20 {
36+
contract ERC20Drop is ContractMetadata, Multicall, Ownable, ERC20Permit, PrimarySale, DropSinglePhase {
3837
/*//////////////////////////////////////////////////////////////
3938
Constructor
4039
//////////////////////////////////////////////////////////////*/
@@ -63,22 +62,6 @@ contract ERC20Drop is ContractMetadata, Multicall, Ownable, ERC20Permit, Primary
6362
_burn(msg.sender, _amount);
6463
}
6564

66-
/**
67-
* @notice Lets an owner burn a given amount of an account's tokens.
68-
* @dev `_account` should own the `_amount` of tokens.
69-
*
70-
* @param _account The account to burn tokens from.
71-
* @param _amount The number of tokens to burn.
72-
*/
73-
function burnFrom(address _account, uint256 _amount) external virtual override {
74-
require(_canBurn(), "Not authorized to burn.");
75-
require(balanceOf(_account) >= _amount, "not enough balance");
76-
uint256 decreasedAllowance = allowance(_account, msg.sender) - _amount;
77-
_approve(_account, msg.sender, 0);
78-
_approve(_account, msg.sender, decreasedAllowance);
79-
_burn(_account, _amount);
80-
}
81-
8265
/*//////////////////////////////////////////////////////////////
8366
Internal (overrideable) functions
8467
//////////////////////////////////////////////////////////////*/
@@ -131,11 +114,6 @@ contract ERC20Drop is ContractMetadata, Multicall, Ownable, ERC20Permit, Primary
131114
return msg.sender == owner();
132115
}
133116

134-
/// @dev Returns whether tokens can be burned in the given execution context.
135-
function _canBurn() internal view virtual returns (bool) {
136-
return msg.sender == owner();
137-
}
138-
139117
/// @dev Returns whether owner can be set in the given execution context.
140118
function _canSetOwner() internal view virtual override returns (bool) {
141119
return msg.sender == owner();

contracts/base/ERC20Vote.sol

+1-24
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ pragma solidity ^0.8.0;
66
import "../openzeppelin-presets/token/ERC20/extensions/ERC20Votes.sol";
77

88
import "./ERC20Base.sol";
9-
import "../extension/interface/IMintableERC20.sol";
10-
import "../extension/interface/IBurnableERC20.sol";
119

1210
/**
1311
* The `ERC20Vote` smart contract implements the ERC20 standard and ERC20Votes.
@@ -26,7 +24,7 @@ import "../extension/interface/IBurnableERC20.sol";
2624
* presenting a message signed by the account.
2725
*/
2826

29-
contract ERC20Vote is ContractMetadata, Multicall, Ownable, ERC20Votes, IMintableERC20, IBurnableERC20 {
27+
contract ERC20Vote is ContractMetadata, Multicall, Ownable, ERC20Votes {
3028
/*//////////////////////////////////////////////////////////////
3129
Constructor
3230
//////////////////////////////////////////////////////////////*/
@@ -64,22 +62,6 @@ contract ERC20Vote is ContractMetadata, Multicall, Ownable, ERC20Votes, IMintabl
6462
_burn(msg.sender, _amount);
6563
}
6664

67-
/**
68-
* @notice Lets an owner burn a given amount of an account's tokens.
69-
* @dev `_account` should own the `_amount` of tokens.
70-
*
71-
* @param _account The account to burn tokens from.
72-
* @param _amount The number of tokens to burn.
73-
*/
74-
function burnFrom(address _account, uint256 _amount) external virtual override {
75-
require(_canBurn(), "Not authorized to burn.");
76-
require(balanceOf(_account) >= _amount, "not enough balance");
77-
uint256 decreasedAllowance = allowance(_account, msg.sender) - _amount;
78-
_approve(_account, msg.sender, 0);
79-
_approve(_account, msg.sender, decreasedAllowance);
80-
_burn(_account, _amount);
81-
}
82-
8365
/*//////////////////////////////////////////////////////////////
8466
Internal (overrideable) functions
8567
//////////////////////////////////////////////////////////////*/
@@ -94,11 +76,6 @@ contract ERC20Vote is ContractMetadata, Multicall, Ownable, ERC20Votes, IMintabl
9476
return msg.sender == owner();
9577
}
9678

97-
/// @dev Returns whether tokens can be burned in the given execution context.
98-
function _canBurn() internal view virtual returns (bool) {
99-
return msg.sender == owner();
100-
}
101-
10279
/// @dev Returns whether owner can be set in the given execution context.
10380
function _canSetOwner() internal view virtual override returns (bool) {
10481
return msg.sender == owner();

0 commit comments

Comments
 (0)