Skip to content

Commit

Permalink
Merge pull request #483 from centrifuge/develop
Browse files Browse the repository at this point in the history
Merge fixes + new content to main
  • Loading branch information
annamehr authored Jan 22, 2024
2 parents 1a3ac50 + 0ca58c6 commit d88c87e
Show file tree
Hide file tree
Showing 43 changed files with 248 additions and 293 deletions.
14 changes: 9 additions & 5 deletions docs/build/bridge/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ title: Centrifuge - Ethereum Bridge

## Bridge Contract & Accounts
### Token Supply
The bridge supply can be audited by looking at the number of tokens stored in the bridge account: 4dpEcgqFor2TJw9uWSjx2JpjkNmTic2UjJAK1j9fRtcTUoRu as well as the ERC20 token supply.
The bridge supply can be audited by comparing the number of tokens stored on the Centrifuge Chain bridge account with the ERC20 token supply of wCFG on Ethereum.

- Centrifuge Chain (CFG): `4dpEcgqFp8UL6eA3b7hhtdj7qftHRZE7g1uadHyuw1WSNSgH`
- Ethereum (wCFG): `0xc221b7e65ffc80de234bbb6667abdd46593d34f0`

### Relayer Threshold
You can submit an RPC call a to a full node and query `chainBridge.relayerThreshold`. This will give you the number of confirmations needed on the Centrifuge Chain to trigger a transfer.
You can submit an RPC call to a full node and query `chainBridge.relayerThreshold`. This will give you the number of confirmations needed on the Centrifuge Chain to trigger a transfer.

On Ethereum, you can query the Chainbridge public method `_relayerThreshold()(uint8)`:

Expand Down Expand Up @@ -42,11 +45,12 @@ Follow instructions here: https://github.com/paritytech/substrate/tree/master/bi
Or run the docker image: https://hub.docker.com/r/parity/subkey

### Install Jq [Optional]
In the bash snippet below we use `jq` to parse a JSON output. You can choose to omit that and paste the address manually.
In the bash snippet below, we use `jq` to parse a JSON output. You can choose to omit that and paste the address manually.
Otherwise, follow instructions here to install in your distribution: https://stedolan.github.io/jq/.

