API Version: v1.5.1

CCIP v1.5.1 Ownable2Step Contract API Reference

Ownable2Step

A minimal contract that implements 2-step ownership transfer and nothing more. It's made to be minimal to reduce the impact of the bytecode size on any contract that inherits from it.

Git Source

Events

OwnershipTransferRequested

event OwnershipTransferRequested(address indexed from, address indexed to);

Parameters

NameTypeDescription
fromaddressCurrent owner initiating the transfer
toaddressProposed new owner

OwnershipTransferred

event OwnershipTransferred(address indexed from, address indexed to);

Parameters

NameTypeDescription
fromaddressPrevious owner
toaddressNew owner

Errors

CannotTransferToSelf

error CannotTransferToSelf();

MustBeProposedOwner

error MustBeProposedOwner();

OnlyCallableByOwner

error OnlyCallableByOwner();

OwnerCannotBeZero

error OwnerCannotBeZero();

State Variables

s_owner

The owner is the current owner of the contract.

address private s_owner;

s_pendingOwner

The pending owner is the address to which ownership may be transferred.

address private s_pendingOwner;

Functions

acceptOwnership

Allows an ownership transfer to be completed by the recipient.

function acceptOwnership() external override;

constructor

Initializes the contract with an owner and optionally a pending owner.

constructor(address newOwner, address pendingOwner);

Parameters

NameTypeDescription
newOwneraddressThe initial owner of the contract
pendingOwneraddressOptional address to initiate ownership transfer to

onlyOwner

Modifier that restricts function access to the contract owner.

modifier onlyOwner();

owner

Returns the current owner's address.

function owner() public view override returns (address);

Returns

TypeDescription
addressThe address of the current owner

transferOwnership

Allows an owner to begin transferring ownership to a new address.

function transferOwnership(address to) public override onlyOwner;

Parameters

NameTypeDescription
toaddressThe address to which ownership will be transferred

_validateOwnership

Internal function to validate access control.

function _validateOwnership() internal view;

Get the latest Chainlink content straight to your inbox.