Walkthrough setup
The viem client, the contracts' clock and the ABIs every walkthrough imports, as the deployed contracts declare them.
On this page
The walkthroughs share two files: a viem client for Robinhood Chain with the contracts' clock, and the ABIs they call, copied from the deployed contracts. Install viem, which carries the robinhood chain, and hookr-sdk, whose CORE_STRUCTS are the pool structs a market and a launch are built from.
The tokenizer's address is 0x08de138e558a9258c6b4077e8bdeb9ad1fb46a4b and the core's is 0x342baa22e202954593b04b7ed1663621e0565d46: paste both into client.ts. Every other address the walkthroughs use is read from it or named on Contracts.
client.ts
import { createPublicClient, http, parseAbi, type Address } from "viem";
import { robinhood } from "viem/chains";
export const client = createPublicClient({ chain: robinhood, transport: http() });
// Paste the tokenizer's address from the Contracts page.
export const TOKENIZER: Address = "0x…";
// Paste the core's address from the Contracts page: the Rules a revenue token's market binds.
export const RULES: Address = "0x…";
// The contracts' clock: Ethereum's block number, which is `block.number` inside a contract on Robinhood Chain.
export function parentBlock() {
return client.readContract({
address: robinhood.contracts.multicall3.address,
abi: parseAbi(["function getBlockNumber() view returns (uint256)"]),
functionName: "getBlockNumber",
});
}
// For good: the largest uint64, as a term or an unlock block.
export const FOREVER = 2n ** 64n - 1n;parentBlock() is the block number a family's term is counted in, Ethereum's; eth_blockNumber is the rollup's own and far higher. Two block numbers says which figures use which.
abis.ts
import { parseAbi, parseAbiParameters } from "viem";
import { CORE_STRUCTS } from "hookr-sdk"; // PoolKey, PoolConfig, RulesConfig, RecaptureConfig, Token, Member and the rest
// The launcher's LaunchParams, as a launch stream carries them: encodeAbiParameters(launchParamsAbi, [p]).
export const launchParamsAbi = parseAbiParameters([
...CORE_STRUCTS,
"struct DevBuy { uint8 member; uint128 quoteIn; uint128 minSubjectOut; uint32 lockBlocks; }",
"struct MemberKnobs { uint16 subjectWeightBps; uint16 dynamicFeeLiquidityDivisor; uint64 lockEndBlock; uint16 windowSeconds; uint16 resetSeconds; uint16 carryBps; uint24 moveTicks; uint8 snipeCurve; }",
"struct OpeningCheck { uint16 toleranceBps; PoolKey[] references; }",
"struct LaunchParams { Token token; address root; Member[] members; MemberKnobs[] knobs; bytes[] advisoryConfigs; DevBuy[] buys; uint16 maxRetainedBps; OpeningCheck opening; uint256 deadline; string tagline; string logoURI; }",
"LaunchParams p",
]);
export const tokenizerAbi = parseAbi([
...CORE_STRUCTS,
"struct TokenTerms { string name; string symbol; uint256 supply; uint32 streamSeconds; uint16 tipBps; address[] assets; address[] recipients; uint256[] amounts; bytes32 termsHash; address streamManager; bool openStreams; }",
"struct PositionPermit { bool forAll; uint256 tokenId; uint256 deadline; uint256 nonce; bytes signature; }",
"struct V3PositionPermit { uint256 tokenId; uint256 deadline; uint8 v; bytes32 r; bytes32 s; }",
"struct FeebSource { address vault; uint256 tokenId; }",
"struct RevenueTokenShares { address token; uint256 amount; }",
"struct StreamParams { bytes launchParams; bytes32[] families; address[] rules; FeebSource[] feebs; uint256[] positionIds; PositionPermit[] positionPermits; uint256[] v3PositionIds; V3PositionPermit[] v3Permits; RevenueTokenShares[] revenueTokens; address[] sources; uint64 unlockBlock; uint64 unlockAt; bool listAssets; }",
"struct MarketTerms { bool open; address quote; uint256 seed; int24 tickSpacing; uint160 sqrtPriceX96; int24 tickLower; int24 tickUpper; uint128 liquidity; PoolConfig config; RulesConfig rules; RecaptureConfig recapture; uint16 bridgeBps; uint128 bridgeMaxPerDrip; uint32 bridgeMinBlocks; uint16 bridgeTipBps; uint16 bridgeMaxJumpBps; }",
"struct Tokenization { address creator; address forwarder; bytes32 marketFamilyId; uint64 createdAt; }",
"struct StreamRecord { uint8 kind; address door; bytes32 id; uint16 legBps; uint64 addedAt; uint8 endKind; uint64 end; uint32 family; }",
"function launcher() view returns (address)",
"function root() view returns (address)",
"function registry() view returns (address)",
"function isAdmittedRules(address rules) view returns (bool)",
"function collector() view returns (address)",
"function positionManager() view returns (address)",
"function positionDoorFactory() view returns (address)",
"function positionManagerV3() view returns (address)",
"function v3PositionDoorFactory() view returns (address)",
"function feebAdapterFactory() view returns (address)",
"function revenueTokenDoorFactory() view returns (address)",
"function ponsAdapterFactory() view returns (address)",
"function dopplerAdapterFactory() view returns (address)",
"function admittedVaults() view returns (address[])",
"function tokenCount() view returns (uint256)",
"function tokenAt(uint256 i) view returns (address)",
"function tokens(uint256 start, uint256 count) view returns (address[])",
"function tokenizations(address token) view returns (Tokenization)",
"function streamCount(address token) view returns (uint256)",
"function streams(address token, uint256 start, uint256 count) view returns (StreamRecord[])",
"function HOOKR_LEG_BPS_OUTSIDE() view returns (uint16)",
"function HOOKR_LEG_BPS_HOOKR() view returns (uint16)",
"function MIN_TERM_BLOCKS() view returns (uint64)",
"function MIN_TERM_SECONDS() view returns (uint64)",
"function predictToken(address creator, TokenTerms t) view returns (address)",
"function defaultMarket(address rules, address token, address quote, uint160 sqrtPriceX96, uint256 seed) view returns (MarketTerms)",
"function previewPositions(address token, uint256[] tokenIds) view returns (bool[] hookrPool, bool[] hookCanBlockCollection, bool[] holdsToken, address[] currencies)",
"function tokenize(TokenTerms t, StreamParams s, MarketTerms m) payable returns (address token)",
"function addStreams(address token, StreamParams s) payable returns (uint256 first)",
"event Tokenized(address indexed token, address indexed creator, uint256 supply, address streamManager, bool openStreams)",
"event StreamAdded(address indexed token, uint256 index, uint8 kind, address indexed door, bytes32 id, uint16 legBps, uint8 endKind, uint64 end, address by)",
"event MarketOpened(address indexed token, bytes32 indexed familyId, bytes32 indexed poolId, uint256 seed, address bridge, uint16 bridgeBps)",
// The tokenizer's own refusals, so a simulation names them with their figures.
"error InvalidConfig()", "error InvalidTerms()", "error TermTooShort(uint64 given, uint64 minimum)", "error InvalidMarket()",
"error RulesNotAdmitted(address rules)", "error VaultNotAdmitted(address vault)", "error MintMismatch(uint256 sum, uint256 expected)",
"error InvalidFunding()", "error Reentered()", "error DoorMismatch(address door)", "error AdvisoryRecipientMismatch(address advisory)",
"error NothingToAdd()", "error UnknownToken(address token)", "error NotStreamManager(address caller)", "error FamilyNotHanded(bytes32 family)",
"error InvalidInnerToken(address token)", "error InvalidSource(address source)", "error SourceNotBound(address source)",
"error SourceRevocationPending(address source, uint64 effectiveAt)", "error LaunchSaltNotCaller(bytes32 salt)", "error SubjectTaken(address subject)",
"error FamilyOffRoot(bytes32 family)", "error TermsHashUsed(address creator, bytes32 termsHash)", "error V3PairIsRevenueToken(uint256 tokenId)",
]);
export const tokenAbi = parseAbi([
"struct Asset { address currency; uint256 index; uint256 carry; uint128 received; uint128 paid; uint128 pendingStream; uint64 streamEnd; uint64 lastRelease; }",
"struct Door { uint8 kind; address target; uint32 gas; uint16 legBps; }",
"function name() view returns (string)",
"function symbol() view returns (string)",
"function decimals() view returns (uint8)",
"function totalSupply() view returns (uint256)",
"function balanceOf(address account) view returns (uint256)",
"function earns(address account) view returns (bool)",
"function earningSupply() view returns (uint256)",
"function streamSeconds() view returns (uint32)",
"function tipBps() view returns (uint16)",
"function bridge() view returns (address)",
"function bridgeBps() view returns (uint16)",
"function streamManager() view returns (address)",
"function openStreams() view returns (bool)",
"function assetCount() view returns (uint256)",
"function assetAt(uint256 asset) view returns (Asset)",
"function releasable(uint256 asset) view returns (uint256)",
"function claimable(address account, uint256 asset) view returns (uint256)",
"function claim(uint256 asset, address to) returns (uint256 amount)",
"function claimAll(address to) returns (uint256[] amounts)",
"function claimWithSig(address holder, uint256 asset, address to, bytes32 nonce, uint256 deadline, bytes signature) returns (uint256 amount)",
"function claimAllWithSig(address holder, address to, bytes32 nonce, uint256 deadline, bytes signature) returns (uint256[] amounts)",
"function doorCount() view returns (uint256)",
"function doorAt(uint256 door) view returns (Door)",
"function doors(uint256 start, uint256 count) view returns (Door[])",
"function sync() returns (uint256 tip)",
"function syncRange(uint256 start, uint256 count) returns (uint256 tip)",
"function syncSome(uint256[] doorIds) returns (uint256 tip)",
"function dropBox() view returns (address)",
"event Synced(address indexed by, uint256 pulledEth, uint256 tip, uint256 bridged)",
"event ClaimSkipped(address indexed holder, uint256 indexed asset, address indexed to)",
"error InvalidConfig()", "error InvalidAsset(address currency)", "error UnknownAsset(uint256 asset)", "error TooManyAssets()", "error InvalidDoor(uint256 door)",
"error InvalidTarget(address target)", "error InvalidRecipient(address to)", "error InvalidAmount(uint256 amount)", "error NothingToClaim()", "error NotLive()",
"error AlreadyLive()", "error Unauthorized(address caller)", "error SyncStarved(uint256 door, uint256 needed)", "error PoolManagerUnlocked()",
"error InexactTransfer()", "error NativeNotAccepted()", "error ClaimStarved(uint256 asset)", "error InvalidSigner()", "error SignatureExpired(uint256 deadline)",
"error AuthorizationNotYetValid(uint256 validAfter)", "error NonceAlreadyUsed(bytes32 nonce)", "error CallerIsNotPayee(address to)",
]);
export const dropBoxAbi = parseAbi([
"struct Drop { address asset; uint48 snapshotBlock; uint256 amount; uint256 earningSupply; uint256 paid; }",
"function dropCount() view returns (uint256)",
"function dropAt(uint256 dropId) view returns (Drop)",
"function claimable(uint256 dropId, address holder) view returns (uint256)",
"function claim(uint256[] dropIds, address to) returns (uint256[] amounts)",
"function claimWithSig(address holder, uint256[] dropIds, address to, bytes32 nonce, uint256 deadline, bytes signature) returns (uint256[] amounts)",
"error RefusedAsset(address asset)", "error InexactValue(uint256 expected, uint256 sent)", "error NativeNotAccepted()", "error NothingReceived()",
"error NoEarningSupply(uint48 snapshotBlock)", "error UnknownDrop(uint256 dropId)", "error AlreadyClaimed(uint256 dropId)",
"error NothingToClaim(uint256 dropId)", "error InvalidRecipient(address to)", "error PaymentFailed(address to)", "error InvalidSigner()",
"error SignatureExpired(uint256 deadline)", "error NonceAlreadyUsed(bytes32 nonce)", "error Unauthorized(address caller)",
]);
// The contracts around the tokenizer that the walkthroughs call.
export const launchFeeAbi = parseAbi(["function launchFee() view returns (uint256 fee, address treasury, uint256 pendingFee, address pendingTreasury, uint256 readyAt)"]);
export const feeNftVaultAbi = parseAbi([
"function ownerOf(uint256 tokenId) view returns (address)",
"function getApproved(uint256 tokenId) view returns (address)",
"function approve(address to, uint256 tokenId)",
]);
export const positionManagerAbi = parseAbi([
"function ownerOf(uint256 tokenId) view returns (address)",
"function isApprovedForAll(address owner, address operator) view returns (bool)",
"function setApprovalForAll(address operator, bool approved)",
]);
export const ponsDoorFactoryAbi = parseAbi([
"function launchFactory() view returns (address)",
"function create(address revenueToken, address memecoin) returns (address adapter)",
]);
export const ponsLaunchFactoryAbi = parseAbi(["function transferCreatorFeeRecipient(address token, address newRecipient)"]);These are the calls, events and errors as the deployed contracts declare them, with their argument names, types and order. Each contract's full ABI is on Sourcify.
Running them
- The walkthroughs simulate their mints, claims and syncs with
simulateContractbefore sending them. A call the tokenizer, a token or a drop box would refuse comes back as the errorabis.tsnames, with its figures, before anything is spent; a refusal from another contract the call reaches, such as a vault, comes back as its selector. - The walkthroughs sign with a key from the environment. In an app, use the connected wallet's client instead; the calls are the same.
- A walkthrough that names an address with
"0x…"is waiting for one of yours.