Treat `Address` as always an implicit address
Clarification and motivation
This concerns ToTAddress
instances.
Currently, we treat Address
as an address of an unknown type - it may be an implicit address or a contract with some parameter. Thus, when calling toTAddress (addr :: Address)
, one has to specify the parameter type explicitly. As result, all transfer
-like methods, when transfer to a simple addr
,
- either require specifying type annotation - what parameter type is;
- or wrapping the address into
TAddress
(also specifying the type annotation); - or running without type-level checks of whether the supplied argument is suitable for the given parameter type / entrypoint.
I propose to change this. Let's start treating Address
as always implicit address. Motivation:
- Currently, we tend to wrap addresses into
TAddress
to specify parameter type, and this practice is the best one. - We will be able to add
addr -> cp
fundep toToTAddress
typeclass, thus specifying type annotation will be no longer necessary.Address
has()
parameter, and that's it. - This provides clearer separation of concerns.
- One may say that we will have to call
toAddress
more often since it is not more possible to useAddress
in some places andTAddress
has to be used instead. But I think in real life, there should be almost no need for explicit conversions (this may be worth discussing)
Acceptance criteria
- We agree whether this change is worth doing.
-
Address
is treated as an implicit address. -
transfer
-like methods (in test framework) are updated, if necessary, to be more type-safe. For instance,transferMoney
should check in types that the default entrypoint hasunit
argument.
Edited by Konstantin Ivanov