{
    "Function": "redeem",
    "File": "contracts/mock/MockzpaToken.sol",
    "Parent Contracts": [
        "contracts/interfaces/Stabilize.sol",
        "node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol",
        "node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol",
        "node_modules/@openzeppelin/contracts/GSN/Context.sol"
    ],
    "High-Level Calls": [
        "SafeMath",
        "SafeMath",
        "SafeMath",
        "SafeMath",
        "SafeERC20",
        "SafeMath",
        "SafeMath",
        "SafeMath",
        "SafeERC20",
        "SafeMath",
        "SafeMath",
        "SafeMath",
        "SafeMath",
        "SafeMath"
    ],
    "Internal Calls": [
        "_msgSender",
        "_burn",
        "_msgSender",
        "pricePerToken",
        "_msgSender"
    ],
    "Library Calls": [
        "div",
        "div",
        "sub",
        "mul",
        "mul",
        "safeTransfer",
        "sub",
        "sub",
        "sub",
        "sub",
        "sub",
        "mul",
        "div",
        "safeTransfer"
    ],
    "Low-Level Calls": [],
    "Code": "function redeem(uint256 _amount) external override {\n        uint256 _underlyingAmount = _amount.mul(pricePerToken()).div(1e18);\n        _burn(msg.sender, _amount);\n\n        // Pay fee upon withdrawing\n        if (userInfo[_msgSender()].depositTime == 0) {\n            // The user has never deposited here\n            userInfo[_msgSender()].depositTime = block.timestamp; // Give them the max fee\n        }\n\n        uint256 feeSubtraction = initialFee.sub(endFee).mul(block.timestamp.sub(userInfo[_msgSender()].depositTime)).div(feeDuration);\n        if (feeSubtraction > initialFee.sub(endFee)) {\n            // Cannot reduce fee more than this\n            feeSubtraction = initialFee.sub(endFee);\n        }\n        uint256 fee = initialFee.sub(feeSubtraction);\n        fee = _underlyingAmount.mul(fee).div(divisionFactor);\n        _underlyingAmount = _underlyingAmount.sub(fee);\n\n        // Now withdraw this amount to the user and send fee to treasury\n        IERC20(underlyingAsset).safeTransfer(msg.sender, _underlyingAmount);\n        IERC20(underlyingAsset).safeTransfer(DEAD, fee);\n    }"
}