Skip to content

Commit

Permalink
Merge branch 'master' into jt/add-messages-eth
Browse files Browse the repository at this point in the history
  • Loading branch information
jennifertrin authored Jul 1, 2024
2 parents f3bd67e + 743c9f3 commit 725ede9
Show file tree
Hide file tree
Showing 35 changed files with 282 additions and 201 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ To convert ICP tokens into <GlossaryTooltip>cycles</GlossaryTooltip>, you first
dfx ledger account-id
```

This will display your account number on the ICP ledger. It looks similar to this:
This will display your account number on the ICP <GlossaryTooltip>ledger</GlossaryTooltip>. It looks similar to this:

```
e213184a548871a47fb526f3cba24e2ee2fbbc8129c4ab497ef2ce535130a0a4
Expand All @@ -28,7 +28,7 @@ e213184a548871a47fb526f3cba24e2ee2fbbc8129c4ab497ef2ce535130a0a4

There are a few different ways you might acquire ICP tokens. For example, you might:

- Purchase ICP tokens directly through an exchange that lists ICP tokens available for trade. To see all available places to purchase ICP tokens, check out this [page](https://coinmarketcap.com/currencies/internet-computer/markets/).
- Purchase ICP tokens directly through an exchange that lists ICP tokens available for trade. [See all available places to purchase ICP tokens](https://coinmarketcap.com/currencies/internet-computer/markets/).

- Receive tokens as rewards for participating in the governance of the Internet Computer.

Expand Down
8 changes: 4 additions & 4 deletions docs/developer-docs/defi/cycles/cycles-ledger.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import { GlossaryTooltip } from "/src/components/Tooltip/GlossaryTooltip";

When developing and deploying canisters on the Internet Computer, developers need to have <GlossaryTooltip>cycles</GlossaryTooltip> to pay for the resources used by their canisters. The **cycles ledger** canister has been developed as an alternative to the **cycles wallet** canister for cycles management.

The biggest difference between the cycles ledger and cycles wallet is that the cycles ledger is a single global ledger canister, whereas the cycles wallet canister must be deployed separately for every developer to be used. Additionally, the cycles wallet has some downsides that the cycles ledger remedies. Some of these are:
The biggest difference between the cycles <GlossaryTooltip>ledger</GlossaryTooltip> and cycles wallet is that the cycles ledger is a single global ledger canister, whereas the cycles wallet canister must be deployed separately for every developer to be used. Additionally, the cycles wallet has some downsides that the cycles ledger remedies. Some of these are:

- Cycles wallets are a complex solution to associate cycles with principal IDs.
- Cycles wallets are a complex solution to associate cycles with <GlossaryTooltip>principal</GlossaryTooltip> IDs.
- Cycles wallets consume cycles themselves, meaning developers need to pay cycles to store cycles.
- If a cycles wallet canister ID is lost, the cycles in that cycles wallet canister are also lost.

In short, the cycles ledger simplifies cycle management by providing the ability for principal IDs to hold cycles.

The cycles ledger currently complies with the ICRC-1, ICRC-2, and ICRC-3 standards. In addition to standard ledger functionality, the cycles ledger also interacts with the NNS canisters and user canisters to provide cycles ledger-specific functions, such as:
The cycles ledger currently complies with the ICRC-1, ICRC-2, and ICRC-3 standards. In addition to standard ledger functionality, the cycles ledger also interacts with the <GlossaryTooltip>NNS</GlossaryTooltip> canisters and user canisters to provide cycles ledger-specific functions, such as:

- Accepting incoming cycles sent from other canisters.
- Sending cycles to other canisters.
Expand Down Expand Up @@ -152,7 +152,7 @@ Replace `CANISTER_NAME` with a name for the new canister.

With these two commands, there are two **optional** flags that can be used:

- `dfx create canister CANISTER_NAME --next-to CANISTER_ID:` The new canister will be installed on the same subnet as the canister provided.
- `dfx create canister CANISTER_NAME --next-to CANISTER_ID:` The new canister will be installed on the same <GlossaryTooltip>subnet</GlossaryTooltip> as the canister provided.
- `dfx create canister CANISTER_NAME --subnet SUBNET_ID`: The new canister will be installed on the given subnet.

If no flag is specified and there aren't any canisters that exist in the project, a random subnet is used.
Expand Down
4 changes: 2 additions & 2 deletions docs/developer-docs/defi/cycles/cycles-wallet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ As discussed in [tokens and cycles](/docs/current/concepts/tokens-cycles), ICP t
Unlike ICP tokens, cycles are only associated with canisters and not with user or developer <GlossaryTooltip>principals</GlossaryTooltip>. Because only canisters require cycles to perform operations and pay for the resources they use, users and developers can manage the distribution and ownership of cycles through a special type of canister called a **cycles wallet**.

:::caution
Please note that the cycles wallet will be removed from dfx in a future release. We recommend using the cycles ledger feature instead, which simplifies the cycles management workflow.
Please note that the cycles wallet will be removed from dfx in a future release. We recommend using the [cycles ledger](cycles-ledger.mdx) feature instead, which simplifies the cycles management workflow.
:::

The cycles wallet holds the cycles required to perform operations such as creating new canisters. These operations are executed using the canister principal of the cycles wallet instead of your user principal.
The cycles wallet holds the cycles required to perform operations such as creating new canisters. These operations are executed using the canister <GlossaryTooltip>principal</GlossaryTooltip> of the cycles wallet instead of your user principal.

For the purposes of using the local canister execution environment, the SDK automatically creates a default cycles wallet for you in every project and most of the operations performed using the cycles wallet happen behind the scenes. For example, the cycles wallet acts on your behalf to register canister principals and deploy canisters in the local canister execution environment.

Expand Down
31 changes: 31 additions & 0 deletions docs/developer-docs/defi/dex/overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
keywords: [intermediate, defi, overview, dex, decentralized exchange, exchange]
---

import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow";

# Decentralized exchange overview

<MarkdownChipRow labels={["Beginner", "Concept"]} />

A decentralized exchange, or DEX, is a peer-to-peer marketplace where transactions are executed directly between parties. There is no central intermediary that executes the transaction, such as a bank, broker, or other institution. Each transaction is recorded directly on-chain. DEXs are primarily used to trade or swap cryptocurrencies.

## Centralized exchanges versus decentralized exchanges

A centralized exchange allows for fiat currencies and cryptocurrencies to be exchanged for one another. On a centralized exchange such as Coinbase, you can trade ICP for its worth in USD, then transfer that USD directly to your bank.

A decentralized exchange only allows for cryptocurrencies to be traded for other cryptocurrencies through crypto pairs. They may also support more advanced actions like limit orders and margin trades. Each transaction is handled by the decentralized exchange via an order book, which uses the current buy and sell orders for that token to establish the price. Decentralized exchanges use a set of smart contracts to establish the price of different cryptocurrencies against each other. They also use liquidity pools, where investors can facilitate trades by locking funds within an exchange in return for rewards.

## ICP decentralized exchanges

ICP enables decentralized exchanges and order books to run on-chain, utilizing ICP's cheap storage and computation. The DEX's internal balance and transactions can be stored in a canister, alongside user balances and data.

Some examples of DEXs running on ICP include:

- [Helix Markets](https://www.helixmarkets.io/)

- [ICPSwap](https://icpswap.com/)

- [ICDex](https://avjzx-pyaaa-aaaaj-aadmq-cai.raw.ic0.app/ICDex)

- [Sonic](https://sonic.ooo/)
2 changes: 1 addition & 1 deletion docs/developer-docs/defi/exchange-rate-canister.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { GlossaryTooltip } from "/src/components/Tooltip/GlossaryTooltip";

The exchange rate canister, referred to as the XRC, is a canister that runs on the **uzr34 system subnet**. The XRC uses [HTTPS outcalls](https://internetcomputer.org/https-outcalls/) to fetch data from major cryptocurrency exchanges by using the exchange's public API to retrieve real time or historical cryptocurrency pricing information. The XRC also queries the public APIs for foreign exchange data providers around the world periodically in order to get forex rates.

The XRC canister can be used by dapps such as decentralized exchanges (DEXs) to provide functionality such as comparing exchange rates against market rates to determine the value of assets that are held in a canister smart contract. For example, the cycle minting canister of the NNS uses the XRC to obtain the current ICP/XDR exchange rates, which it requires for the conversion of ICP to cycles.
The XRC canister can be used by dapps such as decentralized exchanges (DEXs) to provide functionality such as comparing exchange rates against market rates to determine the value of assets that are held in a canister smart contract. For example, the cycle minting canister of the <GlossaryTooltip>NNS</GlossaryTooltip> uses the XRC to obtain the current ICP/XDR exchange rates, which it requires for the conversion of ICP to cycles.

The XRC provides this data in response to requests made by other canisters. A request made by another canister is composed of a base asset, a quote asset, and an optional UNIX epoch timestamp.

Expand Down
5 changes: 3 additions & 2 deletions docs/developer-docs/defi/icp-tokens/account-trimming.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
keywords: [intermediate, tokens, concept, defi]
---


import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow";
import { GlossaryTooltip } from "/src/components/Tooltip/GlossaryTooltip";


# Account trimming

<MarkdownChipRow labels={["Intermediate" , "Concept"]} />

## Overview
Even if the ledger can index a large number of accounts, it has a finite capacity.
Even if the <GlossaryTooltip>ledger</GlossaryTooltip> can index a large number of accounts, it has a finite capacity.
To avoid saturation and maintain good performance,
some accounts are trimmed if the ledger capacity is reaching a threshold.
This mechanism prevents dust (i.e. accounts with balance too small to be spent) from accumulating in the ledger.
Expand Down
2 changes: 1 addition & 1 deletion docs/developer-docs/defi/icp-tokens/using-the-ledger.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ keywords: [intermediate, tokens, tutorial, ledger]

import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow";

# Using the ledger
# Using the ICP ledger

<MarkdownChipRow labels={["Intermediate" , "Tutorial"]} />

Expand Down
7 changes: 4 additions & 3 deletions docs/developer-docs/defi/nfts/nft-collections.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ keywords: [intermediate, tutorial, nft collection, create an nft, icrc-7, icrc-3
---

import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow";
import { GlossaryTooltip } from "/src/components/Tooltip/GlossaryTooltip";

# Creating an NFT collection

Expand Down Expand Up @@ -41,7 +42,7 @@ git clone https://github.com/PanIndustrial-Org/icrc_nft.mo.git
cd icrc_nft.mo
```

### Step 2: Start the local replica.
### Step 2: Start the local <GlossaryTooltip>replica</GlossaryTooltip>.

Start `dfx` with the command:

Expand All @@ -51,7 +52,7 @@ dfx start --clean background

### Step 3: Create new local identities.

Create two new identities to be used with the NFT canister: `alice` and `icrc7_deployer`. The `alice` identity will be used to demonstrate the approve workflow, and `icrc7_deployer` will be used as the canister's admin controller.
Create two new identities to be used with the NFT <GlossaryTooltip>canister</GlossaryTooltip>: `alice` and `icrc7_deployer`. The `alice` identity will be used to demonstrate the approve workflow, and `icrc7_deployer` will be used as the canister's admin controller.


```
Expand Down Expand Up @@ -283,7 +284,7 @@ dfx canister call icrc7 icrc7_owner_of '(vec {0;1;2})' --query
)
```

You can see that the canister's principal owns all of the minted tokens. To see if your admin principal is approved to spend tokens, make the following canister call:
You can see that the canister's <GlossaryTooltip>principal</GlossaryTooltip> owns all of the minted tokens. To see if your admin principal is approved to spend tokens, make the following canister call:

```
dfx canister call icrc7 icrc37_is_approved "(vec{record { spender=record {owner = principal \"$ADMIN_PRINCIPAL\"; subaccount = null;}; from_subaccount=null; token_id=0;}})" --query
Expand Down
3 changes: 2 additions & 1 deletion docs/developer-docs/defi/nfts/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ keywords: [intermediate, concept, nfts]
---

import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow";
import { GlossaryTooltip } from "/src/components/Tooltip/GlossaryTooltip";

# NFT overview

Expand All @@ -20,7 +21,7 @@ NFTs are deployed on-chain using smart contracts to provide a transparent record

- Recording documents such as education certificates or awards.

NFTs are created by recording the token's data on-chain through a process known as minting. On ICP, minting is done through a canister smart contract that defines the NFT's ownership, data, and metadata. It also enables the NFT to be sold or transferred to another account.
NFTs are created by recording the token's data on-chain through a process known as minting. On ICP, minting is done through a <GlossaryTooltip>canister</GlossaryTooltip> smart contract that defines the NFT's ownership, data, and metadata. It also enables the NFT to be sold or transferred to another account.

Each NFT is assigned a unique identifier that is publicly accessible, along with the NFT's data, metadata, and transaction history. NFTs can be part of a large collection, such as '1 of 1_000', or they can be '1 of 1' tokens. '1 of 1' NFTs are often used for original art, education certificates, or property records, while '1 of 1_000' can be used to provide equal benefits to each NFT holder, such as membership to a website or tickets to an event.

Expand Down
7 changes: 4 additions & 3 deletions docs/developer-docs/defi/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ keywords: [intermediate, defi, overview, tokens, icrc-1, icrc ledger, icrc index
---

import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow";
import { GlossaryTooltip } from "/src/components/Tooltip/GlossaryTooltip";

# Digital assets overview

<MarkdownChipRow labels={["Intermediate""Concept"]} />
<MarkdownChipRow labels={["Beginner""Concept"]} />

A digital asset is an electronically-stored item that has value and can be owned, sold, traded, or transferred.

Expand All @@ -18,7 +19,7 @@ Digital assets can take many forms, such as:

On ICP, digital assets come in three primary forms: ICP tokens, ICRC tokens, and chain-key tokens.

ICP tokens are the network's native utility token. They are used for different actions on the network, such as being converted into [cycles](/docs/current/developer-docs/getting-started/cycles/overview) to pay for a canister's resources, or being staked in a neuron to receive voting power on the [NNS](/docs/current/developer-docs/daos/nns/overview).
ICP tokens are the network's native utility token. They are used for different actions on the network, such as being converted into <GlossaryTooltip>[cycles](/docs/current/developer-docs/getting-started/cycles/overview)</GlossaryTooltip> to pay for a <GlossaryTooltip>canister</GlossaryTooltip>'s resources, or being staked in a neuron to receive voting power on the [<GlossaryTooltip>NNS</GlossaryTooltip>](/docs/current/developer-docs/daos/nns/overview).

[ICRC](https://github.com/dfinity/ICRC) stands for `Internet Computer Request for Comments` and is a working group for various topics. ICRC standards can be created for anything, not just token types. Currently, the protocol supports the ICRC token standards ICRC-1, ICRC-2, ICRC-3, and ICRC-7, with several more in the process of being drafted and developed.

Expand All @@ -30,7 +31,7 @@ Each token standard is elaborated on in the [token standards documentation](/doc

## Terminology

- **Principal**: An entity that can be authenticated by ICP. Principals are used to identify canisters, individuals, services, ledger accounts, or other components deployed on ICP. A principal can have multiple accounts because you can change the bytes of the subaccount. Principals are ICP's representation of a public key of a user.
- **Principal**: An entity that can be authenticated by ICP. Principals are used to identify canisters, individuals, services, ledger accounts, or other components deployed on ICP. A <GlossaryTooltip>principal</GlossaryTooltip> can have multiple accounts because you can change the bytes of the subaccount. Principals are ICP's representation of a public key of a user.

- **Subaccount**: A optional 32-byte array. Together a principal and a subaccount form an account according to the ICRC-1 standard.

Expand Down
Loading

0 comments on commit 725ede9

Please sign in to comment.