Metaplex Auction house execute_sale function is throwing error " Program log: panicked at 'index out of bounds: the len is 0 but the index is 0'"

Viewed 138
1 Answers

The "index out of bounds" happens when execute_sale function cannot find a matching buy and sell order to execute the sale.

To make sure that execute_sale works, you need the following:

  1. A sell order on against a mint X with price P (make sure your treasury fee account is funded)
  2. A buy order against mint X (make sure you have enough funds in the wallet as the funds go into an escrow)
  3. Sell and buy order prices must be the same
  4. Sell and buy orders have to have been made against the same auctionhouse instance
  5. when you call execute_sale, the price specified must match the buy and the sell order price.

when the above conditions are met, execute_sale will work. If execute_sale is unable to find a matching sell/buy order pair, then you will receive the not-so-helpful index out of bounds error.

Related