Zilliqa / marketplace-contracts

GNU General Public License v3.0
2 stars 4 forks source link

clean up of buy order #17

Closed bb111189 closed 2 years ago

bb111189 commented 2 years ago

I think there might be a possibility of some entry in buy_orders. I think it is good to clean it up too

  match is_sell_order with 
  | True => 
    (* Side: Sell *)
    (* - Buyers can fulfill sell orders. *)
    buyer = _sender;
    maybe_sell_order <- sell_orders[token_address][token_id][payment_token_address][sale_price];

    match maybe_sell_order with
    | None => 
      error = SellOrderNotFoundError;
      Throw error
    | Some (Order seller expiration_bnum) =>  
      RequireNotExpired expiration_bnum;

      is_native_zil = builtin eq payment_token_address zero_address;
      match is_native_zil with
      | False => 
      | True => 
        RequireEqualZILAmount sale_price;
        accept
      end;

      HandleFulfillOrder token_address token_id payment_token_address sale_price buyer seller side dest;

      (* Remove all sell orders *)
      (* When a sell order is fulfilled, the sell order is removed and the other sell orders for the token are also removed. *)
      delete sell_orders[token_address][token_id]
    end
ghost commented 2 years ago

I think keeping buy orders is good for the owner because the owner has more options. What do you think?

bb111189 commented 2 years ago

I think this case will be good for the new owner. The new owner has more options to sell. It will not impact the old owner.

ghost commented 2 years ago

ok, I will close this issue.