{
    "Function": "slitherConstructorConstantVariables",
    "File": "contracts/contracts/Minter.sol",
    "Parent Contracts": [],
    "High-Level Calls": [],
    "Internal Calls": [],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "contract Minter {\n    uint internal constant WEEK = 86400 * 7; // allows minting once per week (reset every Thursday 00:00 UTC)\n    uint internal constant EMISSION = 990;\n    uint internal constant TAIL_EMISSION = 2;\n    uint internal constant PRECISION = 1000;\n    IVelo public immutable _velo;\n    IVoter public immutable _voter;\n    IVotingEscrow public immutable _ve;\n    IRewardsDistributor public immutable _rewards_distributor;\n    uint public weekly = 15000000e18;\n    uint public active_period;\n    uint internal constant LOCK = 86400 * 7 * 52 * 4;\n\n    address internal initializer;\n    address public team;\n    address public pendingTeam;\n    uint public teamRate;\n    uint public constant MAX_TEAM_RATE = 50; // 50 bps = 0.05%\n\n    event Mint(address indexed sender, uint weekly, uint circulating_supply, uint circulating_emission);\n\n    constructor(\n        address __voter, // the voting & distribution system\n        address __ve, // the ve(3,3) system that will be locked into\n        address __rewards_distributor // the distribution system that ensures users aren't diluted\n    ) {\n        initializer = msg.sender;\n        team = msg.sender;\n        teamRate = 30; // 30 bps = 0.03%\n        _velo = IVelo(IVotingEscrow(__ve).token());\n        _voter = IVoter(__voter);\n        _ve = IVotingEscrow(__ve);\n        _rewards_distributor = IRewardsDistributor(__rewards_distributor);\n        active_period = ((block.timestamp + (2 * WEEK)) / WEEK) * WEEK;\n    }\n\n    function initialize(\n        address[] memory claimants,\n        uint[] memory amounts,\n        uint max // sum amounts / max = % ownership of top protocols, so if initial 20m is distributed, and target is 25% protocol ownership, then max - 4 x 20m = 80m\n    ) external {\n        require(initializer == msg.sender);\n        _velo.mint(address(this), max);\n        _velo.approve(address(_ve), type(uint).max);\n        for (uint i = 0; i < claimants.length; i++) {\n            _ve.create_lock_for(amounts[i], LOCK, claimants[i]);\n        }\n        initializer = address(0);\n        active_period = ((block.timestamp + WEEK) / WEEK) * WEEK;\n    }\n\n    function setTeam(address _team) external {\n        require(msg.sender == team, \"not team\");\n        pendingTeam = _team;\n    }\n\n    function acceptTeam() external {\n        require(msg.sender == pendingTeam, \"not pending team\");\n        team = pendingTeam;\n    }\n\n    function setTeamRate(uint _teamRate) external {\n        require(msg.sender == team, \"not team\");\n        require(_teamRate <= MAX_TEAM_RATE, \"rate too high\");\n        teamRate = _teamRate;\n    }\n\n    // calculate circulating supply as total token supply - locked supply\n    function circulating_supply() public view returns (uint) {\n        return _velo.totalSupply() - _ve.totalSupply();\n    }\n\n    // emission calculation is 2% of available supply to mint adjusted by circulating / total supply\n    function calculate_emission() public view returns (uint) {\n        return weekly * EMISSION * circulating_supply() / PRECISION / _velo.totalSupply();\n    }\n\n    // weekly emission takes the max of calculated (aka target) emission versus circulating tail end emission\n    function weekly_emission() public view returns (uint) {\n        return Math.max(calculate_emission(), circulating_emission());\n    }\n\n    // calculates tail end (infinity) emissions as 0.2% of total supply\n    function circulating_emission() public view returns (uint) {\n        return (circulating_supply() * TAIL_EMISSION) / PRECISION;\n    }\n\n    // calculate inflation and adjust ve balances accordingly\n    function calculate_growth(uint _minted) public view returns (uint) {\n        uint _veTotal = _ve.totalSupply();\n        uint _veloTotal = _velo.totalSupply();\n        return\n            (((((_minted * _veTotal) / _veloTotal) * _veTotal) / _veloTotal) *\n                _veTotal) /\n            _veloTotal /\n            2;\n    }\n\n    // update period can only be called once per cycle (1 week)\n    function update_period() external returns (uint) {\n        uint _period = active_period;\n        if (block.timestamp >= _period + WEEK && initializer == address(0)) { // only trigger if new week\n            _period = (block.timestamp / WEEK) * WEEK;\n            active_period = _period;\n            weekly = weekly_emission();\n\n            uint _growth = calculate_growth(weekly);\n            uint _teamEmissions = (teamRate * (_growth + weekly)) /\n                (PRECISION - teamRate);\n            uint _required = _growth + weekly + _teamEmissions;\n            uint _balanceOf = _velo.balanceOf(address(this));\n            if (_balanceOf < _required) {\n                _velo.mint(address(this), _required - _balanceOf);\n            }\n\n            require(_velo.transfer(team, _teamEmissions));\n            require(_velo.transfer(address(_rewards_distributor), _growth));\n            _rewards_distributor.checkpoint_token(); // checkpoint token balance that was just minted in rewards distributor\n            _rewards_distributor.checkpoint_total_supply(); // checkpoint supply\n\n            _velo.approve(address(_voter), weekly);\n            _voter.notifyRewardAmount(weekly);\n\n            emit Mint(msg.sender, weekly, circulating_supply(), circulating_emission());\n        }\n        return _period;\n    }\n}"
}