From a4b62054700d73a225da76399588160279267fe1 Mon Sep 17 00:00:00 2001 From: Matthew Pilsbury Date: Wed, 18 Sep 2024 19:03:20 -0400 Subject: [PATCH] test updated 4naly3er SARIF --- src/delegateLoop.sol | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/delegateLoop.sol diff --git a/src/delegateLoop.sol b/src/delegateLoop.sol new file mode 100644 index 0000000..d1976a4 --- /dev/null +++ b/src/delegateLoop.sol @@ -0,0 +1,15 @@ +contract DelegateCaller { + address public libraryAddress; // Address of the library contract + + constructor(address _libraryAddress) { + libraryAddress = _libraryAddress; + } + + // Function to perform delegatecall inside a loop + function delegateInLoop(address[] calldata targets, bytes calldata data) external { + for (uint i = 0; i < targets.length; i++) { + (bool success, ) = targets[i].delegatecall(abi.encodePacked(data)); + require(success, "Delegatecall failed"); + } + } +}