Skip to content

Commit 17d525b

Browse files
committed
Merge branch 'master' into mraszyk/pic
2 parents 46e358c + 0c27b54 commit 17d525b

File tree

80 files changed

+1889
-2205
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1889
-2205
lines changed

.github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/motoko/hello_cycles/ @dfinity/languages
2222
/motoko/ic-pos/ @dfinity/growth
2323
/motoko/icrc2-swap/ @dfinity/growth
24-
/motoko/internet_identity_integration/ @dfinity/gix
24+
/motoko/internet_identity_integration/ @dfinity/identity
2525
/motoko/life/ @dfinity/languages
2626
/motoko/minimal-counter-dapp/ @dfinity/growth
2727
/motoko/parallel_calls/ @dfinity/languages

.github/workflows/provision-linux.sh

+17-17
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@ set -ex
66
pushd /tmp
77

88
# Install Node.
9-
wget --output-document install-node.sh "https://deb.nodesource.com/setup_14.x"
10-
sudo bash install-node.sh
9+
wget --output-document nodesource_setup.sh "https://deb.nodesource.com/setup_lts.x"
10+
sudo bash nodesource_setup.sh
1111
sudo apt-get install --yes nodejs
12-
rm install-node.sh
12+
rm nodesource_setup.sh
1313

