Skip to content

Commit

Permalink
Merge pull request #748 from eth-brownie/feat-interface-selectors
Browse files Browse the repository at this point in the history
Interface selectors
  • Loading branch information
iamdefinitelyahuman authored Sep 11, 2020
2 parents 96bdb32 + 199c12d commit b45643a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions brownie/network/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@ class InterfaceConstructor:
def __init__(self, name: str, abi: List) -> None:
self._name = name
self.abi = abi
self.selectors = {
build_function_selector(i): i["name"] for i in self.abi if i["type"] == "function"
}

def __call__(self, address: str, owner: Optional[AccountsType] = None) -> "Contract":
return Contract.from_abi(self._name, address, self.abi, owner)
Expand Down
2 changes: 1 addition & 1 deletion brownie/project/compiler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def get_abi(
continue
name = Path(path).stem
final_output[name] = {
"abi": output_json["contracts"][path][name],
"abi": output_json["contracts"][path][name]["abi"],
"contractName": name,
"type": "interface",
"sha1": sha1(contract_sources[path].encode()).hexdigest(),
Expand Down

0 comments on commit b45643a

Please sign in to comment.