Employee Badge

A deep dive into the various methods in the Employee Badge ERC-721 contract

The following assumes you have installed the required interface package and imported the working contract into your codebase.

mintFor

Used for onboarding new employees. This external function allows verified employers to add a given wallet to their organisation and define a tokenUri which will contain the ipfs CID pointer to the json file representing the job details in the standard NFT json schema.

uint256 _tokenId = employeeNft.mintFor(0x3DdDF83eDD1aa846c4e75f0592AE60C4D1C1C1c6, "QmU2EXy9qKZd1H6ngxQMSY9vdbDyiVD8c8EEnaQqqW839d");
{
  "name": "Chief Technology Officer",
  "image": "ipfs://QmXVPmiW6uq6c9XDKkFeQjU6KVjCq4wi5zksaE5WwSwbAX",
  "employer": "Hooli",
  "attributes": [
    {
      "display_type": "date",
      "trait_type": "start date",
      "value": 1546360800
    },
    {
      "trait_type": "Employer",
      "value": "Hooli"
    },
    {
      "trait_type": "Department",
      "value": "Internal Solutions"
    },
    {
      "trait_type": "Governance Level",
      "value": "Board of Directors"
    },
    {
      "trait_type": "Special Groups",
      "value": "Hooli X"
    }
  ]
}

getEmployerId

An easy way to get the current employer id for a give employee NFT id.

uint256 _employerId = employeeNft.getEmployerId(1)

burn

As a token holder (employee) or token granter (employer) you can terminate the employment within that organisation at any given time. This is done by burning the employee badge.

employeeNft.burn(_tokenId);

Last updated