How to restrict the number of contracts?

Have a look at this answer for how to do it: Indicate list of OR signatories - #3 by bernhard

But let me be clear: I reeeeally don’t recommend doing this. partyFromText is a hack and shouldn’t exist in my opinion. If you do this, your application will be entirely non-portable. You won’t be able to migrate it from one ledger to another smoothly.

3 Likes