From ac252e2a83b63f3370fde58b349ecbe7d92d4766 Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Thu, 17 May 2018 10:54:49 -0300 Subject: [PATCH] simplify move account + get creation time view --- contracts/registry/ENSSubdomainRegistry.sol | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/contracts/registry/ENSSubdomainRegistry.sol b/contracts/registry/ENSSubdomainRegistry.sol index ef6e594..2d9ef55 100644 --- a/contracts/registry/ENSSubdomainRegistry.sol +++ b/contracts/registry/ENSSubdomainRegistry.sol @@ -170,23 +170,21 @@ contract ENSSubdomainRegistry is Controlled { /** * @notice Migrate account to new registry - * @param _newRegistry new registry address * @param _userHash `msg.sender` owned subdomain hash * @param _domainHash choosen contract owned domain hash **/ function moveAccount( - ENSSubdomainRegistry _newRegistry, bytes32 _userHash, bytes32 _domainHash ) external { - require(ens.owner(_domainHash) == address(_newRegistry)); - require(address(this) == _newRegistry.parentRegistry()); bytes32 subdomainHash = keccak256(_domainHash, _userHash); require(msg.sender == accounts[subdomainHash].fundsOwner); + ENSSubdomainRegistry _newRegistry = ENSSubdomainRegistry(ens.owner(_domainHash)); Account memory account = accounts[subdomainHash]; delete accounts[subdomainHash]; + require(address(this) == _newRegistry.parentRegistry()); token.approve(_newRegistry, account.tokenBalance); _newRegistry.migrateAccount(_userHash, _domainHash, account.tokenBalance, account.creationTime, account.fundsOwner); } @@ -324,5 +322,13 @@ contract ENSSubdomainRegistry is Controlled { { fundsOwner = accounts[_subdomainHash].fundsOwner; } + + function getCreationTime(bytes32 _subdomainHash) + external + view + returns(uint256 creationTime) + { + creationTime = accounts[_subdomainHash].creationTime; + } } \ No newline at end of file