
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 name | type | details |
---|---|---|
_subType | string | subscription type |
_price | integer | price 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 name | type | details |
---|---|---|
subID | integer | the subscription id |
_name | string | the 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 name | type | details |
---|---|---|
addr | ethereum address | the client's address |
cancelSubscription allows a cient to cancel his gym membership
getClientDetails called by the manager to return a client's details
parameter name | type | details |
---|---|---|
addr | ethereum address | the client's address |
transferMoney allows the owner to transfer money from the contract's balance to his own account
parameter name | type | details |
---|---|---|
amount | integer | the sum the manager wants to transfer |
getBalance returns the balance of the contract when called by the manager
Events
NewMember
parameter name | type | details |
---|---|---|
cl | ethereum address | new member's address |
sub | integer | the id of the subscription the client chose |
SubscriptionPaid
parameter name | type | details |
---|---|---|
cl | ethereum address | member's address |
sub | integer | the id of the subscription the client has |