Commit 92d95ea9 by github-actions

Transpile d61be46a

parent 1a80ad56
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
* `AccessControl`: removed enumerability by default for a more lightweight contract. It is now opt-in through `AccessControlEnumerable`. ([#2512](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2512)) * `AccessControl`: removed enumerability by default for a more lightweight contract. It is now opt-in through `AccessControlEnumerable`. ([#2512](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2512))
* Meta Transactions: add `ERC2771Context` and a `MinimalForwarder` for meta-transactions. ([#2508](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2508)) * Meta Transactions: add `ERC2771Context` and a `MinimalForwarder` for meta-transactions. ([#2508](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2508))
* Overall reorganisation of the contract folder to improve clarity and discoverability. ([#2503](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2503)) * Overall reorganisation of the contract folder to improve clarity and discoverability. ([#2503](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2503))
* `ERC20Capped`: optimize gas usage of by enforcing te check directly in `_mint`. ([#2524](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2524))
### How to upgrade from 3.x ### How to upgrade from 3.x
......
...@@ -33,18 +33,11 @@ abstract contract ERC20CappedUpgradeable is Initializable, ERC20Upgradeable { ...@@ -33,18 +33,11 @@ abstract contract ERC20CappedUpgradeable is Initializable, ERC20Upgradeable {
} }
/** /**
* @dev See {ERC20-_beforeTokenTransfer}. * @dev See {ERC20-_mint}.
*
* Requirements:
*
* - minted tokens must not cause the total supply to go over the cap.
*/ */
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { function _mint(address account, uint256 amount) internal virtual override {
super._beforeTokenTransfer(from, to, amount); require(ERC20Upgradeable.totalSupply() + amount <= cap(), "ERC20Capped: cap exceeded");
super._mint(account, amount);
if (from == address(0)) { // When minting tokens
require(totalSupply() + amount <= cap(), "ERC20Capped: cap exceeded");
}
} }
uint256[50] private __gap; uint256[50] private __gap;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment