Skip to main content
. 2021 May 31;21(11):3822. doi: 10.3390/s21113822
Algorithm 4 Bid on a NFT
  • 1:

    functionBidNFT(id string)

  • 2:

         tokenReadToken(id)                            ▹ Calling Algorithm 2

  • 3:

         if token.NotForSale == true then

  • 4:

             return “Token ID not for sale”

  • 5:

         end if

  • 6:

         bidderclientGetClientIdentity().GetID()

  • 7:

         if token.Bid== then

  • 8:

               token.Bid=bidderclient

  • 9:

         else

  • 10:

             return “There is already a bid on this token by token.Bid”

  • 11:

       end if

  • 12:

       tokenJSONjson.Marshal(token)

  • 13:

       PutState(id,tokenJSON)

                                                 ▹ Saving updated token

  • 14:

    end function