Search code examples
solanametaplex

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'"


When i try to use execute_sale transactio falis and it throws this error

"Timed out awaiting confirmation on transaction"

https://solscan.io/tx/3ZxL5ATkhXWM995RKaMqRuNHfDjANCg5fPjxuq2oSbsU8p7tKsia2w7Apk2cBopinhGviXGQckC8rGTJC7C8Wchw?cluster=devnet

I input

  1. Auction house address 2.buyerPrice 3.token mint address 4.token size 5.buyer_pub_key 6.seller_pub_key 7.my private key

Solution

  • 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.