From 043156cc56dc1fb1cddb0b716081bb0c22019b39 Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Thu, 6 Sep 2018 16:38:24 -0300 Subject: [PATCH] prevent moveAccount to self contract. --- contracts/registry/UsernameRegistrar.sol | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contracts/registry/UsernameRegistrar.sol b/contracts/registry/UsernameRegistrar.sol index 43709cf..c67701d 100644 --- a/contracts/registry/UsernameRegistrar.sol +++ b/contracts/registry/UsernameRegistrar.sol @@ -241,7 +241,7 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack { } /** - * @notice Migrate account to new registry. + * @notice Migrate account to new registry, opt-in to new contract. * @param _label Username hash. **/ function moveAccount( @@ -249,6 +249,7 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack { ) external { + require(state == RegistrarState.Moved, "Wrong contract state"); require(msg.sender == accounts[_label].owner, "Callable only by account owner."); UsernameRegistrar _newRegistry = UsernameRegistrar(ensRegistry.owner(ensNode)); Account memory account = accounts[_label];