LSDVault - Dependencies
Owned.sol
This is a Solidity contract named 'Owned'. The contract is used to manage the ownership of a contract. It provides features like changing the owner, nominating a new owner, and accepting ownership. The contract uses events to emit changes in the owner and nomination of a new owner.
The Owned contract establishes an owner for a contract, allows for ownership to be transferred, and for a new owner to be nominated and accept ownership.
function nominateNewOwner(address _owner) external onlyOwner
This method is used to nominate a new owner for the contract. The method can only be called by the current owner.
- _owner
address
: The address of the nominated new owner.
function acceptOwnership() external
This method is used by the nominated owner to accept the ownership of the contract.
- You must be nominated before you can accept ownership: This error is thrown if the method is called by any address that is not the nominated owner.
This modifier is used to restrict function access to the current owner only.
- Only the contract owner may perform this action: This error is thrown if the method decorated with this modifier is called by any address that is not the current owner.
An event that is emitted when a new owner is nominated.
An event that is emitted when the ownership of the contract changes.
Example of how to nominate a new owner and accept ownership
// Assuming existingContract is an instance of Owned contract
// Nominate new owner
existingContract.nominateNewOwner(newOwnerAddress);
// Accept ownership from the nominated address
existingContract.acceptOwnership({from: newOwnerAddress});