Getting Testnet Tokens

To try swaps end-to-end you’ll need a balance of the demo tokens that live on Fuji.

Agora provides faucet contracts that mint small amounts of each asset to any address on request.

Prerequisite

Make sure your Fuji wallet already holds a little AVAX for gas (see Wallet Setup). A single transaction costs only a few gwei, but the transaction will fail if your balance is zero.


Faucet addresses

TokenSymbolFaucet contract
Agora USDAUSD0xd236c18D274E54FAccC3dd9DDA4b27965a73ee6C
Constant TokenCTK0xB2C2E6c8507360123B2B2D62F2C0Cd4F2d3cE6a8

Helper function to request tokens

With the previously mentioned viem wallet client running, you should just need to use this helper function to call our contract and request testnet tokens.

1 const { request } = await client.simulateContract({
2 address: AUSD_FAUCET,
3 abi: ausdFaucetAbi,
4 functionName: "requestFunds",
5 args: [callerAddress],
6 });

Full Example

1(async () => {
2 // Ensure the wallet is configured properly.
3 const [callerAddress] = await client.getAddresses();
4 console.log(`Caller Address ${callerAddress}`);
5
6 const { request } = await client.simulateContract({
7 address: AUSD_FAUCET,
8 abi: ausdFaucetAbi,
9 functionName: "requestFunds",
10 args: [callerAddress],
11 });
12
13 let txHash = await client.writeContract(request);
14 console.log("AUSD - Request Funds transaction hash:", txHash);
15})();

Output

AUSD - Request Funds transaction hash: 0x2ede80f87afe463d3766b547af02780d149e2cc002b88629370d86e28d9db01b

You can check the status of the returned transaction hash in the Snowtrace testnet explorer. Here is the transaction from the example above.

Snowtrace shows that the transaction was successful so there should now be 10,000 AUSD in the configured wallet’s balance.