Пример #1
0
def get_factory(factory_addr: str) -> Contract:
    """Retrieve the EscrowFactory contract from a given address.

    >>> credentials = {
    ... 	"gas_payer": "0x1413862C2B7054CDbfdc181B83962CB0FC11fD92",
    ... 	"gas_payer_priv": "28e516f1e2f99e96a48a23cea1f94ee5f073403a1c68e818263f0eb898f1c8e5"
    ... }
    >>> job = Job(credentials=credentials, escrow_manifest=manifest)
    >>> type(get_factory(job.factory_contract.address))
    <class 'web3._utils.datatypes.Contract'>

    Args:
        factory_addr (str): the ethereum address of the Escrow contract.

    Returns:
        Contract: returns the EscrowFactory solidity contract.

    """
    w3 = get_w3()
    contract_interface = get_contract_interface(
        "{}/EscrowFactory.sol:EscrowFactory".format(CONTRACT_FOLDER))
    escrow_factory = w3.eth.contract(
        address=ChecksumAddress(HexAddress(HexStr(factory_addr))),
        abi=contract_interface["abi"],
    )
    return escrow_factory
Пример #2
0
def build_etherscan_manifest(uri: URI, package_name: str,
                             version: str) -> Iterable[Tuple[str, Any]]:
    address, chain_id = parse.urlparse(uri).netloc.split(":")
    network = get_etherscan_network(chain_id)
    body = make_etherscan_request(address, network)
    contract_type = body["ContractName"]
    w3 = setup_w3(to_int(text=chain_id))
    block_uri = create_latest_block_uri(w3)
    runtime_bytecode = to_hex(
        w3.eth.getCode(ChecksumAddress(HexAddress(HexStr(address)))))

    yield "package_name", package_name
    yield "version", version
    yield "manifest_version", "2"
    yield "sources", {f"./{contract_type}.sol": body["SourceCode"]}
    yield "contract_types", {
        contract_type: {
            "abi": json.loads(body["ABI"]),
            "runtime_bytecode": {
                "bytecode": runtime_bytecode
            },
            "compiler": generate_compiler_info(body),
        }
    }
    yield "deployments", {
        block_uri: {
            contract_type: {
                "contract_type": contract_type,
                "address": address
            }
        }
    }
Пример #3
0
def get_escrow(escrow_addr: str) -> Contract:
    """Retrieve the Escrow contract from a given address.

    >>> credentials = {
    ... 	"gas_payer": "0x1413862C2B7054CDbfdc181B83962CB0FC11fD92",
    ... 	"gas_payer_priv": "28e516f1e2f99e96a48a23cea1f94ee5f073403a1c68e818263f0eb898f1c8e5"
    ... }
    >>> rep_oracle_pub_key = b"2dbc2c2c86052702e7c219339514b2e8bd4687ba1236c478ad41b43330b08488c12c8c1797aa181f3a4596a1bd8a0c18344ea44d6655f61fa73e56e743f79e0d"
    >>> job = Job(credentials=credentials, escrow_manifest=manifest)

    Deploying a new Job to the ethereum network succeeds.

    >>> job.launch(rep_oracle_pub_key)
    True
    >>> type(get_escrow(job.job_contract.address))
    <class 'web3._utils.datatypes.Contract'>

    Args:
        escrow_addr (str): an ethereum address of the escrow contract.

    Returns:
        Contract: returns the Escrow solidity contract.

    """

    w3 = get_w3()
    contract_interface = get_contract_interface(
        "{}/Escrow.sol:Escrow".format(CONTRACT_FOLDER))
    escrow = w3.eth.contract(
        address=ChecksumAddress(HexAddress(HexStr(escrow_addr))),
        abi=contract_interface["abi"],
    )
    return escrow
Пример #4
0
def test_verify_existent_deployment_with_wrong_code(
        token_network_registry_contract: Contract) -> None:
    """ Test verify_deployed_contracts_in_filesystem() with an existent deployment data

    but with a fake web3 that does not return the correct code.
    """
    web3_mock = Mock()
    web3_mock.version.network = 42
    web3_mock.eth.getTransactionReceipt = lambda _: {
        "blockNumber": 10711807,
        "gasUsed": 555366,
        "contractAddress": "0x8Ff327f7ed03cD6Bd5e611E9e404B47d8c9Db81E",
    }
    verifier = ContractVerifier(web3=web3_mock, contracts_version="0.11.1")
    # The Mock returns a wrong block number, so the comparison fails.
    with pytest.raises(RuntimeError):
        verifier.verify_deployed_contracts_in_filesystem()
    with pytest.raises(RuntimeError):
        verifier.verify_deployed_service_contracts_in_filesystem(
            token_address=HexAddress(
                "0x3Aa761BcDB064179a1e37748D8A5F577a177Be5c"),
            user_deposit_whole_balance_limit=2**256 - 1,
            token_network_registry_address=token_network_registry_contract.
            address,
        )
