You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pool creation does not fail when a standard wallet or a smart contract that does not implement decimals() is used as the base token.
Motivation
Pool creation should be allowed only with correct initialization. Otherwise, the name is reserved in the registry and the pool cannot be used. This is relevant for users trying to deploy a pool with the same name and address on multiple chains.
Specification
The call IERC20(initParams.baseToken).decimals() will fail silently if the target address does not implement the method. Therefore, the following part of the code will be skipped, which is the pool initialization. In order to guarantee that the pool is initialized correctly, we have to use a try/catch statement and revert with an error. It is not important to revert with the message error as the pool proxy initializePool() call will fail with POOL_INITIALIZATION_FAILED_ERROR without catching the revert reason for gas optimizations.
The decimals initialization should not make an assertion when the token is base currency as we define 18 decimals. The token assertion should be moved in the try/catch statement and decimals should be defined case by case instead of initially set to 18 and overwritten if different.
Summary
Pool creation does not fail when a standard wallet or a smart contract that does not implement decimals() is used as the base token.
Motivation
Pool creation should be allowed only with correct initialization. Otherwise, the name is reserved in the registry and the pool cannot be used. This is relevant for users trying to deploy a pool with the same name and address on multiple chains.
Specification
The call
IERC20(initParams.baseToken).decimals()
will fail silently if the target address does not implement the method. Therefore, the following part of the code will be skipped, which is the pool initialization. In order to guarantee that the pool is initialized correctly, we have to use a try/catch statement and revert with an error. It is not important to revert with the message error as the pool proxyinitializePool()
call will fail with POOL_INITIALIZATION_FAILED_ERROR without catching the revert reason for gas optimizations.The decimals initialization should not make an assertion when the token is base currency as we define 18 decimals. The token assertion should be moved in the try/catch statement and decimals should be defined case by case instead of initially set to 18 and overwritten if different.
Notes
Github issue
Proposed implementation
The text was updated successfully, but these errors were encountered: