sherlock-audit / 2023-01-ajna-judging

1 stars 0 forks source link

Avci - if someone uses Lyra LP as collateral will lose OP vault reward #180

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

Avci

high

if someone uses Lyra LP as collateral will lose OP vault reward

Summary: Optimism currently offers yield farming opportunities for Lyra LPs, see OP Reward Announcement. Every 2 weeks Lyra LPs split a claimable pool. When they use their Lyra LP as collateral, it is transferred to the Lyra vault which means that all OP will be instead claimable by the vault. The vault currently doesn't implement any method to claim or distribute those tokens. The result is a loss of user yield on their Lyra tokens. Aside from the loss of funds, it also highly disincentivizes users from using Lyra tokens as collateral.

Impact Lyra LPs that use their tokens as collateral will lose all their OP rewards

Tool used Manual Review

Recommendation It's unclear how long OP rewards will continue but it seems like other protocols have been getting 6 months of incentives. Since they are temporary I would recommend not integrating reward distribution directly into the contract. I would recommend adding a function to claim rewards to the Isomorph treasury. After the rewards end, the Isomorph should create an airdrop to distribute those tokens to users during that period of time.

Code Snippet:

should be add claim reward function like:


function claimLyraRewards(address[] calldata _tokens, address distributor) onlyAdmin external{
        IMultiDistributor(distributor).claim(_tokens);
        uint256 length = _tokens.length;
        for(uint256 i =0; i < length; i++){
            require(!collateralBook.collateralValid(_tokens[i]), "Cannot withdraw collaterals");
            IERC20 currentToken = IERC20(_tokens[i]);
            uint256 amount = currentToken.balanceOf(address(this));
            currentToken.transfer(msg.sender, amount);        
        }

    }```