It is simple enough that it may serve as an example of what is need under ggplot2 >= 2.0.0 for defining a simple stat_. I used the source code of ggplot2 itself as a template, maybe you could just use mine given below. For each stat one needs to define one function, which will be public and an object holding all the definitions needed for the actual computations and mapping of aesthetics (the object is used internally although still needs to be exported if included in a package).
A package that as of today contains the same stat_poly_eq() definition is available at Bitbucket. In the future I may add more examples or improve this one. It can be installed from source using package devtools.
I have collected some code snippets I used recently for working with polynomials. The idea of writing this page came from a question I was asked a few days ago by Titta Kotilainen. I should emphasize that the page linked below concerns only polynomials, and excludes all other linear models that can be fit with lm(). Even models that are polynomials but formulated not as a regular polynomial equation (e.g. x ~ I(x^2) + x instead of the expected x + I(x^2) will quietly fail! In contrast, use of poly() as in y ~ poly(x, 2) is fine.