Skip to main content

TimeLockRecovery

Solidity implementation

TimeLockRecovery.sol (Link to full source code to be added after launch on testnet)

Designed to facilitate a time-locked recovery process for a Universal Profile.

Constructor

constructor(address _targetUP, address _nextOwnerUP, uint256 _timeLockDuration);

Sets the addresses of the UPs of the two involved parties as well as the duration of the waiting period of the time lock mechanism

Parameters

NameTypeDescription
_targetUPaddressThe address of the Universal Profile that can be recovered with this contract
_nextOwnerUPaddressThe address of the Universal Profile that is capabable of performing the recovery
_timeLockDurationuint256The duration of the time lock waiting period in seconds

Modifiers

onlyCurrentOwner

modifier onlyCurrentOwner()

Restricts access to functions so that only the current owner (targetUP) can call them.

onlyNextOwner

modifier onlyNextOwner()

Restricts access to functions so that only the next owner (nextOwnerUP) can call them.

onlyCurrentOrNextOwner

modifier onlyCurrentOrNextOwner()

Restricts access to functions so that only the current (targetUP) or next owner (nextOwnerUP) can call them.

Public Methods

getTargetUP

function getTargetUP() external view onlyCurrentOrNextOwner returns (address)

Returns

TypeDescription
addressaddress of the target UP

Retrieves the address of the targetUP

getNextOwnerUP

function getNextOwnerUP() external view onlyCurrentOrNextOwner returns (address)

Returns

TypeDescription
addressaddress of the next owner

Retrieves the address of the nextOwnerUP

getRequestTimestamp

function getRequestTimestamp() external view onlyCurrentOrNextOwner returns (address)

Returns

TypeDescription
uint256initiation timestamp, or 0 if no active request

Retrieves the timestamp when the recovery request was initiated

setTimeLockDuration

function setTimeLockDuration(uint256 _timeLockDuration) external onlyCurrentOwner

Parameters

NameTypeDescription
_timeLockDurationuint256new time lock duration in seconds

Returns

TypeDescription
addressaddress of the target UP

Allows the current owner to update the timeLockDuration

setNextOwnerController

function setNextOwnerController(address _nextOwnerController) external onlyNextOwner;

Allows the nextOwnerUP to set the controller address (nextOwnerController) that will receive permissions upon completion of the recovery.

Parameters

NameTypeDescription
_nextOwnerControlleraddressnext owner controller address

initiateRecoveryRequest

function initiateRecoveryRequest() external onlyNextOwner

Starts the time lock waiting period by setting the timestamp of the request.

blockRecoveryRequest

function blockRecoveryRequest() external onlyCurrentOwner

Resets an active recovery request by resetting the request timestamp.

completeRecoveryRequest

function completeRecoveryRequest() external onlyNextOwner

If the waiting period is over, give nextOwnerController permission to control targetUP.

Events

NextOwnerControllerSet

event NextOwnerControllerSet(
address indexed controller
);

Parameters

NameTypeDescription
controller indexedaddressaddress of the controller that was set

RecoveryInitiated

event RecoveryInitiated(
uint256 timestamp
);

Parameters

NameTypeDescription
timestampuint256timestamp of when the recovery was initiated

RecoveryBlocked

event RecoveryBlocked(
uint256 timestamp
);

Parameters

NameTypeDescription
timestampuint256timestamp of when the recovery was blocked

RecoveryCompleted

event RecoveryCompleted(
uint256 timestamp
);

Parameters

NameTypeDescription
timestampuint256timestamp of when the recovery was completed