better protect user funds by backup owner
This commit is contained in:
parent
b45c2967ce
commit
c4e6a396e8
|
@ -131,7 +131,7 @@ contract ENSSubdomainRegistry is Controlled {
|
||||||
require(account.creationTime + releaseDelay >= block.timestamp);
|
require(account.creationTime + releaseDelay >= block.timestamp);
|
||||||
ens.setSubnodeOwner(_domainHash, _userHash, address(this));
|
ens.setSubnodeOwner(_domainHash, _userHash, address(this));
|
||||||
ens.setResolver(subdomainHash, address(0));
|
ens.setResolver(subdomainHash, address(0));
|
||||||
ens.setSubnodeOwner(_domainHash, _userHash, address(0));
|
ens.setOwner(subdomainHash, address(0));
|
||||||
} else {
|
} else {
|
||||||
require(msg.sender == account.backupOwner);
|
require(msg.sender == account.backupOwner);
|
||||||
}
|
}
|
||||||
|
@ -204,10 +204,17 @@ contract ENSSubdomainRegistry is Controlled {
|
||||||
* @notice updates backup owner useful in case of opt-out domain move to new registry.
|
* @notice updates backup owner useful in case of opt-out domain move to new registry.
|
||||||
* @param _subdomainHash hash of the subdomain regarding this
|
* @param _subdomainHash hash of the subdomain regarding this
|
||||||
**/
|
**/
|
||||||
function updateBackupOwner(bytes32 _subdomainHash) external {
|
function updateBackupOwner(
|
||||||
require(accounts[_subdomainHash].creationTime > 0);
|
bytes32 _userHash,
|
||||||
require(msg.sender == ens.owner(_subdomainHash));
|
bytes32 _domainHash
|
||||||
accounts[_subdomainHash].backupOwner = msg.sender;
|
)
|
||||||
|
external
|
||||||
|
{
|
||||||
|
bytes32 subdomainHash = keccak256(_domainHash, _userHash);
|
||||||
|
require(accounts[subdomainHash].creationTime > 0);
|
||||||
|
require(msg.sender == ens.owner(subdomainHash));
|
||||||
|
require(ens.owner(_domainHash) == address(this));
|
||||||
|
accounts[subdomainHash].backupOwner = msg.sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -239,7 +246,7 @@ contract ENSSubdomainRegistry is Controlled {
|
||||||
require(ens.owner(_domainHash) == address(_newRegistry));
|
require(ens.owner(_domainHash) == address(_newRegistry));
|
||||||
require(address(this) == _newRegistry.parentRegistry());
|
require(address(this) == _newRegistry.parentRegistry());
|
||||||
bytes32 subdomainHash = keccak256(_domainHash, _userHash);
|
bytes32 subdomainHash = keccak256(_domainHash, _userHash);
|
||||||
require(msg.sender == ens.owner(subdomainHash));
|
require(msg.sender == accounts[subdomainHash].backupOwner);
|
||||||
Account memory account = accounts[subdomainHash];
|
Account memory account = accounts[subdomainHash];
|
||||||
delete accounts[subdomainHash];
|
delete accounts[subdomainHash];
|
||||||
token.approve(_newRegistry, account.tokenBalance);
|
token.approve(_newRegistry, account.tokenBalance);
|
||||||
|
|
Loading…
Reference in New Issue