def test_can_create_advanced_collectible_integration(
    get_keyhash,
    chainlink_fee,
):
    # Arrange
    if network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS:
        pytest.skip("Only for integration testing")
    advanced_collectible = AdvancedCollectible.deploy(
        get_contract("vrf_coordinator").address,
        get_contract("link_token").address,
        get_keyhash,
        {"from": get_account()},
    )
    get_contract("link_token").transfer(advanced_collectible.address,
                                        chainlink_fee * 3,
                                        {"from": get_account()})
    # Act
    advanced_collectible.createCollectible("None", {"from": get_account()})
    # time.sleep(75)
    listen_for_event(advanced_collectible,
                     "ReturnedCollectible",
                     timeout=200,
                     poll_interval=10)
    # Assert
    assert advanced_collectible.tokenCounter() > 0
def test_can_create_advanced_collectible(
    get_account,
    get_vrf_coordinator,
    get_keyhash,
    get_link_token,
    chainlink_fee,
    get_seed,
):
    # Arrange
    if network.show_active() not in ["development"] or "fork" in network.show_active():
        pytest.skip("Only for local testing")
    advanced_collectible = AdvancedCollectible.deploy(
        get_vrf_coordinator.address,
        get_link_token.address,
        get_keyhash,
        {"from": get_account},
    )
    get_link_token.transfer(
        advanced_collectible.address, chainlink_fee * 3, {"from": get_account}
    )
    # Act
    transaction_receipt = advanced_collectible.createCollectible(
        "None", get_seed, {"from": get_account}
    )
    requestId = transaction_receipt.events["requestedCollectible"]["requestId"]
    assert isinstance(transaction_receipt.txid, str)
    get_vrf_coordinator.callBackWithRandomness(
        requestId, 777, advanced_collectible.address, {"from": get_account}
    )
    # Assert
    assert advanced_collectible.tokenCounter() > 0
    assert isinstance(advanced_collectible.tokenCounter(), int)
def test_can_create_advanced_collectible(
    get_keyhash,
    chainlink_fee,
):
    # Arrange
    if network.show_active() not in LOCAL_BLOCKCHAIN_ENVIRONMENTS:
        pytest.skip("Only for local testing")
    advanced_collectible = AdvancedCollectible.deploy(
        get_contract("vrf_coordinator").address,
        get_contract("link_token").address,
        get_keyhash,
        {"from": get_account()},
    )
    get_contract("link_token").transfer(advanced_collectible.address,
                                        chainlink_fee * 3,
                                        {"from": get_account()})
    # Act
    transaction_receipt = advanced_collectible.createCollectible(
        "None", {"from": get_account()})
    requestId = transaction_receipt.events["RequestedCollectible"]["requestId"]
    assert isinstance(transaction_receipt.txid, str)
    get_contract("vrf_coordinator").callBackWithRandomness(
        requestId, 777, advanced_collectible.address, {"from": get_account()})
    # Assert
    assert advanced_collectible.tokenCounter() > 0
    assert isinstance(advanced_collectible.tokenCounter(), int)
Beispiel #4
0
def main():
    dev = accounts.add(os.getenv(config['wallets']['from_key']))
    print(network.show_active())
    return AdvancedCollectible.deploy(
        config['networks'][network.show_active()]['vrf_coordinator'],
        config['networks'][network.show_active()]['link_token'],
        config['networks'][network.show_active()]['keyhash'], {'from': dev})
def main():
    dev = accounts.add(config["wallets"]["from_key"])
    print(network.show_active())
    advanced_collectible = AdvancedCollectible.deploy(
        config["networks"][network.show_active()]["vrf_coordinator"],
        config["networks"][network.show_active()]["link_token"],
        config["networks"][network.show_active()]["keyhash"],
        {"from": dev},
        publish_source=get_publish_source(),
    )
    fund_with_link(advanced_collectible.address)
    return advanced_collectible
Beispiel #6
0
def main():
    dev = accounts.add(config['wallets']['from_key'])
    print(network.show_active())
    publish_source = False
    advanced_collectible = AdvancedCollectible.deploy(
        config['networks'][network.show_active()]['vrf_coordinator'],
        config['networks'][network.show_active()]['link_token'],
        config['networks'][network.show_active()]['keyhash'],
        {"from": dev},
        publish_source=publish_source
    )
    fund_advanced_collectible(advanced_collectible)
    return advanced_collectible
Beispiel #7
0
def main():
    dev = accounts.add(config["wallets"]["from_key"])
    print(network.show_active())
    # publish_source = True if os.getenv("ETHERSCAN_TOKEN") else False # Currently having an issue with this
    publish_source = False
    advanced_collectible = AdvancedCollectible.deploy(
        config["networks"][network.show_active()]["vrf_coordinator"],
        config["networks"][network.show_active()]["link_token"],
        config["networks"][network.show_active()]["keyhash"],
        {"from": dev},
        publish_source=publish_source,
    )
    fund_advanced_collectible(advanced_collectible)
    return advanced_collectible
Beispiel #8
0
def flatten():
    file = open("./AdvancedCollectible_flattened.json", "w")
    json.dump(AdvancedCollectible.get_verification_info(), file)
    file.close()