* switch to using Context internally
* add context import
* Add smoke test to make sure enabling GSN support works
* Update test/GSN/ERC721GSNRecipientMock.test.js
Co-Authored-By: Francisco Giordano <frangio.1@gmail.com>
* Upgrade truffle
* add missing awaits
* Revert "Upgrade truffle"
This reverts commit f9b0ba9019.
80 lines
2.3 KiB
Solidity
80 lines
2.3 KiB
Solidity
pragma solidity ^0.5.2;
|
|
|
|
import "@openzeppelin/upgrades/contracts/Initializable.sol";
|
|
|
|
import "../GSN/Context.sol";
|
|
|
|
/**
|
|
* @title Ownable
|
|
* @dev The Ownable contract has an owner address, and provides basic authorization control
|
|
* functions, this simplifies the implementation of "user permissions".
|
|
*/
|
|
contract Ownable is Initializable, Context {
|
|
address private _owner;
|
|
|
|
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
|
|
|
|
/**
|
|
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
|
|
* account.
|
|
*/
|
|
function initialize(address sender) public initializer {
|
|
_owner = sender;
|
|
emit OwnershipTransferred(address(0), _owner);
|
|
}
|
|
|
|
/**
|
|
* @return the address of the owner.
|
|
*/
|
|
function owner() public view returns (address) {
|
|
return _owner;
|
|
}
|
|
|
|
/**
|
|
* @dev Throws if called by any account other than the owner.
|
|
*/
|
|
modifier onlyOwner() {
|
|
require(isOwner());
|
|
_;
|
|
}
|
|
|
|
/**
|
|
* @return true if `msg.sender` is the owner of the contract.
|
|
*/
|
|
function isOwner() public view returns (bool) {
|
|
return _msgSender() == _owner;
|
|
}
|
|
|
|
/**
|
|
* @dev Allows the current owner to relinquish control of the contract.
|
|
* It will not be possible to call the functions with the `onlyOwner`
|
|
* modifier anymore.
|
|
* @notice Renouncing ownership will leave the contract without an owner,
|
|
* thereby removing any functionality that is only available to the owner.
|
|
*/
|
|
function renounceOwnership() public onlyOwner {
|
|
emit OwnershipTransferred(_owner, address(0));
|
|
_owner = address(0);
|
|
}
|
|
|
|
/**
|
|
* @dev Allows the current owner to transfer control of the contract to a newOwner.
|
|
* @param newOwner The address to transfer ownership to.
|
|
*/
|
|
function transferOwnership(address newOwner) public onlyOwner {
|
|
_transferOwnership(newOwner);
|
|
}
|
|
|
|
/**
|
|
* @dev Transfers control of the contract to a newOwner.
|
|
* @param newOwner The address to transfer ownership to.
|
|
*/
|
|
function _transferOwnership(address newOwner) internal {
|
|
require(newOwner != address(0));
|
|
emit OwnershipTransferred(_owner, newOwner);
|
|
_owner = newOwner;
|
|
}
|
|
|
|
uint256[50] private ______gap;
|
|
}
|