1

Crypto Kitties offers a marketplace where you can buy kitties. The functionality is handeled by a contract called SaleClockAuction. This contract inherits from ClockAuctionBase where all auctions are stored in a mapping mapping (uint256 => Auction) tokenIdToAuction; The only way to get an auction seems to be the function getAuction(uint256 _tokenId).

If I want a list of all auctions would mean I had to iterate over all kitties and call getAuction(uint256 _tokenId) for each kitty to check if an auction exists.

Question is: Is this really the way to do it or am I missing something here?

https://github.com/dapperlabs/cryptokitties-bounty/tree/master/contracts/Auction

1 Answer 1

1

You should fetch all the AuctionCreated events (it's in ClockAuctionBase.sol which SaleClockAuction indirectly inherits from) which are created when auctions are created.

1
  • OK so I have fetch all AuctionCreated event and all AuctionClosed to get a list of all running auctions. I'm wondering if this couldn't cause performance issues with an increasing number of auctions and using a client like Metamask to access the blockchain. Crypto kitties offers a api function on their webserver to fetch all running auctions. So maybe they are caching this information on their server.
    – MarcS82
    Jun 5, 2018 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.