Open edmundedgar opened 1 year ago
This turns out to be a little bit hairy because our templates start at 0
which makes checking them in a mapping slightly complicated. Booting it to v5, we may do a separate template manager contract while we're at it.
We store the hash of new templates in
template_hashes
which maps template ID to its content.We should probably have done this the other way around, stored the template hash against the template ID and added a check to make sure the templates are unique, either erroring out if they're not or just returning the existing template ID. This would make it easier to get the ID of a template automatically instead of having to worry about managing different template IDs on different chains.
Consider either adding an additional mapping or checking how much the current mapping is used, and replacing it if we don't need it.