0
pragma solidity ^0.8.0;

contract Invoice {
    // The PAN of the buyer
    string public buyerPAN;
    // The PAN of the seller
    string public sellerPAN;
    // The amount of the invoice
    uint256 public invoiceAmount;
    // The date of the invoice
    uint256 public invoiceDate;
    // The payment status of the invoice (true if paid, false if not paid)
    bool public paymentStatus;

    // Maps buyer PANs to their invoices
    mapping(string => Invoice[]) public buyerInvoices;

    // Initializes the contract with the given buyer and seller PANs,
    // invoice amount, and invoice date
   
    constructor(string memory _buyerPAN, string memory _sellerPAN, uint256 _invoiceAmount, uint256 _invoiceDate) {
        buyerPAN = _buyerPAN;
        sellerPAN = _sellerPAN;
        invoiceAmount = _invoiceAmount;
        invoiceDate = _invoiceDate;
        paymentStatus = false;
    }

    // Changes the payment status of the invoice to paid
    function payInvoice() public {
        paymentStatus = true;
    }

    // Adds the current invoice to the list of invoices for the given buyer PAN
    function addToBuyerInvoices(string memory _buyerPAN) public {
        buyerInvoices[_buyerPAN].push(this);
    }

    // Returns the list of invoices for the given buyer PAN
    function getInvoicesForBuyer(string memory _buyerPAN) public view returns (Invoice[] memory) {
        return buyerInvoices[_buyerPAN];
    }
}

1 Answer 1

0

That means you are not providing the right type of arguments to your constructor when deploying the smart contract.

I just deployed it, making sure I provided a string, a string, an unit and an uint and it worked just fine.

How do you deploy it?

Your Answer

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