Skip to content

Contract events

Listen for launch, collection, listing, sale, and withdrawal events.

Events connect contract transactions to Spawn's discovery index. Integrations can query historical logs or subscribe to new logs through a compatible provider.

Launchpad events

ContractEventUse
Spawn factoryERC20TokenCreatedDiscover a launched token address
Spawn factoryTokenFeeRecipientSetRecord the LP fee recipient
Spawn factoryTokenReferrerSetRecord the permanent token referrer
Spawn factoryReferralFeePaidRecord an LP referral payout by asset
Spawn factoryCreateTokenSwitchedTrack launch availability
Spawn factoryInitialBuyAmountUpdatedRefresh launch minimums
Spawn routerBuyRecord routed token buys
Spawn routerSellRecord routed token sells
Spawn routerReferralFeePaidRecord a router referral payout

Uniswap pool swap events provide the full market activity stream, including swaps that bypass the Spawn router.

NFT events

ContractEventUse
Collection factoryCollectionCreatedDiscover collection identity and creator
Spawn collectionTokenMintedDiscover token ID, recipient, and URI
Spawn collectionContractURIUpdatedRefresh collection metadata
Spawn collectionDefaultRoyaltyUpdatedTrack collection royalty settings
MarketplaceListingCreatedAdd an active fixed-price listing
MarketplaceListingUpdatedReplace price and expiry
MarketplaceListingCancelledRemove a seller's listing
MarketplaceListingInvalidatedRemove stale listing state
MarketplaceListingPurchasedRecord sale settlement and ownership change
MarketplaceProceedsWithdrawnRecord a claimed pending balance

Standard ERC-721 Transfer events remain the source for ownership changes, including transfers outside the marketplace.

Query historical purchases

import { Contract } from "ethers";
import { addresses, provider } from "./spawn";

const marketplace = new Contract(addresses.nftMarketplace, [
  "event ListingPurchased(address indexed collection,uint256 indexed tokenId,address indexed seller,address buyer,uint256 price,uint256 platformFee,address royaltyReceiver,uint256 royaltyAmount)",
], provider);

const filter = marketplace.filters.ListingPurchased(collectionAddress);
const events = await marketplace.queryFilter(filter, 8_923_296, "latest");

for (const event of events) {
  console.log(event.transactionHash, event.args);
}

Use bounded block ranges for production queries. Public RPC endpoints may limit result size or request duration.

Subscribe to new listings

const market = new Contract(addresses.nftMarketplace, [
  "event ListingCreated(address indexed collection,uint256 indexed tokenId,address indexed seller,uint256 price,uint64 expiresAt)",
], provider);

market.on("ListingCreated", (collection, tokenId, seller, price, expiresAt, event) => {
  console.log({ collection, tokenId, seller, price, expiresAt, event });
});

// Call when the subscription is no longer needed.
await market.removeAllListeners("ListingCreated");