Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .gitbook/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -1690,6 +1690,63 @@
]
}
]
},
{
"language": "ja",
"groups": [
{
"group": "INJECTIVE",
"pages": [
{
"group": "EVM 開発者",
"icon": "rectangle-code",
"expanded": false,
"pages": [
"ja/developers-evm/index",
"ja/developers-evm/network-information",
{
"group": "初めての EVM Smart Contract",
"pages": [
"ja/developers-evm/smart-contracts/index",
"ja/developers-evm/smart-contracts/compile-hardhat",
"ja/developers-evm/smart-contracts/test-hardhat",
"ja/developers-evm/smart-contracts/deploy-hardhat",
"ja/developers-evm/smart-contracts/verify-hardhat",
"ja/developers-evm/smart-contracts/interact-hardhat",
"ja/developers-evm/smart-contracts/compile-foundry",
"ja/developers-evm/smart-contracts/test-foundry",
"ja/developers-evm/smart-contracts/deploy-foundry",
"ja/developers-evm/smart-contracts/verify-foundry",
"ja/developers-evm/smart-contracts/interact-foundry"
]
},
{
"group": "初めての EVM dApp",
"pages": [
"ja/developers-evm/dapps/index",
"ja/developers-evm/dapps/connect-with-metamask",
"ja/developers-evm/dapps/connect-with-walletconnect"
]
},
"ja/developers-evm/evm-equivalence",
"ja/developers-evm/multivm-token-standard",
"ja/developers-evm/permissioned-multivm-token",
"ja/developers-evm/wrapped-inj",
"ja/developers-evm/precompiles",
"ja/developers-evm/bank-precompile",
"ja/developers-evm/exchange-precompile",
"ja/developers-evm/erc20-module",
"ja/developers-evm/infrastructure-and-tooling",
"ja/developers-evm/add-injective-to-your-dapp",
"ja/developers-evm/evm-integrations-cheat-sheet",
"ja/developers-evm/evm-integrations-faq",
"redirects/https_testnet_faucet_injective_network",
"redirects/https_testnet_blockscout_injective_network_blocks"
]
}
]
}
]
}
]
},
Expand Down
65 changes: 65 additions & 0 deletions .gitbook/ja/developers-evm/add-injective-to-your-dapp.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
title: InjectiveをdAppに追加する
---

# InjectiveをdAppに追加する

ユーザーがワンクリックでInjectiveネットワークに接続できるようにしましょう。

以下のコードスニペットを使用して、dAppに「Add Injective Network」ボタンを追加し、ユーザーがMetaMaskまたはEVM互換ウォレットにInjectiveを簡単に追加できるようにします。

1. スニペットをフロントエンドのコードベースにコピー&ペーストします。
2. `addInjectiveNetwork`関数をお好みのUIボタンに接続します。
3. 以上です。ユーザーは数秒でウォレットにInjectiveを追加できるようになります。

```tsx
// Network configuration
const INJECTIVE_MAINNET_CONFIG = {
chainId: '0x6f0', // 1776 in decimal
chainName: 'Injective',
rpcUrls: ['https://evm-rpc.injective.network'],
nativeCurrency: {
name: 'Injective',
symbol: 'INJ',
decimals: 18
},
blockExplorerUrls: ['https://explorer.injective.network']
};

async function addInjectiveNetwork() {
// Check if MetaMask or another Web3 wallet is installed
if (!window.ethereum) {
alert('Please install MetaMask or another Web3 wallet!');
return;
}

try {
// First, try to switch to the Injective network
await window.ethereum.request({
method: 'wallet_switchEthereumChain',
params: [{ chainId: INJECTIVE_MAINNET_CONFIG.chainId }],
});

console.log('Switched to Injective network successfully!');
} catch (switchError) {
// Error code 4902 means the network hasn't been added yet
if (switchError.code === 4902) {
try {
// Add the Injective network
await window.ethereum.request({
method: 'wallet_addEthereumChain',
params: [INJECTIVE_MAINNET_CONFIG],
});

console.log('Injective network added successfully!');
} catch (addError) {
console.error('Failed to add Injective network:', addError);
alert('Failed to add Injective network. Please try again.');
}
} else {
console.error('Failed to switch network:', switchError);
alert('Failed to switch to Injective network.');
}
}
}
```
50 changes: 50 additions & 0 deletions .gitbook/ja/developers-evm/bank-precompile.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
title: Bank Precompile
---

