{
    "Function": "receiveAndSendToken",
    "File": "contracts/cgp/test/ReceiverImplementation.sol",
    "Parent Contracts": [
        "contracts/cgp/test/DepositServiceBase.sol",
        "contracts/cgp/interfaces/IDepositServiceBase.sol"
    ],
    "High-Level Calls": [
        "IERC20",
        "SafeTokenTransfer",
        "IAxelarGateway",
        "IAxelarGateway",
        "IERC20",
        "IERC20",
        "IAxelarDepositService"
    ],
    "Internal Calls": [
        "revert NothingDeposited()",
        "revert InvalidSymbol()"
    ],
    "Library Calls": [
        "safeTransfer"
    ],
    "Low-Level Calls": [],
    "Code": "function receiveAndSendToken(\n        address refundAddress,\n        string calldata destinationChain,\n        string calldata destinationAddress,\n        string calldata symbol\n    ) external {\n        address tokenAddress = IAxelarGateway(gateway).tokenAddresses(symbol);\n        // Checking with AxelarDepositService if need to refund a token\n        address refund = IAxelarDepositService(msg.sender).refundToken();\n\n        if (refund != address(0)) {\n            if (refundAddress == address(0)) refundAddress = msg.sender;\n            IERC20(refund).safeTransfer(refundAddress, IERC20(refund).balanceOf(address(this)));\n            return;\n        }\n\n        uint256 amount = IERC20(tokenAddress).balanceOf(address(this));\n\n        if (tokenAddress == address(0)) revert InvalidSymbol();\n        if (amount == 0) revert NothingDeposited();\n\n        // Not doing safe approval as gateway will revert anyway if approval fails\n        // We expect allowance to always be 0 at this point\n        IERC20(tokenAddress).approve(gateway, amount);\n        // Sending the token trough the gateway\n        IAxelarGateway(gateway).sendToken(destinationChain, destinationAddress, symbol, amount);\n    }"
}