Possible regresssion when fetching contract
### Environment information

* `brownie` Version: master
* `ganache-cli` Version: v6.12.2 (ganache-core: 2.13.2)
* `solc` Version: n/a
* Python Version: n/a
* OS: n/a

### What was wrong?
Running `emp = Contract("0xEAA081a9fad4607CdF046fEA7D4BF3DfEf533282")` in the console fails with:
```
  File "<console>", line 1, in <module>
  File "eth_brownie-1.13.1-py3.8.egg/brownie/network/contract.py", line 923, in __init__
    contract = self.from_explorer(address, owner=owner, silent=True)
  File "eth_brownie-1.13.1-py3.8.egg/brownie/network/contract.py", line 1177, in from_explorer
    build_json = compiler.generate_build_json(input_json, output_json)
  File "eth_brownie-1.13.1-py3.8.egg/brownie/project/compiler/__init__.py", line 313, in generate_build_json
    build_json[contract_alias] = solidity._get_unique_build_json(
  File "eth_brownie-1.13.1-py3.8.egg/brownie/project/compiler/solidity.py", line 260, in _get_unique_build_json
    pc_map, statement_map, branch_map = _generate_coverage_data(
  File "eth_brownie-1.13.1-py3.8.egg/brownie/project/compiler/solidity.py", line 353, in _generate_coverage_data
    pc_list.append({"op": opcodes.popleft(), "pc": pc})
IndexError: pop from an empty deque
```

Older versions of brownie 1.11.8 get:
```
>>> emp = Contract.from_explorer("0xEAA081a9fad4607CdF046fEA7D4BF3DfEf533282")
Fetching source of 0xEAA081a9fad4607CdF046fEA7D4BF3DfEf533282 from api.etherscan.io...
  File "<console>", line 1, in <module>
  File "brownie/network/contract.py", line 770, in from_explorer
    build_json = compiler.generate_build_json(input_json, output_json)
  File "brownie/project/compiler/__init__.py", line 309, in generate_build_json
    build_json[contract_name] = solidity._get_unique_build_json(
  File "brownie/project/compiler/solidity.py", line 246, in _get_unique_build_json
    pc_map, statement_map, branch_map = _generate_coverage_data(
  File "brownie/project/compiler/solidity.py", line 349, in _generate_coverage_data
    pc += int(pc_list[-1]["op"][4:])
ValueError: invalid literal for int() with base 10: 'AK256'
```


diff --git a/brownie/network/contract.py b/brownie/network/contract.py
index 174f6b1e..72f9737e 100644
--- a/brownie/network/contract.py
+++ b/brownie/network/contract.py
@@ -1100,9 +1100,9 @@ class Contract(_DeployedContractBase):
             # always check for an EIP1822 proxy - https://eips.ethereum.org/EIPS/eip-1822
             implementation_eip1822 = web3.eth.getStorageAt(address, web3.keccak(text="PROXIABLE"))
             if len(implementation_eip1967) > 0 and int(implementation_eip1967.hex(), 16):
-                as_proxy_for = _resolve_address(implementation_eip1967[12:])
+                as_proxy_for = _resolve_address(implementation_eip1967[-20:])
             elif len(implementation_eip1822) > 0 and int(implementation_eip1822.hex(), 16):
-                as_proxy_for = _resolve_address(implementation_eip1822[12:])
+                as_proxy_for = _resolve_address(implementation_eip1822[-20:])
             elif data["result"][0].get("Implementation"):
                 # for other proxy patterns, we only check if etherscan indicates
                 # the contract is a proxy. otherwise we could have a false positive
diff --git a/brownie/project/compiler/solidity.py b/brownie/project/compiler/solidity.py
index 32bbf46f..9e4524d3 100644
--- a/brownie/project/compiler/solidity.py
+++ b/brownie/project/compiler/solidity.py
@@ -347,6 +347,12 @@ def _generate_coverage_data(
     active_fn_name: Optional[str] = None
     first_source = source_map[0]
 
+    while source_map and source_map[-1][2] == -1:
+        # trim the end of the source map where there are no contracts associated
+        # this is required because sometimes the source map is too long
+        # likely a side effect of the YUL optimizer ¯\\_(ツ)_/¯
+        source_map.pop()
+
     while source_map:
         # format of source_map is [start, stop, contract_id, jump code]
         source = source_map.popleft()
['brownie/project/compiler/solidity.py', 'brownie/network/contract.py']