creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "src/fx/voter/FXNVoter.sol": {
        "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity 0.8.19;\n\nimport {ILocker} from \"src/base/interfaces/ILocker.sol\";\nimport {IExecutor} from \"src/base/interfaces/IExecutor.sol\";\n\ncontract FXNVoter {\n    /// @notice Address of the cake locker\n    address public immutable locker;\n\n    /// @notice Address of the pancake gauge controller\n    address public immutable gaugeController;\n\n    /// @notice Address of the governance\n    address public governance;\n\n    /// @notice Address of the future governance\n    address public futureGovernance;\n\n    /// @notice Error emitted when an executor call failed\n    error CallFailed();\n\n    /// @notice Error emitted on auth\n    error NotAllowed();\n\n    /// @notice Event emitted when the future governance accept the gov\n    event GovernanceChanged(address governance);\n\n    modifier onlyGovernance() {\n        if (msg.sender != governance) revert NotAllowed();\n        _;\n    }\n\n    constructor(address _gaugeController, address _locker, address _governance) {\n        locker = _locker;\n        gaugeController = _gaugeController;\n        governance = _governance;\n    }\n\n    /// @notice Vote for the gauge weights\n    /// @param _gauges Array of gauge addresses\n    /// @param _weights Array of weights\n    function voteGauges(address[] calldata _gauges, uint256[] calldata _weights) external onlyGovernance {\n        if(_gauges.length != _weights.length) revert NotAllowed();\n\n        uint256 length = _gauges.length;\n        for (uint256 i; i < length; i++) {\n            bytes memory voteData =\n                abi.encodeWithSignature(\"vote_for_gauge_weights(address,uint256)\", _gauges[i], _weights[i]);\n            (bool success,) = IExecutor(locker).execute(gaugeController, 0, voteData);\n            require(success, \"Voting failed!\");\n        }\n    }\n\n    /// @notice Call the execute function in another compatible contract\n    /// @param _to Address of the contract to interact with the execute()\n    /// @param _value Value to send to the _to contract.\n    /// @param _data Data to send to the _to contract.\n    /// @return success_ Boolean indicating if the execution was successful.\n    function execute(address _to, uint256 _value, bytes calldata _data)\n        external\n        onlyGovernance\n        returns (bool success_, bytes memory result_)\n    {\n        (success_, result_) = ILocker(locker).execute(_to, _value, _data);\n    }\n\n    /// @notice Execute a function.\n    /// @param _to Address of the contract to execute.\n    /// @param _value Value to send to the contract.\n    /// @param _data Data to send to the contract.\n    /// @return success_ Boolean indicating if the execution was successful.\n    /// @return result_ Bytes containing the result of the execution.\n    function executeTo(address _to, uint256 _value, bytes calldata _data)\n        external\n        onlyGovernance\n        returns (bool success_, bytes memory result_)\n    {\n        (success_, result_) = _to.call{value: _value}(_data);\n    }\n\n    function acceptLockerGovernance() external onlyGovernance {\n        ILocker(locker).acceptGovernance();\n    }\n\n    function transferLockerGovernance(address _governance) external onlyGovernance {\n        ILocker(locker).transferGovernance(_governance);\n    }\n\n    /// @notice Transfer the governance to a new address.\n    /// @param _governance Address of the new governance.\n    function transferGovernance(address _governance) external onlyGovernance {\n        futureGovernance = _governance;\n    }\n\n    /// @notice Accept the governance transfer.\n    function acceptGovernance() external {\n        if (msg.sender != futureGovernance) revert NotAllowed();\n\n        governance = msg.sender;\n        futureGovernance = address(0);\n\n        emit GovernanceChanged(msg.sender);\n    }\n}\n"
      },
      "src/base/interfaces/ILocker.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.7;\n\ninterface ILocker {\n    function createLock(uint256, uint256) external;\n\n    function claimAllRewards(address[] calldata _tokens, address _recipient) external;\n\n    function increaseAmount(uint256) external;\n\n    function increaseAmount(uint128) external;\n\n    function increaseUnlockTime(uint256) external;\n\n    function release() external;\n\n    function claimRewards(address, address) external;\n    function claimRewards(address, address, address) external;\n\n    function claimFXSRewards(address) external;\n\n    function claimFPISRewards(address) external;\n\n    function execute(address, uint256, bytes calldata) external returns (bool, bytes memory);\n\n    function setGovernance(address) external;\n\n    function voteGaugeWeight(address, uint256) external;\n\n    function setAngleDepositor(address) external;\n\n    function setDepositor(address) external;\n\n    function setFxsDepositor(address) external;\n\n    function setYFIDepositor(address) external;\n\n    function setYieldDistributor(address) external;\n\n    function setGaugeController(address) external;\n\n    function setAccumulator(address _accumulator) external;\n\n    function governance() external view returns (address);\n\n    function increaseLock(uint256 _value, uint256 _duration) external;\n\n    function release(address _recipient) external;\n\n    function transferGovernance(address _governance) external;\n\n    function acceptGovernance() external;\n}\n"
      },
      "src/base/interfaces/IExecutor.sol": {
        "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity 0.8.19;\n\ninterface IExecutor {\n    function allowAddress(address _address) external;\n\n    function execute(address _to, uint256 _value, bytes calldata _data) external returns (bool, bytes memory);\n\n    function callExecuteTo(address _executor, address _to, uint256 _value, bytes calldata _data)\n        external\n        returns (bool, bytes memory);\n}\n"
      }
    },
    "settings": {
      "remappings": [
        "utils/=lib/utils/",
        "solady/=lib/solady/",
        "forge-std/=lib/forge-std/src/",
        "address-book/=lib/address-book/src/",
        "@openzeppelin/=lib/openzeppelin-contracts/",
        "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
        "solidity-examples/=lib/solidity-examples/contracts/",
        "address-book/=lib/address-book/src/",
        "ds-test/=lib/forge-std/lib/ds-test/src/",
        "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
        "forge-std/=lib/forge-std/src/",
        "openzeppelin/=lib/openzeppelin-contracts/contracts/",
        "solady/=lib/solady/",
        "solmate/=lib/solmate/src/"
      ],
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "metadata": {
        "useLiteralContent": false,
        "bytecodeHash": "ipfs",
        "appendCBOR": true
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "evmVersion": "paris",
      "viaIR": false,
      "libraries": {}
    }
  }}