contract COREGlobals is OwnableUpgradeSafe {

    address public CORETokenAddress;
    address public COREGlobalsAddress;
    address public COREDelegatorAddress;
    address public COREVaultAddress;
    address public COREWETHUniPair;
    address public UniswapFactory;
    address public TransferHandler;
    address public FannyTokenAddress;
    address public FannyVaultAddress;

    function initialize(address _COREWETHUniPair, address _COREToken, address _COREDelegator, address _COREVault, address _uniFactory, address _transferHandler) public initializer {
        OwnableUpgradeSafe.__Ownable_init();
        CORETokenAddress = _COREToken;
        COREGlobalsAddress = address(this);
        COREDelegatorAddress = _COREDelegator;
        COREVaultAddress = _COREVault;
        UniswapFactory = _uniFactory;
        TransferHandler = _transferHandler;
        COREWETHUniPair = _COREWETHUniPair;
    }



    function setCoreToken(address _COREToken) public onlyOwner {
        CORETokenAddress = _COREToken;
    }

    function setCoreDelegator(address _COREDelegator) public onlyOwner {
        COREDelegatorAddress = _COREDelegator;
    }

    function setCoreVaultAddress(address _COREVault) public onlyOwner {
        COREVaultAddress = _COREVault;
    }

    function setTransferHandler(address _transferHandler) public onlyOwner {
        TransferHandler = _transferHandler;
    }

    function setFannyTokenAddress(address _FannyToken) public onlyOwner {
        FannyTokenAddress = _FannyToken;
    }

    function setFannyVaultAddress(address _fannyVault) public onlyOwner {
        FannyVaultAddress = _fannyVault;
    }

    mapping (address => bool) private delegatorStateChangeApproved;

    function addDelegatorStateChangePermission(address that, bool status) public onlyOwner {
        return _addDelegatorStateChangePermission(that, status);
    }

    function _addDelegatorStateChangePermission(address that, bool status) internal {
        require(isContract(that), "Only contracts");
        delegatorStateChangeApproved[that] = status;
    }

    // Only contracts.
    function isStateChangeApprovedContract(address that)  public view returns (bool) {
        return _isStateChangeApprovedContract(that);
    }

    function _isStateChangeApprovedContract(address that) internal view returns (bool) {
        return delegatorStateChangeApproved[that];
    }

    function isContract(address addr) public view returns (bool) {
        uint size;
        assembly { size := extcodesize(addr) }
        return size > 0;
    }

}
function isStateChangeApprovedContract(address that)  public view returns (bool) {
    return _isStateChangeApprovedContract(that);
}

// Only contracts.