Smart Account Reference
Owners
swapOwner

swapOwner

Replaces the owner oldOwner in the Safe with newOwner.

⚠️

This action can only be done via a Safe transaction.

Usage


_17
interface ISafe {
_17
function swapOwner(
_17
address prevOwner,
_17
address oldOwner,
_17
address newOwner
_17
) external;
_17
}
_17
_17
contract Example {
_17
function example() … {
_17
(ISafe safe).swapOwner(
_17
0x...,
_17
0x...,
_17
0x...
_17
);
_17
}
_17
}

Parameters

prevOwner

  • Type: address

Owner address that is pointing to the owner to be removed in the contract linked list (opens in a new tab).

A linked list is a data structure that allows efficient insertion and removal of elements in a list. Each element in it will point to the next one. In Safe contracts, the owners are stored in a linked list.


_10
(ISafe safe).swapOwner(
_10
0x...,
_10
0x...,
_10
0x...
_10
);

oldOwner

  • Type: address

Owner address to be replaced.


_10
(ISafe safe).swapOwner(
_10
0x...,
_10
0x...,
_10
0x...
_10
);

newOwner

  • Type: address

New owner address.


_10
(ISafe safe).swapOwner(
_10
0x...,
_10
0x...,
_10
0x...
_10
);

Events

AddedOwner


_10
event AddedOwner(address owner);

Emitted when an owner is added to the Safe.

RemovedOwner


_10
event RemovedOwner(address owner);

Emitted when an owner is removed from the Safe.

Was this page helpful?