@@ -14,10 +14,10 @@ import { VaultComposerSync } from "./VaultComposerSync.sol";
1414/**
1515 * @title Synchronous Vault Composer with Stargate NativePools as Asset and WETH as Share
1616 * @author LayerZero Labs (@shankars99)
17- * @dev Extends VaultComposerSync with Pool-specific behavior such as oft. token wrapping
17+ * @dev Extends VaultComposerSync with Pool-specific behavior such as OFT token wrapping
1818 * @dev WETH is used as the asset token for the vault instead of native token (ETH)
19- * @dev DepositAndSend and Deposit use asset token (WETH) instead of native token (ETH )
20- * @dev DepositNativeAndSend allows for deposits with ETH
19+ * @dev `depositAndSend` uses asset token (WETH)
20+ * @dev `depositNativeAndSend` allows for deposits with ETH
2121 * @dev Redemptions always output the asset token (WETH)
2222 * @dev Compatible with ERC4626 vaults and requires Share OFT to be an adapter
2323 */
@@ -43,7 +43,7 @@ contract VaultComposerSyncNative is VaultComposerSync, IVaultComposerSyncNative
4343 * @dev Reduction of ComposerNative into ComposerBase by wrapping ETH into WETH
4444 * @dev All internal logic handles WETH as the asset token making deposit symmetric to redemption
4545 * @dev The native token used here was sent during lzReceive from the Pool
46- * @dev lzCompose calls comes from the Endpoint and are not affected by the wrapNative call
46+ @dev Inherits entry authorization from parent contract
4747 */
4848 function lzCompose (
4949 address _composeSender , // The OFT used on refund, also the vaultIn token.
@@ -53,6 +53,7 @@ contract VaultComposerSyncNative is VaultComposerSync, IVaultComposerSyncNative
5353 bytes calldata _extraData
5454 ) public payable virtual override {
5555 /// @dev Wrap ETH received during lzReceive into WETH
56+ /// @dev Conversion happens here to avoid running out of gas in the receive function
5657 if (_composeSender == ASSET_OFT) IWETH (ASSET_ERC20).deposit { value: _message.amountLD () }();
5758
5859 /// @dev Since lzCompose is public, the msg.value called to pay the tx Fee is automatically forwarded
@@ -103,8 +104,8 @@ contract VaultComposerSyncNative is VaultComposerSync, IVaultComposerSyncNative
103104
104105 /// @dev Safe because this is the only function in VaultComposerSync that calls oft.send()
105106 if (_oft == ASSET_OFT) {
106- /// @dev In deposit's lzReceive () we converted ETH to WETH.
107- /// @dev Incase of redemption the vault outputs WETH.
107+ /// @dev In deposit's lzCompose () we converted ETH to WETH.
108+ /// @dev In a redemption, the vault outputs WETH.
108109 /// @dev So we always have WETH at this point which we unwrap to ETH for the Stargate Pool
109110 IWETH (ASSET_ERC20).withdraw (_sendParam.amountLD);
110111 /// @dev MsgValue passed to Stargate Pool is nativeFee + amountLD
@@ -132,6 +133,6 @@ contract VaultComposerSyncNative is VaultComposerSync, IVaultComposerSyncNative
132133
133134 receive () external payable virtual {
134135 /// @dev From ASSET_OFT for NativeOFT::lzReceive and from ASSET_ERC20 for WETH::withdraw
135- if (msg .sender != ASSET_OFT && msg .sender != ASSET_ERC20) revert ETHTransferOnlyFromAssetOFT ();
136+ if (msg .sender != ASSET_OFT && msg .sender != ASSET_ERC20) revert ETHTransferNotFromAsset ();
136137 }
137138}
0 commit comments