sherlock-audit / 2024-01-napier-judging

8 stars 5 forks source link

LTDingZhen - `scale` should be the conversation rate from target to underlying #131

Closed sherlock-admin closed 5 months ago

sherlock-admin commented 5 months ago

LTDingZhen

high

scale should be the conversation rate from target to underlying

Summary

scale should be the conversation rate from target to underlying, not the share-asset ratio in ERC4626.

Vulnerability Detail

In BaseLSTAdapter.sol, scale is calculated with convertToAssets in OZ's ERC4626 implementation:

function scale() external view override returns (uint256) {
    return convertToAssets(1e18);
}

However, such value cannot always be a substitute for real conversation rate from target token to underlying token. As Frax takes a fee at the time of withdrawal requests, which temporarily reduces the share price, and Tranche only track the MAX scale, so that create a arbitage opportunity for malicious users. They can simply deposit into tranche at a lower scale.

Impact

arbitage opportunity on Frax adapter.

Code Snippet

https://github.com/sherlock-audit/2024-01-napier/blob/6313f34110b0d12677b389f0ecb3197038211e12/napier-v1/src/adapters/BaseLSTAdapter.sol#L232C1-L235C1

Tool used

Manual Review

Recommendation

Such value should be taken from corresponding protocol.