...

/

Smart Contract: Creator and Applicant Profiles

Smart Contract: Creator and Applicant Profiles

Learn to extend our smart contract to allow users to create profiles and apply for jobs.

To begin this project, we’ll add a profile functionality. This will allow potential job creators and applicants to create separate profiles with specific abilities.

Project structure

We’ll make this project as modular as possible, separating aspects into different files. We’ll clear any existing code from our Remix widget and delete all files in the contracts folder because we’ll be creating new ones.

The first new file is the core contract code, and we’ll call it SolJobs.sol. We’ll also create sibling files in the same directory called enums.sol, constants.sol, and structs.sol. These files will hold the corresponding data types, and we’ll import them into the core contract code.

The structure should look like this:

Project file structure
Project file structure

Core contract code

We’ll copy the contents of the individual files below and paste them into the corresponding new files we created. Then, we’ll take a look at each of them and what they do.

Press + to interact
SolJobs.sol
constants.sol
enums.sol
structs.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "./enums.sol";
struct CreatorProfile {
uint id;
string email;
string name;
string tagline;
string description;
address creatorAddress;
bool verified;
ProfileType profileType;
uint[] jobOfferIDs;
}
struct ApplicantProfile {
uint id;
address applicantAddress;
string fullname;
string email;
string location;
string bio;
ProfileType profileType;
uint[] applicationIDs;
}

constants.sol

...