filling and draining at the touch of a button

https://www.google.com/search?q=positive+displacement+pump
Each rotation displaces a predetermined amount of fluid.

Use the EEPROM to record the accumulated total.

Provide a reset in case something goes wrong (you would either completely fill or completely empty the container).