I have an NFT contract and a Market deployed for it.
I've not been using nft_transfer_call for accepting a bid but adding it in now.
In the case an NFT/Media owner accepting a bid the current implemented flow is:
- Call
[nft-contract].accept_bid(token_id, bidder)which starts a cross contract call [market-contract].xcc_market_accept_bid(token_id, bidder, design.creator, design.owner_id, design.prev_owner)- Market takes care of paying out shares, removing bid and calls back
NFT [nft-contract].xcc_media_nft_transfer(token_id, receiver_id)- Transfer moves
NFT/Mediato new owner and finale!
I understand this is not the correct way as I should use nft_transfer_call and based on the Standars this is how the above calls are supposed to be as I understood:
[nft-contract].nft_transfer_call({
"receiver_id": ${market_address}, ? or ${bidder}
"token_id": ${token_id},
"msg": "${token_id} ${bidder} ${creator} ${owner_id} ${prev_owner}"
})
which should transfer token internally and then fires:
[market-contract].nft_on_transfer({
"sender_id": ${sender_of_nft_transfer_call},
"previous_owner_id": ${get_media_prev_owner_from_store},
"token_id": ${token_id_passed_by_front_end},
"msg": "${token_id} ${bidder} ${creator} ${owner_id} ${prev_owner}", // parameters for Market contract
})
that distributes payouts, updates new shares, and finally calls back:
[nft-contract].nft_resolve_transfer({
"sender_id": ${sender_of_nft_transfer_call},
"receiver_id": ${market_address}, ? or ${bidder},
"token_id": ${token_id},
})
The question is who is the receiver_id in this case (the market or the new owner)? I understand approval management Standard might be better solution here but I'm trying to keep it simple and solve it with the transfer call.