Using Ownable Contract In Openzeppelin Solidity

[Solved] Using Ownable Contract In Openzeppelin Solidity | Solidity - Code Explorer | yomemimo.com
Question : using Ownable contract in openzeppelin solidity

Answered by : shirshak

// contracts/Box.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Import Ownable from the OpenZeppelin Contracts library
import "@openzeppelin/contracts/access/Ownable.sol";
// Make Box inherit from the Ownable contract
contract Box is Ownable { uint256 private _value; event ValueChanged(uint256 value); // The onlyOwner modifier restricts who can call the store function function store(uint256 value) public onlyOwner { _value = value; emit ValueChanged(value); } function retrieve() public view returns (uint256) { return _value; }
}

Source : https://docs.openzeppelin.com/learn/developing-smart-contracts | Last Update : Tue, 27 Sep 22

Answers related to using ownable contract in openzeppelin solidity

Code Explorer Popular Question For Solidity