Documentation Index
Fetch the complete documentation index at: https://injectivelabs-mintlify-jp-native-developers-first-half.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Injectiveはコミュニティ運営のブロックチェーンであり、INJをステーキングしているユーザーはブロックチェーンに関するgovernanceに参加できます。Injectiveプログラムへの修正、技術アップグレード、またはInjectiveエコシステム全体に影響を与えるその他のInjective関連の変更について、Proposalを提出できます。
作成する各Proposalに対して、少なくとも1 INJのデポジットが必要です。これはあなたがInjectiveコミュニティのアクティブな参加者であり、Proposalの作成とプロトコルのガバナンスに資格があることを確認するためです。Proposalが投票ステージに進むには、500 INJのデポジットが必要です。500 INJを自身でデポジットすることもできますし、コミュニティと協力してまとめてデポジットすることもできます。
メッセージ
Governanceモジュールがエクスポートし、Injectiveチェーンとのやり取りに使用できるメッセージを順番に確認し、例を提供します。例えば、これらのメッセージを使用して新しいspot、perpetual、futuresマーケットを提案できます。
MsgGovDeposit
MsgGovDeposit は、既存Proposalへデポジットを追加するためのメッセージです。
import { Network } from "@injectivelabs/networks";
import { toChainFormat } from "@injectivelabs/utils";
import { MsgGovDeposit } from "@injectivelabs/sdk-ts/core/modules";
import { MsgBroadcasterWithPk } from "@injectivelabs/sdk-ts/core/tx";
const denom = "inj";
const proposalId = 12345;
const privateKey = "0x...";
const injectiveAddress = "inj...";
const amount = toChainFormat(1).toFixed();
const message = MsgGovDeposit.fromJSON({
amount: {
denom,
amount,
},
proposalId,
depositor: injectiveAddress,
});
/* broadcast transaction */
const txHash = await new MsgBroadcasterWithPk({
privateKey,
network: Network.Testnet,
}).broadcast({
msgs: message,
});
MsgVote
Proposalに適切に資金提供されると、投票を開始できます。「Yes」「No」「Abstain」「No with Veto」に投票できます。
import { Network } from "@injectivelabs/networks";
import { VoteOption } from "@injectivelabs/sdk-ts/types";
import { MsgVote } from "@injectivelabs/sdk-ts/core/modules";
import { MsgBroadcasterWithPk } from "@injectivelabs/sdk-ts/core/tx";
const proposalId = 12345;
const privateKey = "0x...";
const injectiveAddress = "inj...";
const vote = VoteOption.VOTE_OPTION_YES;
const message = MsgVote.fromJSON({
vote,
proposalId,
voter: injectiveAddress,
});
const txHash = await new MsgBroadcasterWithPk({
privateKey,
network: Network.Testnet,
}).broadcast({
msgs: message,
});
MsgSubmitTextProposal
Injective上の任意のアクションを提案します。TextProposalは標準的なテキストProposalを定義し、承認された場合はその変更を手動で更新する必要があります。
import { Network } from "@injectivelabs/networks";
import { toChainFormat } from "@injectivelabs/utils";
import { MsgBroadcasterWithPk } from "@injectivelabs/sdk-ts/core/tx";
import { MsgSubmitTextProposal } from "@injectivelabs/sdk-ts/core/modules";
const denom = "inj";
const privateKey = "0x...";
const injectiveAddress = "inj...";
const amount = toChainFormat(1).toFixed();
const message = MsgSubmitTextProposal.fromJSON({
title: "Title of Proposal",
description: "Description of Proposal",
proposer: injectiveAddress,
deposit: {
denom,
amount,
},
});
const txHash = await new MsgBroadcasterWithPk({
privateKey,
network: Network.Testnet,
}).broadcast({
msgs: message,
});
MsgSubmitProposalSpotMarketLaunch
このメッセージにより、新しいspotマーケットを提案できます。tickerが正確であることを確認し、base assetのdenom、続いてquote assetのdenomを指定してください。Base denomは取引したいアセットを指し、quote denomはbase assetが何で建てられているかを指します。例えばINJ/USDTマーケットでは、USDTを使用してINJを買ったり売ったりすることになります。
import { TokenStaticFactory } from "@injectivelabs/sdk-ts/service";
import { MsgBroadcasterWithPk } from "@injectivelabs/sdk-ts/core/tx";
import { toChainFormat, toHumanReadable } from "@injectivelabs/utils";
import { getNetworkEndpoints, Network } from "@injectivelabs/networks";
import { MsgSubmitProposalSpotMarketLaunch } from "@injectivelabs/sdk-ts/core/modules";
// refer to https://github.com/InjectiveLabs/injective-lists
import { tokens } from "../data/tokens.json";
const tokenStaticFactory = new TokenStaticFactory(tokens as TokenStatic[]);
const denom = "inj";
const privateKey = "0x...";
const injectiveAddress = "inj...";
const amount = toChainFormat(1).toFixed();
const market = {
baseDenom: "inj", // for example
quoteDenom: "peggy0x...",
makerFeeRate: "0.001",
takerFeeRate: "0.002",
title: "INJ/USDT Spot Market Launch",
description:
"This proposal will launch the INJ/USDT Spot Market with maker and taker fees 0.001% and 0.002% respectively",
ticker: "INJ/USDT",
minPriceTickSize: "0.001",
minQuantityTickSize: "0.001",
};
const baseDenom = tokenStaticFactory.toToken(market.baseDenom);
const quoteDenom = tokenStaticFactory.toToken(market.quoteDenom);
const marketWithDecimals: SpotMarketLaunchProposal = {
...market,
baseTokenDecimals: baseDenom ? baseDenom.decimals : 18,
quoteTokenDecimals: quoteDenom ? quoteDenom.decimals : 6,
};
const marketWithTickSizes = {
...market,
minPriceTickSize: toHumanReadable(
marketWithDecimals.minPriceTickSize,
marketWithDecimals.baseTokenDecimals - marketWithDecimals.quoteTokenDecimals
).toFixed(),
minQuantityTickSize: toChainFormat(
marketWithDecimals.minQuantityTickSize,
marketWithDecimals.baseTokenDecimals
).toFixed(),
};
const message = MsgSubmitProposalSpotMarketLaunch.fromJSON({
market: marketWithTickSizes,
proposer: injectiveAddress,
deposit: {
denom,
amount,
},
});
const txHash = await new MsgBroadcasterWithPk({
privateKey,
network: Network.Testnet,
}).broadcast({
msgs: message,
});
MsgSubmitProposalPerpetualMarketLaunch
このメッセージにより、新しいperpetualマーケットを提案できます。perpetual futuresコントラクト(perps)は、ユーザーが原資産であるbase assetを実際に所有することなく、その価値を売買できるderivative futuresコントラクトです。これは、指定されたトークンペアのperpマーケットを作成するために使用できるメッセージです。
import {
TokenStaticFactory,
MsgBroadcasterWithPk,
MsgSubmitProposalPerpetualMarketLaunch,
} from "@injectivelabs/sdk-ts/core/modules";
import { toChainFormat } from "@injectivelabs/utils";
import { TokenStaticFactory } from "@injectivelabs/sdk-ts/service";
import { MsgBroadcasterWithPk } from "@injectivelabs/sdk-ts/core/tx";
import { getNetworkEndpoints, Network } from "@injectivelabs/networks";
// refer to https://github.com/InjectiveLabs/injective-lists
import { tokens } from "../data/tokens.json";
const tokenStaticFactory = new TokenStaticFactory(tokens as TokenStatic[]);
const denom = "inj";
const privateKey = "0x...";
const injectiveAddress = "inj...";
const amount = toChainFormat(1).toFixed();
const market = {
title: "INJ/USDT Perpetual Market Launch",
description:
"This proposal will launch the INJ/USDT Spot Market with maker and taker fees 0.001% and 0.002% respectively",
ticker: "INJ/USDT PERP",
quoteDenom: "peggy0x...",
oracleBase: "INJ",
oracleQuote: "USDT",
oracleScaleFactor: 6,
oracleType: 10, // BAND IBC
initialMarginRatio: "0.05",
maintenanceMarginRatio: "0.02",
makerFeeRate: "0.01",
takerFeeRate: "0.02",
minPriceTickSize: "0.01",
minQuantityTickSize: "0.01",
};
const quoteDenom = await tokenStaticFactory.toToken(market.quoteDenom);
const marketWithDecimals = {
...market,
quoteTokenDecimals: quoteDenom ? quoteDenom.decimals : 6,
};
const marketWithTickSizes = {
...market,
minPriceTickSize: toChainFormat(
marketWithDecimals.minPriceTickSize,
marketWithDecimals.quoteTokenDecimals
).toFixed(),
};
const message = MsgSubmitProposalPerpetualMarketLaunch.fromJSON({
market: marketWithTickSizes,
proposer: injectiveAddress,
deposit: {
denom,
amount,
},
});
const txHash = await new MsgBroadcasterWithPk({
privateKey,
network: Network.Testnet,
}).broadcast({
msgs: message,
});
MsgSubmitProposalExpiryFuturesMarketLaunch
expiry futuresコントラクトとは、2つのcounterparty間で、指定された将来の特定の価格で特定量の原資産(base asset)を売買する契約であり、将来の指定日に満期を迎えるよう設定されます。これは、指定されたトークンペアのfuturesマーケットを作成するために使用できるメッセージです。
import {
TokenStaticFactory,
MsgBroadcasterWithPk,
MsgSubmitProposalExpiryFuturesMarketLaunch,
import { toChainFormat } from "@injectivelabs/utils";
import { getNetworkEndpoints, Network } from "@injectivelabs/networks";
// refer to https://github.com/InjectiveLabs/injective-lists
import { tokens } from "../data/tokens.json";
const tokenStaticFactory = new TokenStaticFactory(tokens as TokenStatic[]);
const denom = "inj";
const injectiveAddress = "inj...";
const privateKey = "0x...";
const amount = toChainFormat(1).toFixed();
const market = {
title: "INJ/USDT Futures Market Launch",
description:
"This proposal will launch the INJ/USDT Spot Market with maker and taker fees 0.001% and 0.002% respectively",
ticker: "INJ/USDT 24-MAR-2023",
quoteDenom: "peggy0x...",
oracleBase: "INJ",
oracleQuote: "USDT",
expiry: 1000000, // when the market will expire, in ms
oracleScaleFactor: 6,
oracleType: 10, // BAND IBC
initialMarginRatio: "0.05",
maintenanceMarginRatio: "0.02",
makerFeeRate: "0.01",
takerFeeRate: "0.02",
minPriceTickSize: "0.01",
minQuantityTickSize: "0.01",
};
const quoteDenom = await tokenStaticFactory.toToken(market.quoteDenom);
const marketWithDecimals = {
...market,
quoteTokenDecimals: quoteDenom ? quoteDenom.decimals : 6,
};
const marketWithTickSizes = {
...market,
minPriceTickSize: toChainFormat(
marketWithDecimals.minPriceTickSize,
marketWithDecimals.quoteTokenDecimals
).toFixed(),
};
const message = MsgSubmitProposalExpiryFuturesMarketLaunch.fromJSON({
market: marketWithTickSizes,
proposer: injectiveAddress,
deposit: {
denom,
amount,
},
});
const txHash = await new MsgBroadcasterWithPk({
privateKey,
network: Network.Testnet,
}).broadcast({
msgs: message,
});
MsgSubmitProposalSpotMarketParamUpdate
このメッセージは、spotマーケットのparamを更新するために使用できます。
import {
MsgBroadcasterWithPk,
MsgSubmitProposalSpotMarketParamUpdate,
} from "@injectivelabs/sdk-ts/core/modules";
import { Network } from "@injectivelabs/networks";
import { toChainFormat } from "@injectivelabs/utils";
import { GrpcMarketStatusMap } from "@injectivelabs/sdk-ts/client/chain";
const denom = "inj";
const privateKey = "0x...";
const injectiveAddress = "inj...";
const amount = toChainFormat(1).toFixed();
const market = {
title: "INJ/USDT Spot Market Launch",
description:
"This proposal will launch the INJ/USDT Spot Market with maker and taker fees 0.001% and 0.002% respectively",
marketId: "0x...",
makerFeeRate: "0.02",
takerFeeRate: "0.03",
relayerFeeShareRate: "0.4", // 40%, the percent of tsx fees that go to the relayers
minPriceTickSize: "0.002",
minQuantityTickSize: "0.002",
status: GrpcMarketStatusMap.Active,
};
const message = MsgSubmitProposalSpotMarketParamUpdate.fromJSON({
market,
proposer: injectiveAddress,
deposit: {
denom,
amount,
},
});
const txHash = await new MsgBroadcasterWithPk({
privateKey,
network: Network.Testnet,
}).broadcast({
msgs: message,
});