-
Notifications
You must be signed in to change notification settings - Fork 6
ShadowForce - call data to enter or exit market is never generated When executing rebalancing in TreasuryAction #98
Comments
Escalate for 10 USDC. this should be a valid issue if #28 is a valid issue if any new cToken is added, failed to call addMarket would make the rebalance flow ineffiecent because the asset never start to accure COMP reward according to the doc of https://docs.compound.finance/v2/comptroller/
failed to enter market means the added cToken failed to be supply as collateral and cannot be borrowed to accure COMP reward and interest |
You've created a valid escalation for 10 USDC! To remove the escalation from consideration: Delete your comment. You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final. |
How does calldata fail to get generated. It is clearly there? The below snippet will encode the right data with the correct function selector to mint cTokens. callData[0] = abi.encodeWithSelector(
underlyingIsETH ? CEtherInterface.mint.selector : CErc20Interface.mint.selector,
depositUnderlyingAmount
); While, |
Hi, I agree the correct mint for CEther and CERC20 token is generated, the the enterMarket is never generated given that the supported token can be USDT (in the future) function enterMarkets(address[] memory cTokens) override public returns (uint[] memory) {
uint len = cTokens.length;
uint[] memory results = new uint[](len);
for (uint i = 0; i < len; i++) {
CToken cToken = CToken(cTokens[i]);
results[i] = uint(addToMarketInternal(cToken, msg.sender));
}
return results;
} |
You don't need to call |
|
Agree with the comments of Leastwood, this issue should be invalid since |
Result: |
Escalations have been resolved successfully! Escalation status:
|
ShadowForce
high
call data to enter or exit market is never generated When executing rebalancing in TreasuryAction
Summary
call data to enter or exit market is never generated
Vulnerability Detail
the function
getDepositCalldata
never generates calldata for entering an exiting compounds markets, this can be observed in the snippet belowsince no calldata for entering and exiting the compound markets is ever generated, it is impossible to enter the market rendering the function useless. Users of the protocol will be unable to correctly enter markets because of this
entering markets is vital for supplying collateral as stated in the Compound docs
https://docs.compound.finance/v2/comptroller/
Notional wants to deposit asset and mint cToken and supply assets to generate interest rate and return for the user and also to accrue COMP token reward as well, this is core functionality of the protocol.
This is the desired outcome but because markets are never entered the above statement is impossible
Users will miss out on return and accrural of COMP tokens. This is a direct loss of funds for the user.
Impact
Because entering a market is crucial for minting cToken, the lack of calldata for entering markets will cause users to not accrue interest and COMP tokens, this is a direct loss of funds for the user.
Code Snippet
https://github.com/notional-finance/contracts-v2/blob/b20a45c912785fab5f2b62992e5260f44dbae197/contracts/external/pCash/adapters/CompoundV2AssetAdapter.sol#L31-L52
Tool used
Manual Review
Recommendation
We recommend generating calldata to enter and exit markets
The text was updated successfully, but these errors were encountered: