{
    "Function": "upgrade",
    "File": "contracts/AxelarGateway.sol",
    "Parent Contracts": [
        "contracts/AdminMultisigBase.sol",
        "contracts/EternalStorage.sol",
        "contracts/interfaces/IAxelarGateway.sol"
    ],
    "High-Level Calls": [],
    "Internal Calls": [
        "codehash(address)",
        "onlyAdmin",
        "revert InvalidCodeHash()",
        "revert SetupFailed()",
        "_setImplementation",
        "abi.encodeWithSelector()"
    ],
    "Library Calls": [],
    "Low-Level Calls": [
        "delegatecall"
    ],
    "Code": "function upgrade(\n        address newImplementation,\n        bytes32 newImplementationCodeHash,\n        bytes calldata setupParams\n    ) external override onlyAdmin {\n        if (newImplementationCodeHash != newImplementation.codehash) revert InvalidCodeHash();\n\n        emit Upgraded(newImplementation);\n\n        // AUDIT: If `newImplementation.setup` performs `selfdestruct`, it will result in the loss of _this_ implementation (thereby losing the gateway)\n        //        if `upgrade` is entered within the context of _this_ implementation itself.\n        if (setupParams.length != 0) {\n            (bool success, ) = newImplementation.delegatecall(abi.encodeWithSelector(IAxelarGateway.setup.selector, setupParams));\n\n            if (!success) revert SetupFailed();\n        }\n\n        _setImplementation(newImplementation);\n    }"
}