(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6219],{42002:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/world/reference/internal/init-module",function(){return s(19503)}])},73307:function(e,t,s){"use strict";s.d(t,{Z:function(){return i}});var n=s(7505),r=s(11689);let l={logo:function(){return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.25em",fontSize:"32px",fontFamily:"PP Supply Mono",textTransform:"uppercase"},children:[(0,n.jsx)("img",{src:"/images/logos/mud-white.svg",style:{height:"calc(var(--nextra-navbar-height) - 35px)"},alt:"MUD logo"}),"MUD"]})},useNextSeoProps(){let{asPath:e}=(0,r.useRouter)();return{titleTemplate:"/"===e?"MUD – a framework for ambitious Ethereum applications":"%s – MUD"}},project:{link:"https://github.com/latticexyz/mud"},docsRepositoryBase:"https://github.com/latticexyz/mud/tree/main/docs",head:(0,n.jsx)(n.Fragment,{children:(0,n.jsx)("meta",{property:"title",content:"MUD documentation"})}),darkMode:!1,nextThemes:{defaultTheme:"dark"},footer:{text:"MIT 2023 \xa9 MUD"},primaryHue:28,sidebar:{defaultMenuCollapseLevel:1}};var i=l},19503:function(e,t,s){"use strict";s.r(t);var n=s(7505),r=s(42585),l=s(38288),i=s(73307);s(54693);var a=s(26736);s(98823);let o={MDXContent:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:t}=Object.assign({},(0,a.ah)(),e.components);return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(d,{...e})}):d(e)},pageOpts:{filePath:"pages/world/reference/internal/init-module.mdx",route:"/world/reference/internal/init-module",headings:[{depth:2,value:"InitModule",id:"initmodule"},{depth:3,value:"State Variables",id:"state-variables"},{depth:4,value:"accessManagementSystem",id:"accessmanagementsystem"},{depth:4,value:"balanceTransferSystem",id:"balancetransfersystem"},{depth:4,value:"batchCallSystem",id:"batchcallsystem"},{depth:4,value:"registrationSystem",id:"registrationsystem"},{depth:3,value:"Functions",id:"functions"},{depth:4,value:"constructor",id:"constructor"},{depth:4,value:"installRoot",id:"installroot"},{depth:4,value:"install",id:"install"},{depth:4,value:"_registerTables",id:"_registertables"},{depth:4,value:"_registerSystems",id:"_registersystems"},{depth:4,value:"_registerSystem",id:"_registersystem"},{depth:4,value:"_registerFunctionSelectors",id:"_registerfunctionselectors"},{depth:4,value:"_registerRootFunctionSelector",id:"_registerrootfunctionselector"},{depth:2,value:"constants.sol",id:"constantssol"},{depth:4,value:"ACCESS_MANAGEMENT_SYSTEM_ID",id:"access_management_system_id"},{depth:4,value:"BALANCE_TRANSFER_SYSTEM_ID",id:"balance_transfer_system_id"},{depth:4,value:"BATCH_CALL_SYSTEM_ID",id:"batch_call_system_id"},{depth:4,value:"REGISTRATION_SYSTEM_ID",id:"registration_system_id"},{depth:2,value:"RegistrationSystem",id:"registrationsystem-1"},{depth:2,value:"LimitedCallContext",id:"limitedcallcontext"},{depth:3,value:"State Variables",id:"state-variables-1"},{depth:4,value:"__self",id:"__self"},{depth:3,value:"Functions",id:"functions-1"},{depth:4,value:"onlyDelegatecall",id:"onlydelegatecall"},{depth:4,value:"_checkDelegatecall",id:"_checkdelegatecall"},{depth:3,value:"Errors",id:"errors"},{depth:4,value:"UnauthorizedCallContext",id:"unauthorizedcallcontext"},{depth:2,value:"SystemCallData",id:"systemcalldata"},{depth:2,value:"SystemCallFromData",id:"systemcallfromdata"}],pageMap:[{kind:"Meta",data:{introduction:{title:"What is MUD?",theme:{breadcrumb:!1}},quickstart:{title:"Get started",theme:{breadcrumb:!1}},protocol:{title:"Protocol",type:"separator"},store:"Store",world:"World",framework:{title:"Framework",type:"separator"},config:"Config",cli:"CLI","state-query":"State Query",indexer:"Indexer","world-explorer":{title:"World Explorer",theme:{breadcrumb:!1}},"---":{title:"",type:"separator"},guides:"Guides",templates:"Templates","best-practices":"Best Practices",contribute:{title:"Contribute",theme:{breadcrumb:!1}},changelog:"Changelog",retrospectives:"Retrospectives",audits:"Audits",version:{title:"2.2.10",type:"menu",items:{changelog:{title:"Changelog",href:"/changelog"},contribute:{title:"Contribute",href:"/contribute"}}},community:{title:"Community",type:"page",href:"https://community.mud.dev",newWindow:!0},twitter:{title:"Twitter",type:"page",href:"https://twitter.com/latticexyz",newWindow:!0},discord:{title:"Discord",type:"page",href:"https://lattice.xyz/discord",newWindow:!0}}},{kind:"Folder",name:"audits",route:"/audits",children:[{kind:"MdxPage",name:"2024-02-11-open-zeppelin",route:"/audits/2024-02-11-open-zeppelin"},{kind:"Meta",data:{"2024-02-11-open-zeppelin":"2024-02-11 OpenZeppelin",pdf:{display:"hidden"},icons:{display:"hidden"}}}]},{kind:"Folder",name:"best-practices",route:"/best-practices",children:[{kind:"Meta",data:{"dividing-into-systems":"Dividing Code into Systems",system:"System Best Practices","deployment-settings":"Recommended Deployment Settings","aws-kms":"Deploy production worlds using AWS KMS"}},{kind:"MdxPage",name:"aws-kms",route:"/best-practices/aws-kms"},{kind:"MdxPage",name:"deployment-settings",route:"/best-practices/deployment-settings"},{kind:"MdxPage",name:"dividing-into-systems",route:"/best-practices/dividing-into-systems"},{kind:"MdxPage",name:"system",route:"/best-practices/system"}]},{kind:"MdxPage",name:"changelog",route:"/changelog"},{kind:"Folder",name:"cli",route:"/cli",children:[{kind:"Meta",data:{tablegen:"mud tablegen",worldgen:"mud worldgen",test:"mud test",deploy:"mud deploy",verify:"mud verify","dev-contracts":"mud dev-contracts","abi-ts":"mud abi-ts","set-version":"mud set-version"}},{kind:"MdxPage",name:"abi-ts",route:"/cli/abi-ts"},{kind:"MdxPage",name:"deploy",route:"/cli/deploy"},{kind:"MdxPage",name:"dev-contracts",route:"/cli/dev-contracts"},{kind:"MdxPage",name:"set-version",route:"/cli/set-version"},{kind:"MdxPage",name:"tablegen",route:"/cli/tablegen"},{kind:"MdxPage",name:"test",route:"/cli/test"},{kind:"MdxPage",name:"verify",route:"/cli/verify"},{kind:"MdxPage",name:"worldgen",route:"/cli/worldgen"}]},{kind:"Folder",name:"config",route:"/config",children:[{kind:"MdxPage",name:"reference",route:"/config/reference"},{kind:"Meta",data:{reference:"Reference"}}]},{kind:"MdxPage",name:"config",route:"/config"},{kind:"MdxPage",name:"contribute",route:"/contribute"},{kind:"Folder",name:"guides",route:"/guides",children:[{kind:"Meta",data:{"hello-world":"Hello World","extending-a-world":"Extending a World","adding-delegation":"Adding Delegation",modules:"Writing MUD Modules",emojimon:"Emojimon",testing:"Testing","replicating-onchain-state":"Replicating onchain state"}},{kind:"MdxPage",name:"adding-delegation",route:"/guides/adding-delegation"},{kind:"Folder",name:"emojimon",route:"/guides/emojimon",children:[{kind:"MdxPage",name:"1-preface-the-ecs-model",route:"/guides/emojimon/1-preface-the-ecs-model"},{kind:"MdxPage",name:"2-getting-started",route:"/guides/emojimon/2-getting-started"},{kind:"MdxPage",name:"3-players-and-movement",route:"/guides/emojimon/3-players-and-movement"},{kind:"MdxPage",name:"4-map-and-terrain",route:"/guides/emojimon/4-map-and-terrain"},{kind:"MdxPage",name:"5-a-wild-emojimon-appears",route:"/guides/emojimon/5-a-wild-emojimon-appears"},{kind:"MdxPage",name:"6-advanced",route:"/guides/emojimon/6-advanced"},{kind:"Meta",data:{"1-preface-the-ecs-model":"Preface: the ECS model","2-getting-started":"Getting started","3-players-and-movement":"Players and movement","4-map-and-terrain":"Map and terrain","5-a-wild-emojimon-appears":"A wild Emojimon appears","6-advanced":"Advanced features"}}]},{kind:"MdxPage",name:"emojimon",route:"/guides/emojimon"},{kind:"Folder",name:"extending-a-world",route:"/guides/extending-a-world",children:[{kind:"Meta",data:{index:"Extending a World Permissionlessly"}},{kind:"MdxPage",name:"index",route:"/guides/extending-a-world"}]},{kind:"Folder",name:"hello-world",route:"/guides/hello-world",children:[{kind:"Meta",data:{"add-table":"Add a table","filter-sync":"Filter data synchronization","add-system":"Add a system",deploy:"Deploy to a blockchain","add-chain-client":"Add chains to the client"}},{kind:"MdxPage",name:"add-chain-client",route:"/guides/hello-world/add-chain-client"},{kind:"MdxPage",name:"add-system",route:"/guides/hello-world/add-system"},{kind:"MdxPage",name:"add-table",route:"/guides/hello-world/add-table"},{kind:"MdxPage",name:"deploy",route:"/guides/hello-world/deploy"},{kind:"MdxPage",name:"filter-sync",route:"/guides/hello-world/filter-sync"}]},{kind:"MdxPage",name:"hello-world",route:"/guides/hello-world"},{kind:"MdxPage",name:"modules",route:"/guides/modules"},{kind:"MdxPage",name:"replicating-onchain-state",route:"/guides/replicating-onchain-state"},{kind:"MdxPage",name:"testing",route:"/guides/testing"}]},{kind:"Folder",name:"indexer",route:"/indexer",children:[{kind:"Meta",data:{using:"Using the Indexer",sqlite:"SQLite Indexer","postgres-event-only":"PostgreSQL for events","postgres-decoded":"PostgreSQL for data (and events)",sql:"SQL API (Experimental)"}},{kind:"MdxPage",name:"postgres-decoded",route:"/indexer/postgres-decoded"},{kind:"MdxPage",name:"postgres-event-only",route:"/indexer/postgres-event-only"},{kind:"MdxPage",name:"sql",route:"/indexer/sql"},{kind:"MdxPage",name:"sqlite",route:"/indexer/sqlite"},{kind:"MdxPage",name:"using",route:"/indexer/using"}]},{kind:"MdxPage",name:"indexer",route:"/indexer"},{kind:"MdxPage",name:"introduction",route:"/introduction"},{kind:"MdxPage",name:"quickstart",route:"/quickstart"},{kind:"Folder",name:"retrospectives",route:"/retrospectives",children:[{kind:"MdxPage",name:"2023-09-12-register-system-vulnerability",route:"/retrospectives/2023-09-12-register-system-vulnerability"},{kind:"MdxPage",name:"2024-04-17-storeread-getdynamicfieldlength-bug",route:"/retrospectives/2024-04-17-storeread-getdynamicfieldlength-bug"},{kind:"Meta",data:{"2024-04-17-storeread-getdynamicfieldlength-bug":"2024-04-17 StoreRead.getDynamicFieldLength bug","2023-09-12-register-system-vulnerability":"2023-09-12 registerSystem vulnerability"}}]},{kind:"Folder",name:"state-query",route:"/state-query",children:[{kind:"Meta",data:{typescript:"TypeScript"}},{kind:"Folder",name:"typescript",route:"/state-query/typescript",children:[{kind:"Meta",data:{recs:"RECS",zustand:"Zustand"}},{kind:"MdxPage",name:"recs",route:"/state-query/typescript/recs"},{kind:"MdxPage",name:"zustand",route:"/state-query/typescript/zustand"}]}]},{kind:"Folder",name:"store",route:"/store",children:[{kind:"Meta",data:{introduction:"Introduction","data-model":"Data model",tables:"Tables","table-libraries":"Table libraries",encoding:"Encoding","store-hooks":"Store hooks",reference:"Reference"}},{kind:"MdxPage",name:"data-model",route:"/store/data-model"},{kind:"MdxPage",name:"encoding",route:"/store/encoding"},{kind:"MdxPage",name:"introduction",route:"/store/introduction"},{kind:"Folder",name:"reference",route:"/store/reference",children:[{kind:"Meta",data:{"store-core":"StoreCore (internal)",store:"IStore (external)","store-hook":"StoreHook",misc:"Miscellaneous"}},{kind:"MdxPage",name:"misc",route:"/store/reference/misc"},{kind:"MdxPage",name:"store-core",route:"/store/reference/store-core"},{kind:"MdxPage",name:"store-hook",route:"/store/reference/store-hook"},{kind:"MdxPage",name:"store",route:"/store/reference/store"}]},{kind:"MdxPage",name:"store-hooks",route:"/store/store-hooks"},{kind:"MdxPage",name:"table-libraries",route:"/store/table-libraries"},{kind:"MdxPage",name:"tables",route:"/store/tables"}]},{kind:"Folder",name:"templates",route:"/templates",children:[{kind:"Meta",data:{typescript:"TypeScript",godot:"Godot",pwa:"Progressive Web App (for mobile)",swift:"Swift",svelte:"Svelte",unity:"Unity",nethereum:"Nethereum"}},{kind:"MdxPage",name:"godot",route:"/templates/godot"},{kind:"MdxPage",name:"nethereum",route:"/templates/nethereum"},{kind:"MdxPage",name:"pwa",route:"/templates/pwa"},{kind:"MdxPage",name:"svelte",route:"/templates/svelte"},{kind:"MdxPage",name:"swift",route:"/templates/swift"},{kind:"Folder",name:"typescript",route:"/templates/typescript",children:[{kind:"Meta",data:{contracts:"Contracts",vanilla:"Vanilla","react-ecs":"React-ECS",threejs:"Three.js",vue:"Vue"}},{kind:"MdxPage",name:"contracts",route:"/templates/typescript/contracts"},{kind:"MdxPage",name:"react-ecs",route:"/templates/typescript/react-ecs"},{kind:"MdxPage",name:"threejs",route:"/templates/typescript/threejs"},{kind:"MdxPage",name:"vanilla",route:"/templates/typescript/vanilla"},{kind:"MdxPage",name:"vue",route:"/templates/typescript/vue"}]},{kind:"MdxPage",name:"unity",route:"/templates/unity"}]},{kind:"MdxPage",name:"templates",route:"/templates"},{kind:"Folder",name:"world",route:"/world",children:[{kind:"Meta",data:{introduction:"Introduction","resource-ids":"Resource Identifiers","namespaces-access-control":"Namespaces & Access Control",tables:"Tables",systems:"Systems","system-hooks":"System Hooks","function-selectors":"Function Selectors",balance:"Balance","account-delegation":"Account Delegation","batch-calls":"Batch Calls",upgrades:"Upgrading",modules:"Modules",reference:"Reference"}},{kind:"MdxPage",name:"account-delegation",route:"/world/account-delegation"},{kind:"MdxPage",name:"balance",route:"/world/balance"},{kind:"MdxPage",name:"batch-calls",route:"/world/batch-calls"},{kind:"MdxPage",name:"function-selectors",route:"/world/function-selectors"},{kind:"MdxPage",name:"introduction",route:"/world/introduction"},{kind:"Folder",name:"modules",route:"/world/modules",children:[{kind:"Meta",data:{keyswithvalue:"Keys with Value",keysintable:"Keys in Table",erc20:"ERC-20 tokens",erc721:"ERC-721 (NFT)"}},{kind:"MdxPage",name:"erc20",route:"/world/modules/erc20"},{kind:"MdxPage",name:"erc721",route:"/world/modules/erc721"},{kind:"MdxPage",name:"keysintable",route:"/world/modules/keysintable"},{kind:"MdxPage",name:"keyswithvalue",route:"/world/modules/keyswithvalue"}]},{kind:"MdxPage",name:"modules",route:"/world/modules"},{kind:"MdxPage",name:"namespaces-access-control",route:"/world/namespaces-access-control"},{kind:"Folder",name:"reference",route:"/world/reference",children:[{kind:"Meta",data:{"delegation-external":"Delegation (interface)",module:"Modules","module-external":"Modules (interface)",system:"Systems","system-external":"Systems (interface)",world:"World","world-external":"World (interfaces)","world-context":"World context","world-context-external":"World context (interface)","resource-ids":"Resource IDs",misc:"Miscellaneous",internal:"Internals"}},{kind:"MdxPage",name:"delegation-external",route:"/world/reference/delegation-external"},{kind:"Folder",name:"internal",route:"/world/reference/internal",children:[{kind:"Meta",data:{"access-control":"Access Control",create:"Create2",delegation:"Delegation",erc165:"ERC165","erc165-external":"ERC165 (interface)","init-module":"Init Module","init-module-implementation":"Init Module Implementation",systemcall:"SystemCall"}},{kind:"MdxPage",name:"access-control",route:"/world/reference/internal/access-control"},{kind:"MdxPage",name:"create",route:"/world/reference/internal/create"},{kind:"MdxPage",name:"delegation",route:"/world/reference/internal/delegation"},{kind:"MdxPage",name:"erc165-external",route:"/world/reference/internal/erc165-external"},{kind:"MdxPage",name:"erc165",route:"/world/reference/internal/erc165"},{kind:"MdxPage",name:"init-module-implementation",route:"/world/reference/internal/init-module-implementation"},{kind:"MdxPage",name:"init-module",route:"/world/reference/internal/init-module"},{kind:"MdxPage",name:"systemcall",route:"/world/reference/internal/systemcall"}]},{kind:"MdxPage",name:"misc",route:"/world/reference/misc"},{kind:"MdxPage",name:"module-external",route:"/world/reference/module-external"},{kind:"MdxPage",name:"module",route:"/world/reference/module"},{kind:"MdxPage",name:"resource-ids",route:"/world/reference/resource-ids"},{kind:"MdxPage",name:"system-external",route:"/world/reference/system-external"},{kind:"MdxPage",name:"system",route:"/world/reference/system"},{kind:"MdxPage",name:"world-context-external",route:"/world/reference/world-context-external"},{kind:"MdxPage",name:"world-context",route:"/world/reference/world-context"},{kind:"MdxPage",name:"world-external",route:"/world/reference/world-external"},{kind:"MdxPage",name:"world",route:"/world/reference/world"}]},{kind:"MdxPage",name:"resource-ids",route:"/world/resource-ids"},{kind:"MdxPage",name:"system-hooks",route:"/world/system-hooks"},{kind:"MdxPage",name:"systems",route:"/world/systems"},{kind:"MdxPage",name:"tables",route:"/world/tables"},{kind:"MdxPage",name:"upgrades",route:"/world/upgrades"}]},{kind:"MdxPage",name:"world-explorer",route:"/world-explorer"}],flexsearch:{codeblocks:!0},title:"Init Module"},pageNextRoute:"/world/reference/internal/init-module",nextraLayout:l.ZP,themeConfig:i.Z};function d(e){let t=Object.assign({h2:"h2",p:"p",a:"a",strong:"strong",em:"em",code:"code",h3:"h3",h4:"h4",pre:"pre",span:"span"},(0,a.ah)(),e.components);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(t.h2,{id:"initmodule",children:"InitModule"}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.a,{href:"https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/InitModule.sol",children:"Git Source"})}),"\n",(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.strong,{children:"Inherits:"}),"\n",(0,n.jsx)(t.a,{href:"/world/reference/module#module",children:"Module"})]}),"\n",(0,n.jsx)(t.p,{children:"Registers internal World tables, systems, and their function selectors."}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsxs)(t.em,{children:["This module only supports ",(0,n.jsx)(t.code,{children:"installRoot"})," because it installs root tables, systems and function selectors."]})}),"\n",(0,n.jsx)(t.h3,{id:"state-variables",children:"State Variables"}),"\n",(0,n.jsx)(t.h4,{id:"accessmanagementsystem",children:"accessManagementSystem"}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsx)(t.code,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"address"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"immutable"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" accessManagementSystem;"})]})})}),"\n",(0,n.jsx)(t.h4,{id:"balancetransfersystem",children:"balanceTransferSystem"}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsx)(t.code,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"address"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"immutable"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" balanceTransferSystem;"})]})})}),"\n",(0,n.jsx)(t.h4,{id:"batchcallsystem",children:"batchCallSystem"}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsx)(t.code,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"address"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"immutable"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" batchCallSystem;"})]})})}),"\n",(0,n.jsx)(t.h4,{id:"registrationsystem",children:"registrationSystem"}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsx)(t.code,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"address"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"immutable"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" registrationSystem;"})]})})}),"\n",(0,n.jsx)(t.h3,{id:"functions",children:"Functions"}),"\n",(0,n.jsx)(t.h4,{id:"constructor",children:"constructor"}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.code,{"data-language":"solidity","data-theme":"default",children:[(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"constructor"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"("})]}),"\n",(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"AccessManagementSystem"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-parameter)"},children:"_accessManagementSystem"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","})]}),"\n",(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"BalanceTransferSystem"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-parameter)"},children:"_balanceTransferSystem"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","})]}),"\n",(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"BatchCallSystem"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-parameter)"},children:"_batchCallSystem"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","})]}),"\n",(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"RegistrationSystem"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-parameter)"},children:"_registrationSystem"})]}),"\n",(0,n.jsx)(t.span,{className:"line",children:(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:");"})})]})}),"\n",(0,n.jsx)(t.h4,{id:"installroot",children:"installRoot"}),"\n",(0,n.jsx)(t.p,{children:"Root installation of the module."}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.em,{children:"Registers core tables, systems, and function selectors in the World."})}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsx)(t.code,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"installRoot"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:") "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"public"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"override"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]})})}),"\n",(0,n.jsx)(t.h4,{id:"install",children:"install"}),"\n",(0,n.jsx)(t.p,{children:"Non-root installation of the module."}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.em,{children:"Installation is only supported at root level, so this function will always revert."})}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsx)(t.code,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"install"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:") "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"public"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"pure"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]})})}),"\n",(0,n.jsx)(t.h4,{id:"_registertables",children:"_registerTables"}),"\n",(0,n.jsx)(t.p,{children:"Register World's tables."}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.em,{children:"This internal function registers various tables and sets initial permissions."})}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsx)(t.code,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"_registerTables"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"() "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]})})}),"\n",(0,n.jsx)(t.h4,{id:"_registersystems",children:"_registerSystems"}),"\n",(0,n.jsx)(t.p,{children:"Register the systems in the World."}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsx)(t.code,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"_registerSystems"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"() "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]})})}),"\n",(0,n.jsx)(t.h4,{id:"_registersystem",children:"_registerSystem"}),"\n",(0,n.jsx)(t.p,{children:"Register the internal system in the World."}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsxs)(t.em,{children:["Uses the WorldRegistrationSystem's ",(0,n.jsx)(t.code,{children:"registerSystem"})," implementation to register the system on the World."]})}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsx)(t.code,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"_registerSystem"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"address"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" target"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"ResourceId"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" systemId) "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]})})}),"\n",(0,n.jsx)(t.h4,{id:"_registerfunctionselectors",children:"_registerFunctionSelectors"}),"\n",(0,n.jsx)(t.p,{children:"Register function selectors for all core system functions in the World."}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.em,{children:"Iterates through known function signatures and registers them."})}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsx)(t.code,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"_registerFunctionSelectors"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"() "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]})})}),"\n",(0,n.jsx)(t.h4,{id:"_registerrootfunctionselector",children:"_registerRootFunctionSelector"}),"\n",(0,n.jsx)(t.p,{children:"Register the function selector in the World."}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsxs)(t.em,{children:["Uses the RegistrationSystem's ",(0,n.jsx)(t.code,{children:"registerRootFunctionSelector"})," to register the function selector."]})}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsx)(t.code,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"_registerRootFunctionSelector"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"ResourceId"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" systemId"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"string"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" functionSignature) "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]})})}),"\n",(0,n.jsx)(t.h2,{id:"constantssol",children:"constants.sol"}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.a,{href:"https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/constants.sol",children:"Git Source"})}),"\n",(0,n.jsx)(t.h4,{id:"access_management_system_id",children:"ACCESS_MANAGEMENT_SYSTEM_ID"}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.em,{children:"Resource ID for access management system."})}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.em,{children:"This ID is derived from the RESOURCE_SYSTEM type, the ROOT_NAMESPACE, and the system name."})}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.code,{"data-language":"solidity","data-theme":"default",children:[(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"ResourceId "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"constant"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" ACCESS_MANAGEMENT_SYSTEM_ID "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" ResourceId."}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"wrap"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"("})]}),"\n",(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"(abi."}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"encodePacked"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"(RESOURCE_SYSTEM"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" ROOT_NAMESPACE"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes16"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"AccessManagement"'}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:")))"})]}),"\n",(0,n.jsx)(t.span,{className:"line",children:(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:");"})})]})}),"\n",(0,n.jsx)(t.h4,{id:"balance_transfer_system_id",children:"BALANCE_TRANSFER_SYSTEM_ID"}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.em,{children:"Resource ID for balance transfer system."})}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.em,{children:"This ID is derived from the RESOURCE_SYSTEM type, the ROOT_NAMESPACE, and the system name."})}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.code,{"data-language":"solidity","data-theme":"default",children:[(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"ResourceId "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"constant"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" BALANCE_TRANSFER_SYSTEM_ID "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" ResourceId."}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"wrap"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"("})]}),"\n",(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"(abi."}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"encodePacked"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"(RESOURCE_SYSTEM"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" ROOT_NAMESPACE"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes16"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"BalanceTransfer"'}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:")))"})]}),"\n",(0,n.jsx)(t.span,{className:"line",children:(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:");"})})]})}),"\n",(0,n.jsx)(t.h4,{id:"batch_call_system_id",children:"BATCH_CALL_SYSTEM_ID"}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.em,{children:"Resource ID for batch call system."})}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.em,{children:"This ID is derived from the RESOURCE_SYSTEM type, the ROOT_NAMESPACE, and the system name."})}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.code,{"data-language":"solidity","data-theme":"default",children:[(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"ResourceId "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"constant"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" BATCH_CALL_SYSTEM_ID "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" ResourceId."}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"wrap"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"("})]}),"\n",(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"(abi."}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"encodePacked"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"(RESOURCE_SYSTEM"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" ROOT_NAMESPACE"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes16"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"BatchCall"'}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:")))"})]}),"\n",(0,n.jsx)(t.span,{className:"line",children:(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:");"})})]})}),"\n",(0,n.jsx)(t.h4,{id:"registration_system_id",children:"REGISTRATION_SYSTEM_ID"}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.em,{children:"Resource ID for core registration system."})}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.em,{children:"This ID is derived from the RESOURCE_SYSTEM type, the ROOT_NAMESPACE, and the system name."})}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.code,{"data-language":"solidity","data-theme":"default",children:[(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"ResourceId "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"constant"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" REGISTRATION_SYSTEM_ID "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" ResourceId."}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"wrap"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"("})]}),"\n",(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"(abi."}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"encodePacked"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"(RESOURCE_SYSTEM"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" ROOT_NAMESPACE"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes16"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"Registration"'}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:")))"})]}),"\n",(0,n.jsx)(t.span,{className:"line",children:(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:");"})})]})}),"\n",(0,n.jsx)(t.h2,{id:"registrationsystem-1",children:"RegistrationSystem"}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.a,{href:"https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/RegistrationSystem.sol",children:"Git Source"})}),"\n",(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.strong,{children:"Inherits:"}),"\n",(0,n.jsx)(t.a,{href:"/world/reference/world-external#iworlderrors",children:"IWorldErrors"}),", ",(0,n.jsx)(t.a,{href:"/world/reference/internal/init-module-implementation#moduleinstallationsystem",children:"ModuleInstallationSystem"}),", ",(0,n.jsx)(t.a,{href:"/world/reference/internal/init-module-implementation#storeregistrationsystem",children:"StoreRegistrationSystem"}),", ",(0,n.jsx)(t.a,{href:"/world/reference/internal/init-module-implementation#worldregistrationsystem",children:"WorldRegistrationSystem"})]}),"\n",(0,n.jsx)(t.p,{children:"This system aggregates World registration and installation functionalities externalized from the World contract, aiming to keep the World contract's bytecode lean."}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.em,{children:"Aggregates multiple system implementations for the World."})}),"\n",(0,n.jsx)(t.h2,{id:"limitedcallcontext",children:"LimitedCallContext"}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.a,{href:"https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/LimitedCallContext.sol",children:"Git Source"})}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsxs)(t.em,{children:["Systems are expected to be always called via the central World contract.\nDepending on whether it is a root or non-root system, the call is performed via ",(0,n.jsx)(t.code,{children:"delegatecall"})," or ",(0,n.jsx)(t.code,{children:"call"}),".\nSince Systems are expected to be stateless and only interact with the World state,\nit is normally not necessary to prevent direct calls to the systems.\nHowever, since the ",(0,n.jsx)(t.code,{children:"CoreSystem"})," is known to always be registered as a root system in the World,\nit is always expected to be delegatecalled, so we made this expectation explicit by reverting if it is not delegatecalled."]})}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsxs)(t.em,{children:["Based on OpenZeppelin's UUPSUpgradeable.sol\n",(0,n.jsx)(t.a,{href:"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/proxy/utils/UUPSUpgradeable.sol#L50",children:"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/proxy/utils/UUPSUpgradeable.sol#L50"})]})}),"\n",(0,n.jsx)(t.h3,{id:"state-variables-1",children:"State Variables"}),"\n",(0,n.jsx)(t.h4,{id:"__self",children:"__self"}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsx)(t.code,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"address"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"private"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"immutable"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" __self "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"address"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"this"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:");"})]})})}),"\n",(0,n.jsx)(t.h3,{id:"functions-1",children:"Functions"}),"\n",(0,n.jsx)(t.h4,{id:"onlydelegatecall",children:"onlyDelegatecall"}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsx)(t.code,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"modifier"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"onlyDelegatecall"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"();"})]})})}),"\n",(0,n.jsx)(t.h4,{id:"_checkdelegatecall",children:"_checkDelegatecall"}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.em,{children:"Reverts if the execution is not performed via delegatecall."})}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsx)(t.code,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"_checkDelegatecall"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"() "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"view"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"virtual"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]})})}),"\n",(0,n.jsx)(t.h3,{id:"errors",children:"Errors"}),"\n",(0,n.jsx)(t.h4,{id:"unauthorizedcallcontext",children:"UnauthorizedCallContext"}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsx)(t.code,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"error"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"UnauthorizedCallContext"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"();"})]})})}),"\n",(0,n.jsx)(t.h2,{id:"systemcalldata",children:"SystemCallData"}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.a,{href:"https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/types.sol",children:"Git Source"})}),"\n",(0,n.jsx)(t.p,{children:"Holds data for making system calls."}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.em,{children:"Used to represent a call to a specific system identified by a ResourceId."})}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.code,{"data-language":"solidity","data-theme":"default",children:[(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"struct"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"SystemCallData"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,n.jsx)(t.span,{className:"line",children:(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"  ResourceId systemId;"})}),"\n",(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" callData;"})]}),"\n",(0,n.jsx)(t.span,{className:"line",children:(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})}),"\n",(0,n.jsx)(t.h2,{id:"systemcallfromdata",children:"SystemCallFromData"}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.a,{href:"https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/init/types.sol",children:"Git Source"})}),"\n",(0,n.jsx)(t.p,{children:"Holds data for making system calls with a specific sender."}),"\n",(0,n.jsx)(t.p,{children:(0,n.jsx)(t.em,{children:"Used to represent a call from a specific address to a specific system."})}),"\n",(0,n.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,n.jsxs)(t.code,{"data-language":"solidity","data-theme":"default",children:[(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"struct"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"SystemCallFromData"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"address"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" from;"})]}),"\n",(0,n.jsx)(t.span,{className:"line",children:(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"  ResourceId systemId;"})}),"\n",(0,n.jsxs)(t.span,{className:"line",children:[(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes"}),(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" callData;"})]}),"\n",(0,n.jsx)(t.span,{className:"line",children:(0,n.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})})]})}t.default=(0,r.j)(o)}},function(e){e.O(0,[3720,2888,179],function(){return e(e.s=42002)}),_N_E=e.O()}]);