forked from OpenZeppelin/openzeppelin-contracts
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix guides for 5.0 (OpenZeppelin#4654)
Co-authored-by: Ernesto García <[email protected]>
- Loading branch information
1 parent
655bd58
commit e12511b
Showing
7 changed files
with
50 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.20; | ||
|
||
import {ERC20} from "../../token/ERC20/ERC20.sol"; | ||
|
||
contract ERC20WithAutoMinerReward is ERC20 { | ||
constructor() ERC20("Reward", "RWD") { | ||
_mintMinerReward(); | ||
} | ||
|
||
function _mintMinerReward() internal { | ||
_mint(block.coinbase, 1000); | ||
} | ||
|
||
function _update(address from, address to, uint256 value) internal virtual override { | ||
if (!(from == address(0) && to == block.coinbase)) { | ||
_mintMinerReward(); | ||
} | ||
super._update(from, to, value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.20; | ||
|
||
import {Ownable} from "../../access/Ownable.sol"; | ||
|
||
contract MyContract is Ownable { | ||
constructor(address initialOwner) Ownable(initialOwner) {} | ||
|
||
function normalThing() public { | ||
// anyone can call this normalThing() | ||
} | ||
|
||
function specialThing() public onlyOwner { | ||
// only the owner can call specialThing()! | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters