  We show that the group ${\mathbb Q \rtimes \mathbb Q^*_+}$ of
orientation-preserving affine transformations of the rational numbers is
quasi-lattice ordered by its subsemigroup ${\mathbb N \rtimes \mathbb
N^\times}$. The associated Toeplitz $C^*$-algebra ${\mathcal T}({\mathbb N
\rtimes \mathbb N^\times})$ is universal for isometric representations which
are covariant in the sense of Nica. We give a presentation of this Toeplitz
algebra in terms of generators and relations, and use this to show that the
$C^*$-algebra ${\mathcal Q_\mathbb N}$ recently introduced by Cuntz is the
boundary quotient of $({\mathbb Q \rtimes \mathbb Q^*_+}, {\mathbb N \rtimes
\mathbb N^\times})$ in the sense of Crisp and Laca. The Toeplitz algebra
${\mathcal T}({\mathbb N \rtimes \mathbb N^\times})$ carries a natural dynamics
$\sigma$, which induces the one considered by Cuntz on the quotient ${\mathcal
Q_\mathbb N}$, and our main result is the computation of the KMS$_\beta$
(equilibrium) states of the dynamical system $({\mathcal T}({\mathbb N \rtimes
\mathbb N^\times}), {\mathbb R},\sigma)$ for all values of the inverse
temperature $\beta$. For $\beta \in [1, 2]$ there is a unique KMS$_\beta$
state, and the KMS$_1$ state factors through the quotient map onto ${\mathcal
Q_\mathbb N}$, giving the unique KMS state discovered by Cuntz. At $\beta =2$
there is a phase transition, and for $\beta>2$ the KMS$_\beta$ states are
indexed by probability measures on the circle. There is a further phase
transition at $\beta=\infty$, where the KMS$_\infty$ states are indexed by the
probability measures on the circle, but the ground states are indexed by the
states on the classical Toeplitz algebra ${\mathcal T}(\mathbb N)$.
