|
@@ -27,17 +27,10 @@ abstract contract ERC20Capped is ERC20 {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @dev See {ERC20-_beforeTokenTransfer}.
|
|
|
- *
|
|
|
- * Requirements:
|
|
|
- *
|
|
|
- * - minted tokens must not cause the total supply to go over the cap.
|
|
|
+ * @dev See {ERC20-_mint}.
|
|
|
*/
|
|
|
- function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
|
|
|
- super._beforeTokenTransfer(from, to, amount);
|
|
|
-
|
|
|
- if (from == address(0)) { // When minting tokens
|
|
|
- require(totalSupply() + amount <= cap(), "ERC20Capped: cap exceeded");
|
|
|
- }
|
|
|
+ function _mint(address account, uint256 amount) internal virtual override {
|
|
|
+ require(ERC20.totalSupply() + amount <= cap(), "ERC20Capped: cap exceeded");
|
|
|
+ super._mint(account, amount);
|
|
|
}
|
|
|
}
|