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

    functionBidFT(id string)

  • 2:

         tokenReadToken(id)                                    ▹ Calling Algorithm 2

  • 3:

         if token.NotForSale==true then

  • 4:

                return “Token ID is not for sale”

  • 5:

         end if

  • 6:

         if token.AvailableAssets<bidvalue then

  • 7:

                Return “Available value token.AvailableAssets is less than bid bidvalue

  • 8:

         end if

  • 9:

         bidderclientGetClientIdentity().GetID()

  • 10:

         if token.Bidmap[bidderclient]!=nil then

  • 11:

              token.Bidmap[bidderclient]existingval+bidvalue

  • 12:

        else

  • 13:

            token.Bidmap[bidderclient]=bidvalue

  • 14:

        end if

  • 15:

        token.AvailableAssets=token.AvailableAssetsbidvalue

  • 16:

        tokenJSONjson.Marshal(token)

  • 17:

        PutState(id,tokenJSON)                                   ▹ Saving updated token

  • 18:

    end function