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スマートコントラクト",
"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: dAppにInjectiveを追加する
---

# dAppにInjectiveを追加する

ワンクリックでユーザーが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.');
}
}
}
```
49 changes: 49 additions & 0 deletions .gitbook/ja/developers-evm/bank-precompile.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: Bank Precompile
---

# Bank Precompile

Bank Precompileは、固定アドレス`0x0000000000000000000000000000000000000064`に存在するシステムスマートコントラクトです。

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

Bank precompileに基づくERC-20実装の一連のコントラクト、precompileインターフェース、抽象コントラクトが[InjectiveのSolidity Contractsリポジトリ](https://github.com/InjectiveLabs/solidity-contracts)で利用可能です。主要なコントラクトは以下の通りです:

* **Bank.sol** – precompileインターフェース
* **BankERC20.sol** – Bank precompileに基づく抽象ERC20実装
* **FixedSupplyBankERC20.sol** – 固定サプライの分散型ERC20(オーナーなし、mintおよびburnなし)
* **MintBurnBankERC20.sol** – オーナーがmintとburnを許可されたERC20

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

## ERC20コントラクトのデプロイ

**ℹ️ 注意:**

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

## 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 "wINJはwETHと同じですか?")は、
[MultiVM Token Standard (MTS)](/developers-evm/multivm-token-standard)を実装するためにBank EVM precompileを利用しています。

## ビルドを開始する

Bank、Exchange、Staking precompileを使用したコントラクトの構築方法を示すデモを用意しました。これらの例では、最も一般的なEthereum開発フレームワークである**Foundry**を使用してInjective EVMとインタラクションする方法も示しています。

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