diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000000..fe1cefae8f --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,20 @@ +name: Publish docs via GitHub Pages +on: + push: + branches: + - main + +jobs: + build: + name: Deploy docs + runs-on: ubuntu-latest + steps: + - name: Checkout main + uses: actions/checkout@v2 + + - name: Deploy docs + uses: mhausenblas/mkdocs-deploy-gh-pages@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CONFIG_FILE: ./mkdocs.yml + EXTRA_PACKAGES: build-base \ No newline at end of file diff --git a/README.md b/README.md index 822648a38e..5c7f16f165 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,11 @@ A Polkadot ecosystem index for investors. A self sustaining auction treasury for parachains. -Organized by the Stateless Money validator, governed by a community that includes Polychain Capital, Hypersphere Ventures, HashKey Capital, Acala, and built by ChainSafe as a StakerDAO product. +Organized by the Stateless Money validator, governed by a community that includes Polychain Capital, Hypersphere +Ventures, HashKey Capital, Acala, and built by ChainSafe as a StakerDAO product. -For more information on the project please visit [Polkadot Index Network Token](https://docs.polkadotindex.com/) documentation. +For more information on the project please visit [Polkadot Index Network Token](https://docs.polkadotindex.com/) +documentation. ❗**Current development should be considered a work in progress.** @@ -21,7 +23,8 @@ Follow these steps to prepare a local Substrate development environment :hammer_ ### Setup -This project currently builds against Rust nightly-2021-01-26. Assuming you have rustup already insatlled set up your local environment: +This project currently builds against Rust nightly-2021-01-26. Assuming you have rustup already insatlled set up your +local environment: ```shell rustup install nightly-2021-01-26 @@ -39,15 +42,32 @@ Once the development environment is set up, build the node template. This comman cargo build --release ``` -Note: If the build fails with `(signal: 9, SIGKILL: kill)` it has probably run out of memory. Try freeing some memory or build on another machine. +Note: If the build fails with `(signal: 9, SIGKILL: kill)` it has probably run out of memory. Try freeing some memory or +build on another machine. ## Run +### Development Chain + +You can start a standalone development chain with: + +```bash +cargo run -- --dev --instant-sealing +``` + +Or if already built + +```bash +./target/release/pint --dev --instant-sealing +``` + +This will use the [`node/src/chain_spec/dev.rs`](node/src/chain_spec/dev.rs) chain spec. + ### Local Testnet Polkadot (release-v0.9.x branch) -``` +```bash cargo build --release ./target/release/polkadot build-spec --chain rococo-local --raw --disable-default-bootnode > rococo_local.json @@ -59,20 +79,21 @@ cargo build --release PINT Parachain: -``` +```bash # this command assumes the chain spec is in a directory named polkadot that is a sibling of the pint directory ./target/release/pint --collator --alice --chain pint-dev --ws-port 9945 --parachain-id 200 --rpc-cors all -- --execution wasm --chain ../polkadot/rococo_local.json --ws-port 9977 --rpc-cors all ``` ### Registering on Local Relay Chain -In order to produce blocks you will need to register the parachain as detailed in the [Substrate Cumulus Workshop](https://substrate.dev/cumulus-workshop/#/en/3-parachains/2-register) by going to +In order to produce blocks you will need to register the parachain as detailed in +the [Substrate Cumulus Workshop](https://substrate.dev/cumulus-workshop/#/en/3-parachains/2-register) by going to Developer -> sudo -> paraSudoWrapper -> sudoScheduleParaInitialize(id, genesis) Ensure you set the `ParaId` to `200` and the `parachain: Bool` to `Yes`. -``` +```bash cargo build --release # Build the Chain spec ./target/release/pint build-spec --disable-default-bootnode > ./pint-local-plain.json @@ -85,11 +106,18 @@ cargo build --release ./target/release/pint export-genesis-wasm > ./para-200.wasm ``` - -* [polkadot-launch](https://github.com/paritytech/polkadot-launch) can be run by dropping the proper polkadot binary in the `./bin` folder and +* [polkadot-launch](https://github.com/paritytech/polkadot-launch) can be run by dropping the proper polkadot binary in + the `./bin` folder and * Run globally * `polkadot-launch config.json` * Run locally, navigate into polkadot-launch, * ``` yarn ``` * ``` yarn start ``` +### Documentation + +## Commands + +* `mkdocs serve` - Start the live-reloading docs server. +* `mkdocs build` - Build the documentation site. +* `mkdocs -h` - Print help message and exit. \ No newline at end of file diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000000..ca35be08d4 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1 @@ +_site diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 0000000000..5e0616e3c4 --- /dev/null +++ b/docs/404.html @@ -0,0 +1,25 @@ +--- +layout: default +permalink: /404.html +--- + + + +
+

404

+ +

Page not found :(

+

The requested page could not be found.

+
diff --git a/docs/assets/css/style.scss b/docs/assets/css/style.scss new file mode 100644 index 0000000000..454b7295df --- /dev/null +++ b/docs/assets/css/style.scss @@ -0,0 +1,47 @@ +body { + color: #BBB !important; + font-family: "ubuntu", sans-serif; + line-height: 1.75 !important; +} + +header, footer { + border: 0 !important; + padding: 2% 0 !important; +} + +h1, h2, h3, h4, h5 { + color: #CCC; + font-weight: 500; + padding-top: 2%; +} + +h1.title { + font-size: 110%; +} + +b, strong { + color: #CCC; +} + +a { + color: #e6087b !important; +} + +a:hover { + color: #EEE !important; + text-decoration: none; + transition: 0.1s; +} + +ul, li { + padding: 0.5% 0; +} + +code { + padding: 4px; +} + +pre { + font-size: 17px; + padding: 10px 16px; +} diff --git a/docs/assets/favicon.ico b/docs/assets/favicon.ico new file mode 100644 index 0000000000..63d970769f Binary files /dev/null and b/docs/assets/favicon.ico differ diff --git a/docs/assets/img/nav-formula.png b/docs/assets/img/nav-formula.png new file mode 100644 index 0000000000..596cc756a8 Binary files /dev/null and b/docs/assets/img/nav-formula.png differ diff --git a/docs/assets/img/pint.png b/docs/assets/img/pint.png new file mode 100644 index 0000000000..1af1ac2724 Binary files /dev/null and b/docs/assets/img/pint.png differ diff --git a/docs/assets/pint2.svg b/docs/assets/pint2.svg new file mode 100644 index 0000000000..53ed35c3c1 --- /dev/null +++ b/docs/assets/pint2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md new file mode 100644 index 0000000000..090d9c94cf --- /dev/null +++ b/docs/getting-started/installation.md @@ -0,0 +1,157 @@ +--- +layout: default +title: Installation +permalink: /getting-started/installation +--- + +# Get Started + +## Prerequisites + +This project currently builds against Rust nightly-2021-01-26. Assuming you have rustup already insatlled set up your local environment: + +```shell +rustup install nightly-2021-01-26 +rustup target add wasm32-unknown-unknown --toolchain nightly-2021-01-26 +rustup override set nightly-2021-01-26 +``` + +## Build + +Once the development environment is set up, build the node template. This command will build the +[Wasm](https://substrate.dev/docs/en/knowledgebase/advanced/executor#wasm-execution) and +[native](https://substrate.dev/docs/en/knowledgebase/advanced/executor#native-execution) code: + +```bash +cargo build --release +``` + +Note: If the build fails with `(signal: 9, SIGKILL: kill)` it has probably run out of memory. Try freeing some memory or build on another machine. + +## Run + +### Development Chain + +You can start a standalone development chain with: + +```bash +cargo run -- --dev --instant-sealing +``` + +Or if already built: + +```bash +./target/release/pint --dev --instant-sealing +``` + +For [docker](https://github.com/ChainSafe/PINT/blob/main/docker/release.Dockerfile): + +``` +docker run chainsafe/pint --dev --instant-sealing +``` + +This will use the [`node/src/chain_spec/dev.rs`](../../node/src/chain_spec/dev.rs) chain spec. + +### Local Testnet + +Polkadot (release-v0.9.x branch) + +``` +cargo build --release + +./target/release/polkadot build-spec --chain rococo-local --raw --disable-default-bootnode > rococo_local.json + +./target/release/polkadot --chain ./rococo_local.json -d cumulus_relay0 --validator --alice --port 9844 + +./target/release/polkadot --chain ./rococo_local.json -d cumulus_relay1 --validator --bob --port 9955 +``` + +##### PINT Parachain: + +``` +# this command assumes the chain spec is in a directory named polkadot that is a sibling of the pint directory +./target/release/pint --collator --alice --chain pint-dev --ws-port 9945 --parachain-id 200 --rpc-cors all -- --execution wasm --chain ../polkadot/rococo_local.json --ws-port 9977 --rpc-cors all +``` + +### Registering on Local Relay Chain + +In order to produce blocks you will need to register the parachain as detailed in the [Substrate Cumulus Workshop](https://substrate.dev/cumulus-workshop/#/en/3-parachains/2-register) by going to + +Developer -> sudo -> paraSudoWrapper -> sudoScheduleParaInitialize(id, genesis) + +Ensure you set the `ParaId` to `200` and the `parachain: Bool` to `Yes`. + +``` +cargo build --release +# Build the Chain spec +./target/release/pint build-spec --chain=pint-dev --disable-default-bootnode > ./pint-local-plain.json +# Build the raw file +./target/release/pint build-spec --chain=./pint-local-plain.json --raw --disable-default-bootnode > ./pint-local.json + + +# export genesis state and wasm +./target/release/pint export-genesis-state --chain=pint-dev --parachain-id 200 > para-200-genesis +./target/release/pint export-genesis-wasm --chain=pint-dev > ./para-200.wasm +``` + + +### Start a Parachain Node (Collator) + +From the parachain template working directory: + +```bash +# This assumes a ParaId of 200. Change as needed. +./target/release/pint \ +-d /tmp/parachain/alice \ +--collator \ +--alice \ +--force-authoring \ +--ws-port 9945 \ +--parachain-id 200 \ +-- \ +--execution wasm \ +--chain pint_local.json +``` + + + +* [polkadot-launch](https://github.com/paritytech/polkadot-launch) can be run by dropping the proper polkadot binary in the `./bin` folder and + * Run globally + * `polkadot-launch config.json` + * Run locally, navigate into polkadot-launch, + * ``` yarn ``` + * ``` yarn start ``` + + +## Test + +### Testing PINT with cargo + +``` +cargo test --all-features +``` + +Will run the tests of PINT with cargo. + +### Testing PINT with polkadot.js + +``` +# the e2e tests require `polkadot-launch` as a git submodule +git submodule update --recursive + +# install dependencies and run e2e tests +cd js && yarn && yarn e2e +``` + +Will bootstrap `PINT` with `polkadot-launch` and run all calls of PINT with `polkadot.js` +to test both `PINT` can connect to `rococo` and PINT calls are workable with `polkadot.js`. + + +## Learn More + +- More detailed instructions to use Cumulus parachains are found in the + [Cumulus Workshop](https://substrate.dev/cumulus-workshop/#/en/3-parachains/2-register). +- Refer to the upstream [Substrate Node Template](https://github.com/substrate-developer-hub/substrate-node-template) + to learn more about the structure of this project, the capabilities it encapsulates and the way in + which those capabilities are implemented. +- Learn more about how a parachain block is added to a finalized chain [here](https://polkadot.network/the-path-of-a-parachain-block/). diff --git a/docs/getting-started/overview/architecture.md b/docs/getting-started/overview/architecture.md new file mode 100644 index 0000000000..4d7fdb5212 --- /dev/null +++ b/docs/getting-started/overview/architecture.md @@ -0,0 +1,150 @@ +--- +layout: default title: Architecture permalink: /architecture/ +--- + +# Architecture + +This document describes the high-level architecture of the PINT codebase. + +You might also find the higher-level conceptual documentation of PINT +helpful: [docs.polkadotindex.com](https://docs.polkadotindex.com/) + +See also these implementation-related community blog posts: + +* https://polkadotindex.substack.com/p/pint-update-1 +* https://polkadotindex.substack.com/p/pint-community-update-2 + +## Terminology + +__SAFT__ (_Simple Agreement for Future Token_) represent asset contributions (from project) that may become liquid +tokens in the future. Their value will be updated regularly + +__NAV__ (_Net Asset Value_) represents: + +* the net value of an asset in the index and is calculated by multiplying the per-unit price with the total amount of + tokens held in the index. +* In the context of the index token itself (PINT) this however represents the unit value of the token and is calculated + by taking the value of each of the underlying tokens over the total supply of PINT: + +
NAV formula
+ +## Pallets + +All custom PINT pallets are located in the [pallets](../pallets) folder in the root of the repository which includes. + +### Committee Pallet + +This includes the core governance mechanics. PINT Governance will be administered in two layers: the PINT Council, and +the Constituent Committee. However, we treat both holistically as a `Committee` within the code base. The pallet +includes a set of privileged accounts that are either of type `MemberType::Council` or `MemberType::Constituent`. + +#### Voting + +All proposals are described as dispatchable calls, which means that any method on any other pallet can be executed as +the result of a proposal. For example, a proposal to transfer 100 PINT to a community member from the treasury would +take the form of a call to the Treasury pallet: `Treasury::withdraw(recipient, 100)`. Proposals need to reach a majority +within a certain voting period for them to be executable. + +### Local Treasury Pallet + +Manages PINT exclusively. The treasury is a single account which is derived from the configured `PalletId`. It maintains +ownership of various assets and is controlled by the Governance Committee. Deposits to the Treasury can be done by +simply transferring funds to its AccountId. The committee can execute proposals to withdraw funds from the Treasury. + +### Remote Treasury Pallet + +Similar to the local treasury, but this pallet will be responsible for DOT (or other liquid assets in the Network). It +will execute withdrawals via XCM. + +### Price feed Pallet + +In order to exchange assets for PINT, the value of those assets as well as PINT’s NAV needs to be computed. This pallet +is an abstraction over the [`chainlink-feed-pallet`](https://github.com/smartcontractkit/chainlink-polkadot) which +provides oracle data from the chainlink network. It provides a lookup table for mapping PINT internal asset identifiers +with the chainlink pallet internal price feed identifiers (`AssetId -> FeedId`). Since the NAV calculation requires that +all asset values are measured in the same currency. All price feeds are expected to be configured with the same quote +currency (e.g. USD). This currency will then also be the currency the NAV is measured in, since the NAV of the index is +then `PINT/USD`, effectively the on-chain price of PINT. + +*Note:* All the core functionality of the `asset-index`, like depositing and redeeming, relies on price feeds and a +mapping from `AssetId -> ChainlinkFeed` in the `price-feed` pallet. + +The chainlink pallet is managed by the `PalletAdmin` account which can assign accounts the role of `FeedCreator`. In +the `pint-dev` chainspec `Alice` is the `PalletAdmin` and the council accounts (`Alice`, `Bob`, `Charlie`, `Dave`) +are `FeedCreators` and are allowed to create feeds. + +### SAFT Registry Pallet + +This pallet consists of records of off-chain SAFTs. An SAFT asset can have multiple SAFT Records. Each `SAFTRecord` +holds the number of units of its asset and their value. This value is expected to in the same currency the liquid assets +use for their price feeds, so that the NAV can easily be calculated according to the NAV formula. The SAFT registry +pallet requires the `AssetRecorder` trait which is an abstraction over the features for adding/removing assets, which is +implemented for the `AssetIndex`. Adding a SAFT record will call into the `AssetRecorder::add_saft` function, in mints +new PINT according to the value of the SAFT record. SAFTs can be converted to liquid tokens once they're available in +the network with a location. + +### Asset Index Pallet + +This pallet provides all user facing extrinsics for depositing assets (`AssetIndex::deposit`) and redeeming +PINT (`AssetIndex::withdraw`). It provides all NAV related calculations which is abstracted over the `NavProvider` +trait. Assets are distinguished by their kind, either they are liquid, or SAFT. The value of liquid assets will be +calculated using the price feeds whereas the value of a SAFT asset is determined by the total value of all SAFT records. +Since the SAFT records are stored in the `SaftRegistry` the `AssetIndex` requires the `SaftRegistry` trait abstraction +for that. + +#### Depositing + +Any user may deposit liquid assets. A new liquid asset class is created either by registering it with its native +location in the network (`AssetIndex::register`) or by being added via (`AssetIndex::add_asset`). In order to be able +to deposit, a user must first send liquid assets (e.g.) from its native location (e.g. relay chain) to PINT, upon which +it gets stored in the user +personal [`MultiCurrency`](https://github.com/open-web3-stack/open-runtime-module-library/tree/master/currencies) +balance. This process will be handled by the `LocalAssetTransactor` configured in the runtime which transacts +incoming `Xcm::Deposit` messages into deposit into the sender's `MultiCurrency` balance for that very asset. +Since `deposit` is fallible this is a 2-step process: + +1. send x amount of liquid asset A from chain A to PINT. +2. call `AssetIndex::deposit(A, x)` + +The deposit call determines how much PINT the amount is worth and transfers the asset amount to the index account and +mints PINT in exchange into the caller's PINT balance. The total value of the index increases by the value of the +deposited amount, but the NAV will stay consistent since the newly minted PINT will counteract that. + +#### Withdrawing + +All new deposits (received PINT) are locked for a certain period and timestamped to calculate withdrawal fees based on +time spent in the index. After the `LockupPeriod` is over PINT can be redeemed by the user for a distribution of the +underlying _liquid_ assets. The liquid assets in the index are awarded to the redeemer, totalling the value of the +redeemed PINT, but in proportion to their representation in the index. This will lock the pending withdrawals for a +certain `WithdrawalPeriod` kick off the unbonding process in which the `RemoteAssetManager` will ensure that the pending +withdrawals are available on their native location. If for example a pending withdrawal exceeds the amount held as a +reserve (e.g. _not_ staked) then they need to be unbonded first. After the `WithdrawalPeriod` a user may try to complete +their withdrawals (`AssetIndex::complete_withdrawal`), which will try to complete every single `AssetWithdrawal` but it +will only get closed entirely after the last `AssetWithdrawal` was completed. + +### Remote Asset Manager Pallet + +This pallet provides all the cross chain capabilities PINT relies on. Most importantly bonding and unbonding liquid +assets. Remote Staking is still experimental and rather complex endeavor. The remote asset manager comes with bindings +for the substrate FRAME `pallet_staking`. Assets that were sent to PINT using XCM reserved based transfer are kept in an +account derived from PINT's parachain ID (sovereign account) to which only the PINT parachain has access to during XCM +execution. In other words, all liquid assets that were deposited to the index (e.g. DOT) are sitting in an account on +the asset's native location (e.g. relay chain) to which the PINT parachain has access via XCM. Withdrawing an amount of +liquid assets from PINT, will then transfer the amount from this account back to recipient included in the destination +of the XCM message. XCM also supports dispatching calls on other chains whose origin then will be the sovereign account +of the parachain. This means funds held in PINT's sovereign account can be staked by calling the necessary functions of +the staking pallet, staked assets are called `active`, the default is `idle`. In order to execute a `Xcm::Transact` the +payload (dispatchable) must be encoded as it would be represented by the `Call` enum of the runtime of the xcm's +destination. The encoding of a dispatchable call in the `Runtime::Call` enum is further dependent on the index of the +pallet as it is configured in the `construct_runtime!` macro. To make things worse, the encoding of course depends on +the runtime specific types. So in order to generalize remote staking it is required that: + +* the index of `pallet_staking` in the runtime is known +* the remote asset manager can encode the runtime specific types. For the `pallet_staking` these are: `AccountId` + , `Balance`, `LookupSource`. + +The remote handles this by requiring the `StakingCallEncoder` type, which takes care of asset specific encoding +of `pallet_staking` dispatchables. + +It also has experimental support for transferring PINT +to [Statemint parachain](https://medium.com/polkadot-network/statemint-generic-assets-chain-proposing-a-common-good-parachain-to-polkadot-governance-d318071b238) \ No newline at end of file diff --git a/docs/getting-started/resources/developer-resources.md b/docs/getting-started/resources/developer-resources.md new file mode 100644 index 0000000000..1031870ec3 --- /dev/null +++ b/docs/getting-started/resources/developer-resources.md @@ -0,0 +1,40 @@ +--- +layout: default +title: Developer Resources +permalink: /developer-resources/ +--- + +### Cryptography + +- blake2s used for hashing +- ed25519 (signing) +- ed25519 (curve) + +### WASM + +- WASM Specification +- Wasm on the Blockchain: The Lesser Evil [blog post] + +### Polkadot + +- Polkadot Wiki +- Polkadot Consensus Wiki +- Polkadot Runtime Environment Specification (Section 8.2) +- Rust Docs: finality_grandpa +- paritytech/finality_grandpa +- The State of Crypto Interoperability Explained in Pictures + +#### Parachains + +- The Parachain (Blog Post) +- Parachains on Polkadot Wiki +- Parathreads (Blog Post) +- Parathreads on Polkadot Wiki +- The Path of a Parachain Block +- The Path of a Parachain Block (Video) + +### Substrate + +- Official Substrate Documentation + + diff --git a/docs/getting-started/resources/general-resources.md b/docs/getting-started/resources/general-resources.md new file mode 100644 index 0000000000..6c1f3b8816 --- /dev/null +++ b/docs/getting-started/resources/general-resources.md @@ -0,0 +1,63 @@ +--- +layout: default +title: General Resources +permalink: /getting-started/resources/general-resources +--- + +## Welcome + +Here you will find resources to help facilitate your learning about _Polkadot_. Don't worry if you are unfamiliar with these terms, the resources listed here assume no prior knowledge about them. + +## Polkadot + +To start, it would be extremely beneficial to have an understanding of the Polkadot Network. For a high-level introduction to Polkadot, check out the lightpaper. To understand the motivation behind Polkadot's creation and what makes it unique, check out this great blog post A brief summary of everything Substrate and Polkadot. While reading, it would be helpful to note that Substrate. + +### Additional Resources + +#### Docs + +- Polkadot Wiki + +- Polkadot Paper + +#### Articles + +- How Polkadot tackles the biggest problems facing blockchain innovators - June 7th 2018 + +#### Block explorers + +- Polkadot Explorer + +- Polkascan - Polkadot block explorer + +- Polkadot Telemetry Service + +### Additional Resources + +## Substrate + +#### Docs + +- Substrate Documentation + +#### Videos + +- Gavin Wood on Substrate at Event Horizon 2018 + +- Rob Habermeier presents Parity Substrate + +#### Articles + +- What is Substrate? - July 9th 2018 + +- A brief summary of everything Substrate and Polkadot - March 18th 2019 + +## Web3 Foundation + +#### Docs + +- Web3 Foundation's General Grants Program + +#### Articles + +- Why Wy Need Web 3.0 - September 12th 2018 diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000000..cba6d38fd8 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,50 @@ +--- +layout: default +permalink: / +--- + +
+ PINT logo +
+ +## A Polkadot ecosystem index for investors. A self-sustaining auction treasury for parachains. + +The Polkadot Index Network Token (PINT) is a token that enables protocols and individuals to easily gain diversified exposure to the top Polkadot ecosystem projects. Holders are exposed to the price movements and rewards of all of the assets within the PINT index. +While many people (even the professionals) believe they should actively manage their portfolios, investing in an index is the best choice for most investors - just ask Warren Buffet. Index funds are popular because they enable ownership of a wide variety of assets, providing immediate diversification and lower risk. + +PINT operates as a DAO within the StakerDAO ecosystem, governed by a council of Polkadot ecosystem participants. + +| Council Members | Company | +|-------------------------------------------------------------------|---------------------------| +| Ruitao Su, Co-Founder & CEO | Acala & Laminar | +| Xiao Xiao, Investment Manager | HashKey Capital | +| Jack Platts, Co-Founder & CEO | Hypersphere Ventures | +| Benjamin Weiss, Substrate Builders Program | Parity Technologies | +| Ben Perszyk, Head of Portfolio Ops, Polkadot Ecosystem Fund Lead | Polychain Capital | +| Graham Tonkin, Co-Founder | Stateless.Money Validator | +| Open Seat for PINT Community Member | | + +One of the key features of the Polkadot ecosystem is the ability for projects to build use-case-specific "parachains". Parachains are self-sovereign blockchains that can interoperate with one another while benefiting from the security of the base Polkadot relay chain. This interoperability creates a commonwealth of sorts, providing unique benefits to projects building within the Polkadot ecosystem. +‌The Polkadot relay chain abstracts away many of the technical complexities present when building "stand-alone" blockchains. Similar to how Amazon Web Services removed the need for individual companies to maintain a rack of servers and the staff to support them in each office, the Polkadot relay chain removes the necessity to employ cryptographers, runtime engineers, and protocol-level specialists. This enables parachains to focus on their core use-case and govern by their own rules, while the relay chain remains optimized to secure and settle the network. +One hundred parachain slots will be available for parachain candidates to compete for via the Parachain Lease Offering (PLO) process. Each prospective parachain candidate must generate sufficient financing to secure the slot and maintain the lease on an ongoing basis. Additionally, many of the parachains will be managed via a permissionless and transparent “on-chain” governance process. This model creates a challenge for parachain communities which may impact the stability and growth of the Polkadot ecosystem: + +***Treasury Management*** - Communities will need to consider how the funds held in their treasury are managed. If a protocol holds only their native asset, the risk of volatility may impact the long-term viability of their parachain slot or ability to finance ongoing development. While the relay chain enables them to focus on their core business case, not all projects will have the expertise or desire to actively manage the funds held in their treasury. +***Ongoing PLO Financing*** - Parachains may find it difficult to maintain their slot for sustained periods of time (e.g after the 4th auction) once token treasuries are depleted from airdrops and when competing with new, more speculative projects that have significant marketing budgets. + +PINT will enable any person or protocol to gain diversified exposure to the top projects in the Polkadot ecosystem in a transparent and permissionless way. Protocols approved to join the index by PINT governance will benefit from; + +***A reduction in treasury risk*** - Each protocol community may choose to exchange a portion of their treasury for PINT, an index that consists of the top projects in the ecosystem, governed by reputable ecosystem professionals. This reduces the need for active treasury manangement. +Ensuring governance quorums are met - The PINT council will participate in the governance of assets in the index. +***PLO Financing*** - Constituent communities will have the ability to apply for financing from the PINT treasury. +Increased token demand - Investors looking to gain diversified ecosystem exposure will increase the demand for tokens in the index. + +***PINT Docs*** is an evolving set of documents and resources to help you understand PINT, the Polkadot ecosystem, and how to build and interact with PINT. + +- If you are already familiar with PINT and the Polkadot ecosystem, or you just want to dive in, head over to [Get Started](./getting-started/installation). + +## Connect + +Let us know if you have any feedback or ideas that might help us improve our documentation or if you have any resources that you would like to see added. If you are planning to use PINT or any of the PINT pallets, please say hello! + + + diff --git a/docs/usage/command-line.md b/docs/usage/command-line.md new file mode 100644 index 0000000000..f455727e2a --- /dev/null +++ b/docs/usage/command-line.md @@ -0,0 +1,38 @@ +--- +layout: default +title: Command-Line +permalink: /usage/command-line/ +--- + +## Commands + +### Build + +This will build the +[Wasm Runtime](https://substrate.dev/docs/en/knowledgebase/advanced/executor#wasm-execution) and +[native](https://substrate.dev/docs/en/knowledgebase/advanced/executor#native-execution) of PINT: + +``` +cargo build --release +``` + +### Test + +Run all tests +``` +cargo test +``` + +Run all tests, including benchmarks +``` +cargo test --all-features +``` + + +### Start the PINT chain + +``` +./target/release/pint --dev --instant-sealing +``` + +If the [polkadot.js UI](https://polkadot.js.org/apps/#/explorer) fails to connect try adding `--rpc-cors all`. \ No newline at end of file diff --git a/docs/usage/configuration.md b/docs/usage/configuration.md new file mode 100644 index 0000000000..9dcc73fb01 --- /dev/null +++ b/docs/usage/configuration.md @@ -0,0 +1,58 @@ +--- +layout: default title: Configuration permalink: /usage/configuration/ +--- + +# Configuration + +## Polkadot JS UI + +In order to use [polkadot.js UI](https://polkadot.js.org/apps/#/explorer) to interact with the chain you need to specify +the custom PINT is using by copying the [types.json](../../resources/types.json) object into the input +at `Settings > Devoloper` in the polkadot js UI menu. + +## Chain Spec + +By default, PINT uses the [dev chain spec](../../node/src/chain_spec/dev.rs). + +The `GenesisConfig` configures the initial chain state at genesis. + +Excerpt: + +```rust +GenesisConfig { + system: SystemConfig { + code: WASM_BINARY.expect("WASM binary was not build, please build it!").to_vec(), + changes_trie_config: Default::default (), + }, + // This ensures the `endowed_accounts` have funds in their accounts + balances: BalancesConfig { balances: endowed_accounts.iter().cloned().map( | k| (k, 1 < < 12)).collect() }, + // This configures the comittee + committee: CommitteeConfig { council_members: council_members.clone(), ..Default::default () }, + // all council members can create feeds + chainlink_feed: ChainlinkFeedConfig { pallet_admin: Some(root_key.clone()), feed_creators: council_members }, + sudo: SudoConfig { key: root_key }, + parachain_info: ParachainInfoConfig { parachain_id: id }, +} +``` + +To run the chain with a custom chainspec we need to provide the path to your chainspec json file: + +*NOTE:* the id of your custom chain spec should contain `dev` in order to run it as standalone chain. + +``` +./target/release/pint --tmp --chain= +``` + +Read more about substrate's [Chain Specification](https://substrate.dev/docs/en/knowledgebase/integrate/chain-spec) +and [creating private networks](https://substrate.dev/docs/en/tutorials/start-a-private-network) + +#### Build the chainspec + +./target/release/pint build-spec \ +--disable-default-bootnode > pint-local-plain.json + +#### Build the raw chainspec file + +./target/release/pint build-spec \ +--chain=./pint-local-plain.json \ +--raw --disable-default-bootnode > pint-local-raw.json \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000000..be995266d3 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,69 @@ +# Copyright 2020 ChainSafe Systems +# SPDX-License-Identifier: LGPL-3.0-only + +site_name: PINT Docs +site_description: The Official Documentation for PINT | A Polkadot ecosystem index for investors + +repo_name: chainsafe/pint +repo_url: https://github.com/ChainSafe/pint +edit_uri: edit/development/docs/ + +# Configuration +markdown_extensions: + - meta + - admonition + - codehilite + - toc: + permalink: true + +theme: + name: material + palette: + primary: brown + accent: yellow + theme: + # Light mode + - media: "(prefers-color-scheme: light)" + scheme: default + primary: brown + accent: yellow + toggle: + icon: material/toggle-switch-off-outline + name: Switch to dark mode + + # Dark mode + - media: "(prefers-color-scheme: dark)" + scheme: slate + primary: brown + accent: yellow + toggle: + icon: material/toggle-switch + name: Switch to light mode + favicon: ./assets/favicon.ico + features: + # - navigation.instant + - navigation.tracking + - navigation.sections + - navigation.tabs + - navigation.tabs.sticky +nav: + - Getting Started: + - Overview: ./index.md + - Architecture: ./getting-started/overview/architecture.md + - Installation: ./getting-started/installation.md + - General Resources: ./getting-started/resources/general-resources.md + - Developer Resources: ./getting-started/resources/developer-resources.md + - Usage: + - Command Line: ./usage/command-line.md + - Configuration: ./usage/configuration.md + # - Testing and Debugging: + # - Test Suite: ./testing-and-debugging/test-suite.md + # - Debugging: ./testing-and-debugging/debugging.md + # - Contributing: + # - Overview: ./contributing.md +extra: + social: + - icon: fontawesome/brands/github-alt + link: https://github.com/ChainSafe/pint + - icon: fontawesome/brands/twitter + link: https://twitter.com/ChainSafeth \ No newline at end of file diff --git a/resources/README.md b/resources/README.md new file mode 100644 index 0000000000..90ae8175a8 --- /dev/null +++ b/resources/README.md @@ -0,0 +1,5 @@ +This folder contains: + +* [types.json](./types.json): The specific type configuration and custom datatypes the PINT runtime uses. This is + required for the polkadot JS UI in order to properly connect to a running node. This also includes all custom types + used by the [chainlink-feed-pallet](https://github.com/smartcontractkit/chainlink-polkadot) \ No newline at end of file diff --git a/resources/types.json b/resources/types.json index a4a088d644..cdd2c2a419 100644 --- a/resources/types.json +++ b/resources/types.json @@ -115,11 +115,7 @@ "reporting_round": "RoundId", "latest_round": "RoundId", "first_valid_round": "Option", - "oracle_count": "u32", - "pruning_window": "RoundId", - "next_round_to_prune": "RoundId", - "debt": "Balance", - "max_debt": "Option" + "oracle_count": "u32" }, "FeedConfigOf": "FeedConfig", "Round": {