{
    "Function": "_delegateMulti",
    "File": "contracts/ERC20MultiDelegate.sol",
    "Parent Contracts": [
        "node_modules/@openzeppelin/contracts/access/Ownable.sol",
        "node_modules/@openzeppelin/contracts/token/ERC1155/ERC1155.sol",
        "node_modules/@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol",
        "node_modules/@openzeppelin/contracts/token/ERC1155/IERC1155.sol",
        "node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol",
        "node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol",
        "node_modules/@openzeppelin/contracts/utils/Context.sol"
    ],
    "High-Level Calls": [
        "Math",
        "Math",
        "Math"
    ],
    "Internal Calls": [
        "_reimburse",
        "_processDelegation",
        "_burnBatch",
        "createProxyDelegatorAndTransfer",
        "_mintBatch",
        "require(bool,string)",
        "require(bool,string)"
    ],
    "Library Calls": [
        "min",
        "max",
        "max"
    ],
    "Low-Level Calls": [],
    "Code": "function _delegateMulti(\n        uint256[] calldata sources,\n        uint256[] calldata targets,\n        uint256[] calldata amounts\n    ) internal {\n        uint256 sourcesLength = sources.length;\n        uint256 targetsLength = targets.length;\n        uint256 amountsLength = amounts.length;\n\n        require(\n            sourcesLength > 0 || targetsLength > 0,\n            \"Delegate: You should provide at least one source or one target delegate\"\n        );\n\n        require(\n            Math.max(sourcesLength, targetsLength) == amountsLength,\n            \"Delegate: The number of amounts must be equal to the greater of the number of sources or targets\"\n        );\n\n        // Iterate until all source and target delegates have been processed.\n        for (\n            uint transferIndex = 0;\n            transferIndex < Math.max(sourcesLength, targetsLength);\n            transferIndex++\n        ) {\n            address source = transferIndex < sourcesLength\n                ? address(uint160(sources[transferIndex]))\n                : address(0);\n            address target = transferIndex < targetsLength\n                ? address(uint160(targets[transferIndex]))\n                : address(0);\n            uint256 amount = amounts[transferIndex];\n\n            if (transferIndex < Math.min(sourcesLength, targetsLength)) {\n                // Process the delegation transfer between the current source and target delegate pair.\n                _processDelegation(source, target, amount);\n            } else if (transferIndex < sourcesLength) {\n                // Handle any remaining source amounts after the transfer process.\n                _reimburse(source, amount);\n            } else if (transferIndex < targetsLength) {\n                // Handle any remaining target amounts after the transfer process.\n                createProxyDelegatorAndTransfer(target, amount);\n            }\n        }\n\n        if (sourcesLength > 0) {\n            _burnBatch(msg.sender, sources, amounts[:sourcesLength]);\n        }\n        if (targetsLength > 0) {\n            _mintBatch(msg.sender, targets, amounts[:targetsLength], \"\");\n        }\n    }"
}