In this talk, we present an ergodicity criterion of a certain class of 1-Lipschitz functions on $\mathbb{Z}_p$ for arbitrary primes $p,$ known as $\mathcal{B}$-functions. These functions are locally analytic functions of order 1 (and therefore contain polynomials). For arbitrary primes $p\geq 5,$ this erodicity criterion leads to an efficient and practical method of constructing ergodic polynomials on $\Z_p$ that realize a given unicyclic permutation modulo $p.$ In particular, for polynomials over $\mathbb{Z}_3$, we provide a complete ergodicity criterion in terms of its coefficients. This method can be applied to a $\mathbb{Z}_p$ for general primes $p.$