For Developers

This page provides technical guidance on how ONE-ID works, and how to integrate it with your protocol or dApp.

Integrating UID in your smart contracts

To integrate UID into your smart contracts, simply check the balance of your user's address to see if they possess the UID token. In Solidity, it would look like this:

Copy

# This is using OpenZeppelin's ERC1155 preset contracts:
# https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155#IERC1155
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";

contract MyContract {
    address ONEID_CONTRACT = "0xba0439088dc1e75f58e0a7c107627942c15cbb41";
    uint256 public constant ID_VERSION_0 = 0;

    function hasONEID(address userAddress) returns (bool) {
        uint256 balance = IERC1155(ONEID_CONTRACT).balanceOf(userAddress, ID_VERSION_0);
        return balance > 0
    }
}

Note: ONE-ID currently only operates on the Ethereum mainnet. The contract itself can be found here

Integrating ONE-ID in your dApp

For your front ends, you can similarly integrate ONE-ID with the following

var Web3 = require('web3');
const web3 = new Web3(Web3.givenProvider);
const minimalAbi = [{"inputs": [{"internalType": "address", "name": "account", "type": "address"}, {"internalType": "uint256", "name": "id", "type": "uint256"}], "name": "balanceOf", "outputs": [{"internalType": "uint256","name": "","type": "uint256"}], "stateMutability": "view", "type": "function"}]
const uidAddress = "0xba0439088dc1e75F58e0A7C107627942C15cbb41"
const UID = new web3.eth.Contract(minimalAbi, uidAddress)

async function hasUID(userAddress) {
  const VERSION_0 = 0
  const balance = parseInt(await UID.methods.balanceOf(userAddress, VERSION_0).call())
  return balance > 0
}

Getting new users verified

If your users don't already have a ONE-ID, you can send them to our front-ends to be verified at app.onefi.io/verify.

How It Works

ONE-ID functions by having a trusted signer (ONE-ID Check Team) verify that a given address has passed KYC. Once verified, the user receives a signed message which they can present to the ONE-ID contract in order to mint their ONE-ID.

So the user flow looks like this...

  1. The user completes the KYC flow.

  2. Submit the completed KYC to the trusted signer, who will return a signed message to the user.

  3. User mints their ONE-ID by presenting the signed message to the ONE-ID contract.

Security and Privacy

All personal data is processed and handled through ONE-ID Check. ONEFi has industry-leading security and privacy practices, and no personal information is stored on-chain.

Need to get in touch?

Have questions about integrating? Do you have a certain use case or feature you'd like to see? The community would love to hear from you. Reach out to ONEID@onefi.io

Last updated