-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
this._instance = contract.instance; | ||
return this._instance; | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation aligns with what we have in the others in ~/contracts
now - previously it actually didn't work at all.
@@ -101,4 +101,17 @@ export default class Registry { | |||
return address; | |||
}); | |||
} | |||
|
|||
lookupMeta (_name, key) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it make sense to now use this lookupMeta
method in lookupAddress
instead of having twice the same code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had it that way around initially since it is 99.9% shared. Not sure why it was reverted, will take a re-look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see why... one calls get
the other getAddress
on the underlying contract. (We don't have Uint in yet, haven't used it at this point in time)
So the options would be to pass the name, key as well as the relevant contract method to some helper to call the contract or to duplicate for code clarity.
I opted for the latter approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes good call. Well I guess that's fine, it small enough. Could have a
getLookupParams (_name, key) {
const name = _name.toLowerCase();
const sha3 = this._api.util.sha3.text(name);
return [sha3, key];
}
method though
contracts/Registry
to havelookupMeta
(interface to contractget
) methodcontracts/GithubHint
to retrieve instance properly & addgetEntry
to retrieve a specific entry(Split from https://github.com/ethcore/parity/pull/4178)