Implement registry of Fuel Contracts that can accept deposits from L1 counterparts
DefiCake opened this issue · comments
In the current implementation, even if there is a refund
mechanism, loss of funds is possible by depositing to a fuel contract ID that does not exist in the Fuel blockchain. When a deposit transaction is called on the ERC20 Gateway, if there is an error on the fuelTokenId
param, the message on the L2 will not ever be processed and thus a refund will not be triggered.
This can be alleviated by implementing a registry in the L1 contract. Upon deployment of the L2 counterpart, it is possible to send a message from L2 to L1, informing that the sender (the L2 contract) is able to process messages from the L1. Before accepting any deposit, the L1 contract can check if the destination fuelTokenId
has previously reported its capabilities to process the deposits, which removes the possibility of this human error
related to #82