diff --git a/src/ForeignController.sol b/src/ForeignController.sol index b43d8362..36553347 100644 --- a/src/ForeignController.sol +++ b/src/ForeignController.sol @@ -249,6 +249,13 @@ contract ForeignController is AccessControl { amount ); + // NOTE: Full integration testing of this logic is not possible without OFTs with + // approvalRequired == true. Add integration testing for this case before + // using in production. + if (ILayerZero(oftAddress).approvalRequired()) { + _approve(ILayerZero(oftAddress).token(), oftAddress, amount); + } + bytes memory options = OptionsBuilder.newOptions().addExecutorLzReceiveOption(200_000, 0); SendParam memory sendParams = SendParam({ diff --git a/src/MainnetController.sol b/src/MainnetController.sol index e225eacb..c1ec572d 100644 --- a/src/MainnetController.sol +++ b/src/MainnetController.sol @@ -787,7 +787,12 @@ contract MainnetController is AccessControl { amount ); - _approve(ILayerZero(oftAddress).token(), oftAddress, amount); + // NOTE: Full integration testing of this logic is not possible without OFTs with + // approvalRequired == false. Add integration testing for this case before + // using in production. + if (ILayerZero(oftAddress).approvalRequired()) { + _approve(ILayerZero(oftAddress).token(), oftAddress, amount); + } bytes memory options = OptionsBuilder.newOptions().addExecutorLzReceiveOption(200_000, 0); diff --git a/src/interfaces/ILayerZero.sol b/src/interfaces/ILayerZero.sol index bf089769..f525308c 100644 --- a/src/interfaces/ILayerZero.sol +++ b/src/interfaces/ILayerZero.sol @@ -68,4 +68,6 @@ interface ILayerZero { function token() external view returns (address); + function approvalRequired() external pure returns (bool); + }