This pull request adds the initialize function for EIP-6551 as described in the guidelines. The initialize function can be called by the owner after ownership change to set the currOwner and prevOwner variables. Additionally, the unlockCircularLock function is introduced to handle situations of circular lock, allowing the previous owner to unlock it.
Changes
Added Functions
initialize(uint256 tokenId) external: Initializes the currOwner and prevOwner variables after ownership change.
unlockCircularLock(uint256 tokenId) external: Allows the previous owner to unlock the circular lock situation by calling this function.
Modifications
Modified the ERC6551Account contract to include the new variables currOwner and prevOwner.
Tests
Added comprehensive tests to cover the new functionalities, including the initialize and unlockCircularLock functions.
Motivation
This enhancement is in line with the objectives of EIP-6551 and provides additional functionalities for handling ownership transitions and circular lock scenarios.
Usage
After ownership change, the new owner can call the initialize function to set the current owner (currOwner) and previous owner (prevOwner) variables.
In cases of circular lock, the previous owner can use the unlockCircularLock function to release the lock.
Issues
The initialize function could only be used to change previousOwner. and this value could only be used for account recovery. however if new owner of Token transfer it to another owner without initialization, the previousOwner is not changed, hence the recovery can be done by third last owner and he can call it without any restriction, which could be malicious.
Checklist
[ ] Code follows the EIP-6551 guidelines.
[ ] Added appropriate tests for the new functionalities.
[ ] Documentation has been updated to reflect the changes.
Description
This pull request adds the
initialize
function for EIP-6551 as described in the guidelines. Theinitialize
function can be called by the owner after ownership change to set thecurrOwner
andprevOwner
variables. Additionally, theunlockCircularLock
function is introduced to handle situations of circular lock, allowing the previous owner to unlock it.Changes
Added Functions
initialize(uint256 tokenId) external
: Initializes thecurrOwner
andprevOwner
variables after ownership change.unlockCircularLock(uint256 tokenId) external
: Allows the previous owner to unlock the circular lock situation by calling this function.Modifications
ERC6551Account
contract to include the new variablescurrOwner
andprevOwner
.Tests
initialize
andunlockCircularLock
functions.Motivation
This enhancement is in line with the objectives of EIP-6551 and provides additional functionalities for handling ownership transitions and circular lock scenarios.
Usage
After ownership change, the new owner can call the
initialize
function to set the current owner (currOwner
) and previous owner (prevOwner
) variables.In cases of circular lock, the previous owner can use the
unlockCircularLock
function to release the lock.Issues
The
initialize
function could only be used to changepreviousOwner
. and this value could only be used for account recovery. however if new owner of Token transfer it to another owner without initialization, thepreviousOwner
is not changed, hence the recovery can be done by third last owner and he can call it without any restriction, which could be malicious.Checklist