πŸ“„Experience Smart Contract

This contract stores all the Work and Educational Experiences of the user.

Structure

struct Experience {
    uint256 experienceId;
    address user;
    uint8 experienceType;
    string role;
    string description;
    string company;
    address companyAddress;
    uint256 startDate;
    uint256 endDate;
    bool companyValidation;
    Skill[] skills;
    string moreInfoLinks;
}
struct Skill {
    string skill;
    uint8 level;
}

Example

{
  "experienceId": 1,
  "user": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
  "experienceType": 0,
  "role": "Developer",
  "description": "Fullstack Blockchain Developer",
  "company": "",
  "companyAddress": "0xea83c649dd49a6ec44c9e2943eb673a8fbb7bab6",
  "startDate": 1704078000,
  "endDate": 1717124400,
  "companyValidation": true,
  "skills": [
    {
      "skill": "Javascript",
      "level": 8
    },
    {
      "skill": "English",
      "level": 0
    }
  ],
  "moreInfoLink": "ipfs://ipfs.io/XXXXXXX"  
}

Field Semantics

  • experienceId: Experience Identificator. This value is assigned correlatively by the Smart Contract.

  • user: Address of the user. Owner of the record.

  • experienceType: Type of the Experience (0 = Professional, 1 = Educational).

  • role: Role name.

  • description: Describe the role with more details.

  • company: Name of the company/institution. It's just descriptive, this experience cannot be verified if this field is used. Must be empty if a Company Address is provided or if the Experience is freelance.

  • companyAddress: Address of the company/institution. Must be provided by the company/institution itself. Must be different from user address. The owner of this address can verify the Experience. Could be empty if the company/institution have no address or if the Experience is freelance.

  • startDate: Date when the Experience began. Store as Unix Timestamp (Seconds since Jan-01-1970). Mandatory field.

  • endDate: Date when the Experience ended. Store as Unix Timestamp (Seconds since Jan-01-1970). Could be 0 if the Experience has not ended yet. Must be 0 if the Experience is freelance. Must be greater than startDate.

  • companyValidation: If a companyAddress is provided, the owner of it can validate the Experience.

  • skills: Skills used for this experience.

  • moreInfoLink: Link to an optional metadata. Typically this link will point to a JSON with different fields for any kind of metadata (Photos, Videos, Informative Fields, etc).

Functions

addExperience: Adds a new experience.

updateExperience: Updates an existing experience.

endExperience: Ends an existing experience.

deleteExperience: Deletes an existing experience.

updateExperienceValidation: Validates an existing experience.

Validation Rules

The are several rules that an Experience must follow to ensure a consistent state. This apply to addExperience, updateExperience and endExperience operation.

  • User address must be different from address zero.

  • Experience type must be 0 (Professional) or 1 (Educational)

  • Role must not be empty.

  • Must specify either a company name or a company address for non-freelance (one or another, not both).

  • User address must be different from company Address.

  • Freelance experience (No company name or company address) must not have endDate.

  • StartDate must not be empty.

  • EndDate must be greater than startDate.

Last updated