-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Implement ERC165 compliant version of ERC20. - Update the NFTSpecChecker and tests.
- Loading branch information
Showing
6 changed files
with
46 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.19; | ||
|
||
import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; | ||
import '../../../token/openzeppelin/ERC20/extensions/ERC20_165.sol'; | ||
|
||
/** | ||
* @title MockERC20 | ||
* @title MockERC20_165 | ||
* @author @NFTCulture | ||
*/ | ||
contract MockERC20 is ERC20 { | ||
uint256 private immutable TOTAL_SUPPLY; | ||
contract MockERC20_165 is ERC20_165 { | ||
uint256 private immutable _maxSupply; | ||
|
||
constructor() ERC20('MockERC20', 'M20') { | ||
TOTAL_SUPPLY = 1000000000; | ||
constructor() ERC20('MockERC20_165', 'M20') { | ||
_maxSupply = 1000000000; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
contracts/token/openzeppelin/ERC20/extensions/ERC20_165.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.19; | ||
|
||
import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; | ||
import '@openzeppelin/contracts/utils/introspection/ERC165.sol'; | ||
|
||
/** | ||
* @title ERC20_165 | ||
* @author @NiftyMike | @NFTCulture | ||
* @dev ERC20 with ERC165 support tacked on, for consistency with more modern ERC specs. | ||
*/ | ||
abstract contract ERC20_165 is ERC20, ERC165 { | ||
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { | ||
return | ||
interfaceId == type(IERC20).interfaceId || | ||
interfaceId == type(IERC20Metadata).interfaceId || | ||
super.supportsInterface(interfaceId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters