require caller to know new registry address
This commit is contained in:
parent
95f3e53081
commit
c4686a9c39
|
@ -275,13 +275,14 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
|
|||
* @param _label Username hash.
|
||||
**/
|
||||
function moveAccount(
|
||||
bytes32 _label
|
||||
bytes32 _label,
|
||||
UsernameRegistrar _newRegistry
|
||||
)
|
||||
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));
|
||||
require(ensRegistry.owner(ensNode) == address(_newRegistry), "Wrong update");
|
||||
Account memory account = accounts[_label];
|
||||
delete accounts[_label];
|
||||
|
||||
|
|
|
@ -964,7 +964,7 @@ contract('UsernameRegistrar', function () {
|
|||
});
|
||||
});
|
||||
|
||||
describe('moveAccount(label)', function() {
|
||||
describe('moveAccount(label,address)', function() {
|
||||
it('should move username to new registry by account owner', async () => {
|
||||
const registrant = accountsArr[5];
|
||||
const username = 'erin';
|
||||
|
@ -978,7 +978,7 @@ contract('UsernameRegistrar', function () {
|
|||
const creationTime = await UsernameRegistrar.methods.getCreationTime(label).call();
|
||||
assert.notEqual(creationTime, 0);
|
||||
assert.equal(await UpdatedUsernameRegistrar.methods.getCreationTime(label).call(), 0);
|
||||
const result = await UsernameRegistrar.methods.moveAccount(label).send({from: registrant});
|
||||
const result = await UsernameRegistrar.methods.moveAccount(label, UpdatedUsernameRegistrar.address).send({from: registrant});
|
||||
assert.equal(await UsernameRegistrar.methods.getCreationTime(label).call(), 0);
|
||||
assert.equal(await UpdatedUsernameRegistrar.methods.getCreationTime(label).call(), creationTime);
|
||||
assert.equal(await TestToken.methods.balanceOf(UsernameRegistrar.address).call(), (+initialRegistryBalance)-(+accountBalance))
|
||||
|
|
Loading…
Reference in New Issue