示例#1
0
def deploy_mocks(decimals=18, initial_value=2000):
    """
    Use this script if you want to deploy mocks to a testnet
    """
    # Set a default gas price
    priority_fee("1 gwei")
    print(f"The active network is {network.show_active()}")
    print("Deploying Mocks...")
    account = get_account()
    print("Deploying Mock Link Token...")
    link_token = LinkToken.deploy({"from": account})
    print("Deploying Mock Price Feed...")
    mock_price_feed = MockV3Aggregator.deploy(decimals, initial_value,
                                              {"from": account})
    print(f"Deployed to {mock_price_feed.address}")
    print("Deploying Mock VRFCoordinator...")
    mock_vrf_coordinator = VRFCoordinatorMock.deploy(
        link_token.address, {
            "from": account,
            "gas_price": chain.base_fee
        })
    print(f"Deployed to {mock_vrf_coordinator.address}")

    print("Deploying Mock Oracle...")
    mock_oracle = MockOracle.deploy(link_token.address, {"from": account})
    print(f"Deployed to {mock_oracle.address}")
    print("Mocks Deployed!")
示例#2
0
def vrf_coordinator(pm, deployer, link_token):
    if network.show_active() == "development" or "fork" in network.show_active(
    ):
        yield VRFCoordinatorMock.deploy(link_token, {"from": deployer})

    if network.show_active() in config["networks"]:
        yield Contract.from_abi(
            "vrf_coordinator",
            config["networks"][network.show_active()]["vrf_coordinator"],
            VRFCoordinatorMock.abi,
        )

    else:
        pytest.skip("Invalid network specified")
示例#3
0
def get_vrf_coordinator(get_account, get_link_token):
    if network.show_active() == 'development' or network.show_active(
    ) == 'mainnet-fork':
        mock_vrf_coordinator = VRFCoordinatorMock.deploy(
            get_link_token.address, {'from': get_account})
        return mock_vrf_coordinator
    if network.show_active() in config['networks']:
        vrf_coordinator = Contract.from_abi(
            "vrf_coordinator",
            config['networks'][network.show_active()]['vrf_coordinator'],
            VRFCoordinatorMock.abi)
        return vrf_coordinator
    else:
        pytest.skip('Invalid network specified')
示例#4
0
def get_vrf_coordinator(get_account, get_link_token):
    if network.show_active() == "development" or "fork" in network.show_active(
    ):
        mock_vrf_coordinator = VRFCoordinatorMock.deploy(
            get_link_token.address, {"from": get_account})
        return mock_vrf_coordinator
    if network.show_active() in config["networks"]:
        vrf_coordinator = Contract.from_abi(
            "vrf_coordinator",
            config["networks"][network.show_active()]["vrf_coordinator"],
            VRFCoordinatorMock.abi,
        )
        return vrf_coordinator
    else:
        pytest.skip("Invalid network specified")
示例#5
0
def deploy_mocks(decimals=DECIMALS, initial_value=INITIAL_VALUE):
    """
    Use this script if you want to deploy mocks to a testnet
    """
    print(f"The active network is {network.show_active()}")
    print("Deploying Mocks...")
    account = get_account()
    print("Deploying Mock Link Token...")
    link_token = LinkToken.deploy({"from": account})
    print("Deploying Mock Price Feed...")
    mock_price_feed = MockV3Aggregator.deploy(decimals, initial_value,
                                              {"from": account})
    print(f"Deployed to {mock_price_feed.address}")
    print("Deploying Mock VRFCoordinator...")
    mock_vrf_coordinator = VRFCoordinatorMock.deploy(link_token.address,
                                                     {"from": account})
    print(f"Deployed to {mock_vrf_coordinator.address}")

    print("Deploying Mock Oracle...")
    mock_oracle = MockOracle.deploy(link_token.address, {"from": account})
    print(f"Deployed to {mock_oracle.address}")
    print("Mocks Deployed!")
def deploy_mocks(decimals=DECIMALS, initial_value=INITIAL_VALUE):
    account = get_account()
    MockV3Aggregator.deploy(decimals, initial_value, {"from": account})
    link_token = LinkToken.deploy({"from": account})
    VRFCoordinatorMock.deploy(link_token.address, {"from": account})
    print("Deployed!")