OpenZeppelin / OpenZeppelin/openzeppelin-contracts
Feature Request: Introduce Time Lock Mechanism in Ownable2Step Contract
Nobody has claimed this yet.
- Dominant language
- Solidity
- Stars
- 27.2k
- Forks
- 12.4k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 33
Description
🧐 Motivation
The current Ownable2Step contract in Solidity provides a robust framework for ownership management with a two-step transfer process. However, there's an opportunity to enhance its security by integrating a Time Lock mechanism for ownership transfer which will work as an extension of current Ownable2Step implementation. This feature is motivated by the need to prevent rapid, potentially malicious ownership changes and to allow ample time for verification and intervention if needed. Adding a time lock would provide a safer, more controlled environment for ownership transitions, especially critical in scenarios where the contract controls significant assets or functionalities.
📝 Details
The proposed feature involves extending the Ownable2Step contract to include a time lock functionality for ownership transfers. When the current owner initiates a transfer, the new owner will only be able to claim ownership after a predefined time period has elapsed. This delay period should be configurable and could be set during contract deployment or through a separate owner-only function.
Key aspects to consider:
- Implementation of a time delay variable to store the duration of the lock period.
- Modification of the transferOwnership function to record the timestamp when the transfer is initiated.
- Adjustment of the acceptOwnership function to check if the time lock period has passed before allowing the transfer to
complete. - Addition of events to log when the time lock starts and ends.
Possible Use Cases
- In DAOs or governance contracts, to prevent abrupt changes in leadership or policies.
- In any contract where ownership change can significantly impact users or stakeholders, ensuring a time buffer for due diligence,
community input, or oversight by a regulatory body. - In situations where an ownership transfer is large and complex, requiring time for proper handover and transition.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing Ownable2Step implementation and its transferOwnership and acceptOwnership entry points. Clarify the configurable delay, how it is set, and the required lock-start and lock-end events; the work is done when the ownership flow enforces the delay and records the transition lifecycle.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- solidity
- Domain
- blockchain, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100