contract Pausable is GuidedByRoles {

    mapping (address => bool) public unpausedWallet;

    event Pause();
    event Unpause();

    bool public paused = true;


    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     */
    modifier whenNotPaused(address _to) {
        require(!paused||unpausedWallet[msg.sender]||unpausedWallet[_to]);
        _;
    }

    function onlyAdmin() internal view {
        require(rightAndRoles.onlyRoles(msg.sender,3));
    }

    // Add a wallet ignoring the "Exchange pause". Available to the owner of the contract.
    function setUnpausedWallet(address _wallet, bool mode) public {
        onlyAdmin();
        unpausedWallet[_wallet] = mode;
    }

    /**
     * @dev called by the owner to pause, triggers stopped state
     */
    function setPause(bool mode)  public {
        require(rightAndRoles.onlyRoles(msg.sender,1));
        if (!paused && mode) {
            paused = true;
            emit Pause();
        }else
        if (paused && !mode) {
            paused = false;
            emit Unpause();
        }
    }

}
function setPause(bool mode)  public {
    require(rightAndRoles.onlyRoles(msg.sender,1));
    if (!paused && mode) {
        paused = true;
        emit Pause();
    }else
    if (paused && !mode) {
        paused = false;
        emit Unpause();
    }
}

/**
 * @dev called by the owner to pause, triggers stopped state
 */