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
@ -9,24 +9,9 @@ The most common and basic form of access control is the concept of _ownership_:
|
||||
|
||||
OpenZeppelin Contracts provides xref:api:access.adoc#Ownable[`Ownable`] for implementing ownership in your contracts.
|
||||
|
||||
[source,solidity]
|
||||
----
|
||||
// contracts/MyContract.sol
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
|
||||
|
||||
contract MyContract is Ownable {
|
||||
function normalThing() public {
|
||||
// anyone can call this normalThing()
|
||||
}
|
||||
|
||||
function specialThing() public onlyOwner {
|
||||
// only the owner can call specialThing()!
|
||||
}
|
||||
}
|
||||
----
|
||||
```solidity
|
||||
include::api:example$MyContractOwnable.sol[]
|
||||
```
|
||||
|
||||
By default, the xref:api:access.adoc#Ownable-owner--[`owner`] of an `Ownable` contract is the account that deployed it, which is usually exactly what you want.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user