sherlock-audit / 2023-05-dodo-judging

6 stars 2 forks source link

simon135 - Matic doent work in this contract #174

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

simon135

medium

Matic doent work in this contract

Summary

since the contract is using weth for wrapping msg.value but if it's on a polygon the function will just revert since the deposit is not for regular users.

Vulnerability Detail

when marginTrading goes live on Polygon, and a user trying to wrap msg.value into weth, it won't work because the deposit function in the normal weth contract is

Impact

Code Snippet

weth contract on polygon

   */
    function deposit(address user, bytes calldata depositData)
        external
        override
        only(DEPOSITOR_ROLE)

Tool used

Manual Review

Recommendation

don't use weth and have some sort of other function wrap native tokens function for each chain.