unshETH - Dependencies

Owned.sol

This is a solidity contract named 'Owned'. The contract is designed to manage ownership of a contract. It allows the current owner of the contract to nominate a new owner. Once the new owner is nominated, they must accept the ownership to become the new owner.

Owned

A contract that manages ownership. It has functions to nominate and accept ownership.

nominateNewOwner

nominateNewOwner(address _owner)

Nominates a new owner for the contract. Only the current owner can nominate a new owner.

Parameters

  • _owner address: The address of the new owner.

Errors

  • Only the contract owner may perform this action: Thrown if the caller is not the current owner.

acceptOwnership

acceptOwnership()

Accepts ownership of the contract. Only the nominated owner can accept ownership.

Errors

  • You must be nominated before you can accept ownership: Thrown if the caller is not the nominated owner.

Examples

Nominate and Accept Ownership

This example shows how to nominate and accept ownership.

// The contract must be deployed first.
// Use the address of the deployed contract to create a new instance.
Owned owned = Owned(deployed_address);

// The current owner nominates a new owner.
owned.nominateNewOwner(new_owner_address);

// The new owner accepts the ownership.
owned.acceptOwnership();
Previous
Math-II.sol