import {
TokenStaticFactory,
MsgBroadcasterWithPk,
MsgSubmitProposalExpiryFuturesMarketLaunch,
} from "@injectivelabs/sdk-ts";
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,
});