Contracts that reference unobserved contracts

Hi Alex, no worries, this is the place to ask questions! Beware you may get different answers here.

I would not go down the route of making the ProductType public. I think there is a simpler solution here. You could add a choice CreateProduct: Product on ProductType, and specifically use the choice first syntax to pass the producer as an argument to the choice - this way you don’t need to maintain an explicit list of observers.

However, you should ask yourself: is every producer allowed to create every type of product? If that is not the case, it would be better to maintain a list of parties on the ProductType template that are allowed to create that type of product. In this case, use the controller first choice syntax for your CreateProduct choice.

Btw the pattern that we’re using here is the ‘master agreement’ pattern. It has an analogue in real life. For instance, in finance/brokerage, a broker will have a ‘master agreement’ with a client. It will say in broad terms that they can agree to enter into an agreement to buy/sell securities with discretion; meaning, they don’t need to physically sign a contract every single time a new transaction takes place, but rather use the master contract to delegate this right. The same happens when you add observers to your ProductType contract - that is the act of the ‘admins’ (as you call them) delegating the producers the right to create new Products in future, without having to agree every single time.

Let me know if that answers your question.

2 Likes