Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

Refactor predeployed contract wrapper classes #414

3 changes: 2 additions & 1 deletion starknet_devnet/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@

from starknet_devnet.account_util import set_balance
from starknet_devnet.contract_class_wrapper import ContractClassWrapper
from starknet_devnet.predeployed_contract_wrapper import PredeployedContractWrapper


class Account:
class Account(PredeployedContractWrapper):
"""Account contract wrapper."""

# pylint: disable=too-many-arguments
Expand Down
3 changes: 2 additions & 1 deletion starknet_devnet/fee_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
from starknet_devnet.account_util import get_execute_args
from starknet_devnet.chargeable_account import ChargeableAccount
from starknet_devnet.constants import SUPPORTED_TX_VERSION
from starknet_devnet.predeployed_contract_wrapper import PredeployedContractWrapper
from starknet_devnet.sequencer_api_utils import InternalInvokeFunction
from starknet_devnet.util import Uint256, str_to_felt


class FeeToken:
class FeeToken(PredeployedContractWrapper):
"""Wrapper of token for charging fees."""

CONTRACT_CLASS: ContractClass = None # loaded lazily
Expand Down
9 changes: 9 additions & 0 deletions starknet_devnet/predeployed_contract_wrapper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Parent for predeployed contract wrapper classes"""


class PredeployedContractWrapper:
"""Parent class for all predeployed contract wrapper classes"""

async def deploy(self):
bigherc18 marked this conversation as resolved.
Show resolved Hide resolved
"""Deploy the contract wrapper to devnet"""
raise NotImplementedError()
4 changes: 3 additions & 1 deletion starknet_devnet/udc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
from starkware.starknet.services.api.contract_class import ContractClass
from starkware.starknet.testing.starknet import Starknet

from starknet_devnet.predeployed_contract_wrapper import PredeployedContractWrapper

class UDC:

class UDC(PredeployedContractWrapper):
"""Universal deployer contract wrapper class"""

CONTRACT_CLASS: ContractClass = None # loaded lazily
Expand Down