(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1662],{5946:function(e,s,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/templates/typescript/contracts",function(){return n(9700)}])},3307:function(e,s,n){"use strict";n.d(s,{Z:function(){return i}});var l=n(7505),r=n(1689);let o={logo:function(){return(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.25em",fontSize:"32px",fontFamily:"PP Supply Mono",textTransform:"uppercase"},children:[(0,l.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,l.jsx)(l.Fragment,{children:(0,l.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=o},9700:function(e,s,n){"use strict";n.r(s);var l=n(7505),r=n(2585),o=n(8288),i=n(3307);n(4693);var t=n(6736);n(8823);let a={MDXContent:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:s}=Object.assign({},(0,t.ah)(),e.components);return s?(0,l.jsx)(s,{...e,children:(0,l.jsx)(c,{...e})}):c(e)},pageOpts:{filePath:"pages/templates/typescript/contracts.mdx",route:"/templates/typescript/contracts",headings:[{depth:1,value:"Contracts (Vanilla and React-ECS)",id:"contracts-vanilla-and-react-ecs"},{depth:2,value:"Tables",id:"tables"},{depth:3,value:"The table schema",id:"the-table-schema"},{depth:4,value:"mud.config.ts",id:"mudconfigts"},{depth:2,value:"Systems",id:"systems"},{depth:4,value:"IncrementSystem.sol",id:"incrementsystemsol"}],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",services:"Services","---":{title:"",type:"separator"},guides:"Guides",templates:"Templates",contribute:{title:"Contribute",theme:{breadcrumb:!1}},changelog:"Changelog",retrospectives:"Retrospectives",audits:"Audits",version:{title:"2.0.9",type:"menu",items:{changelog:{title:"Changelog",href:"/changelog"},contribute:{title:"Contribute",href:"/contribute"}}},status:{title:"Status",type:"page",href:"https://status.mud.dev",newWindow:!0},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:"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",faucet:"mud faucet","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:"faucet",route:"/cli/faucet"},{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:"MdxPage",name:"config",route:"/config"},{kind:"MdxPage",name:"contribute",route:"/contribute"},{kind:"Folder",name:"guides",route:"/guides",children:[{kind:"Meta",data:{"replicating-onchain-state":"Replicating onchain state","hello-world":"Hello World","extending-a-world":"Extending a World","adding-delegation":"Adding Delegation",emojimon:"Emojimon","best-practices":"Best Practices"}},{kind:"MdxPage",name:"adding-delegation",route:"/guides/adding-delegation"},{kind:"Folder",name:"best-practices",route:"/guides/best-practices",children:[{kind:"Meta",data:{"system-best-practices":"System Best Practices"}},{kind:"MdxPage",name:"system-best-practices",route:"/guides/best-practices/system-best-practices"}]},{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:{title:"Deploy to a blockchain",href:"/cli/deploy"}}},{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:"filter-sync",route:"/guides/hello-world/filter-sync"}]},{kind:"MdxPage",name:"hello-world",route:"/guides/hello-world"},{kind:"MdxPage",name:"replicating-onchain-state",route:"/guides/replicating-onchain-state"}]},{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:"services",route:"/services",children:[{kind:"Meta",data:{indexer:"Indexer",faucet:"Faucet"}},{kind:"MdxPage",name:"faucet",route:"/services/faucet"},{kind:"MdxPage",name:"indexer",route:"/services/indexer"}]},{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"}},{kind:"MdxPage",name:"godot",route:"/templates/godot"},{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:"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"}},{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"}]}],flexsearch:{codeblocks:!0},title:"Contracts (Vanilla and React-ECS)"},pageNextRoute:"/templates/typescript/contracts",nextraLayout:o.ZP,themeConfig:i.Z};function c(e){let s=Object.assign({h1:"h1",p:"p",ul:"ul",li:"li",strong:"strong",h2:"h2",h3:"h3",h4:"h4",code:"code",a:"a",pre:"pre",span:"span",details:"details",summary:"summary",table:"table",thead:"thead",tr:"tr",th:"th",tbody:"tbody",td:"td",em:"em"},(0,t.ah)(),e.components);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(s.h1,{children:"Contracts (Vanilla and React-ECS)"}),"\n",(0,l.jsx)(s.p,{children:"This section explains the contracts for the vanilla and react-ecs templates.\nThe Three.JS and React templates use different contracts."}),"\n",(0,l.jsx)(s.p,{children:"The onchain components can be divided into two types of functionality:"}),"\n",(0,l.jsxs)(s.ul,{children:["\n",(0,l.jsxs)(s.li,{children:[(0,l.jsx)(s.strong,{children:"Tables"}),", storing the data of the application."]}),"\n",(0,l.jsxs)(s.li,{children:[(0,l.jsx)(s.strong,{children:"Systems"}),", business logic that can be called to read or modify data in the tables."]}),"\n"]}),"\n",(0,l.jsx)(s.h2,{id:"tables",children:"Tables"}),"\n",(0,l.jsx)(s.h3,{id:"the-table-schema",children:"The table schema"}),"\n",(0,l.jsx)(s.h4,{id:"mudconfigts",children:(0,l.jsx)(s.code,{children:"mud.config.ts"})}),"\n",(0,l.jsxs)(s.p,{children:["The table schema is declared in ",(0,l.jsx)(s.code,{children:"packages/contracts/mud.config.ts"}),".\n",(0,l.jsx)(s.a,{href:"/cli/config",children:"Read more details about the schema definition here"}),"."]}),"\n",(0,l.jsx)(s.p,{children:"The table schema provided in the example is extremely simple (one singleton)."}),"\n",(0,l.jsx)(s.pre,{"data-language":"ts","data-theme":"default",filename:"mud.config.ts",hasCopyCode:!0,children:(0,l.jsxs)(s.code,{"data-language":"ts","data-theme":"default",children:[(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" { mudConfig } "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"@latticexyz/world/register"'}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"export"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"default"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"mudConfig"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"({"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  tables"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    Counter"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"      keySchema"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {}"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"      valueSchema"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"uint32"'}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    }"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  }"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"});"})})]})}),"\n",(0,l.jsx)(s.p,{children:"There are two automatically generated files related to the tables:"}),"\n",(0,l.jsxs)(s.ul,{children:["\n",(0,l.jsx)(s.li,{children:(0,l.jsx)(s.code,{children:"packages/contracts/src/codegen/index.sol"})}),"\n",(0,l.jsx)(s.li,{children:(0,l.jsx)(s.code,{children:"packages/contracts/src/codegen/tables/Counter.sol"})}),"\n"]}),"\n",(0,l.jsxs)(s.details,{children:[(0,l.jsx)(s.summary,{children:"The automatically generated table files"}),(0,l.jsx)(s.p,{children:(0,l.jsx)(s.code,{children:"index.sol"})}),(0,l.jsx)(s.p,{children:"This file just imports all of the automatically generated tables and their identifiers."}),(0,l.jsx)(s.pre,{"data-language":"solidity","data-theme":"default",filename:"index.sol",children:(0,l.jsxs)(s.code,{"data-language":"solidity","data-theme":"default",children:[(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"// SPDX-License-Identifier: MIT"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"pragma"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:"solidity"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" >=0.8.24;"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"/* Autogenerated file. Do not edit manually. */"})}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"Counter"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" } "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"./tables/Counter.sol"'}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:";"})]})]})}),(0,l.jsxs)(s.p,{children:["In this case there is only one table, ",(0,l.jsx)(s.code,{children:"Counter"}),"."]}),(0,l.jsx)(s.p,{children:(0,l.jsx)(s.code,{children:"Counter.sol"})}),(0,l.jsx)(s.pre,{"data-language":"solidity","data-theme":"default",children:(0,l.jsxs)(s.code,{"data-language":"solidity","data-theme":"default",children:[(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"// SPDX-License-Identifier: MIT"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"pragma"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:"solidity"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" >=0.8.24;"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"/* Autogenerated file. Do not edit manually. */"})}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"// Import store internals"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"IStore"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" } "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"@latticexyz/store/src/IStore.sol"'}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"StoreSwitch"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" } "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"@latticexyz/store/src/StoreSwitch.sol"'}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"StoreCore"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" } "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"@latticexyz/store/src/StoreCore.sol"'}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"Bytes"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" } "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"@latticexyz/store/src/Bytes.sol"'}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"Memory"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" } "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"@latticexyz/store/src/Memory.sol"'}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"SliceLib"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" } "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"@latticexyz/store/src/Slice.sol"'}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"EncodeArray"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" } "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"@latticexyz/store/src/tightcoder/EncodeArray.sol"'}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"FieldLayout"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" } "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"@latticexyz/store/src/FieldLayout.sol"'}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"Schema"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" } "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"@latticexyz/store/src/Schema.sol"'}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"EncodedLengths"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"EncodedLengthsLib"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" } "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"@latticexyz/store/src/EncodedLengths.sol"'}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"ResourceId"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" } "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"@latticexyz/store/src/ResourceId.sol"'}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:";"})]})]})}),(0,l.jsx)(s.p,{children:"These are various definitions required for a MUD table.\nYou don't typically need to worry about them."}),(0,l.jsx)(s.pre,{"data-language":"solidity","data-theme":"default",children:(0,l.jsx)(s.code,{"data-language":"solidity","data-theme":"default",children:(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"library"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"Counter"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]})})}),(0,l.jsx)(s.p,{children:"This library contains all the definitions necessary to use the table."}),(0,l.jsx)(s.pre,{"data-language":"solidity","data-theme":"default",children:(0,l.jsxs)(s.code,{"data-language":"solidity","data-theme":"default",children:[(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:'// Hex below is the result of `WorldResourceIdLib.encode({ namespace: "", name: "Counter", typeId: RESOURCE_TABLE });`'})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"ResourceId "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"constant"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _tableId "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" ResourceId."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"wrap"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0x74620000000000000000000000000000436f756e746572000000000000000000"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:");"})]})]})}),(0,l.jsxs)(s.p,{children:["The ",(0,l.jsx)(s.code,{children:"<table name>._tableId"})," value is the ",(0,l.jsx)(s.a,{href:"/world/resource-ids",children:(0,l.jsx)(s.code,{children:"ResourceId"})}),", the identifier for the table in the ",(0,l.jsx)(s.code,{children:"World"}),".\nIt is composed of three fields:"]}),(0,l.jsxs)(s.table,{children:[(0,l.jsx)(s.thead,{children:(0,l.jsxs)(s.tr,{children:[(0,l.jsx)(s.th,{align:"right",children:"Bytes"}),(0,l.jsx)(s.th,{children:"Field"}),(0,l.jsx)(s.th,{children:"Value here"})]})}),(0,l.jsxs)(s.tbody,{children:[(0,l.jsxs)(s.tr,{children:[(0,l.jsx)(s.td,{align:"right",children:"0-1"}),(0,l.jsx)(s.td,{children:(0,l.jsx)(s.a,{href:"https://github.com/latticexyz/mud/blob/main/packages/store/src/storeResourceTypes.sol",children:"Resource type identifier"})}),(0,l.jsx)(s.td,{children:(0,l.jsx)(s.code,{children:"tb"})})]}),(0,l.jsxs)(s.tr,{children:[(0,l.jsx)(s.td,{align:"right",children:"2-15"}),(0,l.jsx)(s.td,{children:"Resource's namespace"}),(0,l.jsx)(s.td,{children:"Root namespace, which is empty"})]}),(0,l.jsxs)(s.tr,{children:[(0,l.jsx)(s.td,{align:"right",children:"16-31"}),(0,l.jsx)(s.td,{children:"Actual resource name"}),(0,l.jsx)(s.td,{children:(0,l.jsx)(s.code,{children:"Counter"})})]})]})]}),(0,l.jsx)(s.pre,{"data-language":"solidity","data-theme":"default",children:(0,l.jsxs)(s.code,{"data-language":"solidity","data-theme":"default",children:[(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"FieldLayout "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"constant"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _fieldLayout "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" FieldLayout."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"wrap"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"("})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0x0004010004000000000000000000000000000000000000000000000000000000"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:");"})})]})}),(0,l.jsxs)(s.p,{children:["The ",(0,l.jsx)(s.a,{href:"https://github.com/latticexyz/mud/blob/main/packages/store/src/FieldLayout.sol",children:"field layout"})," encodes the lengths of the various fields."]}),(0,l.jsxs)(s.table,{children:[(0,l.jsx)(s.thead,{children:(0,l.jsxs)(s.tr,{children:[(0,l.jsx)(s.th,{align:"right",children:"Bytes"}),(0,l.jsx)(s.th,{children:"Field"}),(0,l.jsx)(s.th,{children:"Value here"})]})}),(0,l.jsxs)(s.tbody,{children:[(0,l.jsxs)(s.tr,{children:[(0,l.jsx)(s.td,{align:"right",children:"0-1"}),(0,l.jsxs)(s.td,{children:["Total length of static",(0,l.jsx)("sup",{children:"1"})," fields"]}),(0,l.jsx)(s.td,{children:"4 bytes"})]}),(0,l.jsxs)(s.tr,{children:[(0,l.jsx)(s.td,{align:"right",children:"2"}),(0,l.jsx)(s.td,{children:"Number of static data fields"}),(0,l.jsx)(s.td,{children:"1 static field"})]}),(0,l.jsxs)(s.tr,{children:[(0,l.jsx)(s.td,{align:"right",children:"3"}),(0,l.jsxs)(s.td,{children:["Number of dynamic",(0,l.jsx)("sup",{children:"2"})," fields"]}),(0,l.jsx)(s.td,{children:"No dynamic fields"})]}),(0,l.jsxs)(s.tr,{children:[(0,l.jsx)(s.td,{align:"right",children:"4"}),(0,l.jsx)(s.td,{children:"Length of first static field"}),(0,l.jsxs)(s.td,{children:["4 bytes (",(0,l.jsx)(s.code,{children:"uint32"}),")"]})]}),(0,l.jsxs)(s.tr,{children:[(0,l.jsx)(s.td,{align:"right",children:"5"}),(0,l.jsx)(s.td,{children:"Length of second static field (if there is one)"}),(0,l.jsx)(s.td,{children:"0x00, no such field"})]}),(0,l.jsxs)(s.tr,{children:[(0,l.jsx)(s.td,{align:"right",children:"..."}),(0,l.jsx)(s.td,{}),(0,l.jsx)(s.td,{})]}),(0,l.jsxs)(s.tr,{children:[(0,l.jsx)(s.td,{align:"right",children:"31"}),(0,l.jsxs)(s.td,{children:["Length of 28th",(0,l.jsx)("sup",{children:"3"})," static field"]}),(0,l.jsx)(s.td,{children:"0x00, no such field"})]})]})]}),(0,l.jsxs)(s.p,{children:['(1) In this context "static" means fixed length.\nFor example, ',(0,l.jsx)(s.code,{children:"uint8"}),", ",(0,l.jsx)(s.code,{children:"int16"}),", and ",(0,l.jsx)(s.code,{children:"bool"})," are all static fields."]}),(0,l.jsxs)(s.p,{children:['(2) In this context "dynamic" means variable length.\nFor example, ',(0,l.jsx)(s.code,{children:"bytes"}),", ",(0,l.jsx)(s.code,{children:"string"}),", and ",(0,l.jsx)(s.code,{children:"uint8[]"})," are all dynamic fields."]}),(0,l.jsx)(s.p,{children:"(3) A MUD table can have up to 28 static fields."}),(0,l.jsx)(s.pre,{"data-language":"solidity","data-theme":"default",children:(0,l.jsxs)(s.code,{"data-language":"solidity","data-theme":"default",children:[(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"// Hex-encoded key schema of ()"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"Schema "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"constant"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keySchema "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" Schema."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"wrap"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0x0000000000000000000000000000000000000000000000000000000000000000"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:");"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"// Hex-encoded value schema of (uint32)"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"Schema "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"constant"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _valueSchema "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" Schema."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"wrap"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0x0004010003000000000000000000000000000000000000000000000000000000"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:");"})]})]})}),(0,l.jsxs)(s.p,{children:["The key schema and the value schema for the table.\nIn this case, the key schema has no fields because it is a singleton, with just one record.\nThe value schema includes a single static field.\n",(0,l.jsx)(s.a,{href:"/store/encoding#schema",children:"The exact schema encoding is explained under the store docs"}),"."]}),(0,l.jsx)(s.pre,{"data-language":"solidity","data-theme":"default",children:(0,l.jsxs)(s.code,{"data-language":"solidity","data-theme":"default",children:[(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"/**"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@notice"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" Get the table's key field names."})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@return"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" keyNames An array of strings with the names of key fields."})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" */"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"getKeyNames"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"() "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"pure"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"returns"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" ("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"string"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[] "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" keyNames) {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  keyNames "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"new"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"string"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[]("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:");"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})}),(0,l.jsx)(s.p,{children:"Get the field names for the key, an empty array in the case of a singleton."}),(0,l.jsx)(s.pre,{"data-language":"solidity","data-theme":"default",children:(0,l.jsxs)(s.code,{"data-language":"solidity","data-theme":"default",children:[(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"/**"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@notice"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" Get the table's value field names."})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@return"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" fieldNames An array of strings with the names of value fields."})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" */"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"getFieldNames"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"() "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"pure"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"returns"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" ("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"string"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[] "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" fieldNames) {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  fieldNames "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"new"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"string"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[]("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"1"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:");"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  fieldNames["}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"] "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"value"'}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})}),(0,l.jsxs)(s.p,{children:["Get the field names for the value.\nIn this case there is only one, ",(0,l.jsx)(s.code,{children:"value"}),", the current value of the counter."]}),(0,l.jsx)(s.pre,{"data-language":"solidity","data-theme":"default",children:(0,l.jsxs)(s.code,{"data-language":"solidity","data-theme":"default",children:[(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"/**"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@notice"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" Register the table with its config."})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" */"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"register"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"() "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  StoreSwitch."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"registerTable"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"(_tableId"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _fieldLayout"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keySchema"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _valueSchema"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"getKeyNames"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"()"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"getFieldNames"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"());"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"}"})}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"/**"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@notice"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" Register the table with its config."})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" */"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"_register"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"() "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  StoreCore."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"registerTable"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"(_tableId"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _fieldLayout"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keySchema"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _valueSchema"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"getKeyNames"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"()"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"getFieldNames"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"());"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})}),(0,l.jsxs)(s.p,{children:["These functions register the schema.\nThe ",(0,l.jsx)(s.code,{children:"_register()"})," function is used when running inside the context of the ",(0,l.jsx)(s.code,{children:"World"}),", for example in a ",(0,l.jsxs)(s.a,{href:"/world/systems#root-systems",children:["root namespace ",(0,l.jsx)(s.code,{children:"System"})]}),".\nThe ",(0,l.jsx)(s.code,{children:"register()"})," function is used when running in any other context, for example from a Solidity script or a normal ",(0,l.jsx)(s.code,{children:"System"}),".\nNote that you ",(0,l.jsx)(s.em,{children:"can"})," use ",(0,l.jsx)(s.code,{children:"register()"})," when running in the context of the ",(0,l.jsx)(s.code,{children:"World"}),", it is just slightly less efficient than ",(0,l.jsx)(s.code,{children:"_register()"})]}),(0,l.jsxs)(s.p,{children:["The same distinction between ",(0,l.jsx)(s.code,{children:"<function>()"}),", which is usable everything, and ",(0,l.jsx)(s.code,{children:"_<function>()"})," which can only be used in the ",(0,l.jsx)(s.code,{children:"World"})," context, exists in most other table functions."]}),(0,l.jsx)(s.pre,{"data-language":"solidity","data-theme":"default",children:(0,l.jsxs)(s.code,{"data-language":"solidity","data-theme":"default",children:[(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"/**"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@notice"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" Get value."})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" */"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"getValue"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"() "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"view"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"returns"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" ("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"uint32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" value) {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[] "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"new"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[]("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:");"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _blob "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" StoreSwitch."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"getStaticField"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"(_tableId"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _fieldLayout);"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" ("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"uint32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes4"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"(_blob)));"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"}"})}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"/**"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@notice"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" Get value."})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" */"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"_getValue"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"() "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"view"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"returns"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" ("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"uint32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" value) {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[] "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"new"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[]("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:");"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _blob "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" StoreCore."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"getStaticField"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"(_tableId"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _fieldLayout);"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" ("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"uint32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes4"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"(_blob)));"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})}),(0,l.jsxs)(s.p,{children:["These functions return the ",(0,l.jsx)(s.code,{children:"value"})," field.\nThe ",(0,l.jsx)(s.code,{children:"_keyTuple"})," is empty, because the table is a singleton."]}),(0,l.jsxs)(s.p,{children:["If there are more fields in the value schema, they each have ",(0,l.jsx)(s.code,{children:"get<field name>(<key>)"})," functions."]}),(0,l.jsx)(s.pre,{"data-language":"solidity","data-theme":"default",children:(0,l.jsxs)(s.code,{"data-language":"solidity","data-theme":"default",children:[(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"/**"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@notice"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" Get value."})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" */"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"get"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"() "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"view"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"returns"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" ("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"uint32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" value) {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[] "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"new"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[]("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:");"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _blob "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" StoreSwitch."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"getStaticField"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"(_tableId"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _fieldLayout);"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" ("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"uint32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes4"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"(_blob)));"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"}"})}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"/**"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@notice"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" Get value."})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" */"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"_get"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"() "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"view"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"returns"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" ("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"uint32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" value) {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[] "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"new"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[]("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:");"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _blob "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" StoreCore."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"getStaticField"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"(_tableId"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _fieldLayout);"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" ("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"uint32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes4"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"(_blob)));"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})}),(0,l.jsxs)(s.p,{children:["These functions return the entire value, which just happens to have a single field called ",(0,l.jsx)(s.code,{children:"value"}),".\nIn this case there is only one value and there are no keys, so they just get the first entry, the one with index zero."]}),(0,l.jsx)(s.pre,{"data-language":"solidity","data-theme":"default",children:(0,l.jsxs)(s.code,{"data-language":"solidity","data-theme":"default",children:[(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"/**"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@notice"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" Set value."})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" */"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"setValue"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"uint32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" value) "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[] "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"new"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[]("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:");"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  StoreSwitch."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"setStaticField"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"(_tableId"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" abi."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"encodePacked"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"((value))"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _fieldLayout);"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"}"})}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"/**"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@notice"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" Set value."})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" */"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"_setValue"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"uint32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" value) "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[] "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"new"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[]("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:");"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  StoreCore."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"setStaticField"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"(_tableId"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" abi."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"encodePacked"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"((value))"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _fieldLayout);"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})}),(0,l.jsxs)(s.p,{children:["Set the ",(0,l.jsx)(s.code,{children:"value"})," field.\nAgain, there is one function pair for each value field."]}),(0,l.jsx)(s.pre,{"data-language":"solidity","data-theme":"default",children:(0,l.jsxs)(s.code,{"data-language":"solidity","data-theme":"default",children:[(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"/**"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@notice"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" Set value."})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" */"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"set"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"uint32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" value) "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[] "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"new"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[]("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:");"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  StoreSwitch."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"setStaticField"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"(_tableId"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" abi."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"encodePacked"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"((value))"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _fieldLayout);"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"}"})}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"/**"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@notice"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" Set value."})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" */"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"_set"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"uint32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" value) "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[] "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"new"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[]("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:");"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  StoreCore."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"setStaticField"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"(_tableId"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" abi."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"encodePacked"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"((value))"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _fieldLayout);"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})}),(0,l.jsx)(s.p,{children:"Set all the value fields."}),(0,l.jsx)(s.pre,{"data-language":"solidity","data-theme":"default",children:(0,l.jsxs)(s.code,{"data-language":"solidity","data-theme":"default",children:[(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"/**"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@notice"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" Delete all data for given keys."})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" */"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"deleteRecord"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"() "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[] "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"new"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[]("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:");"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  StoreSwitch."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"deleteRecord"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"(_tableId"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple);"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"}"})}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"/**"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@notice"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" Delete all data for given keys."})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" */"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"_deleteRecord"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"() "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[] "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"new"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[]("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:");"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  StoreCore."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"deleteRecord"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"(_tableId"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _fieldLayout);"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})}),(0,l.jsx)(s.p,{children:"These functions delete the value.\nNormally it would be the value associated with the a key provided as a parameter, but this is a singleton."}),(0,l.jsx)(s.pre,{"data-language":"solidity","data-theme":"default",children:(0,l.jsxs)(s.code,{"data-language":"solidity","data-theme":"default",children:[(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"/**"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"   * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@notice"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" Encode all of a record's fields."})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"   * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@return"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" The static (fixed length) data, encoded into a sequence of bytes."})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"   * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@return"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" The lengths of the dynamic fields (packed into a single bytes32 value)."})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"   * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@return"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" The dynamic (variable length) data, encoded into a sequence of bytes."})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"   */"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"encode"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"uint32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" value) "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"pure"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"returns"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" ("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"EncodedLengths"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:") {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _staticData "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"encodeStatic"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"(value);"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    EncodedLengths _encodedLengths;"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _dynamicData;"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" (_staticData"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _encodedLengths"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _dynamicData);"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  }"})}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"/**"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"   * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@notice"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" Encode keys as a bytes32 array using this table's field layout."})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"   */"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"encodeKeyTuple"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"() "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"internal"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"pure"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"returns"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" ("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[] "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:") {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[] "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"new"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"bytes32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"[]("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:");"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" _keyTuple;"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  }"})}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})}),(0,l.jsx)(s.p,{children:"Utility functions to encode a value."})]}),"\n",(0,l.jsx)(s.h2,{id:"systems",children:"Systems"}),"\n",(0,l.jsxs)(s.p,{children:["The way MUD works, onchain logic is implemented by one or more ",(0,l.jsx)(s.code,{children:"System"})," contracts.\nThose systems are always called by a central ",(0,l.jsx)(s.code,{children:"World"})," contract."]}),"\n",(0,l.jsx)(s.h4,{id:"incrementsystemsol",children:(0,l.jsx)(s.code,{children:"IncrementSystem.sol"})}),"\n",(0,l.jsxs)(s.p,{children:["This is the system that is provided by the demo (",(0,l.jsx)(s.code,{children:"packages/contracts/src/systems/IncrementSystem.sol"}),").\nAs the name suggests, it includes a single function that increments ",(0,l.jsx)(s.code,{children:"Counter"}),"."]}),"\n",(0,l.jsx)(s.pre,{"data-language":"solidity","data-theme":"default",children:(0,l.jsxs)(s.code,{"data-language":"solidity","data-theme":"default",children:[(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"// SPDX-License-Identifier: MIT"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"pragma"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:"solidity"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" >=0.8.24;"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"System"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" } "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"@latticexyz/world/src/System.sol"'}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"Counter"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" } "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"../codegen/Tables.sol"'}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:";"})]})]})}),"\n",(0,l.jsxs)(s.p,{children:["The system needs to know how to be a ",(0,l.jsx)(s.code,{children:"System"}),", as well as have access to the table (or tables) it needs."]}),"\n",(0,l.jsx)(s.pre,{"data-language":"solidity","data-theme":"default",children:(0,l.jsxs)(s.code,{"data-language":"solidity","data-theme":"default",children:[(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"contract"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"IncrementSystem"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"is"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"System"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"increment"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"() "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"public"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"returns"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" ("}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"uint32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:") {"})]})]})}),"\n",(0,l.jsxs)(s.p,{children:["There could be multiple functions in the same system, but in this case there is only one, ",(0,l.jsx)(s.code,{children:"increment"}),"."]}),"\n",(0,l.jsx)(s.pre,{"data-language":"solidity","data-theme":"default",children:(0,l.jsx)(s.code,{"data-language":"solidity","data-theme":"default",children:(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"uint32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" counter "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" Counter."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"get"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"();"})]})})}),"\n",(0,l.jsxs)(s.p,{children:["Read the value. Because ",(0,l.jsx)(s.code,{children:"Counter"})," is a singleton, there are no keys to look up."]}),"\n",(0,l.jsx)(s.pre,{"data-language":"solidity","data-theme":"default",children:(0,l.jsxs)(s.code,{"data-language":"solidity","data-theme":"default",children:[(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"uint32"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" newValue "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" counter "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"+"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-constant)"},children:"1"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    Counter."}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-function)"},children:"set"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"(newValue);"})]})]})}),"\n",(0,l.jsx)(s.p,{children:"Update the value."}),"\n",(0,l.jsx)(s.pre,{"data-language":"solidity","data-theme":"default",children:(0,l.jsxs)(s.code,{"data-language":"solidity","data-theme":"default",children:[(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:" newValue;"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"  }"})}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})}),"\n",(0,l.jsx)(s.p,{children:"Return the new value."})]})}s.default=(0,r.j)(a)}},function(e){e.O(0,[3720,2888,179],function(){return e(e.s=5946)}),_N_E=e.O()}]);