Преглед на файлове

Fix unbounded recursion in ERC20WithAutoMinerReward example

Francisco Giordano преди 4 години
родител
ревизия
a51e181e3b
променени са 1 файла, в които са добавени 3 реда и са изтрити 1 реда
  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);
     }
 }