1414
# Install DFINITY SDK.
1515
wget --output-document install-dfx.sh "https://raw.githubusercontent.com/dfinity/sdk/master/public/install-dfxvm.sh"
1616
DFX_VERSION=${DFX_VERSION:=0.24.3} DFXVM_INIT_YES=true bash install-dfx.sh
1717
rm install-dfx.sh
18-
echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH
18+
echo "$HOME/.local/share/dfx/bin" >>$GITHUB_PATH
1919
source "$HOME/.local/share/dfx/env"
2020
dfx cache install
2121
# check the current ic-commit found in the main branch, check if it differs from the one in this PR branch
2222
# if so, update the dfx cache with the latest ic artifacts
2323
if [ -f "${GITHUB_WORKSPACE}/.ic-commit" ]; then
24-
stable_sha=$(curl https://raw.githubusercontent.com/dfinity/examples/master/.ic-commit)
25-
current_sha=$(sed <"$GITHUB_WORKSPACE/.ic-commit" 's/#.*$//' | sed '/^$/d')
26-
arch="x86_64-linux"
27-
if [ "$current_sha" != "$stable_sha" ]; then
28-
export current_sha
29-
export arch
30-
sh "$GITHUB_WORKSPACE/.github/workflows/update-dfx-cache.sh"
31-
fi
24+
stable_sha=$(curl https://raw.githubusercontent.com/dfinity/examples/master/.ic-commit)
25+
current_sha=$(sed <"$GITHUB_WORKSPACE/.ic-commit" 's/#.*$//' | sed '/^$/d')
26+
arch="x86_64-linux"
27+
if [ "$current_sha" != "$stable_sha" ]; then
28+
export current_sha
29+
export arch
30+
sh "$GITHUB_WORKSPACE/.github/workflows/update-dfx-cache.sh"
31+
fi
3232
fi
3333

3434
# Install ic-repl
@@ -47,14 +47,14 @@ rustup target add wasm32-unknown-unknown
4747

4848
# Install matchers
4949
matchers_version=1.2.0
50-
curl -fsSLO "https://github.com/kritzcreek/motoko-matchers/archive/refs/tags/v${matchers_version}.tar.gz"
50+
curl -fsSLO "https://github.com/kritzcreek/motoko-matchers/archive/refs/tags/v${matchers_version}.tar.gz"
5151
tar -xzf "v${matchers_version}.tar.gz" --directory "$(dfx cache show)"
5252
rm "v${matchers_version}.tar.gz"
5353
mv "$(dfx cache show)/motoko-matchers-${matchers_version}" "$(dfx cache show)/motoko-matchers"
5454

5555
# Install wasmtime
5656
wasmtime_version=0.33.1
57-
curl -fsSLO "https://github.com/bytecodealliance/wasmtime/releases/download/v${wasmtime_version}/wasmtime-v${wasmtime_version}-x86_64-linux.tar.xz"
57+
curl -fsSLO "https://github.com/bytecodealliance/wasmtime/releases/download/v${wasmtime_version}/wasmtime-v${wasmtime_version}-x86_64-linux.tar.xz"
5858
mkdir -p "${HOME}/bin"
5959
tar -xf "wasmtime-v${wasmtime_version}-x86_64-linux.tar.xz" --directory "${HOME}/bin/"
6060
mv "${HOME}/bin/wasmtime-v${wasmtime_version}-x86_64-linux/wasmtime" "${HOME}/bin/wasmtime"
@@ -66,13 +66,13 @@ cargo install --path wasi2ic --root "${HOME}"
6666

6767
# Install wasm-opt
6868
version=117
69-
curl -fsSLO "https://github.com/WebAssembly/binaryen/releases/download/version_117/binaryen-version_${version}-x86_64-linux.tar.gz"
69+
curl -fsSLO "https://github.com/WebAssembly/binaryen/releases/download/version_117/binaryen-version_${version}-x86_64-linux.tar.gz"
7070
tar -xzf "binaryen-version_${version}-x86_64-linux.tar.gz" --directory "${HOME}/" --strip-components 1
7171
rm "binaryen-version_${version}-x86_64-linux.tar.gz"
7272

7373
# Set environment variables.
74-
echo "$HOME/bin" >> $GITHUB_PATH
75-
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
74+
echo "$HOME/bin" >>$GITHUB_PATH
75+
echo "$HOME/.cargo/bin" >>$GITHUB_PATH
7676

7777
# Exit temporary directory.
7878
popd

.github/workflows/rust-threshold-schnorr-example.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ jobs:
2020
steps:
2121
- uses: actions/checkout@v1
2222
- name: Provision Darwin
23-
run: bash .github/workflows/provision-darwin.sh
23+
run: |
24+
bash .github/workflows/provision-darwin.sh
25+
brew install llvm
2426
- name: Provision PocketIC
2527
run: bash .github/workflows/provision-pocket-ic-server.sh
2628
- name: Rust Threshold Schnorr Darwin

archive/motoko/dip721-nft-container/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Using this management canister address, we can construct its principal and set t
8888

8989
## NFT sample code tutorial
9090

91-
### Prerequisites
91+
## Prerequisites
9292

9393
- [x] Install the [IC SDK](https://internetcomputer.org/docs/current/developer-docs/setup/install/index.mdx).
9494
- [x] Download and install [git.](https://git-scm.com/downloads)

archive/motoko/hello/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ This example demonstrates a dead simple dapp consisting of two canister smart co
4141

4242
This example is based on the default project created by running `dfx new hello`.
4343

44-
### Prerequisites
44+
## Prerequisites
4545
This example requires an installation of:
4646
- [x] Install the [IC SDK](https://internetcomputer.org/docs/current/developer-docs/setup/install/index.mdx).
4747
- [x] Install `node.js` (to build the web frontend).

archive/motoko/persistent-storage/README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ This example covers:
2424
## Installation
2525
This example project can be cloned, installed, and deployed locally, for learning and testing purposes. The instructions are based on running the example on either macOS or Linux, but when using WSL2 on Windows, the instructions will be the same.
2626

27-
### Prerequisites
27+
## Prerequisites
2828
This example requires an installation of:
2929

3030
- [x] Install the [IC SDK](https://internetcomputer.org/docs/current/developer-docs/setup/install/index.mdx).
@@ -33,7 +33,8 @@ This example requires an installation of:
3333

3434
Begin by opening a terminal window.
3535

36-
### Step 1: Navigate into the folder containing the project's files and start a local instance of the Internet Computer with the command:
36+
### Step 1: Navigate into the folder containing the project's files and start a local instance of the Internet Computer with the commands:
37+
3738

3839
```bash
3940
cd examples/motoko/persistent-storage

motoko/basic_bitcoin/README.md

+10-16
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
---
2-
keywords: [advanced, motoko, bitcoin, bitcoin integration, btc]
3-
---
4-
51
# Basic Bitcoin
62

7-
[View this sample's code on GitHub](https://github.com/dfinity/examples/tree/master/motoko/basic_bitcoin)
8-
9-
## Overview
103
This tutorial will walk you through how to deploy a sample [canister smart contract](https://wiki.internetcomputer.org/wiki/Canister_smart_contract) **that can send and receive Bitcoin** on the Internet Computer.
114

125
## Architecture
@@ -21,22 +14,23 @@ For a deeper understanding of the ICP < > BTC integration, see the [Bitcoin inte
2114

2215
## Prerequisites
2316

24-
* [x] Install the [IC
25-
SDK](https://internetcomputer.org/docs/current/developer-docs/setup/install/index.mdx). For local testing, `dfx >= 0.22.0` is required.
17+
- [x] Install the [IC
18+
SDK](https://internetcomputer.org/docs/current/developer-docs/getting-started/install). For local testing, `dfx >= 0.22.0` is required.
19+
- [x] Clone the example dapp project: `git clone https://github.com/dfinity/examples`
20+
21+
> [!WARNING]
22+
> This example is designed to be deployed on the mainnet. It will return errors when deployed locally; these errors are expected.
2623
27-
:::info
28-
This example is designed to be deployed on the mainnet. It will return errors when deployed locally; these errors are expected.
29-
:::
24+
Begin by opening a terminal window.
3025

31-
## Step 1: Building and deploying sample code
26+
## Step 1: Setup the project environment
3227

33-
### Clone the smart contract
28+
Navigate into the folder containing the project's files and start a local instance of the Internet Computer with the commands:
3429

35-
To clone and build the smart contract in **Motoko**:
3630

3731
```bash
38-
git clone https://github.com/dfinity/examples
3932
cd examples/motoko/basic_bitcoin
33+
dfx start --background
4034
```
4135

4236
### Install MOPS

motoko/basic_dao/README.md

+12-15
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
---
2-
keywords: [advanced, motoko, dao, decentralized organization, decentralized org]
3-
---
4-
51
# Basic DAO
62

7-
[View this sample's code on GitHub](https://github.com/dfinity/examples/tree/master/motoko/basic_dao)
8-
93
This sample project demonstrates a basic [decentralized autonomous organization](https://en.wikipedia.org/wiki/Decentralized_autonomous_organization) (DAO) that can be deployed to the [Internet Computer](https://github.com/dfinity/ic). The basic DAO sample code is available in [Motoko](https://github.com/dfinity/examples/tree/master/motoko/basic_dao) and [Rust](https://github.com/dfinity/examples/tree/master/rust/basic_dao). You can see a quick introduction on [YouTube](https://youtu.be/3IcYlieA-EE).
104

11-
## Overview
12-
135
A `basic_dao` can be initialized with a set of accounts: mappings from principal IDs to a number of tokens. Account owners can query their account balance by calling `account_balance` and transfer tokens to other accounts by calling `transfer`. Anyone can call `list_accounts` to view all accounts.
146

157
Account owners can submit proposals by calling `submit_proposal`. A proposal specifies a canister, method, and arguments for this method. Account owners can cast votes (either `Yes` or `No`) on a proposal by calling `vote`. The amount of votes cast is equal to the amount of tokens the account owner has. If enough `Yes` votes are cast, `basic_dao` will execute the proposal by calling the proposal’s given method with the given args against the given canister. If enough `No` votes are cast, the proposal is not executed, and is instead marked as `Rejected`.
@@ -19,30 +11,35 @@ This workflow is demonstrated below.
1911

2012
View the [canister service definition](https://github.com/dfinity/examples/blob/master/rust/basic_dao/src/basic_dao/src/basic_dao.did) for more details.
2113

22-
### Prerequisites
23-
This example requires an installation of:
14+
## Prerequisites
2415

25-
- [x] Install the [IC SDK](https://internetcomputer.org/docs/current/developer-docs/setup/install/).
16+
- [x] Install the [IC
17+
SDK](https://internetcomputer.org/docs/current/developer-docs/getting-started/install). For local testing, `dfx >= 0.22.0` is required.
2618
- [x] To run the test scripts, you need to download [ic-repl](https://github.com/chenyan2002/ic-repl/releases).
2719
- [x] Clone the example dapp project: `git clone https://github.com/dfinity/examples`
2820

2921
Begin by opening a terminal window.
3022

31-
### Step 1: Navigate into the folder containing the project's files and start a local instance of the Internet Computer with the command:
23+
## Step 1: Setup the project environment
24+
25+
Navigate into the folder containing the project's files and start a local instance of the Internet Computer with the commands:
26+
3227

3328
```bash
3429
cd examples/motoko/basic_dao
3530
dfx start --background
3631
```
3732

38-
### Step 2: Create test identities with the commands:
33+
## Step 2: Create identities
34+
35+
Create test identities with the commands:
3936

4037
```bash
4138
dfx identity new Alice --disable-encryption; dfx identity use Alice; export ALICE=$(dfx identity get-principal);
4239
dfx identity new Bob --disable-encryption; dfx identity use Bob; export BOB=$(dfx identity get-principal);
4340
```
4441

45-
### Step 3: Deploy `basic_dao` with initial test accounts.
42+
## Step 3: Deploy `basic_dao` with initial test accounts
4643

4744
```bash
4845
dfx deploy --argument "(record {
@@ -57,7 +54,7 @@ dfx deploy --argument "(record {
5754
})"
5855
```
5956

60-
### Step 4: Run the ic-repl test scripts:
57+
## Step 4: Run the `ic-repl` test scripts:
6158

6259
```bash
6360
ic-repl tests/account.test.sh

motoko/canister_logs/README.md

+23-25
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,43 @@
1-
---
2-
keywords: [beginner, motoko, canister logs, logging]
3-
---
4-
51
# Canister logs
62

7-
[View this sample's code on GitHub](https://github.com/dfinity/examples/tree/master/motoko/canister_logs)
8-
93
## Prerequisites
10-
This example requires an installation of:
114

12-
- [x] DFX version 0.19.0 or newer
13-
- [x] Install the [IC SDK](https://internetcomputer.org/docs/current/developer-docs/setup/install/).
14-
- [x] Download the following project files from GitHub: `git clone https://github.com/dfinity/examples/`
5+
- [x] Install the [IC
6+
SDK](https://internetcomputer.org/docs/current/developer-docs/getting-started/install). For local testing, `dfx >= 0.22.0` is required.
7+
- [x] Clone the example dapp project: `git clone https://github.com/dfinity/examples`
158

16-
You will need to have 3 terminal windows:
17-
- Terminal A: Running a DFX instance and separating its output from anything else
18-
- Terminal B: Deploying a canister and seeing its output
19-
- Terminal C: Reading logs interactively
9+
## Step 1: Setup project environment
10+
11+
Navigate into the folder containing the project's files and start a local instance of the replica with the command:
2012

21-
### Step 1: Navigate into the folder containing the project's files and start a local instance of the replica with the command:
13+
```shell
14+
dfx start --clean
15+
```
16+
17+
You will need to have 3 terminal windows:
18+
- Terminal A: Running a `dfx` instance and separating its output from anything else.
19+
- Terminal B: Deploying a canister and seeing its output.
20+
- Terminal C: Reading logs interactively.
2221

2322
```shell
2423
# Terminal A -- for running DFX and separating its output from anything else.
25-
$ cd examples/motoko/canister_logs
26-
$ dfx start --clean
24+
cd examples/motoko/canister_logs
2725

2826
# Terminal B -- for deploying the canister and calling its methods.
29-
$ cd examples/motoko/canister_logs
27+
cd examples/motoko/canister_logs
3028

3129
# Terminal C -- for polling logs.
32-
$ cd examples/motoko/canister_logs
30+
cd examples/motoko/canister_logs
3331
```
3432

35-
### Step 2: Deploy the canister:
33+
## Step 2: Deploy the canister
3634

3735
```shell
3836
# Terminal B
39-
$ dfx deploy
37+
dfx deploy
4038
```
4139

42-
### Step 3: Check canister logs:
40+
## Step 3: Check canister logs
4341

4442
Expect to see logs from timer traps.
4543

@@ -52,7 +50,7 @@ $ dfx canister logs CanisterLogs
5250
[3. 2024-05-23T08:32:31.836721763Z]: [TRAP]: timer trap
5351
```
5452

55-
### Step 4: Call `print` method and check the logs:
53+
## Step 4: Call `print` method and check the logs
5654

5755
```shell
5856
# Terminal B
@@ -70,7 +68,7 @@ $ dfx canister logs CanisterLogs
7068
...
7169
```
7270

73-
### Step 5: Start constantly polling logs:
71+
## Step 5: Start constantly polling logs
7472

7573
In order not to call `dfx canister logs CanisterLogs` after every canister call in a separate terminal window/pane C start a script that will constantly poll logs:
7674

@@ -86,7 +84,7 @@ $ ./poll_logs.sh
8684
...
8785
```
8886

89-
### Step 6: Call `print`, `trap` and other canister methods:
87+
## Step 6: Call `print`, `trap` and other canister methods
9088

9189
```shell
9290
# Terminal B

0 commit comments

Comments
 (0)