πŸ“„User Smart Contract

This contract stores two different things:

User Data

This is an on-chain way to store basic user information (name, bio, social networks, picture). It's not mandatory, is just another option. User can choose to use different sources to display their info (i.e. ENS, NFTs, LinkedIn or other on-chain or off-chain sources).

Structure

struct UserInfo {
    address user;
    string name;
    string bio;
    string[] networkLinks;
    string profilePicture;
    string moreInfoLink;
}  

Example:

{
  "user": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
  "name": "John Doe",
  "bio": "I am a developer with 5 years of experience...",
  "networkLinks": [
    "twitter.com/johndoe",
    "linkedin.com/in/johndoe"
  ],
  "profilePicture": "https://i.pravatar.cc/300",
  "moreInfoLink": "ipfs://ipfs.io/XXXXXXX"
}

Permissions

Permissions are a tool that allows the user to delegate to an operator the ability to register a record on their behalf. This is necessary if the user wants to use Prutopia API or eventually another third party tool.

Types

There are two type of permissions: General and Experience. The first one are permissions relative to general actions and the second one are permissions relative to a certain experience.

Structure

struct GeneralPermission {
    bool updateInfo;
    bool addExperience;
    bool editExperience;
    bool endExperience;
    bool deleteExperience;
    bool addCompanyValidation;
    bool updateWorkRecordValidation;
    bool usePlatformAddress;
    bool total;
}

Each permission name describes the action that is allowed to be executed by the operator. User can choose to configure "total" permissions, that acts as a superpermission for all operations.

struct ExperiencePermission {
    bool addWorkRecord;
    bool editWorkRecord;
    bool endWorkRecord;
    bool deleteWorkRecord;
    bool cancelWorkRecord;
}

Experience Permissions are used for freelance experiences and allows to perform Work Record functions for a specific Experience. To understand this better, think of a user who do regular jobs on a freelance service platform and wants to allow that platform to write that services but specifically for that experience, and not for another.

Functions

updateInfo: Used to insert/update their profile.

updateGeneralPermissions: Used to update General Permissions.

updateGeneralPermissionsWithSig: Used to update General Permissions with user Signature. This allows the user to configure General Permissions delegating the blockchain transaction to a third party.

updateExperiencePermissions: Used to update ExperiencePermissions.

updateExperiencePermissionsWithSig: Used to update Experience Permissions with user Signature. This allows the user to configure Experience Permissions delegating the blockchain transaction to a third party.

Last updated