generated from ApeWorX/project-template
-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: issue where mistakenly said
EthTester
can handle fork networks…
… [APE-1392] (#21)
- Loading branch information
Showing
8 changed files
with
74 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,37 @@ | ||
import pytest | ||
from ape_ethereum.transactions import TransactionType | ||
from ethpm_types.abi import MethodABI | ||
|
||
|
||
@pytest.mark.parametrize("type", (0, "0x0")) | ||
def test_create_transaction(polygon, type): | ||
with polygon.local.use_provider("test"): | ||
txn = polygon.create_transaction(type=type) | ||
assert txn.type == TransactionType.STATIC.value | ||
def test_gas_limit(polygon): | ||
assert polygon.config.local.gas_limit == "max" | ||
|
||
|
||
# NOTE: None because we want to show the default is DYNAMIC | ||
@pytest.mark.parametrize("tx_type", (None, 2, "0x2")) | ||
def test_create_transaction(polygon, tx_type, eth_tester_provider): | ||
tx = polygon.create_transaction(type=tx_type) | ||
assert tx.type == TransactionType.DYNAMIC.value | ||
assert tx.gas_limit == eth_tester_provider.max_gas | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"tx_type", | ||
( | ||
TransactionType.STATIC.value, | ||
TransactionType.DYNAMIC.value, | ||
), | ||
) | ||
def test_encode_transaction(tx_type, polygon, eth_tester_provider): | ||
abi = MethodABI.parse_obj( | ||
{ | ||
"type": "function", | ||
"name": "fooAndBar", | ||
"stateMutability": "nonpayable", | ||
"inputs": [], | ||
"outputs": [], | ||
} | ||
) | ||
address = "0x274b028b03A250cA03644E6c578D81f019eE1323" | ||
actual = polygon.encode_transaction(address, abi, sender=address, type=tx_type) | ||
assert actual.gas_limit == eth_tester_provider.max_gas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters