Skip to content

Commit

Permalink
syntax highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
neila committed Sep 22, 2023
1 parent c973160 commit dd963eb
Show file tree
Hide file tree
Showing 161 changed files with 4,036 additions and 4,948 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

では下のコマンドをターミナルで実行してrustを使用できるようにしていきます。(Windows OSの場合は`https://rust.sh/`からインストール用のinit.exeをダウンロードし実行しましょう。)

```
```bash
curl --proto '=https' --tlsv1.2 -sSf `https://sh.rustup.rs` | sh
```

Expand All @@ -27,7 +27,7 @@ curl --proto '=https' --tlsv1.2 -sSf `https://sh.rustup.rs` | sh

処理が終わったら下のコマンドを実行して環境変数を設定します。

```
```bash
source "$HOME/.cargo/env"
```

Expand All @@ -54,7 +54,7 @@ rustup toolchain list


```
rustup override set 1.68.0
rustup override set 1.68.0
rustup component add rust-src --toolchain 1.68.0-aarch64-apple-darwin
```

Expand Down Expand Up @@ -89,15 +89,15 @@ cargo install --force --locked cargo-contract

それでは本プロジェクトで使用するフォルダーを作成してきましょう。作業を始めるディレクトリに移動したら、次のコマンドを実行します。

```bash
```
mkdir ASTAR-SocialFi
cd ASTAR-SocialFi
yarn init --private -y
```

ASTAR-SocialFiディレクトリ内に、package.jsonファイルが生成されます。

```bash
```
ASTAR-SocialFi
└── package.json
```
Expand Down Expand Up @@ -151,13 +151,13 @@ ASTAR-SocialFi

これにより、各パッケージのディレクトリへ階層を移動しなくてもプロジェクトのルート直下から以下のようにコマンドを実行することが可能となります(ただし、各パッケージ内に`package.json`ファイルが存在し、その中にコマンドが定義されていないと実行できません。そのため、現在は実行してもエラーとなります。ファイルは後ほど作成します)。

```bash
```
yarn <パッケージ名> <実行したいコマンド>
```

次に、ASTAR-SocialFiディレクトリ下に`.gitignore`ファイルを作成して以下の内容を書き込みます。
package
```bash

```
**/yarn-error.log*
# dependencies
Expand All @@ -171,7 +171,7 @@ package

最終的に以下のようなフォルダー構成となっていることを確認してください。

```bash
```
ASTAR-SocialFi
├── .gitignore
├── package.json
Expand All @@ -194,14 +194,14 @@ cargo contract new aster_sns_contract

次に下のコマンドを順番に実行してコントラクトディレクトリを編集していきましょう。

```bash
```
cd packages/contract
yarn init --private -y
```

その後`contract`ディレクトリ内で作成されたpackage.jsonを以下のように編集しましょう。

```
```json
{
"name": "contract",
"version": "1.0.0",
Expand All @@ -213,7 +213,6 @@ yarn init --private -y
"test": "cargo test"
}
}
```

