Skip to content

Commit

Permalink
feat: deploy contracts & subgraph
Browse files Browse the repository at this point in the history
  • Loading branch information
antho31 committed Nov 26, 2024
1 parent 6474e9d commit 4111936
Show file tree
Hide file tree
Showing 18 changed files with 6,565 additions and 255 deletions.
98 changes: 53 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,58 @@
# 🏗 Scaffold-ETH 2
# Noodles.Fun - Feed Your KOLs! 🍜

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

🧪 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.
**Noodles.Fun** tokenizes Twitter (X) accounts into unique bonding curve tokens. Instantly trade and speculate on content creators’ tokens and use them for promotion services like shoutout posts on X. A fun and interactive way to support, engage, and invest in KOLs!

⚙️ Built using NextJS, RainbowKit, Hardhat, Wagmi, Viem, and Typescript.
### How It Works

-**Contract Hot Reload**: Your frontend auto-adapts to your smart contract as you edit it.
- 🪝 **[Custom hooks](https://docs.scaffoldeth.io/hooks/)**: Collection of React hooks wrapper around [wagmi](https://wagmi.sh/) to simplify interactions with smart contracts with typescript autocompletion.
- 🧱 [**Components**](https://docs.scaffoldeth.io/components/): Collection of common web3 components to quickly build your frontend.
- 🔥 **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.
1. **Every Twitter Account is tokenized:** Automatically generate a unique bonding curve token.
2. **Trade Tokens instantly:** Buy or sell tokens instantly through the bonding curve—no need for liquidity pools or listings.
3. **Spend Tokens for Promotions:** The X account owner can accept their tokens as payment for services like post promotions, pinned tweets, or other custom engagements.

![Debug Contracts tab](https://github.com/scaffold-eth/scaffold-eth-2/assets/55535804/b237af0c-5027-4849-a5c1-2e31495cccb1)
---

## Requirements
### Built With

- **Privy:** Ties Twitter accounts to Ethereum wallets seamlessly.
- **The Graph:** Fully decentralized data for promotion services and trading history.
- **Abstract L2:** Scalable Ethereum dApps infrastructure.

---

### Deployments

#### `VisibilityCredits` contract

Powers creator tokens using the bonding curve formula: `Price = A × Supply² + B × Supply + BasePrice`. As token supply increases, the price grows exponentially, rewarding early supporters.

- Abstract Testnet: [`0x2bA4eC624b2b9033453551964FA4eAB7ce0A0c71`](https://explorer.testnet.abs.xyz/address/0x2bA4eC624b2b9033453551964FA4eAB7ce0A0c71)

#### `VisibilityServices` contract

Allows creators to accept tokens for off-chain promotion services.

- Abstract Testnet: [`0x6760CE623A9231F5328b0C043B759B7c6d3626Fa`](https://explorer.testnet.abs.xyz/address/0x6760CE623A9231F5328b0C043B759B7c6d3626Fa)

#### Subgraphs

Fetch data from onchain events.

- [Abstract Testnet Subgraph endpoint](https://api.goldsky.com/api/public/project_cm3yp5wtflxub01wra3g2a0bc/subgraphs/noodles-abstractTestnet/0.0.1/gn)

## Development

Before you begin, you need to install the following tools:

- [Node (>= v18.18)](https://nodejs.org/en/download/)
- Yarn ([v1](https://classic.yarnpkg.com/en/docs/install/) or [v2+](https://yarnpkg.com/getting-started/install))
- [Git](https://git-scm.com/downloads)

## Quickstart
### Get started

To get started with Scaffold-ETH 2, follow the steps below:

1. Install dependencies if it was skipped in CLI:
1. Install dependencies:

```
cd my-dapp-example
yarn install
```

Expand Down Expand Up @@ -66,7 +86,7 @@ Run smart contract test with `yarn hardhat:test`
- Edit your frontend homepage at `packages/nextjs/app/page.tsx`. For guidance on [routing](https://nextjs.org/docs/app/building-your-application/routing/defining-routes) and configuring [pages/layouts](https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts) checkout the Next.js documentation.
- Edit your deployment scripts in `packages/hardhat/deploy`

## 🚀 Setup The Graph Integration
### 🚀 Setup The Graph Integration

Now that we have spun up our blockchain, started our frontend application and deployed our smart contract, we can start setting up our subgraph and utilize The Graph!

Expand Down Expand Up @@ -248,7 +268,7 @@ All 1 tests passed! 😎

> NOTE: If you get an error, you may trying passing `-d` flag `yarn subgraph:test -d`. This will run matchstick in docker container.
## Shipping to Subgraph Studio 🚀
### Shipping to Subgraph Studio 🚀

> NOTE: This step requires [deployment of contract](https://docs.scaffoldeth.io/deploying/deploy-smart-contracts) to live network. Checkout list of [supported networks](https://thegraph.com/docs/networks).
Expand Down Expand Up @@ -290,104 +310,92 @@ All 1 tests passed! 😎
+ const subgraphUri = 'YOUR_SUBGRAPH_ENDPOINT';
```

## A list of all available commands
### A list of all available commands

### run-node
#### run-node

```sh
yarn run-node
```

Spin up a local graph node (requires Docker).

### stop-node
#### stop-node

```sh
yarn stop-node
```

Stop the local graph node.

### clean-node
#### clean-node

```sh
yarn clean-node
```

Remove the data from the local graph node.

### local-create
#### local-create

```sh
yarn local-create
```

Create your local subgraph (only required once).

### local-remove
#### local-remove

```sh
yarn local-remove
```

Delete a local subgprah.

### abi-copy
#### abi-copy

```sh
yarn abi-copy
```

Copy the contracts ABI from the hardhat/deployments folder. Generates the networks.json file too.

### codegen
#### codegen

```sh
yarn codegen
```

Generates AssemblyScript types from the subgraph schema and the contract ABIs.

### build
#### build

```sh
yarn build
```

Compile and check the mapping functions.

### local-deploy
#### local-deploy

```sh
yarn local-deploy
```

Deploy a local subgraph.

### local-ship
#### local-ship

```sh
yarn local-ship
```

Run all the required commands to deploy a local subgraph (abi-copy, codegen, build and local-deploy).

### deploy
#### deploy

```sh
yarn deploy
```

Deploy a subgraph to TheGraph.

## Documentation

Visit our [docs](https://docs.scaffoldeth.io) to learn how to start building with Scaffold-ETH 2.

To know more about its features, check out our [website](https://scaffoldeth.io).

## 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.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"graph": "yarn workspace @noodles-protocol/subgraph graph",
"graphclient:build": "yarn workspace @noodles-protocol/nextjs client",
"hardhat-verify": "yarn workspace @noodles-protocol/hardhat hardhat-verify",
"hardhat:compile:abstractTestnet": "yarn workspace @noodles-protocol/hardhat compile:abstractTestnet",
"hardhat:deploy:abstractTestnet": "yarn workspace @noodles-protocol/hardhat deploy:abstractTestnet",
"hardhat:format": "yarn workspace @noodles-protocol/hardhat format",
"hardhat:lint": "yarn workspace @noodles-protocol/hardhat lint",
"hardhat:lint-staged": "yarn workspace @noodles-protocol/hardhat lint-staged",
Expand Down
2 changes: 0 additions & 2 deletions packages/hardhat/deploy/00_deploy_your_contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ const deployment: DeployFunction = async function (hre: HardhatRuntimeEnvironmen
const visibilityServicesAddress = await visibilityServices.getAddress();
console.log("VisibilityServices deployed to:", visibilityServicesAddress);

/*
await hre.run("verify:verify", {
address: visibilityCreditsAddress,
constructorArguments: [deployer, deployer],
Expand All @@ -69,7 +68,6 @@ const deployment: DeployFunction = async function (hre: HardhatRuntimeEnvironmen
address: visibilityServicesAddress,
constructorArguments: [visibilityCreditsAddress, deployer],
});
*/
};

export default deployment;
Expand Down
30 changes: 30 additions & 0 deletions packages/hardhat/deploy/deployZkSync.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Wallet } from "zksync-ethers";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { Deployer } from "@matterlabs/hardhat-zksync";

// An example of a deploy script that will deploy and call a simple contract.
export default async function (hre: HardhatRuntimeEnvironment) {
if (!process.env.DEPLOYER_PRIVATE_KEY) {
throw new Error("Please set your DEPLOYER_PRIVATE_KEY in a .env file");
}
const wallet = new Wallet(process.env.DEPLOYER_PRIVATE_KEY);
const deployer = new Deployer(hre, wallet);
const ethProvider = deployer.ethWallet.provider;
if (!ethProvider) {
throw new Error("ethProvider is not set");
}
const ethWalletAddr = deployer.ethWallet.address;
console.log("Ready to deploy to ", hre.network.name, "with deployer : ", ethWalletAddr);

const creditsArtifact = await deployer.loadArtifact("VisibilityCredits");
console.log("Deploying VisibilityCredits...");
const creditsContract = await deployer.deploy(creditsArtifact, [ethWalletAddr, ethWalletAddr]);
const creditsContractAddr = await creditsContract.getAddress();
console.log("VisibilityCredits deployed to:", creditsContractAddr);

const servicesArtifact = await deployer.loadArtifact("VisibilityServices");
console.log("Deploying VisibilityServices...");
const servicesContract = await deployer.deploy(servicesArtifact, [creditsContractAddr, ethWalletAddr]);
const servicesContractAddr = await servicesContract.getAddress();
console.log("VisibilityServices deployed to:", servicesContractAddr);
}
1 change: 1 addition & 0 deletions packages/hardhat/deployments-zk/abstractTestnet/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x2b74
Loading

0 comments on commit 4111936

Please sign in to comment.