Skip to content

Commit

Permalink
mvp
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrostr committed Sep 8, 2024
1 parent ca72e7d commit 69d1ac5
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 8 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# 🏗 Scaffold-ETH 2
# 🚨FairDrop

<h4 align="center">
<a href="https://docs.scaffoldeth.io">Documentation</a> |
<a href="https://scaffoldeth.io">Website</a>
</h4>
- [Quickstart](https://raw.githubusercontent.com/piotrostr/fairdrop/docs/usage.md)
- [Development Docs](https://raw.githubusercontent.com/piotrostr/fairdrop/docs/setup.md)

- [Setup Instructions](https://raw.githubusercontent.com/piotrostr/fairdrop/docs/setup.md)
- [Usage Guide](https://raw.githubusercontent.com/piotrostr/fairdrop/docs/usage.md)
Let's make Ethereum fair again! 🚀

<sub>Made with <3 by piotrostr.eth</sub>
20 changes: 20 additions & 0 deletions docs/setup.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Setup

<h4 align="center">
<a href="https://docs.scaffoldeth.io">Documentation</a> |
<a href="https://scaffoldeth.io">Website</a>
</h4>

Some cool features

- the pre-built components are easily customizable but satisfy most of the
needs of a typical dapp
- it is very straightforward to expand to more chains, as simple as adding
a new target in the `scaffold.config.ts`
- contracts automatically get their typings passed onto frontend, after `node
scripts-js/generateTsAbis.js` is ran as part of the standard workflow
- you can `yarn verify` to verify the contracts, be sure to re-set the etherscan
API key in the `.env` to matching file

Note: I needed a custom deploy script under
`//fairdrop/packages/foundry/deploy.sh`, `yarn deploy` might need to be
adjusted to work

## Intro to Scaffold-ETH 2

🧪 An open-source, up-to-date toolkit for building decentralized applications (dapps) on the Ethereum blockchain. It's designed to make it easier for developers to create and deploy smart contracts and build user interfaces that interact with those contracts.
Expand Down
51 changes: 51 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
@@ -1 +1,52 @@
# Usage

- [WorldID Orb](https://worldcoin.org/world-id)
- [Wormhole](https://docs.wormhole.com/wormhole/quick-start/tutorials/hello-wormhole/hello-wormhole-explained)

You can power-up your smart contract to only serve WorldID Orb verified users
by calling the `isVerified` function of the smart contract on the network of
your choice.

## Mainnet Addresses:

- Optimism: `0x04a85361c22eD1DDF4f3EcB998570FC71A5df991`
- Arbitrum: `0x146174BD95fB5b71Dd6aa6dd003d52D0bC4dA799` (Satellite)

## Testnet Addresses:

Coming soon:)

## Code Example

The `IFairDrop` interface is tiny, it has one function that is relevant:

```solidity
interface IFairDrop {
function isVerified(address _user) external view returns (bool);
}
```

after defining the interface, you can use it in your smart contract like this:

```solidity
modifier onlyVerified() {
require(IFairDrop(fairDropAddress).isVerified(msg.sender), "FairDrop: User is not verified");
_;
}
```

and then

```solidity
function antiSybilFunction() public onlyVerified {
// only humans allowed here!
}
```

## How it works

There is a Satellite contract on Arbitrum that receives data from Optimism core
FairDrop contract through Wormhole

Satellite cannot perform verification, it is only a mirror of the data in the
core contract
2 changes: 1 addition & 1 deletion packages/nextjs/components/WorldCoinVerification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const WorldCoinVerification = () => {
try {
const res = await fairDrop(
{
functionName: "verifyAndPropagate",
functionName: "verify", // replace with verifyAndPropagate to propagate to satellite
args: [address, BigInt(result.merkle_root), BigInt(result.nullifier_hash), unpackedProof],
},
{
Expand Down

0 comments on commit 69d1ac5

Please sign in to comment.