Submitted by rvierdiiev
Users can mint USDO on chain A, then lend this USDO to singularity on chain B and lock singularity tokens to be able to get tap options on chain C.
The first step of this flow is inside MagnetarMintXChainModule.mintBBLendXChainSGL function. This function mints USDO and then initiates LZ message to chain B to process second step using _withdrawToChain function.
When message will be received by USDO on chain B, then receiver will handle compose message and MSG_DEPOSIT_LEND_AND_SEND_FOR_LOCK msg type should be provided to process it correctly. The problem is that USDO will never receive such msg type as it is not allowed.
Lets check how _withdrawToChain function works on chain A. In order to request compose message it should call _lzCustomWithdraw. This function then creates instance of TapiocaOmnichainEngineHelper contract, which will be used to prepare LZ message.
When TapiocaOmnichainEngineHelper will build compose message it will call _sanitizeMsgType function with msg type that is going to be sent.
https://github.com/Tapioca-DAO/tapioca-periph/blob/032396f701be935b04a7e5cf3cb40a0136259dbc/contracts/tapiocaOmnichainEngine/extension/TapiocaOmnichainEngineHelper.sol#L333-L346
As you can see this function allows only some types and other should be handled by _sanitizeMsgTypeExtended function and this function is empty and returns false. It is designed to be extended by other helpers, such as UsdoHelper.
But as _lzCustomWithdraw always creates instance of TapiocaOmnichainEngineHelper it means that some messages will be not allowed and will not work. Thus, whole minting flow that I have described on the beginning wont work.
Users cant mint on one chain and deposit on another.
VsCode
For different oft token you should use different helper. For example, if message is going to be sent to USDO, then UsdoHelper should be used; if message comes to tOft, then ToftHelper is needed.
Or you can set all approved messaged in TapiocaOmnichainEngineHelper instead, then you can leave current design of MagnetarBaseModule.
Error
cryptotechmaker (Tapioca) disputed and commented:
rvierdiiev (warden) commented:
