npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@identity.com/gateway-protocol-eth

v0.0.4

Published

Identity.com Gateway Tokens ethereum smart contracts

Downloads

12

Readme

Identity.com Gateway Tokens on Ethereum blockchain

This repository contains set of Ethereum smart contracts for Identity.com On-chain Identity Gateway token system.

Gateway tokens allows Ethereum DeFi projects to validate that their users successfully completed KYC, with regulations and guidances from FATF, US OFAC, US OCC BSA and others.

Quick Start

  1. Use established node version by running nvm use
  2. Install repository dependencies by running yarn install
  3. Run yarn build to compile smart contracts
  4. Execute yarn test to run the tests.

Static analysis

Additionally, you can perform static analysis for well-known code issues and vulnerabilities using Slither.

pip3 install slither-analyzer
yarn analyze

Environment variables

Please refer to .env.example and create .env to provide secret info such as private keys, Infura ID. Private keys are used in order to deploy smart contracts on one of the Ethereum networks.

Compile

To compile smart contracts, type hardhat compile. Use --force option to recompile everything if needed.

The compiled output is a json file called Artifacts and saved in ./build/contracts directory per contract basis. ABI and bytecode associated with the smart contract will be saved in the json file.

Deployment

In order to deploy the protocol please execute yarn deploy <NETWORK> command and replace with the network you want to deploy the protocol.

For example yarn deploy hardhat will deploy the protocol on the local hardhat version of the ethereum blockchain.

After the successful deployment you'll be able to find the deployment result in the deployments folder.

Integration

To integrate Gateway Tokens and validate user's identities DeFi contract has to import IGatewayTokenVerifier interface.

After importing IGatewayTokenVerifier interface, you can trigger the function below:

pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;

interface IGatewayTokenVerifier {
    /**
    * @dev Triggered by external contract to verify if `tokenId` and token `owner` are correct.
    *
    * Checks if token exists in gateway token contract, `tokenId` still active, and not expired.
    * Performs additional checks to verify that `owner` is not blacklisted globally.
    */
    function verifyToken(address owner, uint256 tokenId) external view returns (bool);

    /**
    * @dev Triggered by external contract to verify the validity of the default token for `owner`.
    *
    * Checks owner has any token on gateway token contract, `tokenId` still active, and not expired.
    * Performs additional checks to verify that `owner` is not blacklisted globally.
    */
    function verifyToken(address owner) external view returns (bool);
}

By sending a user's address and optionally, token ID, as parameters, the system will validate if their gateway token is active.

Integration example

In order to validate your user's gateway tokens validation smart contract first has to import a validation interface:

import "./interfaces/IGatewayTokenVerifier.sol";

After importing an interface a validation smart contract has to either specify a GatewayToken contract address for which type of tokens contract needs to validate for, or pass a token address during into the validation function. Typically there is two ways to validate user's tokens such as:

  1. Validate specific token by tokenID
address gatekeeperNetwork;

function borrow(uint256 amount, uint256 tokenId) {
	IGatewayToken gt = IGatewayToken(gatekeeperNetwork);
	require(gt.verify(msg.sender, tokenid), "INVALID OR MISSING GATEWAY TOKEN");
	// transfer funds to msg.sender
}
  1. Or validate a default token for user
address gatekeeperNetwork;

function borrow(uint256 amount) {
	IGatewayToken gt = IGatewayToken(gatekeeperNetwork);
	require(gt.verify(msg.sender), "INVALID OR MISSING GATEWAY TOKEN");
	// transfer funds to msg.sender
}

Creating a GKN

...

Adding a Gatekeeper to the GKN