generated from ApeWorX/project-template
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
120 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,33 @@ | ||
import pytest | ||
from ape_ethereum.transactions import TransactionType | ||
from ethpm_types import MethodABI | ||
|
||
|
||
def test_gas_limit(networks): | ||
bsc = networks.bsc | ||
def test_gas_limit(bsc): | ||
assert bsc.config.local.gas_limit == "max" | ||
|
||
|
||
@pytest.mark.parametrize("type", (0, "0x0")) | ||
def test_create_transaction(networks, type): | ||
bsc = networks.bsc | ||
txn = bsc.create_transaction(type=type) | ||
assert txn.type == TransactionType.STATIC.value | ||
@pytest.mark.parametrize("type", (None, 0, "0x0")) | ||
def test_create_transaction(bsc, type, eth_tester_provider): | ||
tx = bsc.create_transaction(type=type) | ||
assert tx.type == TransactionType.STATIC.value | ||
assert tx.gas_limit == eth_tester_provider.max_gas | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"type_", | ||
(TransactionType.STATIC.value, TransactionType.DYNAMIC.value), | ||
) | ||
def test_encode_transaction(type_, bsc, eth_tester_provider): | ||
abi = MethodABI.parse_obj( | ||
{ | ||
"type": "function", | ||
"name": "fooAndBar", | ||
"stateMutability": "nonpayable", | ||
"inputs": [], | ||
"outputs": [], | ||
} | ||
) | ||
address = "0x274b028b03A250cA03644E6c578D81f019eE1323" | ||
actual = bsc.encode_transaction(address, abi, sender=address, type=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
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,6 +1,5 @@ | ||
def test_use_provider(account, provider): | ||
receipt = account.transfer(account, 100) | ||
def test_basic(account, second_account, networks, eth_tester_provider): | ||
receipt = account.transfer(second_account, 100) | ||
|
||
assert not receipt.failed | ||
assert receipt.value == 100 | ||
# Ensure uses type 0 by default. | ||
assert receipt.transaction.type == 0 |