Skip to content

Commit

Permalink
Merge branch 'main' into feat/extra-msg
Browse files Browse the repository at this point in the history
  • Loading branch information
NotPeopling2day authored Aug 12, 2023
2 parents 0e7724a + faeaeb7 commit 0459e34
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 21 deletions.
16 changes: 9 additions & 7 deletions src/ape_ethereum/ecosystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,15 @@ def get_proxy_info(self, address: AddressType) -> Optional[ProxyInfo]:
return None

patterns = {
ProxyType.Minimal: r"363d3d373d3d3d363d73(.{40})5af43d82803e903d91602b57fd5bf3",
ProxyType.Vyper: r"366000600037611000600036600073(.{40})5af4602c57600080fd5b6110006000f3", # noqa: E501
ProxyType.Clones: r"36603057343d52307f830d2d700a97af574b186c80d40429385d24241565b08a7c559ba283a964d9b160203da23d3df35b3d3d3d3d363d3d37363d73(.{40})5af43d3d93803e605b57fd5bf3", # noqa: E501
ProxyType.ZeroAge: r"3d3d3d3d363d3d37363d73(.{40})5af43d3d93803e602a57fd5bf3",
ProxyType.SoladyPush0: r"5f5f365f5f37365f73(.{40})5af43d5f5f3e6029573d5ffd5b3d5ff3",
ProxyType.ClonesWithImmutableArgs: r"3d3d3d3d363d3d3761007f603736393661007f013d73(.{40})5af43d3d93803e603557fd5bf3.*", # noqa: E501
ProxyType.Create2ClonesWithImmutableArgs: r"3d3d3d3d363d3d376100476037363936610047013d73(.{40})5af43d3d93803e603557fd5bf3.*", # noqa: E501
ProxyType.Minimal: r"^363d3d373d3d3d363d73(.{40})5af43d82803e903d91602b57fd5bf3",
ProxyType.ZeroAge: r"^3d3d3d3d363d3d37363d73(.{40})5af43d3d93803e602a57fd5bf3",
ProxyType.Clones: r"^36603057343d52307f830d2d700a97af574b186c80d40429385d24241565b08a7c559ba283a964d9b160203da23d3df35b3d3d3d3d363d3d37363d73(.{40})5af43d3d93803e605b57fd5bf3", # noqa: E501
ProxyType.Vyper: r"^366000600037611000600036600073(.{40})5af4602c57600080fd5b6110006000f3", # noqa: E501
ProxyType.VyperBeta: r"^366000600037611000600036600073(.{40})5af41558576110006000f3",
ProxyType.CWIA: r"^3d3d3d3d363d3d3761.{4}603736393661.{4}013d73(.{40})5af43d3d93803e603557fd5bf3.*", # noqa: E501
ProxyType.SudoswapCWIA: r"^3d3d3d3d363d3d37605160353639366051013d73(.{40})5af43d3d93803e603357fd5bf3.*", # noqa: E501
ProxyType.SoladyCWIA: r"36602c57343d527f9e4ac34f21c619cefc926c8bd93b54bf5a39c7ab2127a895af1cc0691d7e3dff593da1005b363d3d373d3d3d3d61.{4}806062363936013d73(.{40})5af43d3d93803e606057fd5bf3.*", # noqa: E501
ProxyType.SoladyPush0: r"^5f5f365f5f37365f73(.{40})5af43d5f5f3e6029573d5ffd5b3d5ff3",
}
for type, pattern in patterns.items():
match = re.match(pattern, code)
Expand Down
55 changes: 41 additions & 14 deletions src/ape_ethereum/proxies.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from enum import IntEnum
from enum import IntEnum, auto

from ethpm_types import ContractType
from lazyasd import LazyObject # type: ignore
Expand All @@ -13,19 +13,46 @@


class ProxyType(IntEnum):
Minimal = 0 # eip-1167 minimal proxy contract
Standard = 1 # eip-1967 standard proxy storage slots
Beacon = 2 # eip-1967 beacon proxy
UUPS = 3 # # eip-1822 universal upgradeable proxy standard
Vyper = 4 # vyper <0.2.9 create_forwarder_to
Clones = 5 # 0xsplits clones
GnosisSafe = 6
OpenZeppelin = 7 # openzeppelin upgradeability proxy
Delegate = 8 # eip-897 delegate proxy
ZeroAge = 9 # a more-minimal proxy
SoladyPush0 = 10 # solady push0 minimal proxy
ClonesWithImmutableArgs = 11 # https://github.com/wighawag/clones-with-immutable-args/blob/master/src/ClonesWithImmutableArgs.sol # noqa: E501
Create2ClonesWithImmutableArgs = 12 # https://github.com/emo-eth/create2-clones-with-immutable-args/blob/main/src/Create2ClonesWithImmutableArgs.sol # noqa: E501
# https://eips.ethereum.org/EIPS/eip-1167
Minimal = auto() # eip-1167 minimal proxy contract

# https://eips.ethereum.org/EIPS/eip-1967
Standard = auto() # eip-1967 standard proxy storage slots
Beacon = auto() # eip-1967 beacon proxy

# https://eips.ethereum.org/EIPS/eip-1822
UUPS = auto() # # eip-1822 universal upgradeable proxy standard

# https://github.com/vyperlang/vyper/blob/v0.2.8/vyper/functions/functions.py#L1428
Vyper = auto() # vyper <0.2.9 create_forwarder_to
# https://github.com/vyperlang/vyper/blob/v0.1.0-beta.4/vyper/functions/functions.py#L633
VyperBeta = auto() # vyper 0.1-beta

# https://github.com/0xSplits/splits-contracts/blob/main/contracts/libraries/Clones.sol
Clones = auto() # 0xsplits clones

# https://github.com/safe-global/safe-contracts/blob/main/contracts/proxies/SafeProxy.sol
GnosisSafe = auto()

# https://github.com/OpenZeppelin/openzeppelin-labs/blob/master/initializer_contracts/contracts/UpgradeabilityProxy.sol
OpenZeppelin = auto() # openzeppelin upgradeability proxy

# https://eips.ethereum.org/EIPS/eip-897
Delegate = auto() # eip-897 delegate proxy

# https://medium.com/coinmonks/the-more-minimal-proxy-5756ae08ee48
ZeroAge = auto() # a more-minimal proxy

# https://github.com/wighawag/clones-with-immutable-args/blob/master/src/ClonesWithImmutableArgs.sol
# https://github.com/emo-eth/create2-clones-with-immutable-args/blob/main/src/Create2ClonesWithImmutableArgs.sol
CWIA = auto() # clones with immutable args

# https://github.com/Vectorized/solady/blob/main/src/utils/LibClone.sol
SoladyPush0 = auto() # solady push0 minimal proxy
SoladyCWIA = auto() # clones with immutable args with a receive method

# https://github.com/sudoswap/lssvm2/blob/main/src/lib/LSSVMPairCloner.sol
SudoswapCWIA = auto() # a variant used in sudoswap


class ProxyInfo(ProxyInfoAPI):
Expand Down

0 comments on commit 0459e34

Please sign in to comment.