Apache-2.0 licensed contracts for ipns.
src/IPNSRegistry.sol: main registry contract (names, renewals, pricing, subnames)src/oz/*: minimal vendored utility contracts (Ownable/ReentrancyGuard/EIP712/ECDSA)- Note: in production you likely swap these for full OpenZeppelin once networked dependency install is available.
- v1 ships parent-controlled subnames.
- Example: owner of
alicecan setblog.alicewithout delegating ownership. - Implemented as
_subnames[parentKey][labelKey].
- Example: owner of
- Storage includes
SubRecord.ownerbut it is unused in v1.- Reserved for delegated subname ownership later (v2) without migrating storage.
- Resolution behavior:
resolveSub(parent, label)returns the subname CID if set.- If no subname CID is set, it falls back to the parent CID.
- Planned v2 extension (not implemented yet):
setSubOwner(parent, label, to)(parent assigns).setSubCIDallows either parent owner (if subOwner unset) or delegatedsubOwner(if set).
From /Users/guy3/Documents/guy3/ipns-contracts:
Note: in this Codex sandbox, Foundry can’t write to ~/.foundry, so set XDG_CACHE_HOME to a project-local directory:
export XDG_CACHE_HOME="/Users/guy3/Documents/guy3/ipns-contracts/.xdg-cache"- Build:
forge build- Run tests:
forge test -vv- Start a local chain (optional):
anvil- Deploy locally (after adding a deploy script):
forge script script/Deploy.s.sol:Deploy --rpc-url http://127.0.0.1:8545 --broadcastscript/Deploy.s.sol requires:
INITIAL_OWNER(recommended: multisig/safe)TREASURY(recommended: multisig/safe)START_PAUSED(optional, defaults to1)1= deploy paused (recommended for first mainnet launch)0= deploy unpaused
pause()/unpause()areonlyOwner.- While paused, user write paths are blocked:
registerrenewsetCIDsetSubCIDclearSubCIDsetDisplayNametransfer
- Read paths remain available:
resolveresolveSubisAvailablegetPricegetRecord