creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "src/velo-fed/VeloFarmerMessengerV3.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\n/**\n * @title ICrossDomainMessenger\n */\ninterface ICrossDomainMessenger {\n    /**********\n     * Events *\n     **********/\n\n    event SentMessage(\n        address indexed target,\n        address sender,\n        bytes message,\n        uint256 messageNonce,\n        uint256 gasLimit\n    );\n    event RelayedMessage(bytes32 indexed msgHash);\n    event FailedRelayedMessage(bytes32 indexed msgHash);\n\n    /*************\n     * Variables *\n     *************/\n\n    function xDomainMessageSender() external view returns (address);\n\n    /********************\n     * Public Functions *\n     ********************/\n\n    /**\n     * Sends a cross domain message to the target messenger.\n     * @param _target Target contract address.\n     * @param _message Message to send to the target.\n     * @param _gasLimit Gas limit for the provided message.\n     */\n    function sendMessage(\n        address _target,\n        bytes calldata _message,\n        uint32 _gasLimit\n    ) external;\n}\n\ncontract VeloFarmerMessengerV3 {\n    ICrossDomainMessenger constant crossDomainMessenger = ICrossDomainMessenger(0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1);\n    address public veloFed;\n    address public gov;\n    address public pendingGov;\n    address public guardian;\n    address public chair;\n\n    uint32 public gasLimit = 750_000;\n\n    constructor(address gov_, address chair_, address guardian_, address veloFed_) {\n        gov = gov_;\n        chair = chair_;\n        guardian = guardian_;\n        veloFed = veloFed_;\n    } \n\n    modifier onlyGov {\n        if (msg.sender != gov) revert OnlyGov();\n        _;\n    }\n\n    modifier onlyGovOrGuardian {\n        if (msg.sender != gov && msg.sender != guardian) revert OnlyGov();\n        _;\n    }\n\n    modifier onlyPendingGov {\n        if (msg.sender != pendingGov) revert OnlyPendingGov();\n        _;\n    }\n\n    modifier onlyChair {\n        if (msg.sender != chair) revert OnlyChair();\n        _;\n    }\n\n    error OnlyGov();\n    error OnlyGovOrGuardian();\n    error OnlyPendingGov();\n    error OnlyChair();\n\n    //Helper functions\n\n    function sendMessage(bytes memory message) internal {\n        crossDomainMessenger.sendMessage(address(veloFed), message, gasLimit);\n    }\n\n    //Gov Messaging functions\n\n    function setMaxSlippageDolaToUsdc(uint newSlippage_) public onlyGovOrGuardian {\n        sendMessage(abi.encodeWithSignature(\"setMaxSlippageDolaToUsdc(uint256)\", newSlippage_));\n    }\n\n    function setMaxSlippageUsdcToDola(uint newSlippage_) public onlyGovOrGuardian {\n        sendMessage(abi.encodeWithSignature(\"setMaxSlippageUsdcToDola(uint256)\", newSlippage_));\n    }\n\n    function setMaxSlippageDolaToUsdcNative(uint newSlippage_) public onlyGovOrGuardian {\n        sendMessage(abi.encodeWithSignature(\"setMaxSlippageDolaToUsdcNative(uint256)\", newSlippage_));\n    }\n\n    function setMaxSlippageUsdcNativeToDola(uint newSlippage_) public onlyGovOrGuardian {\n        sendMessage(abi.encodeWithSignature(\"setMaxSlippageUsdcNativeToDola(uint256)\", newSlippage_));\n    }\n\n    function setMaxSlippageUsdcToUsdcNative(uint newSlippage_) public onlyGovOrGuardian {\n        sendMessage(abi.encodeWithSignature(\"setMaxSlippageUsdcToUsdcNative(uint256)\", newSlippage_));\n    }\n\n    function setMaxSlippageUsdcNativeToUsdc(uint newSlippage_) public onlyGovOrGuardian {\n        sendMessage(abi.encodeWithSignature(\"setMaxSlippageUsdcNativeToUsdc(uint256)\", newSlippage_));\n    }\n\n    function setMaxSlippageLiquidity(uint newSlippage_) public onlyGovOrGuardian {\n        sendMessage(abi.encodeWithSignature(\"setMaxSlippageLiquidity(uint256)\", newSlippage_));\n    }\n\n    function setPendingGov(address newPendingGov_) public onlyGov {\n        sendMessage(abi.encodeWithSignature(\"setPendingGov(address)\", newPendingGov_));\n    }\n\n    function claimGov() public onlyGov {\n        sendMessage(abi.encodeWithSignature(\"claimGov()\"));\n    }\n\n    function changeTreasury(address newTreasury_) public onlyGov {\n        sendMessage(abi.encodeWithSignature(\"changeTreasury(address)\", newTreasury_));\n    }\n\n    function changeChair(address newChair_) public onlyGov {\n        sendMessage(abi.encodeWithSignature(\"changeChair(address)\", newChair_));\n    }\n\n    function changeGuardian(address newGuardian_) public onlyGov {\n        sendMessage(abi.encodeWithSignature(\"changeGuardian(address)\", newGuardian_));\n    }\n\n    function changeL2Chair(address newChair_) public onlyGov {\n        sendMessage(abi.encodeWithSignature(\"changeL2Chair(address)\", newChair_));\n    }\n\n    function changeOptiFed(address optiFed_) public onlyGov {\n        sendMessage(abi.encodeWithSignature(\"changeOptiFed(address)\", optiFed_));\n    }\n\n    //Chair messaging functions\n\n    function claimVeloRewards() public onlyChair {\n        sendMessage(abi.encodeWithSignature(\"claimVeloRewards()\"));\n    }\n\n    function claimRewards(address[] calldata addrs) public onlyChair {\n        sendMessage(abi.encodeWithSignature(\"claimRewards(address)\", addrs));\n    }\n\n    function swapAndDeposit(uint dolaAmount) public onlyChair {\n        sendMessage(abi.encodeWithSignature(\"swapAndDeposit(uint256)\", dolaAmount));\n    }\n\n    function deposit(uint dolaAmount, uint usdcAmount) public onlyChair {\n        sendMessage(abi.encodeWithSignature(\"deposit(uint256,uint256)\", dolaAmount, usdcAmount));\n    }\n\n    function withdrawLiquidity(uint dolaAmount) public onlyChair {\n        sendMessage(abi.encodeWithSignature(\"withdrawLiquidity(uint256)\", dolaAmount));\n    }\n\n    function withdrawLiquidityAndSwapToDola(uint dolaAmount) public onlyChair {\n        sendMessage(abi.encodeWithSignature(\"withdrawLiquidityAndSwapToDOLA(uint256)\", dolaAmount));\n    }\n\n    function withdrawToL1OptiFed(uint dolaAmount) public onlyChair {\n        sendMessage(abi.encodeWithSignature(\"withdrawToL1OptiFed(uint256)\", dolaAmount));\n    }\n\n    function withdrawToL1OptiFedNative(uint dolaAmount, uint usdcAmount) public onlyChair {\n        sendMessage(abi.encodeWithSignature(\"withdrawToL1OptiFedNative(uint256,uint256)\", dolaAmount, usdcAmount));\n    }\n\n    function withdrawToL1OptiFedNative(uint usdcAmount) public onlyChair {\n        sendMessage(abi.encodeWithSignature(\"withdrawToL1OptiFedNative(uint256)\", usdcAmount));\n    }\n\n    function withdrawToL1OptiFedBridged(uint usdcAmount) public onlyChair {\n        sendMessage(abi.encodeWithSignature(\"withdrawToL1OptiFedBridged(uint256)\", usdcAmount));\n    }\n    \n    function withdrawTokensToL1(address l2Token, uint amount) public onlyChair {\n        sendMessage(abi.encodeWithSignature(\"withdrawTokensToL1(address, uint256)\", l2Token, amount));\n    }\n    \n    function swapUSDCtoDOLA(uint usdcAmount) public onlyChair {\n        sendMessage(abi.encodeWithSignature(\"swapUSDCtoDOLA(uint256)\", usdcAmount));\n    }\n\n    function swapDOLAtoUSDC(uint usdcAmount) public onlyChair {\n        sendMessage(abi.encodeWithSignature(\"swapDOLAtoUSDC(uint256)\", usdcAmount));\n    }\n\n    function swapDOLAtoUSDCNative(uint dolaAmount) public onlyChair {\n        sendMessage(abi.encodeWithSignature(\"swapDOLAtoUSDCNative(uint256)\", dolaAmount));\n    }\n\n    function swapUSDCNativetoDOLA(uint usdcAmount) public onlyChair {\n        sendMessage(abi.encodeWithSignature(\"swapUSDCNativetoDOLA(uint256)\", usdcAmount));\n    }\n\n    function swapUSDCtoUSDCNative(uint usdcAmount) public onlyChair {\n        sendMessage(abi.encodeWithSignature(\"swapUSDCtoUSDCNative(uint256)\", usdcAmount));\n    }\n\n    function swapUSDCNativetoUSDC(uint usdcAmount) public onlyChair {\n        sendMessage(abi.encodeWithSignature(\"swapUSDCNativetoUSDC(uint256)\", usdcAmount));\n    }\n    \n    function resign() public onlyChair {\n        sendMessage(abi.encodeWithSignature(\"resign()\"));\n    }\n\n    //Gov functions\n\n    function setGasLimit(uint32 newGasLimit_) public onlyGov {\n        gasLimit = newGasLimit_;\n    }\n\n    function setPendingMessengerGov(address newPendingGov_) public onlyGov {\n        pendingGov = newPendingGov_;\n    }\n\n    function claimMessengerGov() public onlyPendingGov {\n        gov = pendingGov;\n        pendingGov = address(0);\n    }\n\n    function changeMessengerChair(address newChair_) public onlyGov {\n        chair = newChair_;\n    }\n\n    function changeMessengerGuardian(address newGuardian_) public onlyGov {\n        guardian = newGuardian_;\n    }\n\n    function setVeloFed(address veloFed_) public onlyGov {\n        veloFed = veloFed_;\n    }\n}\n"
      }
    },
    "settings": {
      "remappings": [
        "arbitrum/=lib/arbitrum/contracts/",
        "@arbitrum/=lib/arbitrum/node_modules/@arbitrum/",
        "@offchainlabs/=lib/arbitrum/node_modules/@offchainlabs/",
        "@openzeppelin/contracts-upgradeable/=lib/arbitrum/node_modules/@openzeppelin/contracts-upgradeable/",
        "@openzeppelin/contracts/=lib/openzeppelin/contracts/",
        "arbitrum-nitro/=lib/arbitrum-nitro/",
        "ds-test/=lib/forge-std/lib/ds-test/src/",
        "erc4626-tests/=lib/openzeppelin/lib/erc4626-tests/",
        "forge-std/=lib/forge-std/src/",
        "nitro-contracts/=lib/arbitrum/lib/nitro-contracts/src/",
        "openzeppelin/=lib/openzeppelin/"
      ],
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "metadata": {
        "useLiteralContent": false,
        "bytecodeHash": "ipfs"
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "evmVersion": "london",
      "viaIR": false,
      "libraries": {}
    }
  }}