I'm trying to develop a set of contracts in where an ERC721 token is auctioned off, then the winner gets the token placed into their wallet. I'm not entirely sure how to structure this. These are the contracts I was thinking would be needed.
WALLET
- Contains the mapping of addresses to tokens owned
- Upon deployment, creates deploys an
AuctionFactory
contract and saves the address
AUCTIONFACTORY
- Deploys an
Auction
contract upon command, with the item being the ERC721 token specified
AUCTION
- Contains all the logic for an auction
- Inherits from
Wallet
, allowing manipulation of themapping
state variable found in the contract, placing ERC721 tokens won into the winners wallet
The problem is that Auction
can't inherit from Wallet
. The compiler will throw an error when AuctionFactory
tries to deploy an auction - cannot create instance of derived or same contract
. And that makes sense to me, since Wallet
deploys the factory, and if the factory deploys an Auction
that inherits from Wallet
, it's technically deploying its parent contract.
So my question is, how can I structure this set of contracts? How can I allow an instance of an auction contract to communicate and manipulate with a store on another contract?