0

I'm working on a Diamond Token contract using Hardhat framework

//SPDX-FileCopyrightText: © 2023 Ndubuisi Favour <favourndubuisi.official@gmail.com>
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

//Libraries -->
import "@solidstate/contracts/proxy/diamond/SolidStateDiamond.sol";
import "hardhat/console.sol";

//This is the Diamond smart contract
contract Haven is SolidStateDiamond {}

When I compile the smart contract, it gives the following error

Warning: This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function.
  --> @solidstate/contracts/proxy/Proxy.sol:11:1:
   |
11 | abstract contract Proxy is IProxy {
   | ^ (Relevant source part starts here and spans across multiple lines).
Note: The payable fallback function is defined here.
  --> @solidstate/contracts/proxy/Proxy.sol:28:5:
   |
28 |     fallback() external payable virtual {
   |     ^ (Relevant source part starts here and spans across multiple lines).


Warning: This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function.
 --> @solidstate/contracts/proxy/diamond/fallback/IDiamondFallback.sol:7:1:
  |
7 | interface IDiamondFallback is IDiamondBase {
  | ^ (Relevant source part starts here and spans across multiple lines).
Note: The payable fallback function is defined here.
 --> @solidstate/contracts/proxy/IProxy.sol:8:5:
  |
8 |     fallback() external payable;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^


Warning: This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function.
  --> @solidstate/contracts/proxy/diamond/base/DiamondBase.sol:13:1:
   |
13 | abstract contract DiamondBase is IDiamondBase, Proxy {
   | ^ (Relevant source part starts here and spans across multiple lines).
Note: The payable fallback function is defined here.
  --> @solidstate/contracts/proxy/Proxy.sol:28:5:
   |
28 |     fallback() external payable virtual {
   |     ^ (Relevant source part starts here and spans across multiple lines).


Warning: This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function.
  --> @solidstate/contracts/proxy/diamond/fallback/DiamondFallback.sol:15:1:
   |
15 | abstract contract DiamondFallback is
   | ^ (Relevant source part starts here and spans across multiple lines).
Note: The payable fallback function is defined here.
  --> @solidstate/contracts/proxy/Proxy.sol:28:5:
   |
28 |     fallback() external payable virtual {
   |     ^ (Relevant source part starts here and spans across multiple lines).


Generating typings for: 1 artifacts in dir: typechain-types for target: ethers-v5
Successfully generated 40 typings!
Compiled 1 Solidity file successfully
Error HH700: Artifact for contract "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol:AggregatorV3Interface" not found.

Please how do I go about solving the following errors;

  1. Warning: This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function.
  2. Error HH700: Artifact for contract "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol:AggregatorV3Interface" not found.
Syre Musk
  • 57
  • 7

1 Answers1

0

The first one is a warning that explains your contract doesn't have a function that receives ether but you used payable. It's not very important but if you want to remove it just remove the payable fullback lines:

"fallback() external payable;"

The second Error is about the library, please install the chainlink library:

npm i @chainlink/contracts

Morteza
  • 1
  • 1
  • 1) I didn't create the fallback payable method, it was inherited from solidstatediamond library package, do I go on an alter it from the library? and 2) Th chainlink library was already installed? – Syre Musk Mar 09 '23 at 12:46
  • @chainlink/contracts version in packchage.json is also important, so check your version to be the latest. – Morteza Mar 09 '23 at 13:22