{
    "Function": "slitherConstructorVariables",
    "File": "contracts/Dao.sol",
    "Parent Contracts": [],
    "High-Level Calls": [],
    "Internal Calls": [],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "contract Dao {\n    address public DEPLOYER;\n    address public BASE;\n\n    uint256 public secondsPerEra;   // Amount of seconds per era (Inherited from BASE contract; intended to be ~1 day)\n    uint256 public coolOffPeriod;   // Amount of time a proposal will need to be in finalising stage before it can be finalised\n    uint256 public proposalCount;   // Count of proposals\n    uint256 public majorityFactor;  // Number used to calculate majority; intended to be 6666bp === 2/3\n    uint256 public erasToEarn;      // Amount of eras that make up the targeted RESERVE depletion; regulates incentives\n    uint256 public daoClaim;        // The DAOVault's portion of rewards; intended to be ~10% initially\n    uint256 public daoFee;          // The SPARTA fee for a user to create a new proposal, intended to be 100 SPARTA initially\n    uint256 public currentProposal; // The most recent proposal; should be === proposalCount\n    \n    struct MemberDetails {\n        bool isMember;\n        uint weight;\n        uint lastBlock;\n        uint poolCount;\n    }\n    struct ProposalDetails {\n        uint id;\n        string proposalType;\n        uint votes;\n        uint coolOffTime;\n        bool finalising;\n        bool finalised;\n        uint param;\n        address proposedAddress;\n        bool open;\n        uint startTime;\n    }\n\n    bool public daoHasMoved;\n    address public DAO;\n\n    iROUTER private _ROUTER;\n    iUTILS private _UTILS;\n    iBONDVAULT private _BONDVAULT;\n    iDAOVAULT private _DAOVAULT;\n    iPOOLFACTORY private _POOLFACTORY;\n    iSYNTHFACTORY private _SYNTHFACTORY;\n    iRESERVE private _RESERVE;\n    iSYNTHVAULT private _SYNTHVAULT;\n\n    address[] public arrayMembers;\n    address [] listedBondAssets; // Only used in UI; is intended to be a historical array of all past Bond listed assets\n    uint256 public bondingPeriodSeconds = 15552000; // Vesting period for bonders (6 months)\n    \n    mapping(address => bool) public isMember;\n    mapping(address => bool) public isListed; // Used internally to get CURRENT listed Bond assets\n    mapping(address => uint256) public mapMember_lastTime;\n\n    mapping(uint256 => uint256) public mapPID_param;\n    mapping(uint256 => address) public mapPID_address;\n    mapping(uint256 => string) public mapPID_type;\n    mapping(uint256 => uint256) public mapPID_votes;\n    mapping(uint256 => uint256) public mapPID_coolOffTime;\n    mapping(uint256 => bool) public mapPID_finalising;\n    mapping(uint256 => bool) public mapPID_finalised;\n    mapping(uint256 => bool) public mapPID_open;\n    mapping(uint256 => uint256) public mapPID_startTime;\n    mapping(uint256 => mapping(address => uint256)) public mapPIDMember_votes;\n\n    event MemberDeposits(address indexed member, address indexed pool, uint256 amount);\n    event MemberWithdraws(address indexed member, address indexed pool, uint256 balance);\n\n    event NewProposal(address indexed member, uint indexed proposalID, string proposalType);\n    event NewVote(address indexed member, uint indexed proposalID, uint voteWeight, uint totalVotes, string proposalType);\n    event RemovedVote(address indexed member, uint indexed proposalID, uint voteWeight, uint totalVotes, string proposalType);\n    event ProposalFinalising(address indexed member, uint indexed proposalID, uint timeFinalised, string proposalType);\n    event CancelProposal(address indexed member, uint indexed proposalID);\n    event FinalisedProposal(address indexed member, uint indexed proposalID, uint votesCast, uint totalWeight, string proposalType);\n    event ListedAsset(address indexed DAO, address indexed asset);\n    event DelistedAsset(address indexed DAO, address indexed asset);\n    event DepositAsset(address indexed owner, uint256 depositAmount, uint256 bondedLP);\n\n    // Restrict access\n    modifier onlyDAO() {\n        require(msg.sender == DEPLOYER);\n        _;\n    }\n\n    constructor (address _base){\n        BASE = _base;\n        DEPLOYER = msg.sender;\n        DAO = address(this);\n        coolOffPeriod = 259200;\n        erasToEarn = 30;\n        majorityFactor = 6666;\n        daoClaim = 1000;\n        daoFee = 100;\n        proposalCount = 0;\n        secondsPerEra = iBASE(BASE).secondsPerEra();\n    }\n\n    //==================================== PROTOCOL CONTRACTs SETTER =================================//\n\n    function setGenesisAddresses(address _router, address _utils, address _reserve) external onlyDAO {\n        _ROUTER = iROUTER(_router);\n        _UTILS = iUTILS(_utils);\n        _RESERVE = iRESERVE(_reserve);\n    }\n\n    function setVaultAddresses(address _daovault, address _bondvault, address _synthVault) external onlyDAO {\n        _DAOVAULT = iDAOVAULT(_daovault);\n        _BONDVAULT = iBONDVAULT(_bondvault);\n        _SYNTHVAULT = iSYNTHVAULT(_synthVault); \n    }\n    \n    function setFactoryAddresses(address _poolFactory, address _synthFactory) external onlyDAO {\n        _POOLFACTORY = iPOOLFACTORY(_poolFactory);\n        _SYNTHFACTORY = iSYNTHFACTORY(_synthFactory);\n    }\n\n    function setGenesisFactors(uint32 _coolOff, uint32 _daysToEarn, uint32 _majorityFactor, uint32 _daoClaim, uint32 _daoFee) external onlyDAO {\n        coolOffPeriod = _coolOff;\n        erasToEarn = _daysToEarn;\n        majorityFactor = _majorityFactor;\n        daoClaim = _daoClaim;\n        daoFee = _daoFee;\n    }\n\n    // Can purge deployer once DAO is stable and final\n    function purgeDeployer() external onlyDAO {\n        DEPLOYER = address(0);\n    }\n\n    // Can change vesting period for bonders\n    function changeBondingPeriod(uint256 bondingSeconds) external onlyDAO{\n        bondingPeriodSeconds = bondingSeconds;\n    }\n\n    //============================== USER - DEPOSIT/WITHDRAW ================================//\n\n    // User deposits LP tokens in the DAOVault\n    function deposit(address pool, uint256 amount) external {\n        depositLPForMember(pool, amount, msg.sender);\n    }\n\n    // Contract deposits LP tokens for member\n    function depositLPForMember(address pool, uint256 amount, address member) public {\n        require(_POOLFACTORY.isCuratedPool(pool) == true, \"!curated\"); // Pool must be Curated\n        require(amount > 0, \"!amount\"); // Deposit amount must be valid\n        if (isMember[member] != true) {\n            arrayMembers.push(member); // If not a member; add user to member array\n            isMember[member] = true; // If not a member; register the user as member\n        }\n        if((_DAOVAULT.getMemberWeight(member) + _BONDVAULT.getMemberWeight(member)) > 0) {\n            harvest(); // If member has existing weight; force harvest to block manipulation of lastTime + harvest\n        }\n        require(iBEP20(pool).transferFrom(msg.sender, address(_DAOVAULT), amount), \"!funds\"); // Send user's deposit to the DAOVault\n        _DAOVAULT.depositLP(pool, amount, member); // Update user's deposit balance & weight\n        mapMember_lastTime[member] = block.timestamp; // Reset user's last harvest time\n        emit MemberDeposits(member, pool, amount);\n    }\n    \n    // User withdraws all of their selected asset from the DAOVault\n    function withdraw(address pool) external {\n        removeVote(); // Users weight is removed from the current open DAO proposal\n        require(_DAOVAULT.withdraw(pool, msg.sender), \"!transfer\"); // User receives their withdrawal\n    }\n\n    //============================== REWARDS ================================//\n    \n    // User claims their DAOVault incentives\n    function harvest() public {\n        require(_RESERVE.emissions(), \"!emissions\"); // Reserve must have emissions turned on\n        uint reward = calcCurrentReward(msg.sender); // Calculate the user's claimable incentive\n        mapMember_lastTime[msg.sender] = block.timestamp; // Reset user's last harvest time\n        uint reserve = iBEP20(BASE).balanceOf(address(_RESERVE)); // Get total BASE balance of RESERVE\n        uint daoReward = (reserve * daoClaim) / 10000; // Get DAO's share of BASE balance of RESERVE (max user claim amount)\n        if(reward > daoReward){\n            reward = daoReward; // User cannot claim more than the daoReward limit\n        }\n        _RESERVE.grantFunds(reward, msg.sender); // Send the claim to the user\n    }\n\n    // Calculate the user's current incentive-claim per era\n    function calcCurrentReward(address member) public view returns(uint){\n        uint secondsSinceClaim = block.timestamp - mapMember_lastTime[member]; // Get seconds passed since last claim\n        uint share = calcReward(member); // Get share of rewards for user\n        uint reward = (share * secondsSinceClaim) / secondsPerEra; // User's share times eras since they last claimed\n        return reward;\n    }\n\n    // Calculate the user's current total claimable incentive\n    function calcReward(address member) public view returns(uint){\n        uint weight = _DAOVAULT.getMemberWeight(member) + _BONDVAULT.getMemberWeight(member); // Get combined total weights (scope: user)\n        uint _totalWeight = _DAOVAULT.totalWeight() + _BONDVAULT.totalWeight(); // Get combined total weights (scope: vaults)\n        uint reserve = iBEP20(BASE).balanceOf(address(_RESERVE)) / erasToEarn; // Aim to deplete reserve over a number of days\n        uint daoReward = (reserve * daoClaim) / 10000; // Get the DAO's share of that\n        return _UTILS.calcShare(weight, _totalWeight, daoReward); // Get users's share of that (1 era worth)\n    }\n\n    //================================ BOND Feature ==================================//\n\n    // Can burn the SPARTA remaining in this contract (Bond allocations held in the DAO)\n    function burnBalance() external onlyDAO returns (bool){\n        uint256 baseBal = iBEP20(BASE).balanceOf(address(this));\n        iBASE(BASE).burn(baseBal);   \n        return true;\n    }\n\n    // Can transfer the SPARTA remaining in this contract to a new DAO (If DAO is upgraded)\n    function moveBASEBalance(address newDAO) external onlyDAO {\n        uint256 baseBal = iBEP20(BASE).balanceOf(address(this));\n        iBEP20(BASE).transfer(newDAO, baseBal);\n    }\n\n    // List an asset to be enabled for Bonding\n    function listBondAsset(address asset) external onlyDAO {\n        if(!isListed[asset]){\n            isListed[asset] = true; // Register as a currently enabled asset\n            listedBondAssets.push(asset); // Add to historical record of past Bond assets\n        }\n        emit ListedAsset(msg.sender, asset);\n    }\n\n    // Delist an asset from the Bond program\n    function delistBondAsset(address asset) external onlyDAO {\n        isListed[asset] = false; // Unregister as a currently enabled asset\n        emit DelistedAsset(msg.sender, asset);\n    }\n\n    // User deposits assets to be Bonded\n    function bond(address asset, uint256 amount) external payable returns (bool success) {\n        require(amount > 0, '!amount'); // Amount must be valid\n        require(isListed[asset], '!listed'); // Asset must be listed for Bond\n        if (isMember[msg.sender] != true) {\n            arrayMembers.push(msg.sender); // If user is not a member; add them to the member array\n            isMember[msg.sender] = true; // Register user as a member\n        }\n        if((_DAOVAULT.getMemberWeight(msg.sender) + _BONDVAULT.getMemberWeight(msg.sender)) > 0) {\n            harvest(); // If member has existing weight; force harvest to block manipulation of lastTime + harvest\n        }\n        uint256 liquidityUnits = handleTransferIn(asset, amount); // Add liquidity and calculate LP units\n        _BONDVAULT.depositForMember(asset, msg.sender, liquidityUnits); // Deposit the Bonded LP units in the BondVault\n        mapMember_lastTime[msg.sender] = block.timestamp; // Reset user's last harvest time\n        emit DepositAsset(msg.sender, amount, liquidityUnits);\n        return true;\n    }\n\n    // Add Bonded assets as liquidity and calculate LP units\n    function handleTransferIn(address _token, uint _amount) internal returns (uint LPunits){\n        uint256 spartaAllocation = _UTILS.calcSwapValueInBase(_token, _amount); // Get the SPARTA swap value of the bonded assets\n        if(iBEP20(BASE).allowance(address(this), address(_ROUTER)) < spartaAllocation){\n            iBEP20(BASE).approve(address(_ROUTER), iBEP20(BASE).totalSupply()); // Increase SPARTA allowance if required\n        }\n        if(_token == address(0)){\n            require((_amount == msg.value), \"!amount\");\n            LPunits = _ROUTER.addLiquidityForMember{value:_amount}(spartaAllocation, _amount, _token, address(_BONDVAULT)); // Add spartaAllocation & BNB as liquidity to mint LP tokens\n        } else {\n            iBEP20(_token).transferFrom(msg.sender, address(this), _amount); // Transfer user's assets to Dao contract\n            if(iBEP20(_token).allowance(address(this), address(_ROUTER)) < _amount){\n                uint256 approvalTNK = iBEP20(_token).totalSupply();\n                iBEP20(_token).approve(address(_ROUTER), approvalTNK); // Increase allowance if required\n            }\n            LPunits = _ROUTER.addLiquidityForMember(spartaAllocation, _amount, _token, address(_BONDVAULT)); // Add spartaAllocation & assets as liquidity to mint LP tokens\n        } \n    }\n\n    // User claims all of their unlocked Bonded LPs\n    function claimAllForMember(address member) external returns (bool){\n        address [] memory listedAssets = listedBondAssets; // Get array of bond assets\n        for(uint i = 0; i < listedAssets.length; i++){\n            uint claimA = calcClaimBondedLP(member, listedAssets[i]); // Check user's unlocked Bonded LPs for each asset\n            if(claimA > 0){\n               _BONDVAULT.claimForMember(listedAssets[i], member); // Claim LPs if any unlocked\n            }\n        }\n        return true;\n    }\n\n    // User claims unlocked Bond units of a selected asset\n    function claimForMember(address asset) external returns (bool){\n        uint claimA = calcClaimBondedLP(msg.sender, asset); // Check user's unlocked Bonded LPs\n        if(claimA > 0){\n            _BONDVAULT.claimForMember(asset, msg.sender); // Claim LPs if any unlocked\n        }\n        return true;\n    }\n    \n    // Calculate user's unlocked Bond units of a selected asset\n    function calcClaimBondedLP(address bondedMember, address asset) public returns (uint){\n        uint claimAmount = _BONDVAULT.calcBondedLP(bondedMember, asset); // Check user's unlocked Bonded LPs\n        return claimAmount;\n    }\n\n    //============================== CREATE PROPOSALS ================================//\n\n    // New ID, but specify type, one type for each function call\n    // Votes counted to IDs\n    // IDs are finalised\n    // IDs are executed, but type specifies unique logic\n\n    // New DAO proposal: Simple action\n    function newActionProposal(string memory typeStr) external returns(uint) {\n        checkProposal(); // If no open proposal; construct new one\n        payFee(); // Pay SPARTA fee for new proposal\n        mapPID_type[currentProposal] = typeStr; // Set the proposal type\n        emit NewProposal(msg.sender, currentProposal, typeStr);\n        return currentProposal;\n    }\n\n    // New DAO proposal: uint parameter\n    function newParamProposal(uint32 param, string memory typeStr) external returns(uint) {\n        checkProposal(); // If no open proposal; construct new one\n        payFee(); // Pay SPARTA fee for new proposal\n        mapPID_param[currentProposal] = param; // Set the proposed parameter\n        mapPID_type[currentProposal] = typeStr; // Set the proposal type\n        emit NewProposal(msg.sender, currentProposal, typeStr);\n        return currentProposal;\n    }\n\n    // New DAO proposal: Address parameter\n    function newAddressProposal(address proposedAddress, string memory typeStr) external returns(uint) {\n        checkProposal(); // If no open proposal; construct new one\n        payFee(); // Pay SPARTA fee for new proposal\n        mapPID_address[currentProposal] = proposedAddress; // Set the proposed new address\n        mapPID_type[currentProposal] = typeStr; // Set the proposal type\n        emit NewProposal(msg.sender, currentProposal, typeStr);\n        return currentProposal;\n    }\n\n    // New DAO proposal: Grant SPARTA to wallet\n    function newGrantProposal(address recipient, uint amount) external returns(uint) {\n        checkProposal(); // If no open proposal; construct new one\n        payFee(); // Pay SPARTA fee for new proposal\n        string memory typeStr = \"GRANT\";\n        mapPID_type[currentProposal] = typeStr; // Set the proposal type\n        mapPID_address[currentProposal] = recipient; // Set the proposed grant recipient\n        mapPID_param[currentProposal] = amount; // Set the proposed grant amount\n        emit NewProposal(msg.sender, currentProposal, typeStr);\n        return currentProposal;\n    }\n\n    // If no existing open DAO proposal; register a new one\n    function checkProposal() internal {\n        require(mapPID_open[currentProposal] == false, '!open'); // There must not be an existing open proposal\n        proposalCount += 1; // Increase proposal count\n        currentProposal = proposalCount; // Set current proposal to the new count\n        mapPID_open[currentProposal] = true; // Set new proposal as open status\n        mapPID_startTime[currentProposal] = block.timestamp; // Set the start time of the proposal to now\n    }\n    \n    // Pay the fee for a new DAO proposal\n    function payFee() internal returns(bool){\n        uint _amount = daoFee*(10**18); // Convert DAO fee to WEI\n        require(iBEP20(BASE).transferFrom(msg.sender, address(_RESERVE), _amount), '!fee'); // User pays the new proposal fee\n        return true;\n    } \n\n    //============================== VOTE && FINALISE ================================//\n\n    // Vote for a proposal\n    function voteProposal() external returns (uint voteWeight) {\n        require(mapPID_open[currentProposal] == true, \"!open\"); // Proposal must be open status\n        bytes memory _type = bytes(mapPID_type[currentProposal]); // Get the proposal type\n        voteWeight = countVotes(); // Vote for proposal and recount\n        if(hasQuorum(currentProposal) && mapPID_finalising[currentProposal] == false){\n            if(isEqual(_type, 'DAO') || isEqual(_type, 'UTILS') || isEqual(_type, 'RESERVE') ||isEqual(_type, 'GET_SPARTA') || isEqual(_type, 'ROUTER') || isEqual(_type, 'LIST_BOND')|| isEqual(_type, 'GRANT')|| isEqual(_type, 'ADD_CURATED_POOL')){\n                if(hasMajority(currentProposal)){\n                    _finalise(); // Critical proposals require 'majority' consensus to enter finalization phase\n                }\n            } else {\n                _finalise(); // Other proposals require 'quorum' consensus to enter finalization phase\n            }\n        }\n        emit NewVote(msg.sender, currentProposal, voteWeight, mapPID_votes[currentProposal], string(_type));\n    }\n\n    // Remove vote from a proposal\n    function removeVote() public returns (uint voteWeightRemoved){\n        bytes memory _type = bytes(mapPID_type[currentProposal]); // Get the proposal type\n        voteWeightRemoved = mapPIDMember_votes[currentProposal][msg.sender]; // Get user's current vote weight\n        if(mapPID_open[currentProposal]){\n            mapPID_votes[currentProposal] -= voteWeightRemoved; // Remove user's votes from propsal (scope: proposal)\n        }\n        mapPIDMember_votes[currentProposal][msg.sender] = 0; // Remove user's votes from propsal (scope: member)\n        emit RemovedVote(msg.sender, currentProposal, voteWeightRemoved, mapPID_votes[currentProposal], string(_type));\n        return voteWeightRemoved;\n    }\n\n    // Push the proposal into 'finalising' status\n    function _finalise() internal {\n        bytes memory _type = bytes(mapPID_type[currentProposal]); // Get the proposal type\n        mapPID_finalising[currentProposal] = true; // Set finalising status to true\n        mapPID_coolOffTime[currentProposal] = block.timestamp; // Set timestamp to calc cooloff time from\n        emit ProposalFinalising(msg.sender, currentProposal, block.timestamp+coolOffPeriod, string(_type));\n    }\n\n    // Attempt to cancel the open proposal\n    function cancelProposal() external {\n        require(block.timestamp > (mapPID_startTime[currentProposal] + 1296000), \"!days\"); // Proposal must not be new\n        mapPID_votes[currentProposal] = 0; // Clear all votes from the proposal\n        mapPID_open[currentProposal] = false; // Set the proposal as not open (closed status)\n        emit CancelProposal(msg.sender, currentProposal);\n    }\n\n    // A finalising-stage proposal can be finalised after the cool off period\n    function finaliseProposal() external {\n        require((block.timestamp - mapPID_coolOffTime[currentProposal]) > coolOffPeriod, \"!cooloff\"); // Must be past cooloff period\n        require(mapPID_finalising[currentProposal] == true, \"!finalising\"); // Must be in finalising stage\n        if(!hasQuorum(currentProposal)){\n            mapPID_finalising[currentProposal] = false; // If proposal has lost quorum consensus; kick it out of the finalising stage\n        } else {\n            bytes memory _type = bytes(mapPID_type[currentProposal]); // Get the proposal type\n            if(isEqual(_type, 'DAO')){\n                moveDao(currentProposal);\n            } else if (isEqual(_type, 'ROUTER')) {\n                moveRouter(currentProposal);\n            } else if (isEqual(_type, 'UTILS')){\n                moveUtils(currentProposal);\n            } else if (isEqual(_type, 'RESERVE')){\n                moveReserve(currentProposal);\n            } else if (isEqual(_type, 'FLIP_EMISSIONS')){\n                flipEmissions(currentProposal);\n            } else if (isEqual(_type, 'COOL_OFF')){\n                changeCooloff(currentProposal);\n            } else if (isEqual(_type, 'ERAS_TO_EARN')){\n                changeEras(currentProposal);\n            } else if (isEqual(_type, 'GRANT')){\n                grantFunds(currentProposal);\n            } else if (isEqual(_type, 'GET_SPARTA')){\n                _increaseSpartaAllocation(currentProposal);\n            } else if (isEqual(_type, 'LIST_BOND')){\n                _listBondingAsset(currentProposal);\n            } else if (isEqual(_type, 'DELIST_BOND')){\n                _delistBondingAsset(currentProposal);\n            } else if (isEqual(_type, 'ADD_CURATED_POOL')){\n                _addCuratedPool(currentProposal);\n            } else if (isEqual(_type, 'REMOVE_CURATED_POOL')){\n                _removeCuratedPool(currentProposal);\n            } \n        }\n    }\n\n    // Change the DAO to a new contract address\n    function moveDao(uint _proposalID) internal {\n        address _proposedAddress = mapPID_address[_proposalID]; // Get the proposed new address\n        require(_proposedAddress != address(0), \"!address\"); // Proposed address must be valid\n        DAO = _proposedAddress; // Change the DAO to point to the new DAO address\n        iBASE(BASE).changeDAO(_proposedAddress); // Change the BASE contract to point to the new DAO address\n        daoHasMoved = true; // Set status of this old DAO\n        completeProposal(_proposalID); // Finalise the proposal\n    }\n\n    // Change the ROUTER to a new contract address\n    function moveRouter(uint _proposalID) internal {\n        address _proposedAddress = mapPID_address[_proposalID]; // Get the proposed new address\n        require(_proposedAddress != address(0), \"!address\"); // Proposed address must be valid\n        _ROUTER = iROUTER(_proposedAddress); // Change the DAO to point to the new ROUTER address\n        completeProposal(_proposalID); // Finalise the proposal\n    }\n\n    // Change the UTILS to a new contract address\n    function moveUtils(uint _proposalID) internal {\n        address _proposedAddress = mapPID_address[_proposalID]; // Get the proposed new address\n        require(_proposedAddress != address(0), \"!address\"); // Proposed address must be valid\n        _UTILS = iUTILS(_proposedAddress); // Change the DAO to point to the new UTILS address\n        completeProposal(_proposalID); // Finalise the proposal\n    }\n\n    // Change the RESERVE to a new contract address\n    function moveReserve(uint _proposalID) internal {\n        address _proposedAddress = mapPID_address[_proposalID]; // Get the proposed new address\n        require(_proposedAddress != address(0), \"!address\"); // Proposed address must be valid\n        _RESERVE = iRESERVE(_proposedAddress); // Change the DAO to point to the new RESERVE address\n        completeProposal(_proposalID); // Finalise the proposal\n    }\n\n    // Flip the BASE emissions on/off\n    function flipEmissions(uint _proposalID) internal {\n        iBASE(BASE).flipEmissions(); // Toggle emissions on the BASE contract\n        completeProposal(_proposalID); // Finalise the proposal\n    }\n\n    // Change cool off period (Period of time until a finalising proposal can be finalised)\n    function changeCooloff(uint _proposalID) internal {\n        uint256 _proposedParam = mapPID_param[_proposalID]; // Get the proposed new param\n        require(_proposedParam != 0, \"!param\"); // Proposed param must be valid\n        coolOffPeriod = _proposedParam; // Change coolOffPeriod\n        completeProposal(_proposalID); // Finalise the proposal\n    }\n\n    // Change erasToEarn (Used to regulate the incentives flow)\n    function changeEras(uint _proposalID) internal {\n        uint256 _proposedParam = mapPID_param[_proposalID]; // Get the proposed new param\n        require(_proposedParam != 0, \"!param\"); // Proposed param must be valid\n        erasToEarn = _proposedParam; // Change erasToEarn\n        completeProposal(_proposalID); // Finalise the proposal\n    }\n\n    // Grant SPARTA to the proposed recipient\n    function grantFunds(uint _proposalID) internal {\n        uint256 _proposedAmount = mapPID_param[_proposalID]; // Get the proposed SPARTA grant amount\n        address _proposedAddress = mapPID_address[_proposalID]; // Get the proposed SPARTA grant recipient\n        require(_proposedAmount != 0, \"!param\"); // Proposed grant amount must be valid\n        require(_proposedAddress != address(0), \"!address\"); // Proposed recipient must be valid\n        _RESERVE.grantFunds(_proposedAmount, _proposedAddress); // Grant the funds to the recipient\n        completeProposal(_proposalID); // Finalise the proposal\n    }\n\n    // Mint a 2.5M SPARTA allocation for the Bond program\n    function _increaseSpartaAllocation(uint _proposalID) internal {\n        uint256 _2point5m = 2.5*10**6*10**18; //_2.5m\n        iBASE(BASE).mintFromDAO(_2point5m, address(this)); // Mint SPARTA and send to DAO to hold\n        completeProposal(_proposalID); // Finalise the proposal\n    }\n\n    // List an asset to be enabled for Bonding\n    function _listBondingAsset(uint _proposalID) internal {\n        address _proposedAddress = mapPID_address[_proposalID]; // Get the proposed new asset\n        if(!isListed[_proposedAddress]){\n            isListed[_proposedAddress] = true; // Register asset as listed for Bond\n            listedBondAssets.push(_proposedAddress); // Add asset to array of listed Bond assets\n        }\n        completeProposal(_proposalID); // Finalise the proposal\n    }\n\n    // Delist an asset from being allowed to Bond\n    function _delistBondingAsset(uint _proposalID) internal {\n        address _proposedAddress = mapPID_address[_proposalID]; // Get the proposed new asset\n        isListed[_proposedAddress] = false; // Unregister asset as listed for Bond (Keep it in the array though; as this is used in the UI)\n        completeProposal(_proposalID); // Finalise the proposal\n    }\n\n    // Add a pool as 'Curated' to enable synths, weight and incentives\n    function _addCuratedPool(uint _proposalID) internal {\n        address _proposedAddress = mapPID_address[_proposalID]; // Get the proposed new asset\n        _POOLFACTORY.addCuratedPool(_proposedAddress); // Add the pool as Curated\n        completeProposal(_proposalID); // Finalise the proposal\n    }\n\n    // Remove a pool from Curated status\n    function _removeCuratedPool(uint _proposalID) internal {\n        address _proposedAddress = mapPID_address[_proposalID]; // Get the proposed asset for removal\n        _POOLFACTORY.removeCuratedPool(_proposedAddress); // Remove pool as Curated\n        completeProposal(_proposalID); // Finalise the proposal\n    }\n    \n    // After completing the proposal's action; close it\n    function completeProposal(uint _proposalID) internal {\n        string memory _typeStr = mapPID_type[_proposalID]; // Get proposal type\n        emit FinalisedProposal(msg.sender, _proposalID, mapPID_votes[_proposalID], _DAOVAULT.totalWeight(), _typeStr);\n        mapPID_votes[_proposalID] = 0; // Reset proposal votes to 0\n        mapPID_finalised[_proposalID] = true; // Finalise the proposal\n        mapPID_finalising[_proposalID] = false; // Remove proposal from 'finalising' stage\n        mapPID_open[_proposalID] = false; // Close the proposal\n    }\n\n    //============================== CONSENSUS ================================//\n    \n    // Add user's total weight to proposal and recount\n    function countVotes() internal returns (uint voteWeight){\n        mapPID_votes[currentProposal] -= mapPIDMember_votes[currentProposal][msg.sender]; // Remove user's current votes from the open proposal\n        voteWeight = _DAOVAULT.getMemberWeight(msg.sender) + _BONDVAULT.getMemberWeight(msg.sender); // Get user's combined total weights\n        mapPID_votes[currentProposal] += voteWeight; // Add user's total weight to the current open proposal (scope: proposal)\n        mapPIDMember_votes[currentProposal][msg.sender] = voteWeight; // Add user's total weight to the current open proposal (scope: member)\n        return voteWeight;\n    }\n\n    // Check if a proposal has Majority consensus\n    function hasMajority(uint _proposalID) public view returns(bool){\n        uint votes = mapPID_votes[_proposalID]; // Get the proposal's total voting weight\n        uint _totalWeight = _DAOVAULT.totalWeight() + _BONDVAULT.totalWeight(); // Get combined total vault weights\n        uint consensus = _totalWeight * majorityFactor / 10000; // Majority > 66.6%\n        if(votes > consensus){\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    // Check if a proposal has Quorum consensus\n    function hasQuorum(uint _proposalID) public view returns(bool){\n        uint votes = mapPID_votes[_proposalID]; // Get the proposal's total voting weight\n        uint _totalWeight = _DAOVAULT.totalWeight()  + _BONDVAULT.totalWeight(); // Get combined total vault weights\n        uint consensus = _totalWeight / 2; // Quorum > 50%\n        if(votes > consensus){\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    // Check if a proposal has Minority consensus\n    function hasMinority(uint _proposalID) public view returns(bool){\n        uint votes = mapPID_votes[_proposalID]; // Get the proposal's total voting weight\n        uint _totalWeight = _DAOVAULT.totalWeight()  + _BONDVAULT.totalWeight(); // Get combined total vault weights\n        uint consensus = _totalWeight / 6; // Minority > 16.6%\n        if(votes > consensus){\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    //======================================PROTOCOL CONTRACTs GETTER=================================//\n    \n    // Get the ROUTER address that the DAO currently points to\n    function ROUTER() public view returns(iROUTER){\n        if(daoHasMoved){\n            return Dao(DAO).ROUTER();\n        } else {\n            return _ROUTER;\n        }\n    }\n\n    // Get the UTILS address that the DAO currently points to\n    function UTILS() public view returns(iUTILS){\n        if(daoHasMoved){\n            return Dao(DAO).UTILS();\n        } else {\n            return _UTILS;\n        }\n    }\n\n    // Get the BONDVAULT address that the DAO currently points to\n    function BONDVAULT() public view returns(iBONDVAULT){\n        if(daoHasMoved){\n            return Dao(DAO).BONDVAULT();\n        } else {\n            return _BONDVAULT;\n        }\n    }\n\n    // Get the DAOVAULT address that the DAO currently points to\n    function DAOVAULT() public view returns(iDAOVAULT){\n        if(daoHasMoved){\n            return Dao(DAO).DAOVAULT();\n        } else {\n            return _DAOVAULT;\n        }\n    }\n\n    // Get the POOLFACTORY address that the DAO currently points to\n    function POOLFACTORY() public view returns(iPOOLFACTORY){\n        if(daoHasMoved){\n            return Dao(DAO).POOLFACTORY();\n        } else {\n            return _POOLFACTORY;\n        }\n    }\n\n    // Get the SYNTHFACTORY address that the DAO currently points to\n    function SYNTHFACTORY() public view returns(iSYNTHFACTORY){\n        if(daoHasMoved){\n            return Dao(DAO).SYNTHFACTORY();\n        } else {\n            return _SYNTHFACTORY;\n        }\n    }\n\n    // Get the RESERVE address that the DAO currently points to\n    function RESERVE() public view returns(iRESERVE){\n        if(daoHasMoved){\n            return Dao(DAO).RESERVE();\n        } else {\n            return _RESERVE;\n        }\n    }\n\n    // Get the SYNTHVAULT address that the DAO currently points to\n    function SYNTHVAULT() public view returns(iSYNTHVAULT){\n        if(daoHasMoved){\n            return Dao(DAO).SYNTHVAULT();\n        } else {\n            return _SYNTHVAULT;\n        }\n    }\n\n    //============================== HELPERS ================================//\n    \n    function memberCount() external view returns(uint){\n        return arrayMembers.length;\n    }\n\n    function getProposalDetails(uint proposalID) external view returns (ProposalDetails memory proposalDetails){\n        proposalDetails.id = proposalID;\n        proposalDetails.proposalType = mapPID_type[proposalID];\n        proposalDetails.votes = mapPID_votes[proposalID];\n        proposalDetails.coolOffTime = mapPID_coolOffTime[proposalID];\n        proposalDetails.finalising = mapPID_finalising[proposalID];\n        proposalDetails.finalised = mapPID_finalised[proposalID];\n        proposalDetails.param = mapPID_param[proposalID];\n        proposalDetails.proposedAddress = mapPID_address[proposalID];\n        proposalDetails.open = mapPID_open[proposalID];\n        proposalDetails.startTime = mapPID_startTime[proposalID];\n        return proposalDetails;\n    }\n\n    function assetListedCount() external view returns (uint256 count){\n        return listedBondAssets.length;\n    }\n\n    function allListedAssets() external view returns (address[] memory _allListedAssets){\n        return listedBondAssets;\n    }\n    \n    function isEqual(bytes memory part1, bytes memory part2) private pure returns(bool){\n        if(sha256(part1) == sha256(part2)){\n            return true;\n        } else {\n            return false;\n        }\n    }\n}"
}