Пример #5
0
 def _get_user_identity(address: ChecksumAddress) -> ChecksumEthAddress:
     """Given an address (signer) returns its protocol user identity.
     """
     return generate_address_via_create2(
         address=HexAddress(HexStr(IDENTITY_FACTORY_ADDR)),
         salt=HexStr(CREATE2_SALT),
         init_code=HexStr(
             IDENTITY_PROXY_INIT_CODE.format(signer_address=address)),
     )
Пример #6
0
    def test_solidityKeccak_ens(
        self, web3: "Web3", types: Sequence[TypeStr], values: Sequence[str], expected: HexBytes
    ) -> None:
        with ens_addresses(web3, {
            'one.eth': ChecksumAddress(
                HexAddress(HexStr("0x49EdDD3769c0712032808D86597B84ac5c2F5614"))
            ),
            'two.eth': ChecksumAddress(
                HexAddress(HexStr("0xA6b759bBbf4B59D24acf7E06e79f3a5D104fdCE5"))
            ),
        }):
            # when called as class method, any name lookup attempt will fail
            with pytest.raises(InvalidAddress):
                Web3.solidityKeccak(types, values)

            # when called as instance method, ens lookups can succeed
            actual = web3.solidityKeccak(types, values)
            assert actual == expected
Пример #7
0
def test_linking() -> None:
    unlinked_bytecode = "73__$34600480520cb524a2c423e33a5b4dd437$__63"
    lib_address = HexAddress(
        HexStr("0x1111111111111111111111111111111111111111"))
    linked_bytecode = link_bytecode(unlinked_bytecode,
                                    LIBRARY_TOKEN_NETWORK_UTILS_LINK_KEY,
                                    lib_address)

    assert linked_bytecode == "73111111111111111111111111111111111111111163"
Пример #8
0
    def test_eth_getBalance(self, web3: "Web3") -> None:
        coinbase = web3.eth.coinbase

        with pytest.raises(InvalidAddress):
            web3.eth.getBalance(ChecksumAddress(HexAddress(HexStr(coinbase.lower()))))

        balance = web3.eth.getBalance(coinbase)

        assert is_integer(balance)
        assert balance >= 0
Пример #9
0
def deserialize_ethereum_address(symbol: str) -> ChecksumEthAddress:
    """This is identical to string_to_ethereum_address()

    TODO:
    But it's wrong. We should differentiate between those two functions.
    That one should only be used for typing purposes while this one here
    should be used to properly deserialize and check that symbol is indeed
    an ethereum address and is always checksummed. So also external input sanitization.
    https://github.com/rotki/rotki/issues/2334
    """
    return ChecksumEthAddress(HexAddress(HexStr(symbol)))
Пример #10
0
def to_checksum_address(value: AnyStr) -> ChecksumAddress:
    """
    Makes a checksum address given a supported format.
    """
    norm_address = to_normalized_address(value)
    address_hash = encode_hex(
        keccak(text=remove_0x_prefix(HexStr(norm_address))))

    checksum_address = add_0x_prefix(
        HexStr("".join((norm_address[i].upper(
        ) if int(address_hash[i], 16) > 7 else norm_address[i])
                       for i in range(2, 42))))
    return ChecksumAddress(HexAddress(checksum_address))
Пример #11
0
def test_generate_address_via_create2(
    address,
    salt,
    init_code,
    expected_contract_address,
):
    """Test the CREATE2 opcode Python implementation.
    """
    contract_address = generate_address_via_create2(
        address=HexAddress(address),
        salt=HexStr(salt),
        init_code=HexStr(init_code),
    )
    assert contract_address == to_checksum_address(expected_contract_address)
Пример #12
0
def to_normalized_address(value: AnyStr) -> HexAddress:
    """
    Converts an address to its normalized hexadecimal representation.
    """
    try:
        hex_address = hexstr_if_str(to_hex, value).lower()
    except AttributeError:
        raise TypeError("Value must be any string, instead got type {}".format(
            type(value)))
    if is_address(hex_address):  #is_address(hex_address):
        return HexAddress(hex_address)
    else:
        raise ValueError(
            "Unknown format {}, attempted to normalize to {}".format(
                value, hex_address))
