メインコンテンツへスキップ

Documentation Index

Fetch the complete documentation index at: https://injectivelabs-mintlify-jp-developers-first-half-1777019423.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

InjectiveのToken Factoryモジュールは、Mint + Burnモデルを使用して、ユーザーとコントラクトが新しいネイティブトークンを作成し、ネイティブトークンとCW20トークンをスワップできるようにします。これは、異なるソースからのアセットをネイティブbank denomとして表現することが、exchange、auction、insurance fundsなど、他のオンチェーンモジュールへのアクセスをユーザーに許可するために不可欠であるため、チェーン上に持つべき重要な機能です。Token Factory denomは次の形式です: factory/{creator address}/{subdenom} createrとして機能するCW20AdapterContractと組み合わせることで、CW20アセットをInjective上でToken Factory denomとしてネイティブに表現できます。仕組みとしては、CW20アセットはCW20AdapterContractによって保持され、injectiveアドレスに対してfactory denomとしてミントされます。CW20に戻したい場合、bankモジュールからburnされ、CW20AdapterContractからオーナーアドレスに解放されます。

factory denomをCW20に戻す例

import {
  MsgExecuteContractCompat,
  ExecArgCW20AdapterRedeemAndTransfer,
} from '@injectivelabs/sdk-ts/core/modules'

const CW20_ADAPTER_CONTRACT = 'inj...'
const contractCw20Address = 'inj...'
const injectiveAddress = 'inj...'

const message = MsgExecuteContractCompat.fromJSON({
  sender: injectiveAddress,
  contractAddress: CW20_ADAPTER_CONTRACT,
  funds: {
    denom: `factory/${CW20_ADAPTER_CONTRACT}/${contractCw20Address}`,
    amount: actualAmount.toFixed(),
  },
  execArgs: ExecArgCW20AdapterRedeemAndTransfer.fromJSON({
    recipient: injectiveAddress,
  }),
})

// その後、メッセージをトランザクションにパックし、署名してチェーンにブロードキャストします

CW20をfactory denomに変換する例

import {
  ExecArgCW20Send,
  MsgExecuteContractCompat,
} from '@injectivelabs/sdk-ts/core/modules'

const CW20_ADAPTER_CONTRACT = 'inj...'
const contractCw20Address = 'inj...'
const injectiveAddress = 'inj...'
const amount = '1000000' // 1 USDT は6桁の小数を持つため、チェーン上では次のように表現されます

const message = MsgExecuteContractCompat.fromJSON({
  contractAddress: contractCw20Address,
  sender: injectiveAddress,
  execArgs: ExecArgCW20Send.fromJSON({
    amount,
    contractAddress: CW20_ADAPTER_CONTRACT,
  }),
})

// その後、メッセージをトランザクションにパックし、署名してチェーンにブロードキャストします
Last modified on April 24, 2026