tornado-contracts/contracts/Governance/libraries/OwnableLibrary.sol
2024-03-29 21:52:45 +00:00

29 lines
751 B
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/**
* @dev Ownable contract that wouldn't use any existing storage slots
*/
library OwnableLibrary {
struct OwnerStorage {
address owner;
}
bytes32 private constant OwnerStorageLocation = keccak256(abi.encode(uint256(keccak256("tornado.storage.owner"))));
function _getOwnerStorage() private pure returns (OwnerStorage storage pointer) {
bytes32 slot = OwnerStorageLocation;
assembly {
pointer_slot := slot
}
}
function setOwner(address _owner) internal {
_getOwnerStorage().owner = _owner;
}
function getOwner() internal view returns (address owner) {
owner = _getOwnerStorage().owner;
}
}