Skip to content

Commit

Permalink
fix: fixed unit tests to adapt new feeAmount parameter
Browse files Browse the repository at this point in the history
Signed-off-by: Logan Nguyen <[email protected]>
  • Loading branch information
quiet-node committed Mar 6, 2024
1 parent 636edbf commit a83922f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ describe('createHederaFungibleToken test suite', () => {
const initialSupply = 900000000; // 9 WHBAR
const metadata = ['Zeus', 'Athena', 'Apollo'];
const msgValue = '20000000000000000000'; // 20 hbar
const feeAmount = 1000; // 20 hbar
const recipient = '0x34810E139b451e0a4c67d5743E956Ac8990842A8';
const contractId = '0xbdcdf69052c9fc01e38377d05cc83c28ee43f24a';
const feeTokenAddress = '0x00000000000000000000000000000000000006Ab';
Expand Down Expand Up @@ -161,7 +162,8 @@ describe('createHederaFungibleToken test suite', () => {
contractId,
inputKeys,
msgValue,
feeTokenAddress
feeTokenAddress,
feeAmount
);

expect(txRes.err).toBeNull;
Expand Down Expand Up @@ -342,7 +344,8 @@ describe('createHederaFungibleToken test suite', () => {
contractId,
inputKeys,
msgValue,
feeTokenAddress
feeTokenAddress,
feeAmount
);

expect(txRes.err).toBeNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ import { TNetworkName } from '@/types/common';
*
* @param feeTokenAddress?: string
*
* @param feeTokenAmount?: number
*
* @return Promise<ISmartContractExecutionResult>
*
* @see https://github.com/hashgraph/hedera-smart-contracts/blob/main/contracts/hts-precompile/IHederaTokenService.sol#L136
Expand All @@ -73,7 +75,8 @@ export const createHederaFungibleToken = async (
treasury: string,
inputKeys: ICommonKeyObject[],
msgValue: string,
feeTokenAddress?: string
feeTokenAddress?: string,
feeTokenAmount?: number
): Promise<ISmartContractExecutionResult> => {
// sanitize params
let sanitizeErr;
Expand Down Expand Up @@ -114,6 +117,7 @@ export const createHederaFungibleToken = async (
initialTotalSupply,
maxSupply,
decimals,
feeTokenAmount,
keyRes.hederaTokenKeys,
{
value: ethers.parseEther(msgValue),
Expand Down Expand Up @@ -175,6 +179,8 @@ export const createHederaFungibleToken = async (
*
* @param feeTokenAddress?: ethers.AddressLike
*
* @param feeTokenAmount?: number
*
* @return Promise<ISmartContractExecutionResult>
*
* @see https://github.com/hashgraph/hedera-smart-contracts/blob/main/contracts/hts-precompile/IHederaTokenService.sol#L136
Expand All @@ -189,7 +195,8 @@ export const createHederaNonFungibleToken = async (
treasury: ethers.AddressLike,
inputKeys: ICommonKeyObject[],
msgValue: string,
feeTokenAddress?: ethers.AddressLike
feeTokenAddress?: ethers.AddressLike,
feeTokenAmount?: number
): Promise<ISmartContractExecutionResult> => {
// sanitize params
let sanitizeErr;
Expand Down Expand Up @@ -224,6 +231,7 @@ export const createHederaNonFungibleToken = async (
symbol,
memo,
maxSupply,
feeTokenAmount,
keyRes.hederaTokenKeys,
{
value: ethers.parseEther(msgValue),
Expand Down
3 changes: 3 additions & 0 deletions test/hts-precompile/token-create/tokenCreateCustomContract.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ describe('TokenCreateCustomContract Test Suite', () => {
const initialSupply = 900000000; // 9 WHBAR
const maxSupply = 30000000000; // 300 WHBAR
const decimals = 8;
const feeAmount = 1000n;
const freezeDefaultStatus = false;
let keys, signers, fixedFeeTokenAddress, tokenCreateCustomContract;

Expand Down Expand Up @@ -133,6 +134,7 @@ describe('TokenCreateCustomContract Test Suite', () => {
initialSupply,
maxSupply,
decimals,
feeAmount,
keys,
{
value: '35000000000000000000',
Expand Down Expand Up @@ -179,6 +181,7 @@ describe('TokenCreateCustomContract Test Suite', () => {
tokenSymbol,
tokenMemo,
maxSupply,
feeAmount,
keys,
{
value: '20000000000000000000',
Expand Down

0 comments on commit a83922f

Please sign in to comment.