From 8bf2e394c6364a206dd2915070b109ced22986f9 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Thu, 27 Aug 2020 20:43:52 -0400 Subject: [PATCH] fix: update contract address on ropsten and use label instead of namehash --- src/app/profile/views/ens_manager.nim | 2 +- src/status/ens.nim | 8 +++++++- src/status/libstatus/contracts.nim | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/app/profile/views/ens_manager.nim b/src/app/profile/views/ens_manager.nim index 03d6298fbd..a429c02ef0 100644 --- a/src/app/profile/views/ens_manager.nim +++ b/src/app/profile/views/ens_manager.nim @@ -148,7 +148,7 @@ QtObject: proc registerENS(self: EnsManager, username: string, password: string) {.slot.} = let pubKey = status_settings.getSetting[string](Setting.PublicKey, "0x0") let address = parseAddress(status_wallet.getWalletAccounts()[0].address) - discard registerUsername(username & status_ens.domain, address, pubKey, password) + discard registerUsername(username, address, pubKey, password) self.connect(username, true) proc setPubKey(self: EnsManager, username: string, password: string) {.slot.} = diff --git a/src/status/ens.nim b/src/status/ens.nim index 5159d96a6d..b6e1300fea 100644 --- a/src/status/ens.nim +++ b/src/status/ens.nim @@ -36,6 +36,11 @@ proc userNameOrAlias*(contact: Profile, removeSuffix: bool = false): string = else: result = contact.alias +proc label*(username:string): string = + let name = username.toLower() + var node:array[32, byte] = keccak_256.digest(username).data + result = "0x" & node.toHex() + proc namehash*(ensName:string): string = let name = ensName.toLower() var node:array[32, byte] @@ -137,8 +142,9 @@ proc extractCoordinates*(pubkey: string):tuple[x: string, y:string] = result = ("0x" & pubkey[4..67], "0x" & pubkey[68..131]) proc registerUsername*(username:string, address: EthAddress, pubKey: string, password: string): string = + echo username, "................." let - label = fromHex(FixedBytes[32], namehash(addDomain(username))) + label = fromHex(FixedBytes[32], label(username)) coordinates = extractCoordinates(pubkey) x = fromHex(FixedBytes[32], coordinates.x) y = fromHex(FixedBytes[32], coordinates.y) diff --git a/src/status/libstatus/contracts.nim b/src/status/libstatus/contracts.nim index f82788f0de..6d94c258ca 100644 --- a/src/status/libstatus/contracts.nim +++ b/src/status/libstatus/contracts.nim @@ -96,7 +96,7 @@ proc allContracts(): seq[Contract] = @[ ("getPrice", Method(signature: "getPrice()")) ].toTable ), - Contract(name: "ens-usernames", network: Network.Testnet, address: parseAddress("0x11d9F481effd20D76cEE832559bd9Aca25405841"), + Contract(name: "ens-usernames", network: Network.Testnet, address: parseAddress("0x76fbf2815ead80006d07a64c1fd5dc9964ab3c93"), methods: [ ("register", Method(signature: "register(bytes32,address,bytes32,bytes32)")), ("getPrice", Method(signature: "getPrice()"))