1

I'm following the Alchemy tutorial to build an NFT Marketplace with hardhat. I want to import my smart contract which is an APIConsumer by Chainlink. I can't do it by path since I'm not allowed by hardhat. My idea is to be able to call a function of APIConsumer.sol from marketplace.sol.

How do I import it? Thanks to all.

This is the link with the code of the marketplace: https://github.com/alchemyplatform/NFT-Marketplace-Tutorial

this is marketplace.sol

//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

import "hardhat/console.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "/riskscoreAPI.sol";

contract NFTMarketplace is ERC721URIStorage{

    using Counters for Counters.Counter;
    
    //owner is the contract address that created the smart contract
    address payable owner;
    //The fee charged by the marketplace to be allowed to list an NFT
    uint256 listPrice = 0.01 ether;

    APIConsumer r;

    int256 risk=-1;
    ...

this is my APIConsumer.sol

pragma solidity ^0.8.0;

import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol";
import "@chainlink/contracts/src/v0.8/ConfirmedOwner.sol";
import "hardhat/console.sol";

contract APIConsumer is ChainlinkClient, ConfirmedOwner {

    using Chainlink for Chainlink.Request;

    int256 private risk;
    bytes32 private jobId;
    uint256 private fee;

    event RequestRisk(bytes32 indexed requestId, int256 risk);
    .....

1 Answer 1

0

Hello Giacomo

Chainlink has some tutorials and examples that can help you!

Check it out the Hardhat Starter Kit

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.