import { createWalletClient, custom, parseUnits } from "viem";
const wallet = createWalletClient({
account,
chain: robinhoodChain, // chain ID 4663
transport: custom(window.ethereum),
});
// Deploys coin, bonding curve and AMM
await wallet.writeContract({
address: FACTORY,
abi: factoryAbi,
functionName: "launch",
args: ["Panic Button", "PANIC", SVIX, 300, parseUnits("5000", 18)],
});
// Let the curve spend your quote tokens
await wallet.writeContract({
address: SVIX,
abi: erc20Abi,
functionName: "approve",
args: [CURVE, amount],
});
// Buy with a minimum-out slippage guard
await wallet.writeContract({
address: CURVE,
abi: curveAbi,
functionName: "buy",
args: [amount, minOut],
});
// Mint sVIX with USDG at the next VIX price
await wallet.writeContract({
address: SVIX_VAULT,
abi: vaultAbi,
functionName: "placeOrder",
args: [MINT, usdgAmount, minOut],
});
// Backed by USDG, redeemable for VIX ÷ 100