Пример #13
0
def test_verify_existent_deployment():
    """ Test verify_deployed_contracts_in_filesystem() with an existent deployment data

    but with a fake web3 that returns a wrong block number for deployment.
    """
    web3_mock = Mock()
    web3_mock.version.network = 42
    web3_mock.eth.getTransactionReceipt = lambda _: {"blockNumber": 0}
    verifier = ContractVerifier(web3=web3_mock, contracts_version="0.11.1")
    # The Mock returns a wrong block number, so the comparison fails.
    with pytest.raises(RuntimeError):
        verifier.verify_deployed_contracts_in_filesystem()
    with pytest.raises(RuntimeError):
        verifier.verify_deployed_service_contracts_in_filesystem(
            token_address=HexAddress(
                "0x3Aa761BcDB064179a1e37748D8A5F577a177Be5c"),
            user_deposit_whole_balance_limit=2**256 - 1,
        )
def test_verify_existent_deployment(token_network_registry_contract: Contract) -> None:
    """Test verify_deployed_contracts_in_filesystem() with an existent deployment data

    but with a fake web3 that returns a wrong block number for deployment.
    """
    web3_mock = Mock()
    web3_mock.version.network = 5
    web3_mock.eth.get_transaction_receipt = lambda _: {"blockNumber": 0}
    verifier = ContractVerifier(web3=web3_mock, contracts_version=ALDERAAN_VERSION)
    # The Mock returns a wrong block number, so the comparison fails.
    with pytest.raises(RuntimeError):
        verifier.verify_deployed_contracts_in_filesystem()
    with pytest.raises(RuntimeError):
        verifier.verify_deployed_service_contracts_in_filesystem(
            token_address=HexAddress(HexStr("0x5Fc523e13fBAc2140F056AD7A96De2cC0C4Cc63A")),
            user_deposit_whole_balance_limit=2**256 - 1,
            token_network_registry_address=token_network_registry_contract.address,
        )
def test_verify_existent_deployment_with_wrong_code(
    token_network_registry_contract: Contract,
) -> None:
    """Test verify_deployed_contracts_in_filesystem() with an existent deployment data

    but with a fake web3 that does not return the correct code.
    """
    web3_mock = Mock()
    web3_mock.version.network = 5
    web3_mock.eth.get_transaction_receipt = lambda _: {
        "blockNumber": 10711807,
        "gasUsed": 555366,
        "contractAddress": "0x8Ff327f7ed03cD6Bd5e611E9e404B47d8c9Db81E",
    }
    verifier = ContractVerifier(web3=web3_mock, contracts_version=ALDERAAN_VERSION)
    # The Mock returns a wrong block number, so the comparison fails.
    with pytest.raises(RuntimeError):
        verifier.verify_deployed_contracts_in_filesystem()
    with pytest.raises(RuntimeError):
        verifier.verify_deployed_service_contracts_in_filesystem(
            token_address=HexAddress(HexStr("0x5Fc523e13fBAc2140F056AD7A96De2cC0C4Cc63A")),
            user_deposit_whole_balance_limit=2**256 - 1,
            token_network_registry_address=token_network_registry_contract.address,
        )
Пример #16
0
def string_to_ethereum_address(value: str) -> ChecksumEthAddress:
    """This is a conversion without any checks of a string to ethereum address

    Is only used for typing.
    """
    return ChecksumEthAddress(HexAddress(HexStr(value)))
Пример #17
0
LIBRARY_TOKEN_NETWORK_UTILS_LINK_KEY = "data/source/lib/TokenNetworkUtils.sol:TokenNetworkUtils"

# Timeouts
TEST_SETTLE_TIMEOUT_MIN = 5
TEST_SETTLE_TIMEOUT_MAX = 100000

DEPLOY_SETTLE_TIMEOUT_MIN = 500  # ~ 2 hours
DEPLOY_SETTLE_TIMEOUT_MAX = 555428  # ~ 3 months

# Temporary deposit limits for the Red Eyes release in WEI
MAX_ETH_CHANNEL_PARTICIPANT = int(0.075 * 10 ** 18)
MAX_ETH_TOKEN_NETWORK = int(250 * 10 ** 18)

# Special hashes
LOCKSROOT_OF_NO_LOCKS = Locksroot(keccak(b""))
EMPTY_ADDRESS = ChecksumAddress(HexAddress(HexStr("0x0000000000000000000000000000000000000000")))

