Add `ToStorageType` instance for an arbitrary `TAddress`
Clarification and motivation
As per the class' haddock documentation, ToStorageType
:
Declares that @addr@ points to an entity with a storage.
This typeclass is as such used to put a constraint on storage-related functions (e.g. getStorage
) and has instances already for Address
and ContractHandler
.
One instance that however is missing is the one for TAddress
of an arbitrary parameter type, requiring users to convert to an Address
to use the aforementioned functions.
Note: much like Address
and not like ContractHandler
this instance will require the user to specify the storage type via type annotation, but it's still nicer to have it.
Acceptance criteria
Cleveland contains an instance
for ToStorageType
of any TAddress
.
Add an explanation comment on why there is no valid use case for this, following this discussion.
TAddress
isn't intended to be a part of the Cleveland API. In the absolute majority of cases, if one is interested in both parameter and storage, then they should use ContractHandler
, as the storage type needs to be known either way. If one isn't interested in storage, they presumably wouldn't call functions to get storage. Hence, this instance wouldn't be particularly useful. Legacy code using TAddress
instead of ContractHandler
should be preferably updated, if possible. If nothing else, toAddress
can be used as a stopgap measure.