Explorar o código

Fix unbounded recursion in ERC20WithAutoMinerReward example

Francisco Giordano %!s(int64=4) %!d(string=hai) anos
pai
achega
a51e181e3b
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      docs/modules/ROOT/pages/erc20-supply.adoc

+ 3 - 1
docs/modules/ROOT/pages/erc20-supply.adoc

@@ -99,7 +99,9 @@ contract ERC20WithAutoMinerReward is ERC20 {
     }
 
     function _beforeTokenTransfer(address from, address to, uint256 value) internal virtual override {
-        _mintMinerReward();
+        if (!(from == address(0) && to == block.coinbase)) {
+          _mintMinerReward();
+        }
         super._beforeTokenTransfer(from, to, value);
     }
 }