Description:Description\
Thorn protocol should be similar to Uniswap and thus should support all sorts of ERC20 tokens, but the problem is that Decimals are optional for the ERC and there can be tokens that don’t implement it. - https://eips.ethereum.org/EIPS/eip-20#decimals
Attack Scenario\
As a result, not all the ERC20 tokens will be supported and those that don’t have decimals will fail in the StableSwapPool::initialize:
Here the execution tries to retrieve the decimals with a high-level call which will revert in case there is no such function in the ABI of the token contract.
Attachments
Proof of Concept (PoC) File
Revised Code File (Optional)
In order to handle all the valid ERC20s decimals should be queried in a try/catch blocks and in case there is no decimals function is presented the catch statement should assign default of 18 decimals.
Github username: -- Twitter username: -- Submission hash (on-chain): 0x583b3a6802966b63ea69ff06445baf91abc0d509afef998d359eb6198c369eca Severity: low
Description: Description\ Thorn protocol should be similar to Uniswap and thus should support all sorts of ERC20 tokens, but the problem is that Decimals are optional for the ERC and there can be tokens that don’t implement it. - https://eips.ethereum.org/EIPS/eip-20#decimals
Attack Scenario\ As a result, not all the ERC20 tokens will be supported and those that don’t have decimals will fail in the
StableSwapPool::initialize
:Here the execution tries to retrieve the decimals with a high-level call which will revert in case there is no such function in the ABI of the token contract.
Attachments
In order to handle all the valid ERC20s decimals should be queried in a try/catch blocks and in case there is no decimals function is presented the catch statement should assign default of 18 decimals.