TimeLockRecovery
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
| Name | Type | Description |
|---|---|---|
_targetUP | address | The address of the Universal Profile that can be recovered with this contract |
_nextOwnerUP | address | The address of the Universal Profile that is capabable of performing the recovery |
_timeLockDuration | uint256 | The 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
| Type | Description |
|---|---|
address | address of the target UP |
Retrieves the address of the targetUP
getNextOwnerUP
function getNextOwnerUP() external view onlyCurrentOrNextOwner returns (address)
Returns
| Type | Description |
|---|---|
address | address of the next owner |
Retrieves the address of the nextOwnerUP
getRequestTimestamp
function getRequestTimestamp() external view onlyCurrentOrNextOwner returns (address)
Returns
| Type | Description |
|---|---|
uint256 | initiation timestamp, or 0 if no active request |
Retrieves the timestamp when the recovery request was initiated
setTimeLockDuration
function setTimeLockDuration(uint256 _timeLockDuration) external onlyCurrentOwner
Parameters
| Name | Type | Description |
|---|---|---|
_timeLockDuration | uint256 | new time lock duration in seconds |
Returns
| Type | Description |
|---|---|
address | address 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
| Name | Type | Description |
|---|---|---|
_nextOwnerController | address | next 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
| Name | Type | Description |
|---|---|---|
controller indexed | address | address of the controller that was set |
RecoveryInitiated
event RecoveryInitiated(
uint256 timestamp
);
Parameters
| Name | Type | Description |
|---|---|---|
timestamp | uint256 | timestamp of when the recovery was initiated |
RecoveryBlocked
event RecoveryBlocked(
uint256 timestamp
);
Parameters
| Name | Type | Description |
|---|---|---|
timestamp | uint256 | timestamp of when the recovery was blocked |
RecoveryCompleted
event RecoveryCompleted(
uint256 timestamp
);
Parameters
| Name | Type | Description |
|---|---|---|
timestamp | uint256 | timestamp of when the recovery was completed |