Getting Started
Quickstart
Deploy a hook-enabled token on Sepolia testnet in under 5 minutes. This guide covers installing the SDK, writing a basic hook, and deploying through the TokenFactory.
i
You need a funded Sepolia wallet (at least 0.01 ETH for gas + fees) and Node.js 18+ installed. Get testnet ETH from the Sepolia faucet. All contracts are live and verified on Sepolia — see Smart Contracts for addresses.
1. Install the SDK
bash
npm install @hookos/sdk ethers2. Initialize the client
src/index.ts
import { HookOS } from "@hookos/sdk";
import { ethers } from "ethers";
const provider = new ethers.JsonRpcProvider(
process.env.SEPOLIA_RPC_URL
);
const signer = new ethers.Wallet(
process.env.PRIVATE_KEY!,
provider
);
const hookos = new HookOS({
signer,
network: "sepolia",
});3. Deploy a token
Create a new token with the TokenFactory. The factory deploys an ERC-20 and registers it on-chain.
src/deploy-token.ts
const token = await hookos.tokens.create({
name: "My Protocol Token",
symbol: "MPT",
initialSupply: ethers.parseEther("1000000"),
metadataURI: "ipfs://Qm...",
});
console.log("Token deployed:", token.address);
console.log("Tx hash:", token.txHash);4. Write a hook
Hooks implement specific lifecycle functions. Here is a minimal hook that applies a 1% burn on every sell:
contracts/BurnOnSell.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import { IHook } from "@hookos/contracts/interfaces/IHook.sol";
contract BurnOnSell is IHook {
uint256 public constant BURN_BPS = 100; // 1%
function afterSwap(
address pool,
address sender,
bool zeroForOne,
int256 amountSpecified,
bytes calldata
) external override returns (bytes4) {
if (amountSpecified < 0) {
// Sell detected — burn 1% of output
uint256 burnAmt = uint256(-amountSpecified)
* BURN_BPS / 10000;
// Burn logic here
}
return IHook.afterSwap.selector;
}
}5. Register and attach the hook
src/attach-hook.ts
// Register the hook on-chain
const hookId = await hookos.hooks.register({
name: "Burn on Sell",
category: "Reward",
implementation: "0x...", // deployed hook address
metadataURI: "ipfs://Qm...",
});
// Attach to your token
await hookos.hooks.attach({
token: token.address,
hookId,
hookPoint: "afterSwap",
});
console.log("Hook attached! ID:", hookId);✓
Use the Playground to test your hook logic before deploying to a live network.
6. Verify on Etherscan
bash
npx hardhat verify --network sepolia <CONTRACT_ADDRESS>Next steps
- Read the Hooks guide to understand the full lifecycle
- Browse the SDK Reference for all available methods
- Explore Smart Contracts for deployment addresses and ABIs
- Use the Developer Portal to write, compile, and simulate hooks in the browser
- Add the Discord Bot to your server for deploy notifications and protocol commands
- Follow @hookosdeploys on Telegram for real-time deploy alerts