Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/core/token/ERC20Core.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {ModularCoreUpgradeable} from "../../ModularCoreUpgradeable.sol";
import {ERC20} from "@solady/tokens/ERC20.sol";
import {Multicallable} from "@solady/utils/Multicallable.sol";

import {IERC20} from "../../interface/IERC20.sol";

import {BeforeMintCallbackERC20} from "../../callback/BeforeMintCallbackERC20.sol";
import {BeforeBurnCallbackERC20} from "../../callback/BeforeBurnCallbackERC20.sol";
import {BeforeApproveCallbackERC20} from "../../callback/BeforeApproveCallbackERC20.sol";
Expand Down Expand Up @@ -105,6 +107,11 @@ contract ERC20Core is ERC20, ModularCoreUpgradeable, Multicallable {
});
}

/// @notice Returns whether a given interface is implemented by the contract.
function supportsInterface(bytes4 interfaceID) public view override returns (bool) {
return interfaceID == type(IERC20).interfaceId || super.supportsInterface(interfaceID);
}

/*//////////////////////////////////////////////////////////////
EXTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
Expand Down
7 changes: 7 additions & 0 deletions src/core/token/ERC20CoreInitializable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {ModularCoreUpgradeable} from "../../ModularCoreUpgradeable.sol";
import {ERC20} from "@solady/tokens/ERC20.sol";
import {Multicallable} from "@solady/utils/Multicallable.sol";

import {IERC20} from "../../interface/IERC20.sol";

import {BeforeMintCallbackERC20} from "../../callback/BeforeMintCallbackERC20.sol";
import {BeforeBurnCallbackERC20} from "../../callback/BeforeBurnCallbackERC20.sol";
import {BeforeApproveCallbackERC20} from "../../callback/BeforeApproveCallbackERC20.sol";
Expand Down Expand Up @@ -110,6 +112,11 @@ contract ERC20CoreInitializable is ERC20, ModularCoreUpgradeable, Multicallable,
});
}

/// @notice Returns whether a given interface is implemented by the contract.
function supportsInterface(bytes4 interfaceID) public view override returns (bool) {
return interfaceID == type(IERC20).interfaceId || super.supportsInterface(interfaceID);
}

/*//////////////////////////////////////////////////////////////
EXTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
Expand Down
19 changes: 19 additions & 0 deletions src/interface/IERC20.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.23;

interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);

function totalSupply() external view returns (uint256);

function balanceOf(address account) external view returns (uint256);

function transfer(address to, uint256 value) external returns (bool);

function allowance(address owner, address spender) external view returns (uint256);

function approve(address spender, uint256 value) external returns (bool);

function transferFrom(address from, address to, uint256 value) external returns (bool);
}