If a mosaic was created with the “Supply Mutable” property, you can make more tokens or reduce the total supply.
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:
In our example, the relative supply is increased by 1,000,000. Since the divisibility property of the mosaic is 0, the change in absolute supply is identical.
Note
If you enter a negative number, it will do the inverse of the indicated “Supply Change Direction”. For example, if you choose to increase by -100, the relative supply will decrease by 100. To decrease the supply, the mosaic owner must have at least the number of units to be removed.
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(),
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(), 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.096x.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();
Note
Symbol works with absolute amounts. To get an absolute amount, multiply the number of assets you want to increase/decrease by 10divisibility. For example, if the mosaic has divisibility 2, to increase 10 units (relative) you should define 1000 (absolute) instead.
// 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.096x.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.096x.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();
}
Otherwise, you can decrease a mosaic supply by changing MosaicSupplyChangeAction.Increase
to MosaicSupplyChangeAction.Decrease
.
In this second case, the mosaic creator account must own at least delta
units to decrease the mosaic supply.
To alter the mosaic supply, open a terminal window and run the following command.
Replace 7cdf3b117a3c40cc
with the mosaic identifier and 1000000
with the absolute units to be increased.
symbol-cli transaction mosaicsupplychange --action Increase --mosaic-id 7cdf3b117a3c40cc --delta 1000000
Did you find what you were looking for? Give us your feedback.