# Event names
# TokenNetworkRegistry
EVENT_TOKEN_NETWORK_CREATED = "TokenNetworkCreated"

# TokenNetwork
EVENT_DEPRECATION_SWITCH = "DeprecationSwitch"

# SecretRegistry
EVENT_SECRET_REVEALED = "SecretRevealed"

# EndpointRegistry
EVENT_ADDRESS_REGISTERED = "AddressRegistered"

# ServiceRegistry
Пример #18
0
CONTRACT_DEPOSIT = "Deposit"

# Timeouts
TEST_SETTLE_TIMEOUT_MIN = 5
TEST_SETTLE_TIMEOUT_MAX = 100000

DEPLOY_SETTLE_TIMEOUT_MIN = 500  # ~ 2 hours
DEPLOY_SETTLE_TIMEOUT_MAX = 555428  # ~ 3 months

# Temporary deposit limits for the Red Eyes release in WEI
MAX_ETH_CHANNEL_PARTICIPANT = int(0.075 * 10**18)
MAX_ETH_TOKEN_NETWORK = int(250 * 10**18)

# Special hashes
LOCKSROOT_OF_NO_LOCKS = keccak(b"")
EMPTY_ADDRESS = HexAddress("0x0000000000000000000000000000000000000000")

# Event names
# TokenNetworkRegistry
EVENT_TOKEN_NETWORK_CREATED = "TokenNetworkCreated"

# TokenNetwork
EVENT_DEPRECATION_SWITCH = "DeprecationSwitch"

# SecretRegistry
EVENT_SECRET_REVEALED = "SecretRevealed"

# EndpointRegistry
EVENT_ADDRESS_REGISTERED = "AddressRegistered"

# ServiceRegistry
Пример #19
0
from eth_typing import (
    HexAddress,
    HexStr,
)
from hexbytes import (
    HexBytes, )

ACCEPTABLE_STALE_HOURS = 48

AUCTION_START_GAS_CONSTANT = 25000
AUCTION_START_GAS_MARGINAL = 39000

EMPTY_SHA3_BYTES = HexBytes(b'\0' * 32)
EMPTY_ADDR_HEX = HexAddress(HexStr('0x' + '00' * 20))

REVERSE_REGISTRAR_DOMAIN = 'addr.reverse'
Пример #20
0
from web3.exceptions import (
    BlockNotFound,
    InvalidAddress,
    TransactionNotFound,
)
from web3.types import (  # noqa: F401
    BlockData,
    FilterParams,
    LogReceipt,
    Nonce,
    SyncStatus,
    TxParams,
    Wei,
)

UNKNOWN_ADDRESS = ChecksumAddress(HexAddress(HexStr('0xdEADBEeF00000000000000000000000000000000')))
UNKNOWN_HASH = HexStr('0xdeadbeef00000000000000000000000000000000000000000000000000000000')

if TYPE_CHECKING:
    from web3 import Web3  # noqa: F401
    from web3.contract import Contract  # noqa: F401


class EthModuleTest:
    def test_eth_protocolVersion(self, web3: "Web3") -> None:
        protocol_version = web3.eth.protocolVersion

        assert is_string(protocol_version)
        assert protocol_version.isdigit()

    def test_eth_syncing(self, web3: "Web3") -> None:
Пример #21
0
    normal_name_to_hash,
    normalize_name,
    raw_name_to_hash,
)

if TYPE_CHECKING:
    from web3 import Web3  # noqa: F401
    from web3.contract import (  # noqa: F401
        Contract, )
    from web3.providers import (  # noqa: F401
        BaseProvider, )
    from web3.types import (  # noqa: F401
        TxParams, )

ENS_MAINNET_ADDR = ChecksumAddress(
    HexAddress(HexStr('0x314159265dD8dbb310642f98f50C066173C1259b')))


class ENS:
    """
    Quick access to common Ethereum Name Service functions,
    like getting the address for a name.

    Unless otherwise specified, all addresses are assumed to be a `str` in
    `checksum format <https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md>`_,
    like: ``"0x314159265dD8dbb310642f98f50C066173C1259b"``
    """

    labelhash = staticmethod(label_to_hash)
    namehash = staticmethod(raw_name_to_hash)
    nameprep = staticmethod(normalize_name)
Пример #22
0
from eth_typing import (
    ChecksumAddress,
    HexAddress,
    HexStr,
)
from hexbytes import (
    HexBytes, )

