Gym Membership

Contract purpose

This smart contract manages gym subscriptions. Clients choose the type of membership they want and regularly pay for it.

Exposed methods and variables

manager address of the gym manager

addSubscription called by the manager to add a new type of subscription to the list and returns the subscription ID by which it will be further identified

parameter nametypedetails
_subTypestringsubscription type
_priceintegerprice per month of the subscription

startMembership payable function called by a person who wants to become a gym member and it emits the NewMember event

parameter nametypedetails
subIDintegerthe subscription id
_namestringthe client's name

paySubscription payable function that allows clients to pay their subscription and emits the event SubscriptionPaid

removeClient allows the manager to cancel a client's membership

parameter nametypedetails
addrethereum addressthe client's address

cancelSubscription allows a cient to cancel his gym membership

getClientDetails called by the manager to return a client's details

parameter nametypedetails
addrethereum addressthe client's address

transferMoney allows the owner to transfer money from the contract's balance to his own account

parameter nametypedetails
amountintegerthe sum the manager wants to transfer

getBalance returns the balance of the contract when called by the manager

Events

NewMember

parameter nametypedetails
clethereum addressnew member's address
subintegerthe id of the subscription the client chose

SubscriptionPaid

parameter nametypedetails
clethereum addressmember's address
subintegerthe id of the subscription the client has
Buy
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract