My apologies in advance for this noob question, I think a scenario might be the best way to ask:
I have a simple escrow smart contract that facilitates the buying of products. For simplicity sake, the contract is deployed at 0x01... and has 3 methods:
deposit() payable - buyer only
shippedItem() - seller only
finalize() - buyer only
and a simple web interface acting as an online store.
User 1 comes to the store and buys product by depositing in the smart contract. The seller marks the item shipped and the deployed contract state becomes 'awaiting finalization'.
User 2 comes to the store and buys product by...Im not 100% sure how? Would a new contract need to be deployed for this user? Or is there a way to instead have contract 'instances' that could be created and interact as independent objects? Ex:
--> Deployed contract at 0x01... --> Instance 1 State: awaiting finalization --> Instance 2 State: awaiting deposit
I did see a question similar to this that said you could use what are called libraries to get this kind of behavior, but I'm still unsure if contract libraries fit this scenario. I ask this because from a practical business standpoint, having the buyer or seller deploy a new contract each time does seem like it could end up being quite expensive on the mainnet. Thanks for viewing my question.