@0xslots/contracts
v1.1.0
Published
Contract ABIs and addresses for 0xSlots protocol
Readme
@0xslots/contracts
Contract ABIs and addresses for the 0xSlots protocol, generated by
wagmi generate from the Foundry build and the deployment records in
apps/contracts/deployments.
Installation
pnpm add @0xslots/contracts viemUsage
import { createPublicClient, http } from "viem";
import { anvil } from "viem/chains";
import { slotFactoryAbi, slotFactoryAddress } from "@0xslots/contracts";
const client = createPublicClient({ chain: anvil, transport: http() });
const factory = slotFactoryAddress[anvil.id]; // Address | undefined
if (factory) {
// The beacon implementation every slot proxy points at.
const implementation = await client.readContract({
address: factory,
abi: slotFactoryAbi,
functionName: "implementation",
});
}Everything is also exported from @0xslots/contracts/slots.
Exports
ABIs
| Export | Contract |
| --- | --- |
| slotAbi | An individual Slot |
| slotFactoryAbi | SlotFactory — deploys slots behind one beacon |
| offerBookAbi | OfferBook — standing bids and the fill |
| minimumTenureModuleAbi | MinimumTenureModule |
| adLandAbi | AdLand |
| slotCollectiveAbi, slotCollectiveFactoryAbi | SlotCollective — split + role-gated management — and its factory |
| slotBoundNftAbi, slotBoundNftFactoryAbi, slotBoundNftWrapperAbi | Slot-bound NFT collections, their factory, and the wrapper for existing ERC-721s |
Addresses
Per-chain maps, typed Partial<Record<number, Address>> — a contract is present
on exactly the chains that have a deployment record carrying a version:
slotFactoryAddress, offerBookAddress, minimumTenureModuleAddress,
adLandAddress, slotCollectiveFactoryAddress, slotImplementationAddress and
slotCollectiveImplementationAddress (the beacon implementations, not
individual slots). slotBoundNftFactoryAddress and slotBoundNftWrapperAddress
come straight from codegen, which only emits them when a record exists.
deployBlockOf(contract, chainId) returns the block a contract was deployed at —
the lower bound for any historical log query — or undefined where there is no
record.
Modules
knownModules[chainId] lists the modules a client can offer by name, and
findKnownModule(chainId, address) names one or returns undefined. Both are
derived from the deployment records, so a module appears on exactly the chains
it is deployed to.
Chains
import { CHAINS, DEFAULT_CHAIN, isDeployedOn } from "@0xslots/contracts";CHAINS is derived from slotFactoryAddress, sorted local, then testnets, then
mainnets. Anvil is filtered out unless NODE_ENV === "development" — bundlers
inline NODE_ENV, so a production build drops it at compile time. The address
maps themselves are unconditional.
Supported networks
The current protocol is not deployed on a public chain yet. pnpm dev:local
deploys it to anvil (31337), and pnpm codegen in this package picks those
records up. Use the exported values rather than copying an address.
License
MIT