## Set environment variables
**Please reach out to us on [Slack](https://centrifuge.io/slack) or [Telegram](https://t.me/centrifuge_chat) for contract addresses.**
**Please submit a ticket on [Discord](https://discord.com/invite/yEzyUq5gxF) for contract addresses.**

```=bash
export ETH_RPC_URL="YOUR_ETH_CLIENT_URL"
export ETH_PRIVATE_KEY="YOUR_PRIVATE_KEY"
Expand Down Expand Up @@ -75,7 +79,7 @@ export ETH_GAS_PRICE=40000000000

## Substrate Native to ERC20 Ethereum
In the substrate UI, select the `Extrinsics` tab and call `palletBridge.transferNative` with these parameters:
- Amount: `1000000000000000000` 1 CFG
- Amount: `1000000000000000000` (= 1 CFG)
- Recipient: `YOUR_ETH_TARGET_ACCOUNT`
- Dest Id: `0`

Expand Down
Binary file removed docs/build/cent-chain/images/cent-stack.png
Binary file not shown.
32 changes: 5 additions & 27 deletions docs/build/cent-chain/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,17 @@ redirect_from:
- /build
- /build/
---
## Centrifuge Chain

## Introduction
Centrifuge Chain is our blockchain built with Rust and [Substrate](https://docs.substrate.io/), purpose built for real-world assets. Pools (and their assets, tranches, etc), [onchain governance](https://docs.centrifuge.io/use/governance-process/) and the Centrifuge treasury, and the CFG token live on Centrifuge Chain.

### The Centrifuge Stack

![Cent Stack](./images/cent-stack.png)

The Centrifuge stack consists of a peer-to-peer messaging protocol to store and exchange business documents in a private, secure way. As the next layer, we built Centrifuge Chain using Substrate to hold the unalterable, single source of truth of these documents for all parties. Using Centrifuge Chain and dApps built on top, businesses can tokenize documents and use this as collateral to access financing. Tinlake is our securitization protocol for these tokenized assets built on Centrifuge Chain to optimize risk allocation and connect Centrifuge to the DeFi ecosystem.

### Centrifuge Chain

[Centrifuge Chain](https://github.com/centrifuge/centrifuge-chain) is the gateway for real-world assets to the Blockchain Multiverse. We built Centrifuge Chain on [Parity Substrate](https://substrate.dev) with an initial bridge to Ethereum. This allows us to move faster and use a consistent approach for certain features.

Substrate allows us to easily tap into the [Polkadot](https://polkadot.network) ecosystem and to connect with other blockchains that support the standard, which in turn increases interoperability.

We envision a larger ecosystem of many, connected blockchains- where Dapps on Ethereum can use data from other chains, value can move freely, and Centrifuge Chain can [enable off-chain assets to access financing](https://medium.com/centrifuge/centrifuge-chain-the-gateway-for-real-world-assets-to-the-blockchain-multiverse-41dd5597ecf1) through DeFi.
Investors can invest in assets on Centrifuge from other chains via Liquidity Pools deployed on supported chains. For example, a Liquidity Pool deployed on Ethereum allows users on Ethereum to invest in a pool on Centrifuge without leaving Ethereum.

#### Centrifuge Chain Efficiencies

Centrifuge Chain is optimized specifically for the transactions required by our specific use case. This focus allows us to improve upon our current architecture in a few key ways: speed, cost, storage efficiencies, and privacy.

Ethereum works well for low volumes of high value transactions. High volumes of privacy-requiring use-cases require a different solution. The average business user, SMBs and large enterprises alike, would be paying many times more using Centrifuge on Ethereum compared to their existing solutions. It wouldn’t be worth it for most businesses to make a switch. But what if we could lower that cost and have high throughput capabilities?

The transactions on the Centrifuge Chain are optimized for the small subset of operations needed by our specific use case. This allows for faster execution of logic and finality of transactions. The optimization of transactions, together with our PoS architecture, is also what brings down the transaction costs dramatically. Centrifuge Chain also implements a state rent model that requires users to pay for continuous availability of their data over long periods of time. This encourages decentralization because less resources are required to run a node. Building our own chain also allows us to improve upon the user and developer experience for Centrifuge. Our users require privacy, and this is something we can build for directly — targeting the features they need from the start. For developers, we can provide custom APIs and tools that come with the blockchain node itself instead of smart contract APIs which are harder to integrate with.

While there are downsides to building a single purpose chain, the advantages for our use case outweigh the costs. Integration with other Ethereum and DeFi projects becomes a bit more involved. Our experience with Ethereum development, combined with a standardized bridge to get data to/from our Parity Substrate based chain reduces the overhead substantially, while still benefiting from the upside of our own chain.

## Further Resources

### Substrate/Polkadot Resources
The transactions on the Centrifuge Chain are optimized for the small subset of operations needed by our specific use case. This allows for faster execution of logic and finality of transactions. The optimization of transactions, together with our PoS architecture, is also what brings down the transaction costs dramatically. This encourages decentralization because less resources are required to run a node. Building our own chain also allows us to improve upon the user and developer experience for Centrifuge. Our users require privacy, and this is something we can build for directly — targeting the features they need from the start. For developers, we can provide custom APIs and tools that come with the blockchain node itself instead of smart contract APIs which are harder to integrate with.

- [Kusama Documentation](https://guide.kusama.network/docs/kusama-getting-started)
- [W3F Guide](https://github.com/w3f/polkadot-secure-validator) on Production Grade Setups for Validators on Substrate chains
- [Guides by Certus One](https://kb.certus.one/) (Cosmos Validator)
- [Architecture Deep Dive by Chorus](https://gdoc.pub/doc/e/2PACX-1vQXb1kd0zqYT8K4B4XYb-lrlfRIuPDXsgiTjj94gDOjw3ezEUAtjvxR8yfbKJypmioKeGRrhkLCtZog)
- [Polkadot Wiki](https://wiki.polkadot.network/docs/getting-started) (also covering Substrate relevant features)
While there are downsides to building a single purpose chain, the advantages for our use case outweigh the costs. Integration with other Ethereum and DeFi projects becomes a bit more involved. Our experience with Ethereum development, combined with a standardized bridge to get data to/from our Parity Substrate based chain reduces the overhead substantially, while still benefiting from the upside of our own chain.
Binary file added docs/build/guides/images/lp-investment-flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 62 additions & 0 deletions docs/build/guides/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
id: guides
order: 2
title: Guides
contributors: <NunoAlexandre:[email protected]>
---

# Investing into a Liquidity Pool

This guide will teach you how to find the correct liquidity pool instance to invest in, how to invest and get the respective tranche tokens in return, and how the whole system flows behind the scenes.

## Deployed Contracts

Pick the contracts deployed on the network you want to invest from.
You will need them on the `Step 2.` below.

- **Ethereum**
- `PoolManager` - `0x78E9e622A57f70F1E0Ec652A4931E4e278e58142`
- `Circle USDC` - `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`

## Steps

1. ERC20 Approval

The user should call the ERC20 approval on the investment currency (e.g. USDC on Ethereum) to allow the Liquidity Pools contract to manage those funds for them.

2. Pick the correct `LiquidityPool` instance

With the appropriate `PoolManager` contract instance, call the following:

**`PoolManager.getLiquidityPool(poolId, trancheId, currency)`**

**NOTES**:

- The `currency` param should be the `USDC` token address in the respective network.
- The `LiquidityPool` offers an interface based on [EIP-7540](https://eips.ethereum.org/EIPS/eip-7540), an extension of [EIP-4626](https://eips.ethereum.org/EIPS/eip-4626)

3. Invest into a LiquidityPool

Now that you have the LiquidityPool instance at hand, you can invest into it by calling:

**`LiquidityPool.requestDeposit(uint256 amount, address receiver)`**

Once submitted, the `amount` is locked on the escrow contract.

Then, the pool issuer needs to fulfill this request.

Once that's done, yield starts to accrue immediately, and the user can claim their tranche tokens.

4. Claim the tranche tokens

Once the request from step 3 is fulfilled, the user can claim their tranche tokens equivalent to `y` by calling:

**`LiquidityPool.mint(uint256 y, address receiver)`**

**NOTE**: `y` needs to be ≤ `maxDeposit`. The user can find that amount by calling **`LiquidityPool.maxDeposit`**.

## Overview

Behind the scenes, this is what takes place on steps 2 and 3:

![Liquidity Pools - Investment Flow](./images/lp-investment-flow.png)
4 changes: 2 additions & 2 deletions docs/build/nfts/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ contributors: <Dennis Wellmann:[email protected]>

## Introduction

User-mintable NFTs are a critical part of the Centrifuge ecosystem. Minting an NFT from a Centrifuge [Document](https://developer.centrifuge.io/docs/overview/protocol-architecture/) allows a user to [draw loans](https://centrifuge.io/technology/tinlake/) against the NFT asset, or simply provides a way to easily transact in privacy-preserving way with a document asset. This flow can be seen in the image below:
User-mintable NFTs are a critical part of the Centrifuge ecosystem. Minting an NFT from a Centrifuge [Document](https://docs.centrifuge.io/build/p2p-node/#documents-within-the-protocol) allows a user to [draw loans](https://docs.centrifuge.io/getting-started/securitization/#on-chain-securitization) against the NFT asset, or simply provides a way to easily transact in privacy-preserving way with a document asset. This flow can be seen in the image below:

![Centrifuge architecture](./images/mint-flow.jpeg)

Expand Down Expand Up @@ -39,7 +39,7 @@ proofs = new bytes32[][](5);
...
```

The verification method can be found in our optimised [Merkle Verifier](https://github.com/centrifuge/privacy-enabled-erc721/blob/develop/src/merkle.sol) contract.
The verification method can be found in our optimised [Merkle Verifier](https://github.com/centrifuge/privacy-enabled-erc721) contract.

An example of an NFT with one proof which can be minted using methods from the precise-proofs library is as follows:

Expand Down
2 changes: 1 addition & 1 deletion docs/build/p2p-node/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ For more information, see the [Parity Substrate Project](https://substrate.dev/)

### Centrifuge is Beta Software

Centrifuge and all its components are Beta Software. There will be substantial changes in the future and backwards compatibility is not guaranteed. Please use with caution. See [Disclaimer](/centrifuge-node/further-reading/disclaimer/). Also, please read the details about the [protocol and implementation limitations](/cent-node/further-reading/protocol-limitations/).
Centrifuge and all its components are Beta Software. There will be substantial changes in the future and backwards compatibility is not guaranteed. Please use with caution. See [Disclaimer](https://docs.centrifuge.io/build/p2p-node/#disclaimer). Also, please read the details about the [protocol and implementation limitations](https://docs.centrifuge.io/build/p2p-node/#protocol-limitations).

## Protocol Architecture

Expand Down
Loading

0 comments on commit d88c87e

Please sign in to comment.