creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `recipient`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address recipient, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `sender` to `recipient` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(\n        address sender,\n        address recipient,\n        uint256 amount\n    ) external returns (bool);\n\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n    using Address for address;\n\n    function safeTransfer(\n        IERC20 token,\n        address to,\n        uint256 value\n    ) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n    }\n\n    function safeTransferFrom(\n        IERC20 token,\n        address from,\n        address to,\n        uint256 value\n    ) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n    }\n\n    /**\n     * @dev Deprecated. This function has issues similar to the ones found in\n     * {IERC20-approve}, and its usage is discouraged.\n     *\n     * Whenever possible, use {safeIncreaseAllowance} and\n     * {safeDecreaseAllowance} instead.\n     */\n    function safeApprove(\n        IERC20 token,\n        address spender,\n        uint256 value\n    ) internal {\n        // safeApprove should only be called when setting an initial allowance,\n        // or when resetting it to zero. To increase and decrease it, use\n        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n        require(\n            (value == 0) || (token.allowance(address(this), spender) == 0),\n            \"SafeERC20: approve from non-zero to non-zero allowance\"\n        );\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n    }\n\n    function safeIncreaseAllowance(\n        IERC20 token,\n        address spender,\n        uint256 value\n    ) internal {\n        uint256 newAllowance = token.allowance(address(this), spender) + value;\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n    }\n\n    function safeDecreaseAllowance(\n        IERC20 token,\n        address spender,\n        uint256 value\n    ) internal {\n        unchecked {\n            uint256 oldAllowance = token.allowance(address(this), spender);\n            require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n            uint256 newAllowance = oldAllowance - value;\n            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     */\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n        // the target address contains contract code and also asserts for success in the low-level call.\n\n        bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n        if (returndata.length > 0) {\n            // Return data is optional\n            require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize, which returns 0 for contracts in\n        // construction, since the code is only stored at the end of the\n        // constructor execution.\n\n        uint256 size;\n        assembly {\n            size := extcodesize(account)\n        }\n        return size > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCall(target, data, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        require(isContract(target), \"Address: call to non-contract\");\n\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        require(isContract(target), \"Address: static call to non-contract\");\n\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(isContract(target), \"Address: delegate call to non-contract\");\n\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            // Look for revert reason and bubble it up if present\n            if (returndata.length > 0) {\n                // The easiest way to bubble the revert reason is using memory via assembly\n\n                assembly {\n                    let returndata_size := mload(returndata)\n                    revert(add(32, returndata), returndata_size)\n                }\n            } else {\n                revert(errorMessage);\n            }\n        }\n    }\n}\n"
      },
      "contracts/buyback/BaseBuyback.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { Strategizable } from \"../governance/Strategizable.sol\";\nimport \"../interfaces/chainlink/AggregatorV3Interface.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { ICVXLocker } from \"../interfaces/ICVXLocker.sol\";\nimport { ISwapper } from \"../interfaces/ISwapper.sol\";\n\nimport { Initializable } from \"../utils/Initializable.sol\";\n\nabstract contract BaseBuyback is Initializable, Strategizable {\n    using SafeERC20 for IERC20;\n\n    event SwapRouterUpdated(address indexed _address);\n\n    event RewardsSourceUpdated(address indexed _address);\n    event TreasuryManagerUpdated(address indexed _address);\n    event CVXShareBpsUpdated(uint256 bps);\n\n    // Emitted whenever OUSD/OETH is swapped for OGV/CVX or any other token\n    event OTokenBuyback(\n        address indexed oToken,\n        address indexed swappedFor,\n        uint256 swapAmountIn,\n        uint256 minExpected\n    );\n\n    // Address of 1-inch Swap Router\n    address public swapRouter;\n\n    // slither-disable-next-line constable-states\n    address private __deprecated_ousd;\n    // slither-disable-next-line constable-states\n    address private __deprecated_ogv;\n    // slither-disable-next-line constable-states\n    address private __deprecated_usdt;\n    // slither-disable-next-line constable-states\n    address private __deprecated_weth9;\n\n    // Address that receives OGV after swaps\n    address public rewardsSource;\n\n    // Address that receives all other tokens after swaps\n    address public treasuryManager;\n\n    // slither-disable-next-line constable-states\n    uint256 private __deprecated_treasuryBps;\n\n    address public immutable oToken;\n    address public immutable ogv;\n    address public immutable cvx;\n    address public immutable cvxLocker;\n\n    // Amount of `oToken` balance to use for OGV buyback\n    uint256 public balanceForOGV;\n\n    // Amount of `oToken` balance to use for CVX buyback\n    uint256 public balanceForCVX;\n\n    // Percentage of `oToken` balance to be used for CVX\n    uint256 public cvxShareBps; // 10000 = 100%\n\n    constructor(\n        address _oToken,\n        address _ogv,\n        address _cvx,\n        address _cvxLocker\n    ) {\n        // Make sure nobody owns the implementation contract\n        _setGovernor(address(0));\n\n        oToken = _oToken;\n        ogv = _ogv;\n        cvx = _cvx;\n        cvxLocker = _cvxLocker;\n    }\n\n    /**\n     * @param _swapRouter Address of Uniswap V3 Router\n     * @param _strategistAddr Address of Strategist multi-sig wallet\n     * @param _treasuryManagerAddr Address that receives the treasury's share of OUSD\n     * @param _rewardsSource Address of RewardsSource contract\n     * @param _cvxShareBps Percentage of balance to use for CVX\n     */\n    function initialize(\n        address _swapRouter,\n        address _strategistAddr,\n        address _treasuryManagerAddr,\n        address _rewardsSource,\n        uint256 _cvxShareBps\n    ) external onlyGovernor initializer {\n        _setStrategistAddr(_strategistAddr);\n\n        _setSwapRouter(_swapRouter);\n        _setRewardsSource(_rewardsSource);\n\n        _setTreasuryManager(_treasuryManagerAddr);\n\n        _setCVXShareBps(_cvxShareBps);\n    }\n\n    /**\n     * @dev Set address of Uniswap Universal Router for performing liquidation\n     * of platform fee tokens. Setting to 0x0 will pause swaps.\n     *\n     * @param _router Address of the Uniswap Universal router\n     */\n    function setSwapRouter(address _router) external onlyGovernor {\n        _setSwapRouter(_router);\n    }\n\n    function _setSwapRouter(address _router) internal {\n        address oldRouter = swapRouter;\n        swapRouter = _router;\n\n        if (oldRouter != address(0)) {\n            // Remove allowance of old router, if any\n\n            if (IERC20(ogv).allowance(address(this), oldRouter) != 0) {\n                // slither-disable-next-line unused-return\n                IERC20(ogv).safeApprove(oldRouter, 0);\n            }\n\n            if (IERC20(cvx).allowance(address(this), oldRouter) != 0) {\n                // slither-disable-next-line unused-return\n                IERC20(cvx).safeApprove(oldRouter, 0);\n            }\n        }\n\n        emit SwapRouterUpdated(_router);\n    }\n\n    /**\n     * @dev Sets the address that receives the OGV buyback rewards\n     * @param _address Address\n     */\n    function setRewardsSource(address _address) external onlyGovernor {\n        _setRewardsSource(_address);\n    }\n\n    function _setRewardsSource(address _address) internal {\n        require(_address != address(0), \"Address not set\");\n        rewardsSource = _address;\n        emit RewardsSourceUpdated(_address);\n    }\n\n    /**\n     * @dev Sets the address that can receive and manage the funds for Treasury\n     * @param _address Address\n     */\n    function setTreasuryManager(address _address) external onlyGovernor {\n        _setTreasuryManager(_address);\n    }\n\n    function _setTreasuryManager(address _address) internal {\n        require(_address != address(0), \"Address not set\");\n        treasuryManager = _address;\n        emit TreasuryManagerUpdated(_address);\n    }\n\n    /**\n     * @dev Sets the percentage of oToken to use for Flywheel tokens\n     * @param _bps BPS, 10000 to 100%\n     */\n    function setCVXShareBps(uint256 _bps) external onlyGovernor {\n        _setCVXShareBps(_bps);\n    }\n\n    function _setCVXShareBps(uint256 _bps) internal {\n        require(_bps <= 10000, \"Invalid bps value\");\n        cvxShareBps = _bps;\n        emit CVXShareBpsUpdated(_bps);\n    }\n\n    /**\n     * @dev Computes the split of oToken balance that can be\n     *      used for OGV and CVX buybacks.\n     */\n    function _updateBuybackSplits()\n        internal\n        returns (uint256 _balanceForOGV, uint256 _balanceForCVX)\n    {\n        _balanceForOGV = balanceForOGV;\n        _balanceForCVX = balanceForCVX;\n\n        uint256 totalBalance = IERC20(oToken).balanceOf(address(this));\n        uint256 unsplitBalance = totalBalance - _balanceForOGV - _balanceForCVX;\n\n        // Check if all balance is accounted for\n        if (unsplitBalance != 0) {\n            // If not, split unaccounted balance based on `cvxShareBps`\n            uint256 addToCVX = (unsplitBalance * cvxShareBps) / 10000;\n            _balanceForCVX = _balanceForCVX + addToCVX;\n            _balanceForOGV = _balanceForOGV + unsplitBalance - addToCVX;\n\n            // Update storage\n            balanceForOGV = _balanceForOGV;\n            balanceForCVX = _balanceForCVX;\n        }\n    }\n\n    function updateBuybackSplits() external onlyGovernor {\n        // slither-disable-next-line unused-return\n        _updateBuybackSplits();\n    }\n\n    function _swapToken(\n        address tokenOut,\n        uint256 oTokenAmount,\n        uint256 minAmountOut,\n        bytes calldata swapData\n    ) internal returns (uint256 amountOut) {\n        require(oTokenAmount > 0, \"Invalid Swap Amount\");\n        require(swapRouter != address(0), \"Swap Router not set\");\n        require(minAmountOut > 0, \"Invalid minAmount\");\n\n        // Transfer OToken to Swapper for swapping\n        // slither-disable-next-line unchecked-transfer unused-return\n        IERC20(oToken).transfer(swapRouter, oTokenAmount);\n\n        // Swap\n        amountOut = ISwapper(swapRouter).swap(\n            oToken,\n            tokenOut,\n            oTokenAmount,\n            minAmountOut,\n            swapData\n        );\n\n        require(amountOut >= minAmountOut, \"Higher Slippage\");\n\n        emit OTokenBuyback(oToken, tokenOut, minAmountOut, amountOut);\n    }\n\n    /**\n     * @dev Swaps `oTokenAmount` to OGV\n     * @param oTokenAmount Amount of OUSD/OETH to swap\n     * @param minOGV Minimum OGV to receive for oTokenAmount\n     * @param swapData 1inch Swap Data\n     */\n    function swapForOGV(\n        uint256 oTokenAmount,\n        uint256 minOGV,\n        bytes calldata swapData\n    ) external onlyGovernorOrStrategist nonReentrant {\n        (uint256 _amountForOGV, ) = _updateBuybackSplits();\n        require(_amountForOGV >= oTokenAmount, \"Balance underflow\");\n        require(rewardsSource != address(0), \"RewardsSource contract not set\");\n\n        unchecked {\n            // Subtract the amount to swap from net balance\n            balanceForOGV = _amountForOGV - oTokenAmount;\n        }\n\n        uint256 ogvReceived = _swapToken(ogv, oTokenAmount, minOGV, swapData);\n\n        // Transfer OGV received to RewardsSource contract\n        // slither-disable-next-line unchecked-transfer unused-return\n        IERC20(ogv).transfer(rewardsSource, ogvReceived);\n    }\n\n    /**\n     * @dev Swaps `oTokenAmount` to CVX\n     * @param oTokenAmount Amount of OUSD/OETH to swap\n     * @param minCVX Minimum CVX to receive for oTokenAmount\n     * @param swapData 1inch Swap Data\n     */\n    function swapForCVX(\n        uint256 oTokenAmount,\n        uint256 minCVX,\n        bytes calldata swapData\n    ) external onlyGovernorOrStrategist nonReentrant {\n        (, uint256 _amountForCVX) = _updateBuybackSplits();\n        require(_amountForCVX >= oTokenAmount, \"Balance underflow\");\n\n        unchecked {\n            // Subtract the amount to swap from net balance\n            balanceForCVX = _amountForCVX - oTokenAmount;\n        }\n\n        uint256 cvxReceived = _swapToken(cvx, oTokenAmount, minCVX, swapData);\n\n        // Lock all CVX\n        _lockAllCVX(cvxReceived);\n    }\n\n    /**\n     * @dev Locks all CVX held by the contract on behalf of the Treasury Manager\n     */\n    function lockAllCVX() external onlyGovernorOrStrategist {\n        _lockAllCVX(IERC20(cvx).balanceOf(address(this)));\n    }\n\n    function _lockAllCVX(uint256 cvxAmount) internal {\n        require(\n            treasuryManager != address(0),\n            \"Treasury manager address not set\"\n        );\n\n        // Lock all available CVX on behalf of `treasuryManager`\n        ICVXLocker(cvxLocker).lock(treasuryManager, cvxAmount, 0);\n    }\n\n    /**\n     * @dev Approve CVX Locker to move CVX held by this contract\n     */\n    function safeApproveAllTokens() external onlyGovernorOrStrategist {\n        IERC20(cvx).safeApprove(cvxLocker, type(uint256).max);\n    }\n\n    /**\n     * @notice Owner function to withdraw a specific amount of a token\n     * @param token token to be transferered\n     * @param amount amount of the token to be transferred\n     */\n    function transferToken(address token, uint256 amount)\n        external\n        onlyGovernor\n        nonReentrant\n    {\n        IERC20(token).safeTransfer(_governor(), amount);\n    }\n}\n"
      },
      "contracts/buyback/OUSDBuyback.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { BaseBuyback } from \"./BaseBuyback.sol\";\n\ncontract OUSDBuyback is BaseBuyback {\n    constructor(\n        address _oToken,\n        address _ogv,\n        address _cvx,\n        address _cvxLocker\n    ) BaseBuyback(_oToken, _ogv, _cvx, _cvxLocker) {}\n}\n"
      },
      "contracts/governance/Governable.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title Base for contracts that are managed by the Origin Protocol's Governor.\n * @dev Copy of the openzeppelin Ownable.sol contract with nomenclature change\n *      from owner to governor and renounce methods removed. Does not use\n *      Context.sol like Ownable.sol does for simplification.\n * @author Origin Protocol Inc\n */\ncontract Governable {\n    // Storage position of the owner and pendingOwner of the contract\n    // keccak256(\"OUSD.governor\");\n    bytes32 private constant governorPosition =\n        0x7bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4a;\n\n    // keccak256(\"OUSD.pending.governor\");\n    bytes32 private constant pendingGovernorPosition =\n        0x44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db;\n\n    // keccak256(\"OUSD.reentry.status\");\n    bytes32 private constant reentryStatusPosition =\n        0x53bf423e48ed90e97d02ab0ebab13b2a235a6bfbe9c321847d5c175333ac4535;\n\n    // See OpenZeppelin ReentrancyGuard implementation\n    uint256 constant _NOT_ENTERED = 1;\n    uint256 constant _ENTERED = 2;\n\n    event PendingGovernorshipTransfer(\n        address indexed previousGovernor,\n        address indexed newGovernor\n    );\n\n    event GovernorshipTransferred(\n        address indexed previousGovernor,\n        address indexed newGovernor\n    );\n\n    /**\n     * @dev Initializes the contract setting the deployer as the initial Governor.\n     */\n    constructor() {\n        _setGovernor(msg.sender);\n        emit GovernorshipTransferred(address(0), _governor());\n    }\n\n    /**\n     * @notice Returns the address of the current Governor.\n     */\n    function governor() public view returns (address) {\n        return _governor();\n    }\n\n    /**\n     * @dev Returns the address of the current Governor.\n     */\n    function _governor() internal view returns (address governorOut) {\n        bytes32 position = governorPosition;\n        // solhint-disable-next-line no-inline-assembly\n        assembly {\n            governorOut := sload(position)\n        }\n    }\n\n    /**\n     * @dev Returns the address of the pending Governor.\n     */\n    function _pendingGovernor()\n        internal\n        view\n        returns (address pendingGovernor)\n    {\n        bytes32 position = pendingGovernorPosition;\n        // solhint-disable-next-line no-inline-assembly\n        assembly {\n            pendingGovernor := sload(position)\n        }\n    }\n\n    /**\n     * @dev Throws if called by any account other than the Governor.\n     */\n    modifier onlyGovernor() {\n        require(isGovernor(), \"Caller is not the Governor\");\n        _;\n    }\n\n    /**\n     * @notice Returns true if the caller is the current Governor.\n     */\n    function isGovernor() public view returns (bool) {\n        return msg.sender == _governor();\n    }\n\n    function _setGovernor(address newGovernor) internal {\n        bytes32 position = governorPosition;\n        // solhint-disable-next-line no-inline-assembly\n        assembly {\n            sstore(position, newGovernor)\n        }\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and make it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        bytes32 position = reentryStatusPosition;\n        uint256 _reentry_status;\n        // solhint-disable-next-line no-inline-assembly\n        assembly {\n            _reentry_status := sload(position)\n        }\n\n        // On the first call to nonReentrant, _notEntered will be true\n        require(_reentry_status != _ENTERED, \"Reentrant call\");\n\n        // Any calls to nonReentrant after this point will fail\n        // solhint-disable-next-line no-inline-assembly\n        assembly {\n            sstore(position, _ENTERED)\n        }\n\n        _;\n\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        // solhint-disable-next-line no-inline-assembly\n        assembly {\n            sstore(position, _NOT_ENTERED)\n        }\n    }\n\n    function _setPendingGovernor(address newGovernor) internal {\n        bytes32 position = pendingGovernorPosition;\n        // solhint-disable-next-line no-inline-assembly\n        assembly {\n            sstore(position, newGovernor)\n        }\n    }\n\n    /**\n     * @notice Transfers Governance of the contract to a new account (`newGovernor`).\n     * Can only be called by the current Governor. Must be claimed for this to complete\n     * @param _newGovernor Address of the new Governor\n     */\n    function transferGovernance(address _newGovernor) external onlyGovernor {\n        _setPendingGovernor(_newGovernor);\n        emit PendingGovernorshipTransfer(_governor(), _newGovernor);\n    }\n\n    /**\n     * @notice Claim Governance of the contract to a new account (`newGovernor`).\n     * Can only be called by the new Governor.\n     */\n    function claimGovernance() external {\n        require(\n            msg.sender == _pendingGovernor(),\n            \"Only the pending Governor can complete the claim\"\n        );\n        _changeGovernor(msg.sender);\n    }\n\n    /**\n     * @dev Change Governance of the contract to a new account (`newGovernor`).\n     * @param _newGovernor Address of the new Governor\n     */\n    function _changeGovernor(address _newGovernor) internal {\n        require(_newGovernor != address(0), \"New Governor is address(0)\");\n        emit GovernorshipTransferred(_governor(), _newGovernor);\n        _setGovernor(_newGovernor);\n    }\n}\n"
      },
      "contracts/governance/Strategizable.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { Governable } from \"./Governable.sol\";\n\ncontract Strategizable is Governable {\n    event StrategistUpdated(address _address);\n\n    // Address of strategist\n    address public strategistAddr;\n\n    // For future use\n    uint256[50] private __gap;\n\n    /**\n     * @dev Verifies that the caller is either Governor or Strategist.\n     */\n    modifier onlyGovernorOrStrategist() {\n        require(\n            msg.sender == strategistAddr || isGovernor(),\n            \"Caller is not the Strategist or Governor\"\n        );\n        _;\n    }\n\n    /**\n     * @dev Set address of Strategist\n     * @param _address Address of Strategist\n     */\n    function setStrategistAddr(address _address) external onlyGovernor {\n        _setStrategistAddr(_address);\n    }\n\n    /**\n     * @dev Set address of Strategist\n     * @param _address Address of Strategist\n     */\n    function _setStrategistAddr(address _address) internal {\n        strategistAddr = _address;\n        emit StrategistUpdated(_address);\n    }\n}\n"
      },
      "contracts/interfaces/chainlink/AggregatorV3Interface.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface AggregatorV3Interface {\n    function decimals() external view returns (uint8);\n\n    function description() external view returns (string memory);\n\n    function version() external view returns (uint256);\n\n    // getRoundData and latestRoundData should both raise \"No data present\"\n    // if they do not have data to report, instead of returning unset values\n    // which could be misinterpreted as actual reported values.\n    function getRoundData(uint80 _roundId)\n        external\n        view\n        returns (\n            uint80 roundId,\n            int256 answer,\n            uint256 startedAt,\n            uint256 updatedAt,\n            uint80 answeredInRound\n        );\n\n    function latestRoundData()\n        external\n        view\n        returns (\n            uint80 roundId,\n            int256 answer,\n            uint256 startedAt,\n            uint256 updatedAt,\n            uint80 answeredInRound\n        );\n}\n"
      },
      "contracts/interfaces/ICVXLocker.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface ICVXLocker {\n    function lock(\n        address _account,\n        uint256 _amount,\n        uint256 _spendRatio\n    ) external;\n\n    function lockedBalanceOf(address _account) external view returns (uint256);\n}\n"
      },
      "contracts/interfaces/ISwapper.sol": {
        "content": "pragma solidity ^0.8.0;\n\ninterface ISwapper {\n    /**\n     * @param fromAsset The token address of the asset being sold.\n     * @param toAsset The token address of the asset being purchased.\n     * @param fromAssetAmount The amount of assets being sold.\n     * @param minToAssetAmmount The minimum amount of assets to be purchased.\n     * @param data tx.data returned from 1Inch's /v5.0/1/swap API\n     */\n    function swap(\n        address fromAsset,\n        address toAsset,\n        uint256 fromAssetAmount,\n        uint256 minToAssetAmmount,\n        bytes calldata data\n    ) external returns (uint256 toAssetAmount);\n}\n"
      },
      "contracts/utils/Initializable.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title Base contract any contracts that need to initialize state after deployment.\n * @author Origin Protocol Inc\n */\nabstract contract Initializable {\n    /**\n     * @dev Indicates that the contract has been initialized.\n     */\n    bool private initialized;\n\n    /**\n     * @dev Indicates that the contract is in the process of being initialized.\n     */\n    bool private initializing;\n\n    /**\n     * @dev Modifier to protect an initializer function from being invoked twice.\n     */\n    modifier initializer() {\n        require(\n            initializing || !initialized,\n            \"Initializable: contract is already initialized\"\n        );\n\n        bool isTopLevelCall = !initializing;\n        if (isTopLevelCall) {\n            initializing = true;\n            initialized = true;\n        }\n\n        _;\n\n        if (isTopLevelCall) {\n            initializing = false;\n        }\n    }\n\n    uint256[50] private ______gap;\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "metadata": {
        "useLiteralContent": true
      },
      "libraries": {}
    }
  }}