0

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 1

1

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.

1
  • Is there any tutorial or example how to do this thing? Sep 10, 2022 at 8:25

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.