I am on an hardhat project, and get this error when i want to compile the solidity code
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Marketplace {
event UserCreated(
address indexed userAddress,
string userId,
string username,
uint8 accountType
);
event StoreCreated(
address indexed sellerAddress,
string storeName,
uint256 latitude,
uint256 longitude
);
event RequestCreated(
string indexed requestId,
address indexed buyerAddress,
string requestName,
uint256 latitude,
uint256 longitude
);
event OfferCreated(
string indexed offerId,
address indexed sellerAddress,
string storeName,
uint256 price,
string requestId
);
event RequestAccepted(
string indexed requestId,
string indexed offerId,
address indexed sellerAddress
);
event OfferRemoved(string indexed offerId, address indexed sellerAddress);
enum AccountType {
BUYER,
SELLER
}
enum RequestLifecycle {
PENDING,
ACCEPTED_BY_SELLER,
ACCEPTED_BY_BUYER,
REQUEST_LOCKED,
COMPLETED
}
struct Location {
uint256 latitude;
uint256 longitude;
}
struct Store {
string name;
string description;
Location location;
}
struct User {
string id;
string username;
string phone;
Location location;
uint256 createdAt;
AccountType accountType;
Store[] stores;
}
struct Request {
string id;
string name;
string buyerId;
uint256 sellersPriceQuote;
string[] sellerIds;
string lockedSellerId;
string description;
string[] images;
uint256 createdAt;
RequestLifecycle lifecycle;
Location location;
uint256 updatedAt;
}
struct Offer {
string id;
uint256 price;
string[] images;
string requestId;
string storeName;
string sellerId;
bool isAccepted;
uint256 createdAt;
uint256 updatedAt;
}
// Custom errors with Marketplace__ prefix
error Marketplace__OnlySellersAllowed();
error Marketplace__OnlyBuyersAllowed();
error Marketplace__OfferAlreadyAccepted();
error Marketplace__InvalidAccountType();
error Marketplace__OfferAlreadyExists();
error Marketplace__UnauthorizedRemoval();
error Marketplace__OfferNotRemovable();
mapping(address => User) public users;
mapping(string => Request) public requests;
mapping(string => Offer) public offers;
mapping(address => mapping(string => bool)) public buyerOffers; // Tracks offers created by each buyer for each request
uint256 constant TIME_TO_LOCK = 900;
function createUser(
string memory _id,
string memory _username,
string memory _phone,
uint256 _latitude,
uint256 _longitude,
AccountType _accountType
) public {
if (
_accountType != AccountType.BUYER &&
_accountType != AccountType.SELLER
) {
revert Marketplace__InvalidAccountType();
}
Location memory userLocation = Location(_latitude, _longitude);
users[msg.sender] = User(
_id,
_username,
_phone,
userLocation,
block.timestamp,
_accountType,
new Store[](0)
);
emit UserCreated(msg.sender, _id, _username, uint8(_accountType));
}
}
error
UnimplementedFeatureError: Copying of type struct Marketplace.Store memory[] memory to storage not yet supported.
Error HH600: Compilation failed