Fix guides for 5.0 (#4654)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
(cherry picked from commit e12511b53e)
This commit is contained in:
committed by
Francisco Giordano
parent
228013d232
commit
bd25a0a26f
@ -27,7 +27,7 @@ import {Time} from "../../utils/types/Time.sol";
|
||||
*
|
||||
* When using this module the derived contract must implement {_getVotingUnits} (for example, make it return
|
||||
* {ERC721-balanceOf}), and can use {_transferVotingUnits} to track a change in the distribution of those units (in the
|
||||
* previous example, it would be included in {ERC721-_beforeTokenTransfer}).
|
||||
* previous example, it would be included in {ERC721-_update}).
|
||||
*/
|
||||
abstract contract Votes is Context, EIP712, Nonces, IERC5805 {
|
||||
using Checkpoints for Checkpoints.Trace208;
|
||||
|
||||
22
contracts/mocks/docs/ERC20WithAutoMinerReward.sol
Normal file
22
contracts/mocks/docs/ERC20WithAutoMinerReward.sol
Normal file
@ -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);
|
||||
}
|
||||
}
|
||||
17
contracts/mocks/docs/MyContractOwnable.sol
Normal file
17
contracts/mocks/docs/MyContractOwnable.sol
Normal file
@ -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()!
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user