Place a preorder

Javascript example using viem

Pre Order

The acceptable Payment Tokens are AVAX,WAVAX, and USDC.

WAVAX Contract Address

0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7

USDC Contract Address

0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E

Note: use 6 decimal places for USDC. 18 for AVAX/WAVAX

Native AVAX

0x0000000000000000000000000000000000000000
async function placePreSaleOrder(
  tokenAddress: string,
  paymentToken: string,
  payAmount: string, 
) {
  try {
    const data = await walletClient.writeContract({
      address: factoryContractAddress,
      abi: factoryABI,
      functionName: 'placePreSaleOrder',
      args: [tokenAddress, paymentToken, payAmount],
      account: account,
    });
    console.log('swap data', data);
  } catch (error) {
    console.error('Error in swap:', error);
  }
}

Last updated