では作成されたコントラクトをローカルのチェーンにデプロイしてみましょう。
Expand Down Expand Up @@ -377,7 +376,7 @@ module.exports = {
"./app/**/*.{js,ts,jsx,tsx}",
"./pages/**/*.{js,ts,jsx,tsx}",
"./components/**/*.{js,ts,jsx,tsx}",

// Or if using `src` directory:
"./src/**/*.{js,ts,jsx,tsx}",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@

それでは本プロジェクトで使用するフォルダーを作成してきましょう。作業を始めるディレクトリに移動したら、次のコマンドを実行します。

```bash
```
mkdir AVAX-AMM
cd AVAX-AMM
yarn init --private -y
```

AVAX-AMMディレクトリ内に、package.jsonファイルが生成されます。

```bash
```
AVAX-AMM
└── package.json
```
Expand Down Expand Up @@ -90,15 +90,15 @@ AVAX-AMM

これにより、各パッケージのディレクトリへ階層を移動しなくてもプロジェクトのルート直下から以下のようにコマンドを実行することが可能となります(ただし、各パッケージ内に`package.json`ファイルが存在し、その中にコマンドが定義されていないと実行できません。そのため、現在は実行してもエラーとなります。ファイルは後ほど作成します)。

```bash
```
yarn <パッケージ名> <実行したいコマンド>
```

次に、TypeScriptの設定ファイル`tsconfig.json`を作成しましょう。今回のプロジェクトは、contractとclientどちらもTypeScriptを使用するため、それぞれのパッケージにtsconfig.jsonが存在します。そのため、ルートディレクトリにもtsconfig.jsonを配置することでパッケージ間で共通したい設定を記述することができます。

それでは、AVAX-AMMディレクトリ直下にいることを確認し、下記のコマンドを実行しましょう。

```bash
```
tsc --init
```

Expand All @@ -120,7 +120,7 @@ AVAX-AMM

最後に、AVAX-AMMディレクトリ下に`.gitignore`ファイルを作成して以下の内容を書き込みます。

```bash
```
**/yarn-error.log*
# dependencies
Expand All @@ -132,7 +132,7 @@ AVAX-AMM

最終的に以下のようなフォルダー構成となっていることを確認してください。

```bash
```
AVAX-AMM
├── .gitignore
├── package.json
Expand All @@ -153,11 +153,13 @@ AVAX-AMM

それでは、先ほど作成した`packages/contract`ディレクトリ内にファイルを作成します。ターミナルに向かい、packages/contract`ディレクトリ内で以下のコマンドを実行します。

```bash
```
cd packages/contract
yarn init --private -y
# Hardhatのインストール
yarn add --dev hardhat@^2.11.2
# スマートコントラクトの開発に必要なプラグインのインストール
yarn add --dev @nomicfoundation/hardhat-network-helpers@^1.0.0 @nomicfoundation/hardhat-chai-matchers@^1.0.0 @nomicfoundation/hardhat-toolbox@^2.0.0 @nomiclabs/hardhat-ethers@^2.0.0 @nomiclabs/hardhat-etherscan@^3.0.0 @types/chai@^4.2.0 @types/mocha@>=9.1.0 @typechain/ethers-v5@^10.1.0 @typechain/hardhat@^6.1.2 hardhat-gas-reporter@^1.0.8 solidity-coverage@^0.8.1 ts-node@^10.9.1 typechain@^8.1.0
Expand All @@ -184,7 +186,7 @@ yarn add dotenv@^16.0.2 @openzeppelin/contracts@^4.7.3

`packages/contract`ディレクトリにいることを確認し、次のコマンドを実行します。

```bash
```
npx hardhat
```

Expand All @@ -198,7 +200,7 @@ npx hardhat
```

(例)
```bash
```
$ npx hardhat
888 888 888 888 888
Expand Down Expand Up @@ -332,7 +334,7 @@ Hardhatは段階的に下記を実行しています。

ターミナルに出力されたアドレスを確認してみましょう。

```bash
```
Greeter deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3
```

Expand All @@ -350,8 +352,8 @@ Greeter deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3

`GitHub`へソースコードをアップロードをしたことがない方は以下を参考にしてください。

[新しいレポジトリを作成](https://docs.github.com/ja/get-started/quickstart/create-a-repo)(リポジトリ名などはご自由に)した後、
手順に従いターミナルからアップロードを済ませます。
[新しいレポジトリを作成](https://docs.github.com/ja/get-started/quickstart/create-a-repo)(リポジトリ名などはご自由に)した後、
手順に従いターミナルからアップロードを済ませます。
以下ターミナルで実行するコマンドの参考です。(`AVAX-AMM`直下で実行することを想定しております)

```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ AMMを実装する上で重要なキーワードは以下の3つです。
Hardhatを使用する場合ファイル構造は非常に重要ですので、注意する必要があります。
ファイル構造が下記のようになっていれば大丈夫です 😊

```bash
```
contract
└── contracts
├── AMM.sol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ yarn contract deploy

このような出力結果が出たら成功です!

```bash
```
yarn run v1.22.19
$ yarn workspace contract deploy
$ npx hardhat run scripts/deploy.ts --network fuji
Expand Down Expand Up @@ -908,4 +908,4 @@ yarn client dev

---

次のレッスンでフロントエンドを完成させましょう 🎉
次のレッスンでフロントエンドを完成させましょう 🎉
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
それでは本プロジェクトで使用するフォルダを作成してきましょう。作業を始めるディレクトリに移動したら、次のコマンドを実行します。
```bash
```
mkdir AVAX-Asset-Tokenization
cd AVAX-Asset-Tokenization
yarn init --private -y
```
AVAX-Asset-Tokenizationディレクトリ内に、package.jsonファイルが生成されます。
```bash
```
AVAX-Asset-Tokenization
└── package.json
```
Expand Down Expand Up @@ -93,15 +93,15 @@ AVAX-Asset-Tokenization

これにより、各パッケージのディレクトリへ階層を移動しなくてもプロジェクトのルート直下から以下のようにコマンドを実行することが可能となります(ただし、各パッケージ内に`package.json`ファイルが存在し、その中にコマンドが定義されていないと実行できません。そのため、現在は実行してもエラーとなります。ファイルは後ほど作成します)。

```bash
```
yarn <パッケージ名> <実行したいコマンド>
```

次に、TypeScriptの設定ファイル`tsconfig.json`を作成しましょう。今回のプロジェクトは、contractとclientどちらもTypeScriptを使用するため、それぞれのパッケージにtsconfig.jsonが存在します。そのため、ルートディレクトリにもtsconfig.jsonを配置することでパッケージ間で共通したい設定を記述することができます。

それでは、AVAX-Asset-Tokenizationディレクトリ直下にいることを確認し、下記のコマンドを実行しましょう。

```bash
```
tsc --init
```

Expand All @@ -125,7 +125,7 @@ tsc --init

最後に、AVAX-Asset-Tokenizationディレクトリ下に`.gitignore`ファイルを作成して以下の内容を書き込みます。

```bash
```
**/yarn-error.log*
# dependencies
Expand All @@ -137,7 +137,7 @@ tsc --init

最終的に以下のようなフォルダー構成となっていることを確認してください。

```bash
```
AVAX-Asset-Tokenization
├── .gitignore
├── package.json
Expand All @@ -161,7 +161,7 @@ AVAX-Asset-Tokenization

それでは、先ほど作成した`packages/contract`ディレクトリ内にファイルを作成します。ターミナルに向かい、`packages/contract`ディレクトリへ移動して以下のコマンドを実行します。

```bash
```
# yarnパッケージを管理するための環境セットアップ
yarn init --private -y
Expand All @@ -185,7 +185,7 @@ yarn add dotenv @openzeppelin/contracts@^4.7.3 @chainlink/contracts@^0.5.1

`packages/contract`ディレクトリにいることを確認し、次のコマンドを実行します。

```bash
```
npx hardhat
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

`AVAX-Asset-Tokenization/packages`ディレクトリに移動し、以下のコマンドを実行して下さい。

```bash
```
yarn create next-app client --ts
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

各コンポーネント作成ごとにUIを確認していくので、Webサイトを立ち上げておくと楽かもしれません。

```bash
```
yarn client dev
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ yarn contract deploy

その後`assetTokenization address:`に続くコントラクトのアドレスを`client`ディレクトリ内、 `hooks/useContract.ts`の中の以下の部分に貼り付けてください。

```
```javascript
export const AssetTokenizationAddress =
"コントラクトのデプロイ先アドレス";
```
Expand Down
Loading

0 comments on commit dd963eb

Please sign in to comment.