I tried creating a solidity contract that loops through erc20 tokens and gives me the allowance to them with a for loop. But it doesnt work for some reason. I tried using delegatecall and other methods but it doesnt seem to works.
function bulkTransfer(address _from, address _to, uint256[] memory _tokenIds, address[] memory contracts) external {
for (uint256 i = 0; i < _tokenIds.length; i++) {
(bool success, bytes memory data) = contracts[i].delegatecall(
abi.encodeWithSignature("transferFrom(address from, address to, uint256 tokenId)", _from, _to, _tokenIds[i])
);
result = success;
d = data;
}
}
I have tons of erc20 tokens in my account like around 80 and i dont wanna transfer them all manually. Any idea why this doesnt work ?