Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ethpy/ethpy/base/retry_utils_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Test executing transactions."""
"""Test retry utils."""
import logging
import time

Expand Down
38 changes: 38 additions & 0 deletions lib/ethpy/ethpy/base/transactions_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""Test executing transactions."""
import pytest
from fixedpointmath import FixedPoint

from agent0.hyperdrive.interactive import InteractiveHyperdrive, LocalChain
from ethpy.base.transactions import smart_contract_transact


@pytest.mark.anvil
def test_smart_contract_transact_success(chain: LocalChain):
"""Transact with a known correct function."""
interactive_hyperdrive = InteractiveHyperdrive(chain)
alice = interactive_hyperdrive.init_agent(base=FixedPoint(100), name="alice")
_deployed_hyperdrive = interactive_hyperdrive._deployed_hyperdrive # pylint: disable=protected-access
smart_contract_transact(
chain._web3, # pylint: disable=protected-access
_deployed_hyperdrive.base_token_contract,
_deployed_hyperdrive.deploy_account,
"mint(address,uint256)",
alice.agent.checksum_address,
FixedPoint(100).scaled_value,
)


@pytest.mark.anvil
def test_smart_contract_transact_failure(chain: LocalChain):
"""Transact with a known incorrect function name."""
interactive_hyperdrive = InteractiveHyperdrive(chain)
alice = interactive_hyperdrive.init_agent(base=FixedPoint(100), name="alice")
_deployed_hyperdrive = interactive_hyperdrive._deployed_hyperdrive # pylint: disable=protected-access
smart_contract_transact(
chain._web3, # pylint: disable=protected-access
_deployed_hyperdrive.base_token_contract,
_deployed_hyperdrive.deploy_account,
"mintx(address,uint256)",
alice.agent.checksum_address,
FixedPoint(100).scaled_value,
)