Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/ForeignController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
7 changes: 6 additions & 1 deletion src/MainnetController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/ILayerZero.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,6 @@ interface ILayerZero {

function token() external view returns (address);

function approvalRequired() external pure returns (bool);

}
Loading