contract GoldRubleBonusStorage is Ownable {

    IERC20 private _token;

    RefStorage private _refStorage;

    mapping (address => bool) admins;

    modifier restricted {
        require(admins[msg.sender] || isOwner());
        _;
    }

    constructor(address token, address refStorageAddr, address initialOwner) public Ownable(initialOwner) {
        _token = IERC20(token);
        _refStorage = RefStorage(refStorageAddr);
    }

    function setAdmins(address account, bool state) public onlyOwner {
        admins[account] = state;
    }

    function setToken(address token) public onlyOwner {
        _token = IERC20(token);
    }

    function setRefStorage(address refStorageAddr) public onlyOwner {
        _refStorage = RefStorage(refStorageAddr);
    }

    function sendBonus(address account, uint256 amount) public restricted {
        _token.transfer(account, amount);
    }

    function withdrawERC20(address ERC20Token, address recipient) external onlyOwner {
        uint256 amount = IERC20(ERC20Token).balanceOf(address(this));
        IERC20(ERC20Token).transfer(recipient, amount);
    }

    //////// REFSTORAGE MANAGE METHODS ////////

    function RS_transferOwnership(address newOwner) external onlyOwner {
        _refStorage.transferOwnership(newOwner);
    }

    function RS_changeContracts(address contractAddr) external restricted {
        _refStorage.changeContracts(contractAddr);
    }

    function RS_changePrize(uint256 newPrize) external restricted {
        _refStorage.changePrize(newPrize);
    }

    function RS_changeInterval(uint256 newInterval) external restricted {
        _refStorage.changeInterval(newInterval);
    }

    function RS_newTicket() external restricted {
        _refStorage.newTicket();
    }

    function RS_addReferrer(address referrer) external restricted {
        _refStorage.addReferrer(referrer);
    }

    function RS_sendBonus(address winner) external restricted {
        _refStorage.sendBonus(winner);
    }

    function RS_withdrawERC20(address ERC20Token, address recipient) external restricted {
        _refStorage.withdrawERC20(ERC20Token, recipient);
    }

    function RS_ticketsOf(address player) external view returns(uint256) {
        _refStorage.ticketsOf(player);
    }

    function RS_referrerOf(address player) external view returns(address) {
        _refStorage.referrerOf(player);
    }

}
/**
 * @title GoldRubleBonusStorage contract
 */
function RS_transferOwnership(address newOwner) external onlyOwner {
    _refStorage.transferOwnership(newOwner);
}

//////// REFSTORAGE MANAGE METHODS ////////