Owned.sol (663B)
1 pragma solidity ^0.8.0; 2 3 contract Owned { 4 address public owner; 5 address newOwner; 6 7 constructor() public { 8 owner = msg.sender; 9 } 10 11 function transferOwnership(address _newOwner) public returns (bool) { 12 require(owner == msg.sender); 13 newOwner = _newOwner; 14 return true; 15 } 16 17 function acceptOwnership() public returns (bool) { 18 require(newOwner == msg.sender); 19 owner = msg.sender; 20 newOwner = address(0); 21 return true; 22 } 23 24 function takeOwnership(address _ownable) public returns (bool) { 25 bool ok; 26 bytes memory result; 27 28 (ok, result) = _ownable.call(abi.encodeWithSignature("acceptOwnership()")); 29 require(ok, "ERR_ACCEPT"); 30 return true; 31 } 32 }