A contract is a grant written by a legislative power by which a body is founded and its rights are defined.