whats problem in my solidity smat-contract?

  Kiến thức lập trình

i write my first project with using smart contract, this is british auction, my problem located in function createAuction(). BidList it is list of all Bid on this auction, he initial state must be null, but in my code arises error, I can not understand why. Can you fix it and put it in working order and give an explanation about my help? thank you in advance.

`// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

contract Auction {
    address owner;
    uint constant TIME_OF_AUCTION = 2 days;
    uint constant MARKET_FEE = 5;
    struct Bid {
        address playerAddress;
        uint time;
        uint Bid;
        uint IdAuction;
    }
    struct Auction  {
        string Name;
        uint openPrice;
        address seller; 
        uint startAt; 
        uint EndTo;
        string description; 
        bool ended;
        uint IdAuction;
        uint endedPrice;
        Bid[] BidList;
    }
    Auction [] public auctions;
    event createAuctionEvent(uint Id, string name, address seller, uint openPrice);
    constructor() {
        owner = msg.sender;
    }
    function createAuction (uint _id,string memory _Name, uint _openPrice, address _seller, uint _startAt, uint _EndTo, string memory _description) external {
        require(_openPrice>0 ,"incorrected price");
        require(_startAt >= block.timestamp, "incorrected Data");
        require (_EndTo - _startAt > TIME_OF_AUCTION, "incorrected time period");
        Auction memory newAuction  = Auction ({
            Name: _Name, 
            openPrice: _openPrice,
            seller: _seller,
            startAt: _startAt,
            EndTo:_EndTo,
            description:_description,
            ended: false,
            IdAuction: _id,
            endedPrice: _openPrice,
            BidList: new Bid[](0)
        });
        emit createAuctionEvent (newAuction.IdAuction, newAuction.Name, newAuction.seller, newAuction.openPrice);
        auctions.push(newAuction);
    }
}`

New contributor

roman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT