[Cadence] How to enforce that a user cannot own more than 1 resource

Hi,
My contract C defines a resource of type T.
Is there any design pattern to enforce the following requirement:

An account cannot own more than 1 resource of type T from my contract C

?

Specifically, I want to avoid the case of the account storing several resources T from C at distinct storage paths.

Would an approach be to have a dict{address:uuid} D in C and add checks based on D in the init() and destroy() functions of T?

1 Like