Can a smart contract have multiple addresses? And I am not asking whether a smart contract can have other smart-contracts. What I am asking is, theoretically can a smart contract have multiple addresses. Lets say there is a smart contract for a game where you choose the outcome of an event. There is outcome A, B and C. can a smart contract theoretically have an address for each outcome where I send tokens to the outcome address if I want to choose it? This is without having other smart contracts? If this is not possible in Ethereum can a blockchain be designed such that this is possible?
1 Answer
Yes, it's doable. There are multiple ways to achieve it. One which is interesting is so-called Diamond pattern EIP-2535: Diamonds, Multi-Facet Proxy
A diamond is a contract with external functions that are supplied by contracts called facets.
Facets are separate, independent contracts that can share internal functions, libraries and state variables.
You can build one controller contract and facets for each outcome.