Online Courses

UTILITYDOCUMENTSFINANCIAL

Contract purpose

This Smart Contract manages the enrollment in online courses for a university or online platform. Courses are added and students can enrol while the enrollment period is open.

Exposed methods and variables

admin the ethereum address of system administrator, given as parameter at contract creation

courseList returns the details about a particular course when called with the reference number of that course.

addCourse function called by the admin when he wants to add a new course to the list

parameter nametypedetails
_refNrintegerunique identifier of the course
_titlestringthe title of the course
_instructorsstringthe name of the instructor/instructors that teach the course
_priceintegerthe price a student has to pay to enrol in this course
_durationintegerthe duration of the course (the number of weeks)

openEnrollment called by the admin to open the enrollment period for a particular course. It emits the EnrollmentOpened event.

parameter nametypedetails
_refNrintegerunique identifier of the course

enrol allows a student to sign up for a course. The enrollment period has to be open and the sum sent to the contract has to be the same as the course price. It emits the StudentEnrolled event.

parameter nametypedetails
_refNrintegerunique identifier of the course

closeEnrollment called by the admin to close the enrollment period for a particular course. It emits the EnrollmentClosed event.

parameter nametypedetails
_refNrintegerunique identifier of the course

transferMoney allows the admin 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 admin

Events

EnrollmentOpened

parameter nametypedetails
ReferenceNumberintegerthe identifier of the course for which the enrollment period is now opened

StudentEnrolled

parameter nametypedetails
ReferenceNumberintegerthe identifier of the course to which the student is now enrolled
Studentethereum addressthe address of the enrolled student

EnrollmentClosed

parameter nametypedetails
ReferenceNumberintegerthe identifier of the course for which the enrollment period is now closed
Buy
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract