@proof-of-residency/contracts

1.2.2 • Public • Published

Proof of Residency

POR

Proof of Residency is a Sybil-resistant Proof of Personhood protocol which issues non-transferable ERC-721 tokens based on physical mailing addresses. Please read the whitepaper to learn how we issue tokens and retain privacy, as well as our plans for future decentralization.

npm version codecov Commitizen friendly


Overview

Installation

$ npm install @proof-of-residency/contracts

The Proof of Residency contracts are non-upgradeable, so the API will remain stable indefinitely.

Usage

Once installed, you can use the contracts by importing them:

pragma solidity ^0.8.7;

import '@proof-of-residency/contracts/contracts/ProofOfResidency.sol';

contract SomeDAOTest {
  ProofOfResidency private immutable _proofOfResidency;

  constructor(address proofOfResidencyAddress) {
    _proofOfResidency = ProofOfResidency(proofOfResidencyAddress);
  }

  function joinDao() external view returns (bool) {
    require(isSenderHuman() && !doesSenderHaveOutstandingTokenChallenge(), 'Not allowed!');

    return true;
  }

  function isSenderHuman() private view returns (bool) {
    return _proofOfResidency.balanceOf(msg.sender) > 0;
  }

  function doesSenderHaveOutstandingTokenChallenge() private view returns (bool) {
    // this should only be used in specific circumstances - there is a chance that
    // a malicious actor could push the PORP DAO to challenge an honest user, in order
    // to disenfranchise them in a downstream vote
    return _proofOfResidency.tokenChallengeExists(msg.sender);
  }
}

This will not increase the size of your contract, it will only add the appropriate function selectors to the compiled bytecode (as long as you don't use the new keyword and create a new Proof of Residency contract!)

The API for the Proof of Residency ERC-721 is documented extensively in the contract and the whitepaper.

Contract Addresses

L1/L2s

Testnets

License

Licensed under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i @proof-of-residency/contracts

Weekly Downloads

1

Version

1.2.2

License

MIT

Unpacked Size

201 kB

Total Files

45

Last publish

Collaborators

  • chase-adams