Skip to content

Commit

Permalink
feat: add support for Polygon Amoy (#26)
Browse files Browse the repository at this point in the history
* Add polygon amoy as a polygon network.

* Update integration test to include amoy as a network.
  • Loading branch information
derekpierre authored Mar 28, 2024
1 parent a08f6d4 commit 8d244f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions ape_polygon/ecosystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
# chain_id, network_id
"mainnet": (137, 137),
"mumbai": (80001, 80001),
"amoy": (80002, 80002),
}


class PolygonConfig(BaseEthereumConfig):
NETWORKS: ClassVar[Dict[str, Tuple[int, int]]] = NETWORKS
mainnet: NetworkConfig = create_network_config(block_time=2, required_confirmations=1)
mumbai: NetworkConfig = create_network_config(block_time=2, required_confirmations=1)
amoy: NetworkConfig = create_network_config(block_time=2, required_confirmations=1)


class Polygon(Ethereum):
Expand Down
11 changes: 7 additions & 4 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

EXPECTED_OUTPUT = """
polygon
├── mainnet
├── amoy
│ └── geth (default)
├── mumbai
├── local (default)
│ └── test (default)
├── mainnet
│ └── geth (default)
└── local (default)
└── test (default)
└── mumbai
└── geth (default)
""".strip()


Expand Down Expand Up @@ -48,6 +50,7 @@ def test_networks(runner, cli, polygon):
# Do this in case local env changed it.
polygon.mainnet.set_default_provider("geth")
polygon.mumbai.set_default_provider("geth")
polygon.amoy.set_default_provider("geth")

result = runner.invoke(cli, ["networks", "list"])
assert_rich_text(result.output, EXPECTED_OUTPUT)

0 comments on commit 8d244f9

Please sign in to comment.