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.
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!
$ npm install @proof-of-residency/contracts
The Proof of Residency contracts are non-upgradeable, so the API will remain stable indefinitely.
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.
- Mainnet: 0x99C5...84ba0c8
- Arbitrum: 0x6f66...a4661B4
- Optimism: 0x6f66...a4661b4
- Polygon: 0xdB1f...9A917B9
- Goerli: 0x2D05...840418A
- Rinkeby: 0xDe1e...4d3857f
- Arbitrum Rinkeby: 0xeB52....C27f677
- Optimistic Kovan: 0x6f66...a4661b4
- Polygon Mumbai: 0x6f66...a4661b4
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.
Licensed under the MIT license.