diff --git a/README.md b/README.md index d0afc2c..7b2df18 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,12 @@ -# ๐Ÿ— Scaffold-ETH 2 +# BeatBridge -๐Ÿงช 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. +Inspiration Music connects people worldwide. Recognizing the power of this universal language and the crucial role fans play in an artist's journey, we created BeatBridge. We sought to empower fans to become active participants, not just passive listeners. -โš™๏ธ Built using NextJS, RainbowKit, Hardhat, Wagmi, and Typescript. +๐ŸŽต What it does BeatBridge allows fans to support their favorite artists directly. By engaging with music, sharing, and promoting it, fans earn tokens redeemable for exclusive rewards. It's a unique platform where every beat builds bridges between artists and fans\ -- โœ… **Contract Hot Reload**: Your frontend auto-adapts to your smart contract as you edit it. -- ๐Ÿ”ฅ **Burner Wallet & Local Faucet**: Quickly test your application with a burner wallet and local faucet. -- ๐Ÿ” **Integration with Wallet Providers**: Connect to different wallet providers and interact with the Ethereum network. -## Contents +๐Ÿ’ป How we built it In our project, we leveraged the noir to veify off-chain data on-chain securely. The Spotify API allowed us to collect various user-related data (such as favorite songs, playlists, time spent on music, etc.), but this data inherently resided off-chain. -- [Requirements](#requirements) -- [Quickstart](#quickstart) -- [Deploying your Smart Contracts to a Live Network](#deploying-your-smart-contracts-to-a-live-network) -- [Deploying your NextJS App](#deploying-your-nextjs-app) -- [Interacting with your Smart Contracts: SE-2 Custom Hooks](#interacting-with-your-smart-contracts-se-2-custom-hooks) -- [Disabling Type & Linting Error Checks](#disabling-type-and-linting-error-checks) - - [Disabling commit checks](#disabling-commit-checks) - - [Deploying to Vercel without any checks](#deploying-to-vercel-without-any-checks) - - [Disabling Github Workflow](#disabling-github-workflow) -- [Contributing to Scaffold-ETH 2](#contributing-to-scaffold-eth-2) ## Requirements @@ -36,8 +23,8 @@ To get started with Scaffold-ETH 2, follow the steps below: 1. Clone this repo & install dependencies ``` -git clone https://github.com/scaffold-eth/scaffold-eth-2.git -cd scaffold-eth-2 +git clone https://github.com/Ifechukwudaniel/BeatBridge.git +cd BeatBridge yarn install ``` @@ -63,15 +50,7 @@ This command deploys a test smart contract to the local network. The contract is yarn start ``` -Visit your app on: `http://localhost:3000`. You can interact with your smart contract using the contract component or the example ui in the frontend. You can tweak the app config in `packages/nextjs/scaffold.config.ts`. - -Run smart contract test with `yarn hardhat:test` - -- Edit your smart contract `YourContract.sol` in `packages/hardhat/contracts` -- Edit your frontend in `packages/nextjs/pages` -- Edit your deployment scripts in `packages/hardhat/deploy` - -## Deploying your Smart Contracts to a Live Network +## Deploying Smart Contracts to a Live Network Once you are ready to deploy your smart contracts, there are a few things you need to adjust. @@ -124,148 +103,6 @@ If you want to redeploy to the same production URL you can run `yarn vercel --pr **Make sure your `packages/nextjs/scaffold.config.ts` file has the values you need.** -## Interacting with your Smart Contracts: SE-2 Custom Hooks - -Scaffold-ETH 2 provides a collection of custom React hooks designed to simplify interactions with your deployed smart contracts. These hooks are wrappers around `wagmi`, automatically loading the necessary contract ABI and address. They offer an easy-to-use interface for reading from, writing to, and monitoring events emitted by your smart contracts. - -To help developers get started with smart contract interaction using Scaffold-ETH 2, we've provided the following custom hooks: - -- [useScaffoldContractRead](#usescaffoldcontractread): for reading public variables and getting data from read-only functions of your contract. -- [useScaffoldContractWrite](#usescaffoldcontractwrite): for sending transactions to your contract to write data or perform an action. -- [useScaffoldEventSubscriber](#usescaffoldeventsubscriber): for subscribing to your contract events and receiving real-time updates when events are emitted. -- [useScaffoldEventHistory](#usescaffoldeventhistory): for retrieving historical event logs for your contract, providing past activity data. -- [useDeployedContractInfo](#usedeployedcontractinfo): for fetching details from your contract, including the ABI and address. -- [useScaffoldContract](#usescaffoldcontract): for obtaining a contract instance that lets you interact with the methods of your deployed smart contract. - -These hooks offer a simplified and streamlined interface for interacting with your smart contracts. If you need to interact with external contracts, you can use `wagmi` directly, or add external contract data to your `deployedContracts.ts` file. - -### useScaffoldContractRead: - -Use this hook to read public variables and get data from read-only functions of your smart contract. - -```ts -const { data: totalCounter } = useScaffoldContractRead({ - contractName: "YourContract", - functionName: "getGreeting", - args: ["ARGUMENTS IF THE FUNCTION ACCEPTS ANY"], -}); -``` - -This example retrieves the data returned by the `getGreeting` function of the `YourContract` smart contract. If the function accepts any arguments, they can be passed in the args array. The retrieved data is stored in the `data` property of the returned object. - -### useScaffoldContractWrite: - -Use this hook to send a transaction to your smart contract to write data or perform an action. - -```ts -const { writeAsync, isLoading, isMining } = useScaffoldContractWrite({ - contractName: "YourContract", - functionName: "setGreeting", - args: ["The value to set"], - // For payable functions, expressed in ETH - value: "0.01", - // The number of block confirmations to wait for before considering transaction to be confirmed (default : 1). - blockConfirmations: 1, - // The callback function to execute when the transaction is confirmed. - onBlockConfirmation: (txnReceipt) => { - console.log("Transaction blockHash", txnReceipt.blockHash); - }, -}); -``` - -To send the transaction, you can call the `writeAsync` function returned by the hook. Here's an example usage: - -```ts - -``` - -This example sends a transaction to the `YourContract` smart contract to call the `setGreeting` function with the arguments passed in `args`. The `writeAsync` function sends the transaction to the smart contract, and the `isLoading` and `isMining` properties indicate whether the transaction is currently being processed by the network. - -### useScaffoldEventSubscriber: - -Use this hook to subscribe to events emitted by your smart contract, and receive real-time updates when these events are emitted. - -```ts -useScaffoldEventSubscriber({ - contractName: "YourContract", - eventName: "GreetingChange", - // The listener function is called whenever a GreetingChange event is emitted by the contract. - // It receives the parameters emitted by the event, for this example: GreetingChange(address greetingSetter, string newGreeting, bool premium, uint256 value); - listener: (greetingSetter, newGreeting, premium, value) => { - console.log(greetingSetter, newGreeting, premium, value); - }, -}); -``` - -This example subscribes to the `GreetingChange` event emitted by the `YourContract` smart contract, and logs the parameters emitted by the event to the console whenever it is emitted. The `listener` function accepts the parameters emitted by the event, and can be customized according to your needs. - -### useScaffoldEventHistory: - -Use this hook to retrieve historical event logs for your smart contract, providing past activity data. - -```ts -const { - data: events, - isLoading: isLoadingEvents, - error: errorReadingEvents, - } = useScaffoldEventHistory({ - contractName: "YourContract", - eventName: "GreetingChange", - // Specify the starting block number from which to read events. - fromBlock: 31231, - blockData: true, - // Apply filters to the event based on parameter names and values { [parameterName]: value }, - filters: { premium: true } - // If set to true it will return the transaction data for each event (default: false), - transactionData: true, - // If set to true it will return the receipt data for each event (default: false), - receiptData: true -}); -``` - -This example retrieves the historical event logs for the `GreetingChange` event of the `YourContract` smart contract, starting from block number 31231 and filtering events where the premium parameter is true. The data property of the returned object contains an array of event objects, each containing the event parameters and (optionally) the block, transaction, and receipt data. The `isLoading` property indicates whether the event logs are currently being fetched, and the `error` property contains any error that occurred during the fetching process (if applicable). - -### useDeployedContractInfo: - -Use this hook to fetch details about a deployed smart contract, including the ABI and address. - -```ts -// ContractName: name of the deployed contract -const { data: deployedContractData } = useDeployedContractInfo(contractName); -``` - -This example retrieves the details of the deployed contract with the specified name and stores the details in the deployedContractData object. - -### useScaffoldContract: - -Use this hook to get your contract instance by providing the contract name. It enables you interact with your contract methods. -For reading data or sending transactions, it's recommended to use `useScaffoldContractRead` and `useScaffoldContractWrite`. - -```ts -const { data: yourContract } = useScaffoldContract({ - contractName: "YourContract", -}); -// Returns the greeting and can be called in any function, unlike useScaffoldContractRead -await yourContract?.greeting(); - -// Used to write to a contract and can be called in any function -import { Signer } from "ethers"; -import { useSigner } from "wagmi"; - -const { data: signer, isError, isLoading } = useSigner(); -const { data: yourContract } = useScaffoldContract({ - contractName: "YourContract", - signerOrProvider: signer as Signer, -}); -const setGreeting = async () => { - // Call the method in any function - await yourContract?.setGreeting("the greeting here"); -}; -``` - -This example uses the `useScaffoldContract` hook to obtain a contract instance for the `YourContract` smart contract. The data property of the returned object contains the contract instance that can be used to call any of the smart contract methods. ## Disabling type and linting error checks @@ -301,8 +138,3 @@ We have github workflow setup checkout `.github/workflows/lint.yaml` which runs To disable it, **delete `.github` directory** -## Contributing to Scaffold-ETH 2 - -We welcome contributions to Scaffold-ETH 2! - -Please see [CONTRIBUTING.MD](https://github.com/scaffold-eth/scaffold-eth-2/blob/main/CONTRIBUTING.md) for more information and guidelines for contributing to Scaffold-ETH 2. diff --git a/packages/noir/circuits/SpotifyVerifier/Nargo.toml b/packages/noir/circuits/SpotifyVerifier/Nargo.toml new file mode 100644 index 0000000..03987c1 --- /dev/null +++ b/packages/noir/circuits/SpotifyVerifier/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "spotifyVerifier" +type = "bin" +authors = [""] +compiler_version = "0.10.5" + +[dependencies] \ No newline at end of file diff --git a/packages/noir/circuits/SpotifyVerifier/src/main.nr b/packages/noir/circuits/SpotifyVerifier/src/main.nr new file mode 100644 index 0000000..206dc46 --- /dev/null +++ b/packages/noir/circuits/SpotifyVerifier/src/main.nr @@ -0,0 +1,11 @@ +fn main(x : Field, y : pub Field) { + assert(x != y); +} + +#[test] +fn test_main() { + main(1, 2); + + // Uncomment to make test fail + // main(1, 1); +}