KIP Identification

  • This contract is used as a KIP Identity to classify users in the KIP Ecosystem.

  • The contract uses the ERC-721 standard with the external implementation ERC721URIStorage

  • Currently, there are three types of Users:

    • App Owner (idType = 1)

    • Model Owner (idType = 2)

    • Dataset Owner (idType = 3)

  • Deployed KIPIdentification contract:

  • Supported roles/actors/users (msg.sender):

    • DEFAULT_ADMIN_ROLE:

      bytes32 DEFAULT_ADMIN_ROLE = 0x0000000000000000000000000000000000000000000000000000000000000000;
    • MINTER_ROLE:

      ///  MINTER_ROLE = keccak256("MINTER_ROLE")
      bytes32 MINTER_ROLE = 0x9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6;
    • Users: owners of tokenId

Contract Interfaces

Getter functions:

function KIPManagement() external view returns (address);
  • Purpose: Query the current address of the KIPManagement contract.

  • Parameters: None

  • Return:

    • Type: address

    • Value: The address of the KIPManagement contract

function name() external view returns (string);
  • Purpose: Query the name of the Identity NFT Collection (ERC-721 standard).

  • Parameters: None

  • Return:

    • Type: string

    • Value: The Identity NFT Collection's name

function symbol() external view returns (string);
  • Purpose: Query the symbol of the Identity NFT Collection (ERC-721 standard)

  • Parameters: None

  • Return:

    • Type: string

    • Value: The Identity NFT Collection's symbol

function balanceOf(address owner) external view returns (uint256);
  • Purpose: Query the number of identities owner has in the NFT Collection (ERC-721 standard)

  • Parameter:

    • owner:

      • Type: address

      • Value: The account's address to check

  • Return:

    • Type: uint256

    • Value: The total number of identities owner has

function ownerOf(uint256 tokenId) external view returns (address);
  • Purpose: Query the owner of the issued tokenId (ERC-721 standard)

  • Parameter:

    • tokenId:

      • Type: uint256

      • Value: The unique ID assigned to an identity

  • Return:

    • Type: address

    • Value: The owner of the provided tokenId

function idTypes(uint256 tokenId) external view returns (uint256);
  • Purpose: Query the idType of the issued tokenId

  • Parameter:

    • tokenId:

      • Type: uint256

      • Value: The unique ID assigned to an identity

  • Return:

    • Type: uint256

    • Value: The unique classification that has been assigned to the tokenId

function tokenURI(uint256 tokenId) external view returns (string);
  • Purpose: Query the URL of the issued tokenId which links to its metadata (ERC-721 standard)

  • Parameter:

    • tokenId:

      • Type: uint256

      • Value: The unique ID assigned to an identity

  • Return:

    • Type: string

    • Value: The string value of URL

function getApproved(uint256 tokenId) external view returns (address);
  • Purpose: Query the address that has been approved as spender of the tokenId (ERC-721 standard)

  • Parameter:

    • tokenId:

      • Type: uint256

      • Value: The unique ID assigned to an identity

  • Return:

    • Type: address

    • Value: The address of an approved spender

function isApprovedForAll(
  address owner,
  address operator
) external view returns (bool);
  • Purpose: Check whether operator is approved as spender for all tokenIds owned by owner (ERC-721 standard)

  • Parameter:

    • owner:

      • Type: address

      • Value: The owners address

    • operator:

      • Type: address

      • Value: The owners address

  • Return:

    • Type: bool

    • Value: true or false

Setter functions:

function setManagement(address management) external;
  • Purpose: Update the address of KIPManagement contract

  • Requirement:

    • Caller must have DEFAULT_ADMIN_ROLE

  • Parameter:

    • management:

      • Type: address

      • Value: The address of the KIPManagement contract

function issueId(
  address to,
  uint256 tokenId,
  uint256 idType,
  string tokenURI
) external;
  • Purpose: Generate the identity and assign to to

  • Requirements:

    • Caller must have MINTER_ROLE

    • Receiving address must follow:

      • Should not be 0x0

      • If a contract, it should have the required interface (IERC721Receiver)

    • tokenId should not have been issued prior to the request

  • Parameters:

    • to:

      • Type: address

      • Value: The address that will be the owner of tokenId

    • tokenId:

      • Type: uint256

      • Value: The unique ID assigned to an identity

    • idType:

      • Type: uint256

      • Value: The classification of the tokenId

    • tokenURI:

      • Type: string

      • Value: The string value of URL

function setTokenURI(uint256 tokenId, string tokenURI) external;
  • Purpose: Update the new string URL of tokenId which links to its metadata

  • Requirements:

    • Caller must be the owner of the tokenId

  • Parameters:

    • tokenId:

      • Type: uint256

      • Value: The unique ID assigned to an identity

    • tokenURI:

      • Type: string

      • Value: The new string of URL

function safeTransferFrom(address from, address to, uint256 tokenId) external;
  • Purpose: Transfer the ownership of the tokenId

  • Requirements:

    • Caller must be one of the following:

      • The owner of the transferring tokenId

      • Approved as spender for the tokenId

    • Receiver must meet the following requirements:

      • Should not be 0x0

      • If a contract, it should have the required interface (IERC721Receiver)

  • Parameters:

    • from:

      • Type: address

      • Value: The current owner of the tokenId

    • to:

      • Type: address

      • Value: The new owner to whom the tokenId will be transferred

    • tokenId:

      • Type: uint256

      • Value: The unique ID assigned to an identity

function transferFrom(address from, address to, uint256 tokenId) external;
  • Purpose: Transfer the ownership of the tokenId. This function does not validate/check the Receiver. It is recommended to use the above function when transferring the identity's ownership.

  • Requirements:

    • Caller must be one of the following:

      • The owner of the transferring tokenId

      • Approved as spender for the tokenId

    • Receiver should not be 0x0

  • Parameters:

    • from:

      • Type: address

      • Value: The current owner of the tokenId

    • to:

      • Type: address

      • Value: The new owner to whom the tokenId will be transferred

    • tokenId:

      • Type: uint256

      • Value: The unique ID assigned to an identity

function approve(address to, uint256 tokenId) external;
  • Purpose: Authorize to as the spender for tokenId

  • Requirements:

    • Caller must be the owner of the tokenId

  • Parameters:

    • to:

      • Type: address

      • Value: The account address that will be assigned as the spender

    • tokenId:

      • Type: uint256

      • Value: The unique ID assigned to an identity

function setApprovalForAll(address operator, bool approved) external;
  • Purpose: Set or reset operator as the approval spender for all tokenIds that owned by msg.sender

  • Requirements:

    • Caller can be ANY

  • Parameters:

    • operator:

      • Type: address

      • Value: The account address that will be assigned as the spender

    • approved:

      • Type: bool

      • Value: true to set, and false to reset

Last updated