How to create a contract for an event and send to a client