Skip to content

Commit

Permalink
chore: more upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Dec 13, 2023
1 parent e0e9c96 commit af21203
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 29 deletions.
9 changes: 6 additions & 3 deletions ape_foundry/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from ape.utils import cached_property
from ape_ethereum.provider import Web3Provider
from ape_test import Config as TestConfig
from eth_pydantic_types import HexBytes
from eth_pydantic_types import HashBytes32, HexBytes
from eth_typing import HexStr
from eth_utils import add_0x_prefix, is_0x_prefixed, is_hex, to_hex
from evm_trace import CallType, ParityTraceList
Expand All @@ -59,7 +59,6 @@
from ape_foundry.constants import EVM_VERSION_BY_NETWORK

from .exceptions import FoundryNotInstalledError, FoundryProviderError, FoundrySubprocessError
from .utils import to_bytes32

EPHEMERAL_PORTS_START = 49152
EPHEMERAL_PORTS_END = 60999
Expand Down Expand Up @@ -784,7 +783,11 @@ def set_code(self, address: AddressType, code: ContractCode) -> bool:
def set_storage(self, address: AddressType, slot: int, value: HexBytes):
self._make_request(
"anvil_setStorageAt",
[address, to_bytes32(slot).hex(), to_bytes32(value).hex()],
[
address,
HashBytes32.__eth_pydantic_validate__(slot).hex(),
HashBytes32.__eth_pydantic_validate__(value).hex(),
],
)

def _eth_call(self, arguments: List) -> HexBytes:
Expand Down
24 changes: 0 additions & 24 deletions ape_foundry/utils.py

This file was deleted.

4 changes: 2 additions & 2 deletions tests/test_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ def test_set_code(connected_provider, contract_container, owner):

def test_set_storage(connected_provider, contract_container, owner):
contract = contract_container.deploy(sender=owner)
assert to_int(connected_provider.get_storage_at(contract.address, "0x2b5e3af16b1880000")) == 0
assert to_int(connected_provider.get_storage(contract.address, "0x2b5e3af16b1880000")) == 0
connected_provider.set_storage(contract.address, "0x2b5e3af16b1880000", "0x1")
assert to_int(connected_provider.get_storage_at(contract.address, "0x2b5e3af16b1880000")) == 1
assert to_int(connected_provider.get_storage(contract.address, "0x2b5e3af16b1880000")) == 1


def test_return_value(connected_provider, contract_instance, owner):
Expand Down

0 comments on commit af21203

Please sign in to comment.