Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

The Ethereum proof of personhood protocol based on mailing addresses 📫

License

Notifications You must be signed in to change notification settings

0xcadams/proof-of-residency

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

This stack uses Hardhat to orchestrate tasks and Ethers for all Ethereum interactions and testing. There are also shared types between the tests and smart contract layer using Typechain.

The Proof of Residency subgraph (using The Graph) can be found on their hosted service.

Please see the website for more information!

DAO Integration with Proof of Residency

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 manipulate 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

Contributing

Clone this repository, then install the dependencies with yarn install. The smart contract code is under packages/contracts, NextJS code is under packages/web, and the subgraph is at packages/subgraph. This repository does not contain the code behind the artwork for each ERC-721.

License

Licensed under the MIT license.