{
    "Function": "slitherConstructorVariables",
    "File": "src/StakeAtRisk.sol",
    "Parent Contracts": [],
    "High-Level Calls": [],
    "Internal Calls": [],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "contract StakeAtRisk {\n\n    /*//////////////////////////////////////////////////////////////\n                                EVENTS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Event emitted when NRNs are reclaimed from this contract (after a win in ranked).\n    event ReclaimedStake(uint256 fighterId, uint256 reclaimAmount);\n\n    /// @notice Event emitted when more NRNs are placed at risk.\n    event IncreasedStakeAtRisk(uint256 fighterId, uint256 atRiskAmount);\n\n    /*//////////////////////////////////////////////////////////////\n                            STATE VARIABLES\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice The current roundId.\n    uint256 public roundId = 0;    \n\n    /// @notice The treasury address.\n    address public treasuryAddress;\n\n    /// @notice The RankedBattle contract address.\n    address _rankedBattleAddress;\n\n    /// @notice The Neuron contract instance.\n    Neuron _neuronInstance;\n    \n    /*//////////////////////////////////////////////////////////////\n                                MAPPINGS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Maps the roundId to the total stake at risk for that round.\n    mapping(uint256 => uint256) public totalStakeAtRisk;\n\n    /// @notice Maps the roundId to the fighterId to the stake at risk for that fighter.\n    mapping(uint256 => mapping(uint256 => uint256)) public stakeAtRisk;\n\n    /// @notice Mapping of address to the amount of NRNs that have been swept.\n    mapping(address => uint256) public amountLost;\n\n    /*//////////////////////////////////////////////////////////////\n                               CONSTRUCTOR\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Sets the community treasury address and ranked battle contract address.\n    /// Instantiates the Neuron contract.\n    /// @param treasuryAddress_ The address of the treasury contract\n    /// @param nrnAddress The address of the Neuron contract\n    /// @param rankedBattleAddress The address of the Ranked Battle contract\n    constructor(\n        address treasuryAddress_,\n        address nrnAddress,\n        address rankedBattleAddress\n    ) {\n        treasuryAddress = treasuryAddress_;\n        _rankedBattleAddress = rankedBattleAddress;   \n        _neuronInstance = Neuron(nrnAddress);\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                            EXTERNAL FUNCTIONS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Sets a new round for staking\n    /// @dev This function can only be called by the RankedBattle contract to set a new round for staking.\n    /// @dev At the end of a round, it sweeps all NRNs held in this contract and sends it to treasury.\n    /// @param roundId_ The ID of the new round.\n    function setNewRound(uint256 roundId_) external {\n        require(msg.sender == _rankedBattleAddress, \"Not authorized to set new round\");\n        bool success = _sweepLostStake();\n        if (success) {\n            roundId = roundId_;\n        }\n    }\n\n    /// @notice Reclaims NRN tokens from the stake at risk.\n    /// @dev This function can only be called by the RankedBattle contract to reclaim \n    /// NRN tokens from the stake at risk.\n    /// @dev This gets triggered when they win a match while having NRNs at risk.\n    /// @param nrnToReclaim The amount of NRN tokens to reclaim.\n    /// @param fighterId The ID of the fighter.\n    /// @param fighterOwner The owner of the fighter.\n    function reclaimNRN(uint256 nrnToReclaim, uint256 fighterId, address fighterOwner) external {\n        require(msg.sender == _rankedBattleAddress, \"Call must be from RankedBattle contract\");\n        require(\n            stakeAtRisk[roundId][fighterId] >= nrnToReclaim, \n            \"Fighter does not have enough stake at risk\"\n        );\n\n        bool success = _neuronInstance.transfer(_rankedBattleAddress, nrnToReclaim);\n        if (success) {\n            stakeAtRisk[roundId][fighterId] -= nrnToReclaim;\n            totalStakeAtRisk[roundId] -= nrnToReclaim;\n            amountLost[fighterOwner] -= nrnToReclaim;\n            emit ReclaimedStake(fighterId, nrnToReclaim);\n        }\n    }\n\n    /// @notice Updates the stake at risk records for a fighter.\n    /// @dev This function can only be called by the RankedBattle contract to update the stake at \n    /// risk records for a fighter.\n    /// @dev This gets triggered when the fighter has 0 points and loses (i.e. goes into deficit).\n    /// @param nrnToPlaceAtRisk The amount of NRN tokens to place at risk.\n    /// @param fighterId The ID of the fighter.\n    function updateAtRiskRecords(\n        uint256 nrnToPlaceAtRisk, \n        uint256 fighterId, \n        address fighterOwner\n    ) \n        external \n    {\n        require(msg.sender == _rankedBattleAddress, \"Call must be from RankedBattle contract\");\n        stakeAtRisk[roundId][fighterId] += nrnToPlaceAtRisk;\n        totalStakeAtRisk[roundId] += nrnToPlaceAtRisk;\n        amountLost[fighterOwner] += nrnToPlaceAtRisk;\n        emit IncreasedStakeAtRisk(fighterId, nrnToPlaceAtRisk);\n    }   \n\n    /// @notice Gets the stake at risk for a specific fighter in the current round.\n    /// @param fighterId The ID of the fighter.\n    /// @return Amount of NRN tokens at risk for the fighter in the current round.\n    function getStakeAtRisk(uint256 fighterId) external view returns(uint256) {\n        return stakeAtRisk[roundId][fighterId];\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                            PRIVATE FUNCTIONS\n    //////////////////////////////////////////////////////////////*/    \n\n    /// @notice Sweeps the lost stake to the treasury contract.\n    /// @dev This function is called internally to transfer the lost stake to the treasury contract.\n    function _sweepLostStake() private returns(bool) {\n        return _neuronInstance.transfer(treasuryAddress, totalStakeAtRisk[roundId]);\n    }\n}"
}