ACCEPTABLE_STALE_HOURS = 48

AUCTION_START_GAS_CONSTANT = 25000
AUCTION_START_GAS_MARGINAL = 39000

EMPTY_SHA3_BYTES = HexBytes(b'\0' * 32)
EMPTY_ADDR_HEX = HexAddress(HexStr('0x' + '00' * 20))

REVERSE_REGISTRAR_DOMAIN = 'addr.reverse'

ENS_MAINNET_ADDR = ChecksumAddress(
    HexAddress(HexStr('0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e')))
Пример #23
0
from enum import IntEnum
from typing import NamedTuple

from eth_typing import HexAddress, HexStr
from eth_utils.units import units

from raiden_contracts.utils.signature import private_key_to_address

UINT256_MAX = 2**256 - 1
NOT_ADDRESS = "0xaaa"
FAKE_ADDRESS = HexAddress(HexStr("0x00112233445566778899aabbccddeeff00112233"))
EMPTY_HEXADDRESS = "0x0000000000000000000000000000000000000000"
EMPTY_BALANCE_HASH = b"\x00" * 32
EMPTY_ADDITIONAL_HASH = b"\x00" * 32
EMPTY_SIGNATURE = b"\x00" * 65
passphrase = "0"
FAUCET_PRIVATE_KEY = "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
FAUCET_ADDRESS = private_key_to_address(FAUCET_PRIVATE_KEY)
FAUCET_ALLOWANCE = 100 * int(units["ether"])
DEPLOYER_ADDRESS = FAUCET_ADDRESS
NONEXISTENT_LOCKSROOT = b"\x00" * 32
SECONDS_PER_DAY = 60 * 60 * 24

# Constants for ServiceRegistry testing
SERVICE_DEPOSIT = 5000 * (10**18)
DEFAULT_BUMP_NUMERATOR = 6
DEFAULT_BUMP_DENOMINATOR = 5
DEFAULT_DECAY_CONSTANT = 200 * SECONDS_PER_DAY
DEFAULT_REGISTRATION_DURATION = 180 * SECONDS_PER_DAY
DEFAULT_MIN_PRICE = 1000
Пример #24
0
 def test_eth_getCode_invalid_address(self, web3: "Web3",
                                      math_contract: "Contract") -> None:
     with pytest.raises(InvalidAddress):
         web3.eth.getCode(
             ChecksumAddress(
                 HexAddress(HexStr(math_contract.address.lower()))))
Пример #25
0
 def test_eth_getTransactionCount_invalid_address(self,
                                                  web3: "Web3") -> None:
     coinbase = web3.eth.coinbase
     with pytest.raises(InvalidAddress):
         web3.eth.getTransactionCount(
             ChecksumAddress(HexAddress(HexStr(coinbase.lower()))))
Пример #26
0
    is_string,
)
from hexbytes import (
    HexBytes, )

from web3.exceptions import (
    BlockNotFound,
    InvalidAddress,
    TransactionNotFound,
)
from web3.types import (  # noqa: F401
    BlockData, FilterParams, LogReceipt, Nonce, SyncStatus, TxParams, Wei,
)

UNKNOWN_ADDRESS = ChecksumAddress(
    HexAddress(HexStr('0xdEADBEeF00000000000000000000000000000000')))
UNKNOWN_HASH = HexStr(
    '0xdeadbeef00000000000000000000000000000000000000000000000000000000')

if TYPE_CHECKING:
    from web3 import Web3  # noqa: F401
    from web3.contract import Contract  # noqa: F401


class EthModuleTest:
    def test_eth_protocolVersion(self, web3: "Web3") -> None:
        protocol_version = web3.eth.protocolVersion

        assert is_string(protocol_version)
        assert protocol_version.isdigit()
Пример #27
0
from dataclasses import asdict

from eth_typing import HexAddress, HexStr

from rotkehlchen.assets.asset import EthereumToken
from rotkehlchen.assets.unknown_asset import UnknownEthereumToken
from rotkehlchen.typing import ChecksumEthAddress

SHUF_ETHEREUM_ADDRESS = ChecksumEthAddress(
    HexAddress(HexStr('0x3A9FfF453d50D4Ac52A6890647b823379ba36B9E')), )
SHUF_SYMBOL = 'SHUF'
SHUF_NAME = 'Shuffle.Monster V3'
SHUF_DECIMALS = 18


