From 64872f87435596eebde6df12233c87850a58147a Mon Sep 17 00:00:00 2001 From: NoahMaizels Date: Thu, 7 Nov 2024 16:19:05 +0700 Subject: [PATCH] add global variables for commonly updated values like incentives contracts, component for dynamically rendering awesome swarm from github, revised descriptions for neighborhood terms --- docs/concepts/DISC/{DISC.md => DISC.mdx} | 0 .../DISC/{kademlia.md => kademlia.mdx} | 1 - .../incentives/{overview.md => overview.mdx} | 8 +++-- docs/references/awesome-list.mdx | 8 +++++ docs/references/community.md | 8 ++++- ...smart-contracts.md => smart-contracts.mdx} | 13 +++---- docusaurus.config.js | 5 +++ package-lock.json | 35 +++++++++++++++++++ package.json | 1 + sidebars.js | 3 +- src/components/AwesomeList.js | 16 +++++++++ src/config/globalVariables.js | 7 ++++ src/pages/awesome-list.js | 18 ++++++++++ 13 files changed, 112 insertions(+), 11 deletions(-) rename docs/concepts/DISC/{DISC.md => DISC.mdx} (100%) rename docs/concepts/DISC/{kademlia.md => kademlia.mdx} (99%) rename docs/concepts/incentives/{overview.md => overview.mdx} (78%) create mode 100644 docs/references/awesome-list.mdx rename docs/references/{smart-contracts.md => smart-contracts.mdx} (55%) create mode 100644 src/components/AwesomeList.js create mode 100644 src/config/globalVariables.js create mode 100644 src/pages/awesome-list.js diff --git a/docs/concepts/DISC/DISC.md b/docs/concepts/DISC/DISC.mdx similarity index 100% rename from docs/concepts/DISC/DISC.md rename to docs/concepts/DISC/DISC.mdx diff --git a/docs/concepts/DISC/kademlia.md b/docs/concepts/DISC/kademlia.mdx similarity index 99% rename from docs/concepts/DISC/kademlia.md rename to docs/concepts/DISC/kademlia.mdx index 04b26eb9a..602555e47 100644 --- a/docs/concepts/DISC/kademlia.md +++ b/docs/concepts/DISC/kademlia.mdx @@ -5,7 +5,6 @@ id: kademlia import bos_fig_2_3 from '/static/img/bos_fig_2_3.jpg'; - Kademlia is a distributed hash table (DHT) algorithm used in peer-to-peer networks to efficiently store and retrieve data without relying on centralized servers. It organizes nodes into an overlay network that ensures efficient routing using a binary tree structure. ## Kademlia Key Concepts diff --git a/docs/concepts/incentives/overview.md b/docs/concepts/incentives/overview.mdx similarity index 78% rename from docs/concepts/incentives/overview.md rename to docs/concepts/incentives/overview.mdx index b62385a32..6619cc1ec 100644 --- a/docs/concepts/incentives/overview.md +++ b/docs/concepts/incentives/overview.mdx @@ -3,6 +3,9 @@ title: Incentives Overview id: overview --- +import { globalVariables } from '/src/config/globalVariables'; + + One of the key challenges in a decentralised data network is incentivizing users to store data and provide bandwidth. Swarm addresses this challenge with two incentives systems, one which rewards nodes for sharing their storage space and another which rewards them for sharing bandwidth. The incentives system consists of multiple elements which work together to build a self sustaining economic system where nodes are rewarded for honestly providing their resources to the network. :::info @@ -13,13 +16,14 @@ Swarm's storage incentives protocols are defined in depth in the [Future Proof S Storage incentives are used to reward node operators for providing their disk space to the network and storing the data they are responsible for storing over time. The storage incentives system is composed of three smart contracts which work together to enact a self regulating economic system. The postage stamp contract manages payments for uploading data, the redistribution contract manages the redistribution of those payments to storer nodes, and the price oracle contract uses data from the redistribution contract to set the price for postage stamps in the postage stamp contract. + ### Postage Stamps -Postage stamps are used to pre-purchase the right to upload data on storm, much in the same way that real life postage stamps are used to pre-pay for use of the postal service. Postage stamps are purchased in batches rather than one by one, and are consumed when uploading data to Swarm. Postage stamp batches are purchased using xBZZ through the [postage stamp smart contract](https://gnosisscan.io/address/0x45a1502382541Cd610CC9068e88727426b696293#code). the xBZZ used to pay for postage stamp batches serve as the funds which are redistributed as storage incentives in the redistribution game. The price of postage stamps is set by the price oracle. Read more [here](/docs/concepts/incentives/postage-stamps). +Postage stamps are used to pre-purchase the right to upload data on storm, much in the same way that real life postage stamps are used to pre-pay for use of the postal service. Postage stamps are purchased in batches rather than one by one, and are consumed when uploading data to Swarm. Postage stamp batches are purchased using xBZZ through the postage stamp smart contract . the xBZZ used to pay for postage stamp batches serve as the funds which are redistributed as storage incentives in the redistribution game. The price of postage stamps is set by the price oracle. Read more [here](/docs/concepts/incentives/postage-stamps). ### Redistribution Game -The redistribution game is used to redistribute the xBZZ paid into the postage stamp contract to full staking nodes which contribute their disk space to the network. The game is designed in such a way that the most profitable way to participate is to honestly store all the data for which a node is responsible. The game's rules are determined by the [redistribution smart contract](https://gnosisscan.io/address/0xFfF73fd14537277B3F3807e1AB0F85E17c0ABea5#code). The results of the game also supply the utilization signal which is used by the price oracle to set the price for postage stamps. Read more [here](/docs/concepts/incentives/postage-stamps). +The redistribution game is used to redistribute the xBZZ paid into the postage stamp contract to full staking nodes which contribute their disk space to the network. The game is designed in such a way that the most profitable way to participate is to honestly store all the data for which a node is responsible. The game's rules are determined by the redistribution smart contract. The results of the game also supply the utilization signal which is used by the price oracle to set the price for postage stamps. Read more [here](/docs/concepts/incentives/postage-stamps). ### Price Oracle diff --git a/docs/references/awesome-list.mdx b/docs/references/awesome-list.mdx new file mode 100644 index 000000000..3239b4461 --- /dev/null +++ b/docs/references/awesome-list.mdx @@ -0,0 +1,8 @@ +--- +title: Awesome List +id: awesome-list +--- + +import AwesomeList from '@site/src/components/AwesomeList'; + + diff --git a/docs/references/community.md b/docs/references/community.md index f27aa0b55..62af0e878 100644 --- a/docs/references/community.md +++ b/docs/references/community.md @@ -25,4 +25,10 @@ Swarm grants support many interesting projects that are already building their p If you have an idea for a project which uses Swarm's technology we welcome you to [apply for a grant](https://grants.ethswarm.org). -Learn more about grants for building on Swarm at the [EthSwarm homepage](https://www.ethswarm.org/grants). \ No newline at end of file +Learn more about grants for building on Swarm at the [EthSwarm homepage](https://www.ethswarm.org/grants). + +## Fellowships + +[Swarm fellows](https://www.ethswarm.org/fellowships) work on items identified as needs for the Swarm network to evolve and grow but are not part of core Swarm development. Fellows are expected to pursue the goals supported by the fellowship in the long term as part of their career path. A fellowship helps them achieve results to a certain degree, but afterwards, the project should be sustainable and able to continue on its own. + +Current Swarm fellows include both [Datafund](https://datafund.io/) and [Solar Punk](https://solarpunk.buzz/). \ No newline at end of file diff --git a/docs/references/smart-contracts.md b/docs/references/smart-contracts.mdx similarity index 55% rename from docs/references/smart-contracts.md rename to docs/references/smart-contracts.mdx index c66d0d6af..4e7fdefd7 100644 --- a/docs/references/smart-contracts.md +++ b/docs/references/smart-contracts.mdx @@ -2,6 +2,7 @@ title: Smart Contracts id: smart-contracts --- +import { globalVariables } from '/src/config/globalVariables'; ### Token Contracts |Contract|Blockchain | Address | @@ -18,9 +19,9 @@ You can find the Solidity source code for each contract in the [storage incentiv For a history of smart contract addresses, see the [storage incentives ABI repo history](https://github.com/ethersphere/go-storage-incentives-abi/commits/master/abi/abi_mainnet.go). -|Contract|Blockchain | Address | -| ---------------------- | ------------------------------- |--------- | -|Postage Stamp|Gnosis Chain|[0x45a1502382541Cd610CC9068e88727426b696293](https://gnosisscan.io/address/0x45a1502382541Cd610CC9068e88727426b696293#code)| -|Staking|Gnosis Chain|[0xBe212EA1A4978a64e8f7636Ae18305C38CA092Bd](https://gnosisscan.io/address/0xBe212EA1A4978a64e8f7636Ae18305C38CA092Bd#code)| -|Redistribution|Gnosis Chain|[0xFfF73fd14537277B3F3807e1AB0F85E17c0ABea5](https://gnosisscan.io/address/0xFfF73fd14537277B3F3807e1AB0F85E17c0ABea5#code)| -|Price Oracle|Gnosis Chain|[0x86DE783Bf23Bc13DaeF5A55ec531C198da8f10cF](https://gnosisscan.io/address/0x86DE783Bf23Bc13DaeF5A55ec531C198da8f10cF#code)| \ No newline at end of file +| Contract | Blockchain | Address | +| --------------- | ------------ | -------------------------------------------------------------------------------------------------------------- | +| Postage Stamp | Gnosis Chain | {globalVariables.postageStampContract} | +| Staking | Gnosis Chain | {globalVariables.stakingContract} | +| Redistribution | Gnosis Chain | {globalVariables.redistributionContract} | +| Price Oracle | Gnosis Chain | {globalVariables.priceOracleContract} | diff --git a/docusaurus.config.js b/docusaurus.config.js index 6700449e8..5fdf6cb0a 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -260,10 +260,15 @@ module.exports = { to: 'docs/references/fair-data-society', label: 'Fair Data Society' }, + { + to: 'docs/references/awesome-list', + label: 'Awesome List' + }, { to: 'docs/references/faq', label: 'FAQ' }, + ] }, diff --git a/package-lock.json b/package-lock.json index 7403da866..9d3880c9b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,7 @@ "plugin-image-zoom": "github:flexanalytics/plugin-image-zoom", "react": "^18.2.0", "react-dom": "^18.2.0", + "react-markdown": "^9.0.1", "redocusaurus": "^2.0.0", "rehype-katex": "^7.0.0", "remark-math": "^6.0.0" @@ -11345,6 +11346,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/html-url-attributes": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/html-url-attributes/-/html-url-attributes-3.0.1.tgz", + "integrity": "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/html-void-elements": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz", @@ -17870,6 +17880,31 @@ "webpack": ">=4.41.1 || 5.x" } }, + "node_modules/react-markdown": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-9.0.1.tgz", + "integrity": "sha512-186Gw/vF1uRkydbsOIkcGXw7aHq0sZOCRFFjGrr7b9+nVZg4UfA4enXCaxm4fUzecU38sWfrNDitGhshuU7rdg==", + "dependencies": { + "@types/hast": "^3.0.0", + "devlop": "^1.0.0", + "hast-util-to-jsx-runtime": "^2.0.0", + "html-url-attributes": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "remark-parse": "^11.0.0", + "remark-rehype": "^11.0.0", + "unified": "^11.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "peerDependencies": { + "@types/react": ">=18", + "react": ">=18" + } + }, "node_modules/react-remark": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/react-remark/-/react-remark-2.1.0.tgz", diff --git a/package.json b/package.json index 15bc45ac0..3c83caf1e 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "plugin-image-zoom": "github:flexanalytics/plugin-image-zoom", "react": "^18.2.0", "react-dom": "^18.2.0", + "react-markdown": "^9.0.1", "redocusaurus": "^2.0.0", "rehype-katex": "^7.0.0", "remark-math": "^6.0.0" diff --git a/sidebars.js b/sidebars.js index 7b7ac3eeb..ab63a1432 100644 --- a/sidebars.js +++ b/sidebars.js @@ -137,6 +137,7 @@ module.exports = { 'references/glossary', 'references/community', 'references/fair-data-society', - 'references/faq' + 'references/faq', + 'references/awesome-list', ], }; diff --git a/src/components/AwesomeList.js b/src/components/AwesomeList.js new file mode 100644 index 000000000..76a1adabc --- /dev/null +++ b/src/components/AwesomeList.js @@ -0,0 +1,16 @@ +import React, { useEffect, useState } from 'react'; +import Markdown from 'react-markdown'; + +const AwesomeList = () => { + const [content, setContent] = useState(''); + + useEffect(() => { + fetch('https://raw.githubusercontent.com/ethersphere/awesome-swarm/refs/heads/master/README.md') + .then((res) => res.text()) + .then((text) => setContent(text)); + }, []); + + return {content}; +}; + +export default AwesomeList; diff --git a/src/config/globalVariables.js b/src/config/globalVariables.js new file mode 100644 index 000000000..e5b0cc691 --- /dev/null +++ b/src/config/globalVariables.js @@ -0,0 +1,7 @@ +export const globalVariables = { + exampleVariable: 'Hello, World!', + postageStampContract: '0x45a1502382541Cd610CC9068e88727426b696293', + stakingContract: '0xBe212EA1A4978a64e8f7636Ae18305C38CA092Bd', + redistributionContract: '0xFfF73fd14537277B3F3807e1AB0F85E17c0ABea5', + priceOracleContract: '0x86DE783Bf23Bc13DaeF5A55ec531C198da8f10cF' + }; diff --git a/src/pages/awesome-list.js b/src/pages/awesome-list.js new file mode 100644 index 000000000..52cca04dc --- /dev/null +++ b/src/pages/awesome-list.js @@ -0,0 +1,18 @@ +import React, { useEffect, useState } from 'react'; +import Markdown from 'react-markdown'; + +export default function AwesomeList() { + const [content, setContent] = useState(''); + + useEffect(() => { + fetch('https://raw.githubusercontent.com/ethersphere/awesome-swarm/refs/heads/master/README.md') + .then((res) => res.text()) + .then((text) => setContent(text)); + }, []); + + return ( +
+ {content} +
+ ); +}