モザイク供給量の変更

Supply Mutable」 プロパティを使用してモザイクを作成した場合、トークンを増やすか、総供給量を減らすことができます。

前提条件

  • モザイクの作成 ガイドを完了している
  • 供給量を変えることができるモザイクを作成している

方法 #01: デスクトップウォレットを使用する

  1. 左側のメニューの 「モザイク」 タブをクリックします。

2. Click on the edit icon (represented by a pen) on the right side of the mosaic that you desire to edit. Click 「modify supply」. Note:

  1. 供給量を増加/減少を指定する 「Supply Change Direction」 を選択してください。次に、相対供給量に変更する量を入力します。 」送信」 をクリックします。次のページの情報を確認し、ウォレットのパスワードを入力します。 「確認」 をクリックします。

この例では、相対供給量が 1,000,000 増加します。モザイクの可分性プロパティは 0 なので、絶対供給量の変化は同じです。

注釈

負の数を入力すると、指示された 「供給変更方向」 の逆になります。たとえば、 -100 の増加を選択した場合、相対供給量は 100 減少します。供給量を減らすには、モザイクの所有者が、少なくとも削除する単位の数を保有している必要があります。

  1. モザイク」 ページで供給量の変更を確認できます。それでも古い供給量が表示される場合は、右上の更新アイコンをクリックしてみてください。

方法 #02: SDK を使用する

1. Define a MosaicSupplyChangeTransaction as in the next code snippet. Then, replace the mosaicId and divisibility with the current mosaic properties. Edit delta with the relative amount of mosaics you want to increase.

 // replace with network type
const networkType = NetworkType.TEST_NET;
// replace with private key
const privateKey =
  '1111111111111111111111111111111111111111111111111111111111111111';
const account = Account.createFromPrivateKey(privateKey, networkType);
// replace with mosaic id
const mosaicIdHex = '7cdf3b117a3c40cc';
const mosaicId = new MosaicId(mosaicIdHex);
// replace with mosaic divisibility
const divisibility = 0;
// replace with mosaic units to increase
const delta = 1000000;
const mosaicSupplyChangeTransaction = MosaicSupplyChangeTransaction.create(
  Deadline.create(epochAdjustment),
  mosaicId,
  MosaicSupplyChangeAction.Increase,
  UInt64.fromUint(delta * Math.pow(10, divisibility)),
  networkType,
  UInt64.fromUint(2000000),
);
 // replace with network type
const networkType = symbol_sdk_1.NetworkType.TEST_NET;
// replace with private key
const privateKey =
  '1111111111111111111111111111111111111111111111111111111111111111';
const account = symbol_sdk_1.Account.createFromPrivateKey(
  privateKey,
  networkType,
);
// replace with mosaic id
const mosaicIdHex = '7cdf3b117a3c40cc';
const mosaicId = new symbol_sdk_1.MosaicId(mosaicIdHex);
// replace with mosaic divisibility
const divisibility = 0;
// replace with mosaic units to increase
const delta = 1000000;
const mosaicSupplyChangeTransaction = symbol_sdk_1.MosaicSupplyChangeTransaction.create(
  symbol_sdk_1.Deadline.create(epochAdjustment),
  mosaicId,
  symbol_sdk_1.MosaicSupplyChangeAction.Increase,
  symbol_sdk_1.UInt64.fromUint(delta * Math.pow(10, divisibility)),
  networkType,
  symbol_sdk_1.UInt64.fromUint(2000000),
);
         // replace with node endpoint
        try (final RepositoryFactory repositoryFactory = new RepositoryFactoryVertxImpl(
                "http://api-01.us-east-1.testnet.symboldev.network:3000")) {
            final NetworkType networkType = repositoryFactory.getNetworkType().toFuture().get();
            // replace with private key
            final String privateKey = "1111111111111111111111111111111111111111111111111111111111111111";
            final Account account = Account
                    .createFromPrivateKey(privateKey, networkType);
            // replace with mosaic id
            final String mosaicIdHex = "7cdf3b117a3c40cc";
            final MosaicId mosaicId = new MosaicId(mosaicIdHex);
            // replace with mosaic divisibility
            final int divisibility = 0;
            // replace with mosaic units to increase
            final int delta = 1000000;
            final MosaicSupplyChangeTransaction mosaicSupplyChangeTransaction = MosaicSupplyChangeTransactionFactory
                    .create(
                            networkType,
                            mosaicId,
                            MosaicSupplyChangeActionType.INCREASE,
                            BigDecimal.valueOf(delta * Math.pow(10, divisibility)).toBigInteger())
                    .maxFee(BigInteger.valueOf(2000000)).build();

注釈

Symbol は 絶対量 を扱います。絶対量を取得するには、増減するアセットの量に 10divisibility を乗じてください。例えば、モザイクが 可分性 2 である場合、10 単位 (相対) 増減するには 1000 (絶対) と定義します。

  1. モザイク作成者のアカウントでトランザクションに署名して、ネットワークにアナウンスします。
 // replace with meta.networkGenerationHash (nodeUrl + '/node/info')
const networkGenerationHash =
  '1DFB2FAA9E7F054168B0C5FCB84F4DEB62CC2B4D317D861F3168D161F54EA78B';
const signedTransaction = account.sign(
  mosaicSupplyChangeTransaction,
  networkGenerationHash,
);
// replace with node endpoint
const nodeUrl = 'http://api-01.us-east-1.testnet.symboldev.network:3000';
const repositoryFactory = new RepositoryFactoryHttp(nodeUrl);
const transactionHttp = repositoryFactory.createTransactionRepository();
transactionHttp.announce(signedTransaction).subscribe(
  (x) => console.log(x),
  (err) => console.error(err),
);
 // replace with meta.networkGenerationHash (nodeUrl + '/node/info')
const networkGenerationHash =
  '1DFB2FAA9E7F054168B0C5FCB84F4DEB62CC2B4D317D861F3168D161F54EA78B';
const signedTransaction = account.sign(
  mosaicSupplyChangeTransaction,
  networkGenerationHash,
);
// replace with node endpoint
const nodeUrl = 'http://api-01.us-east-1.testnet.symboldev.network:3000';
const repositoryFactory = new symbol_sdk_1.RepositoryFactoryHttp(nodeUrl);
const transactionHttp = repositoryFactory.createTransactionRepository();
transactionHttp.announce(signedTransaction).subscribe(
  (x) => console.log(x),
  (err) => console.error(err),
);
             final String generationHash = repositoryFactory.getGenerationHash().toFuture().get();
            final SignedTransaction signedTransaction = account
                    .sign(mosaicSupplyChangeTransaction, generationHash);
            final TransactionRepository transactionRepository = repositoryFactory
                    .createTransactionRepository();
            transactionRepository.announce(signedTransaction).toFuture().get();
        }

それ以外の場合は MosaicSupplyChangeAction.IncreaseMosaicSupplyChangeAction.Decrease に変更することでモザイクの供給を減らすことができます。この2番目の場合、モザイク作成者アカウントはモザイクの供給を減らすために、少なくとも delta 単位を保有していなければなりません。

方法 #03: CLI を使用する

ターミナルを開き、次のコマンドを実行します。

7cdf3b117a3c40cc をモザイク識別子に、 1000000 を増加させたい絶対量に置き換えます。

 symbol-cli transaction mosaicsupplychange --action Increase --mosaic-id 7cdf3b117a3c40cc --delta 1000000