# Test initialization
def test_init_default():
    ue_token = UnknownEthereumToken(
        ethereum_address=SHUF_ETHEREUM_ADDRESS,
        symbol=SHUF_SYMBOL,
    )
    assert ue_token.ethereum_address == SHUF_ETHEREUM_ADDRESS
    assert ue_token.symbol == SHUF_SYMBOL
    assert ue_token.name is None
    assert ue_token.decimals is None


# Test operators
def test_eq():
    ue_token_1 = UnknownEthereumToken(
        ethereum_address=SHUF_ETHEREUM_ADDRESS,
Пример #28
0
def deserialize_ethereum_address(symbol: str) -> ChecksumEthAddress:
    return ChecksumEthAddress(HexAddress(HexStr(symbol)))
Пример #29
0
def deprecation_test(
    ctx: click.Context,
    private_key: str,
    rpc_provider: URI,
    wait: int,
    gas_price: int,
    gas_limit: int,
) -> None:
    """Turn on the deprecation switch and see channel opening fails"""
    setup_ctx(
        ctx=ctx,
        private_key=private_key,
        password_file=None,
        rpc_provider=rpc_provider,
        wait=wait,
        gas_price=gas_price,
        gas_limit=gas_limit,
    )
    deployer = ctx.obj["deployer"]

    # We deploy the Raiden Network contracts and register a token network
    token_amount = MAX_ETH_CHANNEL_PARTICIPANT * 6
    channel_participant_deposit_limit = MAX_ETH_CHANNEL_PARTICIPANT
    token_network_deposit_limit = MAX_ETH_TOKEN_NETWORK
    (_, token_network, _) = deprecation_test_setup(
        deployer=deployer,
        token_amount=token_amount,
        channel_participant_deposit_limit=channel_participant_deposit_limit,
        token_network_deposit_limit=token_network_deposit_limit,
    )

    log.info("Checking that channels can be opened and deposits can be made.")

    # Check that we can open channels and deposit on behalf of A and B
    # Some arbitrary Ethereum addresses
    A = HexAddress(HexStr("0x6AA63296FA94975017244769F00F0c64DB7d7115"))
    B = HexAddress(HexStr("0xc9a4fad99B6d7D3e48D18d2585470cd8f27FA61e"))
    channel_identifier = open_and_deposit(A=A, B=B, token_network=token_network, deployer=deployer)
    log.info("Seding transaction to activate the deprecation switch.")

    # Activate deprecation switch
    assert token_network.functions.safety_deprecation_switch().call() is False
    txhash = deployer.transact(token_network.functions.deprecate())
    log.debug(f"Deprecation txHash={encode_hex(txhash)}")
    assert token_network.functions.safety_deprecation_switch().call() is True

    log.info("Checking that channels cannot be opened anymore and no more deposits are allowed.")

    # Check that we cannot open more channels or deposit
    C = HexAddress(HexStr("0x5a23cedB607684118ccf7906dF3e24Efd2964719"))
    D = HexAddress(HexStr("0x3827B9cDc68f061aa614F1b97E23664ef3b9220A"))
    open_and_deposit(
        A=C,
        B=D,
        token_network=token_network,
        deployer=deployer,
        channel_identifier=channel_identifier,
        txn_success_status=False,
    )

    log.info("Deprecation switch test OK.")
Пример #30
0
CONTRACT_DEPOSIT = "Deposit"

# Timeouts
TEST_SETTLE_TIMEOUT_MIN = 5
TEST_SETTLE_TIMEOUT_MAX = 100000

DEPLOY_SETTLE_TIMEOUT_MIN = 500  # ~ 2 hours
DEPLOY_SETTLE_TIMEOUT_MAX = 555428  # ~ 3 months

# Temporary deposit limits for the Red Eyes release in WEI
MAX_ETH_CHANNEL_PARTICIPANT = int(0.075 * 10**18)
MAX_ETH_TOKEN_NETWORK = int(250 * 10**18)

# Special hashes
LOCKSROOT_OF_NO_LOCKS = keccak(b"")
EMPTY_ADDRESS = HexAddress(
    HexStr("0x0000000000000000000000000000000000000000"))

# Event names
# TokenNetworkRegistry
EVENT_TOKEN_NETWORK_CREATED = "TokenNetworkCreated"

# TokenNetwork
EVENT_DEPRECATION_SWITCH = "DeprecationSwitch"

# SecretRegistry
EVENT_SECRET_REVEALED = "SecretRevealed"

# EndpointRegistry
EVENT_ADDRESS_REGISTERED = "AddressRegistered"

# ServiceRegistry