示例#1
0
def sol_registry(w3):
    manifest = get_ethpm_local_manifest("simple-registry", "v3.json")
    registry_package = Package(manifest, w3)
    registry_deployer = Deployer(registry_package)
    deployed_registry_package = registry_deployer.deploy("PackageRegistry")
    assert isinstance(registry_package, Package)
    registry = deployed_registry_package.deployments.get_instance("PackageRegistry")
    return SimpleRegistry(registry.address, w3)
示例#2
0
def sol_registry(w3):
    manifest = json.loads(
        (ASSETS_DIR / "registry" / "2.0.0a1.json").read_text())
    registry_package = Package(manifest, w3)
    registry_deployer = Deployer(registry_package)
    deployed_registry_package = registry_deployer.deploy("PackageRegistry")
    assert isinstance(registry_package, Package)
    registry = deployed_registry_package.deployments.get_instance(
        "PackageRegistry")
    return SimpleRegistry(registry.address, w3)
def test_web3_ens(ens):
    w3 = ens.web3
    ns = ENS.fromWeb3(w3, ens.ens.address)
    w3.ens = ns
    registry = SimpleRegistry.deploy_new_instance(w3)
    w3.ens.setup_address('tester.eth', registry.address)
    actual_addr = ens.address('tester.eth')
    w3.pm.set_registry('tester.eth')
    assert w3.pm.registry.address == actual_addr
    w3.pm.release_package('owned', '1.0.0', 'ipfs://QmcxvhkJJVpbxEAa6cgW3B6XwPJb79w9GpNUv2P2THUzZR')
    pkg_name, version, manifest_uri = w3.pm.get_release_data('owned', '1.0.0')
    assert pkg_name == 'owned'
    assert version == '1.0.0'
    assert manifest_uri == 'ipfs://QmcxvhkJJVpbxEAa6cgW3B6XwPJb79w9GpNUv2P2THUzZR'
def test_web3_ens(ens):
    w3 = ens.web3
    ns = ENS.fromWeb3(w3, ens.ens.address)
    w3.ens = ns
    registry = SimpleRegistry.deploy_new_instance(w3)
    w3.ens.setup_address('tester.eth', registry.address)
    actual_addr = ens.address('tester.eth')
    w3.pm.set_registry('tester.eth')
    assert w3.pm.registry.address == actual_addr
    w3.pm.release_package(
        'owned', '1.0.0',
        'ipfs://QmbeVyFLSuEUxiXKwSsEjef6icpdTdA4kGG9BcrJXKNKUW')
    pkg_name, version, manifest_uri = w3.pm.get_release_data('owned', '1.0.0')
    assert pkg_name == 'owned'
    assert version == '1.0.0'
    assert manifest_uri == 'ipfs://QmbeVyFLSuEUxiXKwSsEjef6icpdTdA4kGG9BcrJXKNKUW'
示例#5
0
def test_simple_registry_deploy_new_instance(w3):
    registry = SimpleRegistry.deploy_new_instance(w3)
    assert isinstance(registry, SimpleRegistry)
    assert isinstance(registry, ERC1319Registry)
    assert is_address(registry.address)