diff --git a/gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/token/deploy.ts b/gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/token/deploy.ts index 2470e7086..e7ba1ec1e 100644 --- a/gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/token/deploy.ts +++ b/gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/token/deploy.ts @@ -1,5 +1,5 @@ import { Result } from '@chainlink/gauntlet-core' -import { logger } from '@chainlink/gauntlet-core/dist/utils' +import { logger, prompt } from '@chainlink/gauntlet-core/dist/utils' import { SolanaCommand, TransactionResponse } from '@chainlink/gauntlet-solana' import { Token, TOKEN_PROGRAM_ID } from '@solana/spl-token' import BN from 'bn.js' @@ -19,22 +19,28 @@ export default class DeployToken extends SolanaCommand { logger.loading('Creating token...') - const decimals = this.flags.decimals || 18 + const decimals = this.flags.decimals || 9 const token = await Token.createMint( this.provider.connection, this.wallet.payer, mintAuthority.publicKey, - null, + this.wallet.payer.publicKey, // Freeze authority decimals, TOKEN_PROGRAM_ID, ) - const tokenVault = await token.createAssociatedTokenAccount(this.wallet.publicKey) - const mintAmount = new BN(['1'].concat(new Array(decimals).fill('0')).join('')) - logger.log('Minting', mintAmount.toString()) + const billion = new BN(Math.pow(10, 9)) + const tokenVault = await token.createAssociatedTokenAccount(this.wallet.payer.publicKey) + const mintAmount = billion.mul(new BN(Math.pow(10, decimals))) + + await prompt( + `Minting ${billion.toString()} token units, with ${decimals} decimals. Total ${mintAmount.toString()}. Continue?`, + ) await token.mintTo(tokenVault, this.wallet.payer, [], mintAmount) + // To disable minting https://github.com/solana-labs/solana-program-library/blob/36e886392b8c6619b275f6681aed6d8aae6e70f9/token/js/client/token.js#L985 + logger.info(` TOKEN: - Address: ${token.publicKey} @@ -42,6 +48,7 @@ export default class DeployToken extends SolanaCommand { - address: ${tokenVault.toString()} STATE ACCOUNTS: - Mint Authority: ${mintAuthority.publicKey} + - Freeze Authority: ${this.wallet.payer.publicKey} `) return {