# Bank Precompile

Bank Precompileは、固定アドレス`0x0000000000000000000000000000000000000064`に存在するシステムsmart contractです。

EVM開発者に対して、Injectiveの**bank module**(`x/bank`)と直接やり取りするためのgas効率の良いネイティブな手段を提供します。これにより、ERC-20トークンを効果的にオンチェーンに取り込むことができます。Bank precompileを使用するすべてのERC-20 contractは、オンチェーンでは`erc20:0x...`というdenomとして表現されます。技術的には、トークンはオンチェーンにのみ存在し、EVMは別のコピーを保持するのではなく、チェーンの状態へのビューを提供するということを意味します。従来のブリッジングでは2つのトークンバージョンが存在しユーザーの操作で切り替える必要がありますが、Bank precompileはオンチェーンのbank denomまたはERC-20の`transfer()`メソッドのいずれを使用した転送でもリアルタイムにデュアル環境の反映を提供します。

Bank precompileを基盤としたERC-20実装、precompileインターフェース、および抽象contractが[InjectiveのSolidity Contractsリポジトリ](https://github.com/InjectiveLabs/solidity-contracts)で利用可能です。主要なcontractは以下の通りです:

* **Bank.sol** – precompileインターフェース
* **BankERC20.sol** – Bank precompileを基盤とした抽象ERC20実装
* **FixedSupplyBankERC20.sol** – 固定供給量の分散型ERC20(オーナーなし、mintおよびburnなし)
* **MintBurnBankERC20.sol** – トークンのmintとburnが許可されたオーナー付きERC20

これらの実装はOpenZeppelinのERC20 contractに基づいています。開発者はBank precompileを利用して自由にカスタムERC20 contractを作成できます。

## ERC20 Contractのデプロイ

**ℹ️ 注意:**

denomスパムを防止するため、ERC20 moduleを介したERC20 contractのデプロイは**有料操作**であり、デプロイ手数料として**1 INJ**が必要です。ERC20 contractのデプロイトランザクションにこの金額が含まれていることを確認してください。含まれていない場合、操作は拒否されます。

## Bank Precompileインターフェース

```solidity
interface IBankModule {
function mint(address,uint256) external payable returns (bool);
function balanceOf(address,address) external view returns (uint256);
function burn(address,uint256) external payable returns (bool);
function transfer(address,address,uint256) external payable returns (bool);
function totalSupply(address) external view returns (uint256);
function metadata(address) external view returns (string memory,string memory,uint8);
function setMetadata(string memory,string memory,uint8) external payable returns (bool);
}
```

## 使用例

[Wrapped INJ (wINJ)](/developers-evm/wrapped-inj#is-winj-the-same-as-weth "Is wINJ the same as wETH?")
は、[MultiVM Token Standard (MTS)](/developers-evm/multivm-token-standard)を実装するために
Bank EVM precompileを活用しています。

## 開発を始める

Bank、Exchange、Staking precompilesを使用したcontractの構築方法を示すデモをいくつか用意しました。これらの例では、最も一般的なEthereum開発フレームワークである**Foundry**を使用してInjective EVMとやり取りする方法も示しています。

Bank precompileのデモは[こちら](https://github.com/InjectiveLabs/solidity-contracts/tree/master/demos/erc20)をご覧いただき、対応するREADMEに従ってください。
Loading