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!
- Every Twitter Account is tokenized: Automatically generate a unique bonding curve token.
- Trade Tokens instantly: Buy or sell tokens instantly through the bonding curveβno need for liquidity pools or listings.
- 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.
- 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.
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
Allows creators to accept tokens for off-chain promotion services.
- Abstract Testnet:
0x6760CE623A9231F5328b0C043B759B7c6d3626Fa
Fetch data from onchain events.
Before you begin, you need to install the following tools:
- Node (>= v18.18)
- Yarn (v1 or v2+)
- Git
- Install dependencies:
yarn install
- Run a local network in the first terminal:
yarn chain
This command starts a local Ethereum network using Hardhat. The network runs on your local machine and can be used for testing and development. You can customize the network configuration in packages/hardhat/hardhat.config.ts
.
- On a second terminal, deploy the test contract:
yarn deploy
This command deploys a test smart contract to the local network. The contract is located in packages/hardhat/contracts
and can be modified to suit your needs. The yarn deploy
command uses the deploy script located in packages/hardhat/deploy
to deploy the contract to the network. You can also customize the deploy script.
- On a third terminal, start your NextJS app:
yarn start
Visit your app on: http://localhost:3000
. You can interact with your smart contract using the Debug Contracts
page. You can tweak the app config in packages/nextjs/scaffold.config.ts
.
Run smart contract test with yarn hardhat:test
- Edit your smart contracts in
packages/hardhat/contracts
- Edit your frontend homepage at
packages/nextjs/app/page.tsx
. For guidance on routing and configuring pages/layouts checkout the Next.js documentation. - Edit your deployment scripts in
packages/hardhat/deploy
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!
Before following these steps be sure Docker is running!
First run the following to clean up any old data. Do this if you need to reset everything.
yarn clean-node
We can now spin up a graph node by running the following commandβ¦ π§βπ
yarn run-node
This will spin up all the containers for The Graph using docker-compose. You will want to keep this window open at all times so that you can see log output from Docker.
As stated before, be sure to keep this window open so that you can see any log output from Docker. π
NOTE FOR LINUX USERS: If you are running Linux you will need some additional changes to the project.
For hardhat
Update your package.json in packages/hardhat with the following command line option for the hardhat chain.
"chain": "hardhat node --network hardhat --no-deploy --hostname 0.0.0.0"
For foundry
Update your package.json in packages/foundry with the following command line option for the anvil chain.
"chain": "anvil --host 0.0.0.0 --config-out localhost.json",
Save the file and then restart your chain in its original window.
yarn chain
Redeploy your smart contracts.
yarn deploy
You might also need to add a firewall exception for port 8432. As an example for Ubuntu... run the following command.
sudo ufw allow 8545/tcp
Now we can open up a fifth window to finish setting up The Graph. π In this fifth window we will create our local subgraph!
Note: You will only need to do this once.
yarn local-create
You should see some output stating your subgraph has been created along with a log output on your graph-node inside docker.
Next we will ship our subgraph! You will need to give your subgraph a version after executing this command. (e.g. 0.0.1).
yarn local-ship
This command does the following all in oneβ¦ πππ
- Copies the contracts ABI from the hardhat/deployments folder
- Generates the networks.json file
- Generates AssemblyScript types from the subgraph schema and the contract ABIs.
- Compiles and checks the mapping functions.
- β¦ and deploy a local subgraph!
If you get an error ts-node you can install it with the following command
npm install -g ts-node
You should get a build completed output along with the address of your Subgraph endpoint.
Build completed: QmYdGWsVSUYTd1dJnqn84kJkDggc2GD9RZWK5xLVEMB9iP
Deployed to http://localhost:8000/subgraphs/name/scaffold-eth/your-contract/graphql
Subgraph endpoints:
Queries (HTTP): http://localhost:8000/subgraphs/name/scaffold-eth/your-contract
Go ahead and head over to your subgraph endpoint and take a look!
Here is an example queryβ¦
{
greetings(first: 25, orderBy: createdAt, orderDirection: desc) {
id
greeting
premium
value
createdAt
sender {
address
greetingCount
}
}
}
If all is well and youβve sent a transaction to your smart contract then you will see a similar data output!
The Graph Client is a tool used to query GraphQL based applications and contains a lot of advanced features, such as client side composition or automatic pagination. A complete list of features and goals of this project can be found [here].(https://github.com/graphprotocol/graph-client?tab=readme-ov-file#features-and-goals)
In order to utilize Graph-Client in our application, we need to build the artifacts needed for our frontend. To do this simply run...
yarn graphclient:build
After doing so, navigate to http://localhost:3000/subgraph and you should be able to see the GraphQL rendered in your application. If you don't see anything, make sure you've triggered an event in your smart contract.
If you want to look at the query code for this, it can be found the component located in the subgraph folder packages/nextjs/app/subgraph/_components/GreetingsTable.tsx
Matchstick is a unit testing framework, developed by LimeChain, that enables subgraph developers to test their mapping logic in a sandboxed environment and deploy their subgraphs with confidence!
The project comes with a pre-written test located in packages/subgraph/tests/asserts.test.ts
To test simply type....
yarn subgraph:test
This will run
graph test
and automatically download the needed files for testing.
You should receive the following output.
Fetching latest version tag...
Downloading release from https://github.com/LimeChain/matchstick/releases/download/0.6.0/binary-macos-11-m1
binary-macos-11-m1 has been installed!
Compiling...
π¬ Compiling asserts...
Igniting tests π₯
asserts
--------------------------------------------------
Asserts:
β Greeting and Sender entities - 0.102ms
All 1 tests passed! π
[Thu, 07 Mar 2024 15:10:26 -0800] Program executed in: 1.838s.
NOTE: If you get an error, you may trying passing
-d
flagyarn subgraph:test -d
. This will run matchstick in docker container.
NOTE: This step requires deployment of contract to live network. Checkout list of supported networks.
-
Update the
packages/subgraph/subgraph.yaml
file with your contract address, network name, start block number(optional) :... - network: localhost + network: sepolia source: abi: YourContract + address: "0x54FE7f8Db97e102D3b7d86cc34D885B735E31E8e" + startBlock: 5889410 ...
TIP: For startBlock
you can use block number of your deployed contract, which can be found by visiting deployed transaction hash in blockexplorer.
-
Create a new subgraph on Subgraph Studio and get "SUBGRAPH SLUG" and "DEPLOY KEY".
-
Authenticate with the graph CLI:
yarn graph auth --studio <DEPLOY KEY>
-
Deploy the subgraph to TheGraph Studio:
yarn graph deploy --studio <SUBGRAPH SLUG>
Once deployed, the CLI should output the Subgraph endpoints. Copy the HTTP endpoint and test your queries.
-
Update
packages/nextjs/components/ScaffoldEthAppWithProviders.tsx
to use the above HTTP subgraph endpoint:- const subgraphUri = "http://localhost:8000/subgraphs/name/scaffold-eth/your-contract"; + const subgraphUri = 'YOUR_SUBGRAPH_ENDPOINT';
yarn run-node
Spin up a local graph node (requires Docker).
yarn stop-node
Stop the local graph node.
yarn clean-node
Remove the data from the local graph node.
yarn local-create
Create your local subgraph (only required once).
yarn local-remove
Delete a local subgprah.
yarn abi-copy
Copy the contracts ABI from the hardhat/deployments folder. Generates the networks.json file too.
yarn codegen
Generates AssemblyScript types from the subgraph schema and the contract ABIs.
yarn build
Compile and check the mapping functions.
yarn local-deploy
Deploy a local subgraph.
yarn local-ship
Run all the required commands to deploy a local subgraph (abi-copy, codegen, build and local-deploy).
yarn deploy
Deploy a subgraph to TheGraph.