{"version":3,"file":"deepbookAdmin.mjs","names":["#config","poolMoveCalls.createPoolAdmin","#adminCap","poolMoveCalls.unregisterPoolAdmin","poolMoveCalls.updateAllowedVersions","registryMoveCalls.enableVersion","registryMoveCalls.disableVersion","registryMoveCalls.setTreasuryAddress","registryMoveCalls.addStablecoin","registryMoveCalls.removeStablecoin","poolMoveCalls.adjustTickSizeAdmin","poolMoveCalls.adjustMinLotSizeAdmin","registryMoveCalls.initBalanceManagerMap","poolMoveCalls.setEwmaParams","poolMoveCalls.enableEwmaState","registryMoveCalls.authorizeApp","registryMoveCalls.deauthorizeApp","registryMoveCalls.mintPauseCap","registryMoveCalls.revokePauseCap","registryMoveCalls.disableVersionPauseCap","registryMoveCalls.allowedPauseCaps"],"sources":["../../src/transactions/deepbookAdmin.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport type { CreatePoolAdminParams, SetEwmaParams } from '../types/index.js';\nimport type { DeepBookConfig } from '../utils/config.js';\nimport { FLOAT_SCALAR } from '../utils/config.js';\nimport { convertQuantity, convertPrice, convertRate } from '../utils/conversion.js';\nimport * as poolMoveCalls from '../contracts/deepbook/pool.js';\nimport * as registryMoveCalls from '../contracts/deepbook/registry.js';\n\n/**\n * DeepBookAdminContract class for managing admin actions.\n */\nexport class DeepBookAdminContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for DeepBookAdminContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @returns The admin capability required for admin operations\n\t * @throws Error if the admin capability is not set\n\t */\n\t#adminCap() {\n\t\tconst adminCap = this.#config.adminCap;\n\t\tif (!adminCap) {\n\t\t\tthrow new Error('ADMIN_CAP environment variable not set');\n\t\t}\n\t\treturn adminCap;\n\t}\n\n\t/**\n\t * @description Create a new pool as admin\n\t * @param {CreatePoolAdminParams} params Parameters for creating pool as admin\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreatePoolAdmin = (params: CreatePoolAdminParams) => (tx: Transaction) => {\n\t\ttx.setSenderIfNotSet(this.#config.address);\n\t\tconst { baseCoinKey, quoteCoinKey, tickSize, lotSize, minSize, whitelisted, stablePool } =\n\t\t\tparams;\n\t\tconst baseCoin = this.#config.getCoin(baseCoinKey);\n\t\tconst quoteCoin = this.#config.getCoin(quoteCoinKey);\n\n\t\tconst baseScalar = baseCoin.scalar;\n\t\tconst quoteScalar = quoteCoin.scalar;\n\n\t\tconst adjustedTickSize = convertPrice(tickSize, FLOAT_SCALAR, quoteScalar, baseScalar);\n\t\tconst adjustedLotSize = convertQuantity(lotSize, baseScalar);\n\t\tconst adjustedMinSize = convertQuantity(minSize, baseScalar);\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.createPoolAdmin({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.REGISTRY_ID,\n\t\t\t\t\ttickSize: adjustedTickSize,\n\t\t\t\t\tlotSize: adjustedLotSize,\n\t\t\t\t\tminSize: adjustedMinSize,\n\t\t\t\t\twhitelistedPool: whitelisted,\n\t\t\t\t\tstablePool,\n\t\t\t\t\tCap: this.#adminCap(),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Unregister a pool as admin\n\t * @param {string} poolKey The key of the pool to be unregistered by admin\n\t * @returns A function that takes a Transaction object\n\t */\n\tunregisterPoolAdmin = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tpoolMoveCalls.unregisterPoolAdmin({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: pool.address,\n\t\t\t\t\tregistry: this.#config.REGISTRY_ID,\n\t\t\t\t\tCap: this.#adminCap(),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Update the allowed versions for a pool\n\t * @param {string} poolKey The key of the pool to be updated\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdateAllowedVersions = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tpoolMoveCalls.updateAllowedVersions({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: pool.address,\n\t\t\t\t\tregistry: this.#config.REGISTRY_ID,\n\t\t\t\t\tCap: this.#adminCap(),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Enable a specific version\n\t * @param {number} version The version to be enabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableVersion = (version: number) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tregistryMoveCalls.enableVersion({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, version, Cap: this.#adminCap() },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Disable a specific version\n\t * @param {number} version The version to be disabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableVersion = (version: number) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tregistryMoveCalls.disableVersion({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, version, Cap: this.#adminCap() },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Sets the treasury address where pool creation fees will be sent\n\t * @param {string} treasuryAddress The treasury address\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetTreasuryAddress = (treasuryAddress: string) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tregistryMoveCalls.setTreasuryAddress({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, treasuryAddress, Cap: this.#adminCap() },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Add a coin to whitelist of stable coins\n\t * @param {string} stableCoinKey The name of the stable coin to be added\n\t * @returns A function that takes a Transaction object\n\t */\n\taddStableCoin = (stableCoinKey: string) => (tx: Transaction) => {\n\t\tconst stableCoinType = this.#config.getCoin(stableCoinKey).type;\n\t\ttx.add(\n\t\t\tregistryMoveCalls.addStablecoin({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, Cap: this.#adminCap() },\n\t\t\t\ttypeArguments: [stableCoinType],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Remove a coin from whitelist of stable coins\n\t * @param {string} stableCoinKey The name of the stable coin to be removed\n\t * @returns A function that takes a Transaction object\n\t */\n\tremoveStableCoin = (stableCoinKey: string) => (tx: Transaction) => {\n\t\tconst stableCoinType = this.#config.getCoin(stableCoinKey).type;\n\t\ttx.add(\n\t\t\tregistryMoveCalls.removeStablecoin({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, Cap: this.#adminCap() },\n\t\t\t\ttypeArguments: [stableCoinType],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Adjust the tick size of a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} newTickSize The new tick size\n\t * @returns A function that takes a Transaction object\n\t */\n\tadjustTickSize = (poolKey: string, newTickSize: number) => (tx: Transaction) => {\n\t\ttx.setSenderIfNotSet(this.#config.address);\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\tconst baseScalar = baseCoin.scalar;\n\t\tconst quoteScalar = quoteCoin.scalar;\n\n\t\tconst adjustedTickSize = convertPrice(newTickSize, FLOAT_SCALAR, quoteScalar, baseScalar);\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.adjustTickSizeAdmin({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, newTickSize: adjustedTickSize, Cap: this.#adminCap() },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Adjust the lot size and min size of a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} newLotSize The new lot size\n\t * @param {number} newMinSize The new min size\n\t * @returns A function that takes a Transaction object\n\t */\n\tadjustMinLotSize =\n\t\t(poolKey: string, newLotSize: number, newMinSize: number) => (tx: Transaction) => {\n\t\t\ttx.setSenderIfNotSet(this.#config.address);\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\t\tconst baseScalar = baseCoin.scalar;\n\n\t\t\tconst adjustedLotSize = convertQuantity(newLotSize, baseScalar);\n\t\t\tconst adjustedMinSize = convertQuantity(newMinSize, baseScalar);\n\n\t\t\ttx.add(\n\t\t\t\tpoolMoveCalls.adjustMinLotSizeAdmin({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: pool.address,\n\t\t\t\t\t\tnewLotSize: adjustedLotSize,\n\t\t\t\t\t\tnewMinSize: adjustedMinSize,\n\t\t\t\t\t\tCap: this.#adminCap(),\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Initialize the balance manager map\n\t * @returns A function that takes a Transaction object\n\t */\n\tinitBalanceManagerMap = () => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tregistryMoveCalls.initBalanceManagerMap({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, Cap: this.#adminCap() },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the EWMA parameters for a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {SetEwmaParamsParams} params The parameters to set\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetEwmaParams = (poolKey: string, params: SetEwmaParams) => (tx: Transaction) => {\n\t\tconst { alpha, zScoreThreshold, additionalTakerFee } = params;\n\t\tconst adjustedAlpha = convertRate(alpha, FLOAT_SCALAR);\n\t\tconst adjustedZScoreThreshold = convertRate(zScoreThreshold, FLOAT_SCALAR);\n\t\tconst adjustedAdditionalTakerFee = convertRate(additionalTakerFee, FLOAT_SCALAR);\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.setEwmaParams({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: pool.address,\n\t\t\t\t\tCap: this.#adminCap(),\n\t\t\t\t\talpha: adjustedAlpha,\n\t\t\t\t\tzScoreThreshold: adjustedZScoreThreshold,\n\t\t\t\t\tadditionalTakerFee: adjustedAdditionalTakerFee,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Enable or disable the EWMA state for a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {boolean} enable Whether to enable or disable the EWMA state\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableEwmaState = (poolKey: string, enable: boolean) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.enableEwmaState({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, Cap: this.#adminCap(), enable },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Authorize the MarginApp to access protected features of DeepBook\n\t * @returns A function that takes a Transaction object\n\t */\n\tauthorizeMarginApp = () => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tregistryMoveCalls.authorizeApp({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, AdminCap: this.#adminCap() },\n\t\t\t\ttypeArguments: [`${this.#config.MARGIN_V1}::margin_manager::MarginApp`],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Deauthorize the MarginApp by removing its authorization key\n\t * @returns A function that takes a Transaction object and returns a bool\n\t */\n\tdeauthorizeMarginApp = () => (tx: Transaction) => {\n\t\treturn tx.add(\n\t\t\tregistryMoveCalls.deauthorizeApp({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, AdminCap: this.#adminCap() },\n\t\t\t\ttypeArguments: [`${this.#config.MARGIN_V1}::margin_manager::MarginApp`],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Mint a `DeepbookCorePauseCap`. The new cap's ID is recorded\n\t * in the core registry so it can later disable any allowed package version\n\t * via `disableVersionWithCorePauseCap`. Companion to the margin-side\n\t * `MarginAdminContract.mintPauseCap`.\n\t * @returns A function that takes a Transaction object and returns the new pause cap\n\t */\n\tmintCorePauseCap = () => (tx: Transaction) => {\n\t\treturn tx.add(\n\t\t\tregistryMoveCalls.mintPauseCap({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, Cap: this.#adminCap() },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Revoke a previously minted `DeepbookCorePauseCap` by ID.\n\t * @param {string} pauseCapId The ID of the core pause cap to revoke\n\t * @returns A function that takes a Transaction object\n\t */\n\trevokeCorePauseCap = (pauseCapId: string) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tregistryMoveCalls.revokePauseCap({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, Cap: this.#adminCap(), pauseCapId },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Emergency kill switch — disable any allowed core package\n\t * version (including the current one) using a held `DeepbookCorePauseCap`.\n\t * Re-enable later via `enableVersion`.\n\t * @param {number | bigint} version The version to disable\n\t * @param {string} pauseCapId The ID of the core pause cap to authorize the disable\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableVersionWithCorePauseCap =\n\t\t(version: number | bigint, pauseCapId: string) => (tx: Transaction) => {\n\t\t\ttx.add(\n\t\t\t\tregistryMoveCalls.disableVersionPauseCap({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: { self: this.#config.REGISTRY_ID, version, pauseCap: pauseCapId },\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Get the set of allowed `DeepbookCorePauseCap` IDs from the\n\t * core registry.\n\t * @returns A function that takes a Transaction object and returns a `VecSet<ID>`\n\t */\n\tcorePauseCaps = () => (tx: Transaction) => {\n\t\treturn tx.add(\n\t\t\tregistryMoveCalls.allowedPauseCaps({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID },\n\t\t\t}),\n\t\t);\n\t};\n}\n"],"mappings":";;;;;;;;;AAeA,IAAa,wBAAb,MAAmC;CAClC;;;;CAKA,YAAY,QAAwB;0BAqBjB,YAAmC,OAAoB;AACzE,MAAG,kBAAkB,MAAKA,OAAQ,QAAQ;GAC1C,MAAM,EAAE,aAAa,cAAc,UAAU,SAAS,SAAS,aAAa,eAC3E;GACD,MAAM,WAAW,MAAKA,OAAQ,QAAQ,YAAY;GAClD,MAAM,YAAY,MAAKA,OAAQ,QAAQ,aAAa;GAEpD,MAAM,aAAa,SAAS;GAC5B,MAAM,cAAc,UAAU;GAE9B,MAAM,mBAAmB,aAAa,UAAU,cAAc,aAAa,WAAW;GACtF,MAAM,kBAAkB,gBAAgB,SAAS,WAAW;GAC5D,MAAM,kBAAkB,gBAAgB,SAAS,WAAW;AAE5D,MAAG,IACFC,gBAA8B;IAC7B,SAAS,MAAKD,OAAQ;IACtB,WAAW;KACV,UAAU,MAAKA,OAAQ;KACvB,UAAU;KACV,SAAS;KACT,SAAS;KACT,iBAAiB;KACjB;KACA,KAAK,MAAKE,UAAW;KACrB;IACD,eAAe,CAAC,SAAS,MAAM,UAAU,KAAK;IAC9C,CAAC,CACF;;8BAQqB,aAAqB,OAAoB;GAC/D,MAAM,OAAO,MAAKF,OAAQ,QAAQ,QAAQ;GAC1C,MAAM,WAAW,MAAKA,OAAQ,QAAQ,KAAK,SAAS;GACpD,MAAM,YAAY,MAAKA,OAAQ,QAAQ,KAAK,UAAU;AACtD,MAAG,IACFG,oBAAkC;IACjC,SAAS,MAAKH,OAAQ;IACtB,WAAW;KACV,MAAM,KAAK;KACX,UAAU,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