Withdraw from a generation-2 vault on chain without the platform (gas limit of at least ~0.67M), and how upgrades of generation-2 contracts are proposed and applied.
Same calls as for a
generation-1 vault,
sent from your wallet, on each vault you hold:
initiateEmergencyWithdraw() // vault owner only; starts the 7-day timelock// ... wait 7 days, then within the following 7 days:emergencyWithdrawERC20(token) // sends the vault's full `token` balance to the vault owneremergencyWithdrawERC1155(token, id) // sends the vault's full balance of position `id` to the vault owner
From initiateEmergencyWithdraw() on, the exchange rejects orders
from that vault. emergencyUnlockAt() returns the unlock time.
If the 7-day execution window lapses, call
initiateEmergencyWithdraw() again.
GET /api/me/vault/emergency shows the state (none, waiting,
executable, unlocksAt, initiatedAt). Pass ?vault=0x… to inspect a
specific vault (default: active vault). It is read-only; the calls are yours.
On a generation-2 vault the final emergencyWithdraw* call needs a
gas limit of at least ~0.67M. The vault forwards 600,000 gas to
DepositLimitRegistry.freezeUser(vaultOwner) and reverts with
InsufficientGasForFreeze if the transaction leaves less. Always estimate
gas with eth_estimateGas or set a limit ≥ 0.67M. A fixed limit sized for
generation 1 reverts without paying out.
const vault = new Contract(vaultAddress, ['function emergencyWithdrawERC20(address token)'], eoa);const gas = await vault.emergencyWithdrawERC20.estimateGas(contracts.usdc);await (await vault.emergencyWithdrawERC20(contracts.usdc, { gasLimit: gas + gas / 10n })).wait();
Timelock: Changes take effect only after upgradeTimelock() (minimum 1 hour, maximum 30 days; configured on chain).
Execution window: Staged proposals must be executed within UPGRADE_WINDOW (7 days) after maturation.
Monitoring events: Watch for VaultUpgradeProposed(impl, activatesAt) and VaultImplementationSet(old, impl) on VaultFactoryGen2, or UpgradeProposed(impl, activatesAt) and UpgradeApplied(impl) on the exchange proxies.
Permanent disable: An admin can call disableUpgrades(address(this)) to irreversibly permanently disable upgrades on that contract (UpgradesDisabled).
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"ADI Predictstreet","description":"Institutional-grade prediction market API — trading, settlement, and on-chain custody.","colors":{"primary":"#013CFF","light":"#3F67ED","dark":"#0028AE"},"logo":{"light":"https://mintcdn.com/ideasoft/m6stBITx7YzlhMtC/logo/light.svg?fit=max\u0026auto=format\u0026n=m6stBITx7YzlhMtC\u0026q=85\u0026s=67eed2cbc5343eb0cb47d0945877af3f","dark":"https://mintcdn.com/ideasoft/m6stBITx7YzlhMtC/logo/dark.svg?fit=max\u0026auto=format\u0026n=m6stBITx7YzlhMtC\u0026q=85\u0026s=c44812a23eae343855d6ec50450195a8"},"favicon":"https://mintcdn.com/ideasoft/m6stBITx7YzlhMtC/favicon.svg?fit=max\u0026auto=format\u0026n=m6stBITx7YzlhMtC\u0026q=85\u0026s=12febd8f21b779fb61083b446cab4a6f","api":{"playground":{"proxy":true}},"navbar":{"links":[{"href":"https://adipredictstreet.com/","label":"Web app"}]},"footer":{"socials":{"x":"https://x.com/predictstreet","github":"https://github.com/predictstreet"}},"styling":{"eyebrows":"section","latex":true},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"ideasoft","hasAudioNarration":false,"actualSubdomain":"ideasoft","customDomains":["docs.adipredictstreet.com"],"gitSource":{"type":"github","owner":"predictstreetproduction","repo":"predictstreet-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae60cec540ca74357046b81","collectionId":"ab951ae8-e645-4c50-b3db-e1d2f84abd42","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae60cec540ca74357046b81"},"entitlements":{},"buildId":"6ae60d18f146f7c5c1deaa00","clientVersion":"0.0.4043","searchFilterCounts":[{"language":"default","tag":"API Reference","count":117},{"language":"default","tag":"Endpoints","count":110},{"language":"default","tag":"Documentation","count":64},{"language":"default","tag":"Portfolio","count":24},{"language":"default","tag":"Markets","count":20},{"language":"default","tag":"Withdrawals","count":15},{"language":"default","tag":"Orders","count":11},{"language":"default","tag":"WebSocket","count":10},{"language":"default","tag":"Public Profile","count":8},{"language":"default","tag":"On-chain Contracts","count":7}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"styles.css","content":":root{--adi-pearl-white:#FFFDFA;--adi-electric-orange:#FF710A;--adi-burgundy:#3E000D;--adi-bright-blue:#013CFF;--adi-sandy-white:#FFF9E1;--adi-pearl-white-mid:#EAEAEA;--adi-pearl-white-dark:#BEBEBE;--adi-electric-orange-light:#FD964B;--adi-electric-orange-dark:#B74D00;--adi-burgundy-light:#632431;--adi-burgundy-dark:#2B0009;--adi-bright-blue-light:#3F67ED;--adi-bright-blue-dark:#0028AE;--adi-sandy-white-light:#FFFBEC;--adi-sandy-white-dark:#E1D9B6}.link,a{color:var(--adi-bright-blue)}.link:hover,a:hover{color:var(--adi-bright-blue-dark)}.dark .link,.dark a{color:var(--adi-bright-blue-light)}.dark .link:hover,.dark a:hover{color:var(--adi-electric-orange-light)}::selection{background-color:var(--adi-electric-orange);color:var(--adi-pearl-white)}"}],"page":{"pagePath":"concepts/vault-gen2/emergency-exit","slug":"/concepts/vault-gen2/emergency-exit","pageMetadata":{"title":"Emergency exit and upgradeability","description":"Withdraw from a generation-2 vault on chain without the platform (gas limit of at least ~0.67M), and how upgrades of generation-2 contracts are proposed and applied.","href":"/concepts/vault-gen2/emergency-exit"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Withdraw from a generation-2 vault on chain without the platform (gas limit of at least ~0.67M), and how upgrades of generation-2 contracts are proposed and applied.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`emergency-exit`,children:`Emergency exit`}),`\n`,_jsxs(_components.p,{children:[`Same calls as for a\n`,_jsx(_components.a,{href:`/concepts/contracts/vaults#emergency-withdraw`,children:`generation-1 vault`}),`,\nsent from your wallet, on each vault you hold:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`solidity`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`solidity`,children:_jsxs(_components.code,{language:`solidity`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`initiateEmergencyWithdraw`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// vault owner only; starts the 7-day timelock`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// ... wait 7 days, then within the following 7 days:`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`emergencyWithdrawERC20`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(token) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\"// sends the vault's full `token` balance to the vault owner\"})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`emergencyWithdrawERC1155`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(token, id) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\"// sends the vault's full balance of position `id` to the vault owner\"})]}),`\n`]})})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`From `,_jsx(_components.code,{children:`initiateEmergencyWithdraw()`}),` on, the exchange rejects orders\nfrom that vault. `,_jsx(_components.code,{children:`emergencyUnlockAt()`}),` returns the unlock time.`]}),`\n`,_jsxs(_components.li,{children:[`If the 7-day execution window lapses, call\n`,_jsx(_components.code,{children:`initiateEmergencyWithdraw()`}),` again.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`GET /api/me/vault/emergency`}),` shows the state (`,_jsx(_components.code,{children:`none`}),`, `,_jsx(_components.code,{children:`waiting`}),`,\n`,_jsx(_components.code,{children:`executable`}),`, `,_jsx(_components.code,{children:`unlocksAt`}),`, `,_jsx(_components.code,{children:`initiatedAt`}),`). Pass `,_jsx(_components.code,{children:`?vault=0x…`}),` to inspect a\nspecific vault (default: active vault). It is read-only; the calls are yours.`]}),`\n`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`On a generation-2 vault the final `,_jsx(_components.code,{children:`emergencyWithdraw*`}),` call needs a\ngas limit of at least ~0.67M. The vault forwards 600,000 gas to\n`,_jsx(_components.code,{children:`DepositLimitRegistry.freezeUser(vaultOwner)`}),` and reverts with\n`,_jsx(_components.code,{children:`InsufficientGasForFreeze`}),` if the transaction leaves less. Always estimate\ngas with `,_jsx(_components.code,{children:`eth_estimateGas`}),` or set a limit ≥ 0.67M. A fixed limit sized for\ngeneration 1 reverts without paying out.`]})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` vault`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Contract`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`vaultAddress`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'function emergencyWithdrawERC20(address token)'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`], `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`eoa`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` gas`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` vault`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`emergencyWithdrawERC20`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`estimateGas`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`contracts`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`usdc`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` vault`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`emergencyWithdrawERC20`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`contracts`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`usdc`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`gasLimit:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` gas`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` +`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` gas`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` /`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 10`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`n`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`wait`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`upgradeability`,children:`Upgradeability`}),`\n`,_jsx(_components.p,{children:`Generation-1 vaults cannot be upgraded. Generation-2 contracts are upgradeable proxies:`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Contract`}),_jsx(_components.th,{children:`Pattern`}),_jsx(_components.th,{children:`Upgrade mechanism`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`MigrationVault`}),` (generation-2 vaults)`]}),_jsx(_components.td,{children:`ERC-1967 Beacon Proxy`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`VaultFactoryGen2.proposeVaultUpgrade(impl)`}),` → timelock → `,_jsx(_components.code,{children:`VaultFactoryGen2.upgradeVaultImplementation(impl)`}),` upgrades all generation-2 vaults at once`]})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`VaultFactoryGen2`}),`, `,_jsx(_components.code,{children:`CTFExchangeGen2`}),`, `,_jsx(_components.code,{children:`NegRiskCtfExchangeGen2`})]}),_jsxs(_components.td,{children:[`UUPS Proxy (`,_jsx(_components.code,{children:`TimelockedUUPS`}),`)`]}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`proposeUpgrade(impl)`}),` → timelock → `,_jsx(_components.code,{children:`upgradeToAndCall(impl, data)`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`DepositLimitRegistry`})}),_jsx(_components.td,{children:`Transparent / UUPS Proxy`}),_jsxs(_components.td,{children:[`Shared timelock mixin (`,_jsx(_components.code,{children:`TimelockedUpgrades`}),`)`]})]})]})]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Timelock:`}),` Changes take effect only after `,_jsx(_components.code,{children:`upgradeTimelock()`}),` (minimum 1 hour, maximum 30 days; configured on chain).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Execution window:`}),` Staged proposals must be executed within `,_jsx(_components.code,{children:`UPGRADE_WINDOW`}),` (7 days) after maturation.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Monitoring events:`}),` Watch for `,_jsx(_components.code,{children:`VaultUpgradeProposed(impl, activatesAt)`}),` and `,_jsx(_components.code,{children:`VaultImplementationSet(old, impl)`}),` on `,_jsx(_components.code,{children:`VaultFactoryGen2`}),`, or `,_jsx(_components.code,{children:`UpgradeProposed(impl, activatesAt)`}),` and `,_jsx(_components.code,{children:`UpgradeApplied(impl)`}),` on the exchange proxies.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Permanent disable:`}),` An admin can call `,_jsx(_components.code,{children:`disableUpgrades(address(this))`}),` to irreversibly permanently disable upgrades on that contract (`,_jsx(_components.code,{children:`UpgradesDisabled`}),`).`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Emergency exit and upgradeability","description":"Withdraw from a generation-2 vault on chain without the platform (gas limit of at least ~0.67M), and how upgrades of generation-2 contracts are proposed and applied.","href":"/concepts/vault-gen2/emergency-exit"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Emergency exit","slug":"emergency-exit","depth":2,"children":[]},{"title":"Upgradeability","slug":"upgradeability","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"ideasoft","siteName":"ADI Predictstreet","title":"Emergency exit and upgradeability - ADI Predictstreet","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-31T15:45:17.913Z","originalFileLocation":"concepts/vault-gen2/emergency-exit.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Withdraw from a generation-2 vault on chain without the platform (gas limit of at least ~0.67M), and how upgrades of generation-2 contracts are proposed and applied.\">\u003cmeta data-mint-head name=\"application-name\" content=\"ADI Predictstreet\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/ideasoft/T2TJrNWM5Wm-DXAw/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/ideasoft/T2TJrNWM5Wm-DXAw/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/ideasoft/T2TJrNWM5Wm-DXAw/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/ideasoft/T2TJrNWM5Wm-DXAw/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/ideasoft/T2TJrNWM5Wm-DXAw/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/ideasoft/T2TJrNWM5Wm-DXAw/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/ideasoft/T2TJrNWM5Wm-DXAw/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/ideasoft/T2TJrNWM5Wm-DXAw/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/ideasoft/T2TJrNWM5Wm-DXAw/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Emergency exit and upgradeability - ADI Predictstreet\">\u003cmeta data-mint-head property=\"og:description\" content=\"Withdraw from a generation-2 vault on chain without the platform (gas limit of at least ~0.67M), and how upgrades of generation-2 contracts are proposed and applied.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"ADI Predictstreet\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.adipredictstreet.com/concepts/vault-gen2/emergency-exit\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://ideasoft.mintlify.app/_mintlify/api/og/v2?division=Vault+generation+2\u0026amp;title=Emergency+exit+and+upgradeability\u0026amp;description=Withdraw+from+a+generation-2+vault+on+chain+without+the+platform+%28gas+limit+of+at+least+%7E0.67M%29%2C+and+how+upgrades+of+generation-2+contracts+are+proposed+and+app\u0026amp;theme=aed7d98745ded4d107883553\u0026amp;signature=34442429bc0f382356ed25f28ccfdfb2500510d0da35f1bad41bdcc7816e8043\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Emergency exit and upgradeability - ADI Predictstreet\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Withdraw from a generation-2 vault on chain without the platform (gas limit of at least ~0.67M), and how upgrades of generation-2 contracts are proposed and applied.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://ideasoft.mintlify.app/_mintlify/api/og/v2?division=Vault+generation+2\u0026amp;title=Emergency+exit+and+upgradeability\u0026amp;description=Withdraw+from+a+generation-2+vault+on+chain+without+the+platform+%28gas+limit+of+at+least+%7E0.67M%29%2C+and+how+upgrades+of+generation-2+contracts+are+proposed+and+app\u0026amp;theme=aed7d98745ded4d107883553\u0026amp;signature=34442429bc0f382356ed25f28ccfdfb2500510d0da35f1bad41bdcc7816e8043\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/ideasoft/T2TJrNWM5Wm-DXAw/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"ADI Predictstreet\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#013CFF\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.adipredictstreet.com/concepts/vault-gen2/emergency-exit\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/concepts/vault-gen2/emergency-exit.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.adipredictstreet.com/#organization\",\"name\":\"ADI Predictstreet\",\"url\":\"https://docs.adipredictstreet.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/ideasoft/m6stBITx7YzlhMtC/logo/light.svg?fit=max\u0026auto=format\u0026n=m6stBITx7YzlhMtC\u0026q=85\u0026s=67eed2cbc5343eb0cb47d0945877af3f\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.adipredictstreet.com#website\",\"name\":\"ADI Predictstreet\",\"url\":\"https://docs.adipredictstreet.com\",\"publisher\":{\"@id\":\"https://docs.adipredictstreet.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.adipredictstreet.com/concepts/vault-gen2/emergency-exit#webpage\",\"url\":\"https://docs.adipredictstreet.com/concepts/vault-gen2/emergency-exit\",\"name\":\"Emergency exit and upgradeability\",\"description\":\"Withdraw from a generation-2 vault on chain without the platform (gas limit of at least ~0.67M), and how upgrades of generation-2 contracts are proposed and applied.\",\"dateModified\":\"2026-10-31T15:45:17.913Z\",\"isPartOf\":{\"@id\":\"https://docs.adipredictstreet.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.adipredictstreet.com/concepts/vault-gen2/emergency-exit#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.adipredictstreet.com/concepts/vault-gen2/emergency-exit#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Vault generation 2\",\"item\":\"https://docs.adipredictstreet.com/concepts/vault-gen2/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Emergency exit and upgradeability\",\"item\":\"https://docs.adipredictstreet.com/concepts/vault-gen2/emergency-exit\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.adipredictstreet.com/concepts/vault-gen2/emergency-exit#article\",\"headline\":\"Emergency exit and upgradeability\",\"name\":\"Emergency exit and upgradeability\",\"description\":\"Withdraw from a generation-2 vault on chain without the platform (gas limit of at least ~0.67M), and how upgrades of generation-2 contracts are proposed and applied.\",\"url\":\"https://docs.adipredictstreet.com/concepts/vault-gen2/emergency-exit\",\"mainEntityOfPage\":{\"@id\":\"https://docs.adipredictstreet.com/concepts/vault-gen2/emergency-exit#webpage\"},\"dateModified\":\"2026-10-31T15:45:17.913Z\",\"publisher\":{\"@id\":\"https://docs.adipredictstreet.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.adipredictstreet.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"ADI Predictstreet\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"ADI Predictstreet","nav":{"global":null,"tabs":[{"tab":"Documentation","groups":[{"group":"Getting Started","pages":[{"title":"Introduction","href":"/introduction"},{"title":"Quickstart","href":"/quickstart"},{"title":"Platform overview","href":"/platform-overview"},{"title":"Environment","href":"/environments"}]},{"group":"Authentication","pages":[{"title":"Authentication overview","href":"/auth/overview"},{"title":"API keys","href":"/auth/api-keys"},{"title":"Rate limits","href":"/auth/rate-limits"}]},{"group":"Vaults","pages":[{"title":"Vaults overview","href":"/concepts/vaults/overview"},{"title":"Backend auto-deploy","href":"/concepts/vaults/auto-deploy"},{"title":"Recovering expired split / merge locks","href":"/concepts/vaults/recovery"}]},{"group":"Vault generation 2","pages":[{"title":"Vault generation 2","href":"/concepts/vault-gen2/overview"},{"title":"Detect a market's generation","href":"/concepts/vault-gen2/market-generation"},{"title":"Upgrade and move USDC","href":"/concepts/vault-gen2/upgrade"},{"title":"Orders and vault operations","href":"/concepts/vault-gen2/vault-operations"},{"title":"API keys and WebSocket","description":"The vault:migrate and positions:write scopes, how to get a key that carries them, what a key can do without your signature, and the per-vault WebSocket changes.","href":"/concepts/vault-gen2/api-keys-websocket"},{"title":"Emergency exit and upgradeability","href":"/concepts/vault-gen2/emergency-exit"}]},{"group":"Deposits","pages":[{"title":"Deposits overview","description":"How USDC moves from your associated EOA into your on-chain vault, and how long the platform takes to credit available balance.","href":"/concepts/deposits/overview"},{"title":"Deposit limits","href":"/concepts/deposits/limits"}]},{"group":"Trading","pages":[{"title":"Order lifecycle","href":"/concepts/trading/order-lifecycle"},{"title":"EIP-712 signing","href":"/concepts/trading/eip712-signing"},{"title":"Placing orders","href":"/concepts/trading/placing-orders"},{"title":"Cancelling orders","href":"/concepts/trading/cancelling"},{"title":"Time-in-force","href":"/concepts/trading/time-in-force"},{"title":"Fees","href":"/concepts/trading/fees"}]},{"group":"Events \u0026 Tags","pages":[{"title":"Events overview","href":"/concepts/events/overview"}]},{"group":"Markets","pages":[{"title":"Markets overview","href":"/concepts/markets/overview"},{"title":"Binary markets","href":"/concepts/markets/binary"},{"title":"Neg-risk markets","href":"/concepts/markets/neg-risk"},{"title":"Crypto markets","href":"/concepts/markets/crypto"},{"title":"Up/Down windows","href":"/concepts/markets/crypto-updown"},{"title":"Orderbook","href":"/concepts/markets/orderbook"},{"title":"Market status","href":"/concepts/markets/market-status"}]},{"group":"Portfolio","pages":[{"title":"Balances","href":"/concepts/portfolio/balances"},{"title":"Positions","href":"/concepts/portfolio/positions"},{"title":"Trades","href":"/concepts/portfolio/trades"},{"title":"Fee ledger","href":"/concepts/portfolio/fees"}]},{"group":"Withdrawals","pages":[{"title":"Withdrawals overview","href":"/concepts/withdrawals/overview"},{"title":"Dual-signature flow","href":"/concepts/withdrawals/dual-sig"},{"title":"WithdrawERC20 EIP-712","href":"/concepts/withdrawals/eip712"},{"title":"State machine","href":"/concepts/withdrawals/state-machine"},{"title":"Deposit sources","href":"/concepts/withdrawals/deposit-sources"},{"title":"Withdrawal 2FA (TOTP)","href":"/concepts/withdrawals/two-factor"},{"title":"Withdrawal address whitelist","href":"/concepts/withdrawals/address-whitelist"}]},{"group":"WebSocket","pages":[{"title":"WebSocket overview","href":"/concepts/websocket/overview"},{"title":"Subscriptions","href":"/concepts/websocket/subscriptions"},{"title":"Message shapes","href":"/concepts/websocket/messages"},{"title":"Crypto price feeds","href":"/concepts/websocket/crypto-price"},{"title":"Reconnect \u0026 resync","href":"/concepts/websocket/reconnect"}]},{"group":"Settlement \u0026 Oracle","pages":[{"title":"Settlement \u0026 oracle overview","href":"/concepts/settlement/overview"},{"title":"Settlement flow","href":"/concepts/settlement/flow"},{"title":"Challenges","href":"/concepts/settlement/challenges"},{"title":"Void \u0026 delayed markets","href":"/concepts/settlement/void-delay"}]},{"group":"On-chain Contracts","pages":[{"title":"Contracts overview","href":"/concepts/contracts/overview"},{"title":"Addresses","href":"/concepts/contracts/addresses"},{"title":"CTFExchange","href":"/concepts/contracts/ctf-exchange"},{"title":"VaultFactory + Vault","href":"/concepts/contracts/vaults"},{"title":"ConditionalTokens","href":"/concepts/contracts/conditional-tokens"},{"title":"NegRiskAdapter","href":"/concepts/contracts/neg-risk-adapter"},{"title":"Oracle","href":"/concepts/contracts/oracle"}]},{"group":"Partners","pages":[{"title":"Partner Trades \u0026 Reconciliation","href":"/concepts/partners/trades-and-recon"},{"title":"Maintenance Notifications","href":"/concepts/partners/maintenance-notifications"},{"title":"Pausing Trading Around Maintenance","href":"/concepts/partners/pausing-around-maintenance"}]},{"group":"Errors","pages":[{"title":"Errors overview","href":"/errors/overview"},{"title":"Error codes","href":"/errors/codes"}]}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/introduction"}]}]},"basePath":"","title":"Emergency exit and upgradeability - ADI Predictstreet","buildId":"dpl_G9nrg4qeJSZtah1Ziwbc2n6WkLch","deploymentId":"dpl_G9nrg4qeJSZtah1Ziwbc2n6WkLch","dynamics":[],"chunks":[]}