@proof-of-residency/contracts
v1.2.2
Published
The Solidity smart contracts for Proof of Residency.
Downloads
21
Readme
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.
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
- Mainnet: 0x99C5...84ba0c8
- Arbitrum: 0x6f66...a4661B4
- Optimism: 0x6f66...a4661b4
- Polygon: 0xdB1f...9A917B9
Testnets
- Goerli: 0x2D05...840418A
- Rinkeby: 0xDe1e...4d3857f
- Arbitrum Rinkeby: 0xeB52....C27f677
- Optimistic Kovan: 0x6f66...a4661b4
- Polygon Mumbai: 0x6f66...a4661b4
License
Licensed under the MIT license.