From 69d1ac54b9e3672cfca94080a24172ec1b714d68 Mon Sep 17 00:00:00 2001 From: Piotr Ostrowski Date: Sun, 8 Sep 2024 05:39:56 +0200 Subject: [PATCH] mvp --- README.md | 13 +++-- docs/setup.md | 20 ++++++++ docs/usage.md | 51 +++++++++++++++++++ .../components/WorldCoinVerification.tsx | 2 +- 4 files changed, 78 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3ea88b9..2931cd1 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@ -# 🏗 Scaffold-ETH 2 +# 🚨FairDrop -

- Documentation | - Website -

+- [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! 🚀 + +Made with <3 by piotrostr.eth diff --git a/docs/setup.md b/docs/setup.md index 0863049..25e5531 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -1,5 +1,25 @@ # Setup +

+ Documentation | + Website +

+ +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. diff --git a/docs/usage.md b/docs/usage.md index 8f04b05..c744ce5 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -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 diff --git a/packages/nextjs/components/WorldCoinVerification.tsx b/packages/nextjs/components/WorldCoinVerification.tsx index 1d93781..da8029d 100644 --- a/packages/nextjs/components/WorldCoinVerification.tsx +++ b/packages/nextjs/components/WorldCoinVerification.tsx @@ -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], }, {