{"version":3,"file":"balanceManager.mjs","names":["#config","balanceManagerMoveCalls.newWithCustomOwner","deposit","balanceManagerMoveCalls.deposit","balanceManagerMoveCalls.withdraw","balanceManagerMoveCalls.withdrawAll","balanceManagerMoveCalls.balance","balanceManagerMoveCalls.generateProofAsOwner","balanceManagerMoveCalls.generateProofAsTrader","balanceManagerMoveCalls.mintTradeCap","balanceManagerMoveCalls.mintDepositCap","balanceManagerMoveCalls.mintWithdrawCap","balanceManagerMoveCalls.depositWithCap","balanceManagerMoveCalls.withdrawWithCap","balanceManagerMoveCalls.setBalanceManagerReferral","balanceManagerMoveCalls.unsetBalanceManagerReferral","balanceManagerMoveCalls.registerBalanceManager","balanceManagerMoveCalls.owner","balanceManagerMoveCalls.id","balanceManagerMoveCalls.balanceManagerReferralOwner","balanceManagerMoveCalls.balanceManagerReferralPoolId","balanceManagerMoveCalls.getBalanceManagerReferralId","balanceManagerMoveCalls.revokeTradeCap"],"sources":["../../src/transactions/balanceManager.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport { coinWithBalance } from '@mysten/sui/transactions';\nimport type { Transaction, TransactionArgument } from '@mysten/sui/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport { convertQuantity } from '../utils/conversion.js';\nimport * as balanceManagerMoveCalls from '../contracts/deepbook/balance_manager.js';\n\n/**\n * BalanceManagerContract class for managing BalanceManager operations.\n */\nexport class BalanceManagerContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for BalanceManagerContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @description Create and share a new BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreateAndShareBalanceManager = () => (tx: Transaction) => {\n\t\t// NOTE: left as positional moveCalls (not codegen). `balance_manager::new`\n\t\t// is called with no args here, but the generated binding's `new` takes an\n\t\t// `Owner` (the current core source drifted from the deployed zero-arg form);\n\t\t// and `0x2::transfer::public_share_object` is a framework call with no\n\t\t// @deepbook/core binding. Kept verbatim to stay byte-identical.\n\t\tconst manager = tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::new`,\n\t\t});\n\n\t\ttx.moveCall({\n\t\t\ttarget: '0x2::transfer::public_share_object',\n\t\t\targuments: [manager],\n\t\t\ttypeArguments: [`${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::BalanceManager`],\n\t\t});\n\t};\n\n\t/**\n\t * @description Create a new BalanceManager, manually set the owner. Returns the manager.\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreateBalanceManagerWithOwner = (ownerAddress: string) => (tx: Transaction) => {\n\t\treturn tx.add(\n\t\t\tbalanceManagerMoveCalls.newWithCustomOwner({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { owner: ownerAddress },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Share the BalanceManager\n\t * @param {TransactionArgument} manager The BalanceManager to share\n\t * @returns A function that takes a Transaction object\n\t */\n\tshareBalanceManager = (manager: TransactionArgument) => (tx: Transaction) => {\n\t\t// Framework call (`0x2::transfer::public_share_object`) — no @deepbook/core\n\t\t// binding exists, so this stays a positional moveCall.\n\t\ttx.moveCall({\n\t\t\ttarget: '0x2::transfer::public_share_object',\n\t\t\targuments: [manager],\n\t\t\ttypeArguments: [`${this.#config.DEEPBOOK_PACKAGE_ID}::balance_manager::BalanceManager`],\n\t\t});\n\t};\n\n\t/**\n\t * @description Deposit funds into the BalanceManager\n\t * @param {string} managerKey The key of the BalanceManager\n\t * @param {string} coinKey The key of the coin to deposit\n\t * @param {number} amountToDeposit The amount to deposit\n\t * @returns A function that takes a Transaction object\n\t */\n\tdepositIntoManager =\n\t\t(managerKey: string, coinKey: string, amountToDeposit: number) => (tx: Transaction) => {\n\t\t\ttx.setSenderIfNotSet(this.#config.address);\n\t\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst depositInput = convertQuantity(amountToDeposit, coin.scalar);\n\t\t\tconst deposit = coinWithBalance({\n\t\t\t\ttype: coin.type,\n\t\t\t\tbalance: depositInput,\n\t\t\t});\n\n\t\t\ttx.add(\n\t\t\t\tbalanceManagerMoveCalls.deposit({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: { balanceManager: managerId, coin: deposit },\n\t\t\t\t\ttypeArguments: [coin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Withdraw funds from the BalanceManager\n\t * @param {string} managerKey The key of the BalanceManager\n\t * @param {string} coinKey The key of the coin to withdraw\n\t * @param {number} amountToWithdraw The amount to withdraw\n\t * @param {string} recipient The recipient of the withdrawn funds\n\t * @returns A function that takes a Transaction object\n\t */\n\twithdrawFromManager =\n\t\t(managerKey: string, coinKey: string, amountToWithdraw: number, recipient: string) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst withdrawInput = convertQuantity(amountToWithdraw, coin.scalar);\n\t\t\tconst coinObject = tx.add(\n\t\t\t\tbalanceManagerMoveCalls.withdraw({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: { balanceManager: managerId, withdrawAmount: withdrawInput },\n\t\t\t\t\ttypeArguments: [coin.type],\n\t\t\t\t}),\n\t\t\t);\n\n\t\t\ttx.transferObjects([coinObject], recipient);\n\t\t};\n\n\t/**\n\t * @description Withdraw all funds from the BalanceManager\n\t * @param {string} managerKey The key of the BalanceManager\n\t * @param {string} coinKey The key of the coin to withdraw\n\t * @param {string} recipient The recipient of the withdrawn funds\n\t * @returns A function that takes a Transaction object\n\t */\n\twithdrawAllFromManager =\n\t\t(managerKey: string, coinKey: string, recipient: string) => (tx: Transaction) => {\n\t\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst withdrawalCoin = tx.add(\n\t\t\t\tbalanceManagerMoveCalls.withdrawAll({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: { balanceManager: managerId },\n\t\t\t\t\ttypeArguments: [coin.type],\n\t\t\t\t}),\n\t\t\t);\n\n\t\t\ttx.transferObjects([withdrawalCoin], recipient);\n\t\t};\n\n\t/**\n\t * @description Check the balance of the BalanceManager\n\t * @param {string} managerKey The key of the BalanceManager\n\t * @param {string} coinKey The key of the coin to check the balance of\n\t * @returns A function that takes a Transaction object\n\t */\n\tcheckManagerBalance = (managerKey: string, coinKey: string) => (tx: Transaction) => {\n\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\tconst coin = this.#config.getCoin(coinKey);\n\t\ttx.add(\n\t\t\tbalanceManagerMoveCalls.balance({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { balanceManager: managerId },\n\t\t\t\ttypeArguments: [coin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Generate a trade proof for the BalanceManager. Calls the appropriate function based on whether tradeCap is set.\n\t * @param {string} managerKey The key of the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tgenerateProof = (managerKey: string) => (tx: Transaction) => {\n\t\tconst balanceManager = this.#config.getBalanceManager(managerKey);\n\t\treturn tx.add(\n\t\t\tbalanceManager.tradeCap\n\t\t\t\t? this.generateProofAsTrader(balanceManager.address, balanceManager.tradeCap)\n\t\t\t\t: this.generateProofAsOwner(balanceManager.address),\n\t\t);\n\t};\n\n\t/**\n\t * @description Generate a trade proof as the owner\n\t * @param {string} managerId The ID of the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tgenerateProofAsOwner = (managerId: string) => (tx: Transaction) => {\n\t\treturn tx.add(\n\t\t\tbalanceManagerMoveCalls.generateProofAsOwner({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { balanceManager: managerId },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Generate a trade proof as a trader\n\t * @param {string} managerId The ID of the BalanceManager\n\t * @param {string} tradeCapId The ID of the tradeCap\n\t * @returns A function that takes a Transaction object\n\t */\n\tgenerateProofAsTrader = (managerId: string, tradeCapId: string) => (tx: Transaction) => {\n\t\treturn tx.add(\n\t\t\tbalanceManagerMoveCalls.generateProofAsTrader({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { balanceManager: managerId, tradeCap: tradeCapId },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Mint a TradeCap\n\t * @param {string} managerKey The name of the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintTradeCap = (managerKey: string) => (tx: Transaction) => {\n\t\tconst manager = this.#config.getBalanceManager(managerKey);\n\t\tconst managerId = manager.address;\n\t\treturn tx.add(\n\t\t\tbalanceManagerMoveCalls.mintTradeCap({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { balanceManager: managerId },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Mint a DepositCap\n\t * @param {string} managerKey The name of the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintDepositCap = (managerKey: string) => (tx: Transaction) => {\n\t\tconst manager = this.#config.getBalanceManager(managerKey);\n\t\tconst managerId = manager.address;\n\t\treturn tx.add(\n\t\t\tbalanceManagerMoveCalls.mintDepositCap({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { balanceManager: managerId },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Mint a WithdrawalCap\n\t * @param {string} managerKey The name of the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintWithdrawalCap = (managerKey: string) => (tx: Transaction) => {\n\t\tconst manager = this.#config.getBalanceManager(managerKey);\n\t\tconst managerId = manager.address;\n\t\treturn tx.add(\n\t\t\tbalanceManagerMoveCalls.mintWithdrawCap({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { balanceManager: managerId },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Deposit using the DepositCap\n\t * @param {string} managerKey The name of the BalanceManager\n\t * @param {string} coinKey The name of the coin to deposit\n\t * @param {number} amountToDeposit The amount to deposit\n\t * @returns A function that takes a Transaction object\n\t */\n\tdepositWithCap =\n\t\t(managerKey: string, coinKey: string, amountToDeposit: number) => (tx: Transaction) => {\n\t\t\ttx.setSenderIfNotSet(this.#config.address);\n\t\t\tconst manager = this.#config.getBalanceManager(managerKey);\n\t\t\tconst managerId = manager.address;\n\t\t\tif (!manager.depositCap) {\n\t\t\t\tthrow new Error(`DepositCap not set for ${managerKey}`);\n\t\t\t}\n\t\t\tconst depositCapId = manager.depositCap;\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst depositInput = convertQuantity(amountToDeposit, coin.scalar);\n\t\t\tconst deposit = coinWithBalance({\n\t\t\t\ttype: coin.type,\n\t\t\t\tbalance: depositInput,\n\t\t\t});\n\t\t\ttx.add(\n\t\t\t\tbalanceManagerMoveCalls.depositWithCap({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: { balanceManager: managerId, depositCap: depositCapId, coin: deposit },\n\t\t\t\t\ttypeArguments: [coin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Withdraw using the WithdrawCap\n\t * @param {string} managerKey The name of the BalanceManager\n\t * @param {string} coinKey The name of the coin to withdraw\n\t * @param {number} amountToWithdraw The amount to withdraw\n\t * @returns A function that takes a Transaction object\n\t */\n\twithdrawWithCap =\n\t\t(managerKey: string, coinKey: string, amountToWithdraw: number) => (tx: Transaction) => {\n\t\t\ttx.setSenderIfNotSet(this.#config.address);\n\t\t\tconst manager = this.#config.getBalanceManager(managerKey);\n\t\t\tconst managerId = manager.address;\n\t\t\tif (!manager.withdrawCap) {\n\t\t\t\tthrow new Error(`WithdrawCap not set for ${managerKey}`);\n\t\t\t}\n\t\t\tconst withdrawCapId = manager.withdrawCap;\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst withdrawAmount = convertQuantity(amountToWithdraw, coin.scalar);\n\t\t\treturn tx.add(\n\t\t\t\tbalanceManagerMoveCalls.withdrawWithCap({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: { balanceManager: managerId, withdrawCap: withdrawCapId, withdrawAmount },\n\t\t\t\t\ttypeArguments: [coin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Set the referral for the BalanceManager for a specific pool\n\t * @param {string} managerKey The name of the BalanceManager\n\t * @param {string} referral The referral (DeepBookPoolReferral) to set the BalanceManager to\n\t * @param {TransactionArgument} tradeCap The tradeCap for permission checking\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetBalanceManagerReferral =\n\t\t(managerKey: string, referral: string, tradeCap: TransactionArgument) => (tx: Transaction) => {\n\t\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\t\ttx.add(\n\t\t\t\tbalanceManagerMoveCalls.setBalanceManagerReferral({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: { balanceManager: managerId, referral, tradeCap },\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Unset the referral for the BalanceManager for a specific pool\n\t * @param {string} managerKey The name of the BalanceManager\n\t * @param {string} poolKey The key of the pool to unset the referral for\n\t * @param {TransactionArgument} tradeCap The tradeCap for permission checking\n\t * @returns A function that takes a Transaction object\n\t */\n\tunsetBalanceManagerReferral =\n\t\t(managerKey: string, poolKey: string, tradeCap: TransactionArgument) => (tx: Transaction) => {\n\t\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\t\tconst poolId = this.#config.getPool(poolKey).address;\n\t\t\ttx.add(\n\t\t\t\tbalanceManagerMoveCalls.unsetBalanceManagerReferral({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: { balanceManager: managerId, poolId, tradeCap },\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\tregisterBalanceManager = (managerKey: string) => (tx: Transaction) => {\n\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\ttx.add(\n\t\t\tbalanceManagerMoveCalls.registerBalanceManager({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { balanceManager: managerId, registry: this.#config.REGISTRY_ID },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the owner of the BalanceManager\n\t * @param {string} managerKey The key of the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\towner = (managerKey: string) => (tx: Transaction) => {\n\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\ttx.add(\n\t\t\tbalanceManagerMoveCalls.owner({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { balanceManager: managerId },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the ID of the BalanceManager\n\t * @param {string} managerKey The key of the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tid = (managerKey: string) => (tx: Transaction) => {\n\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\ttx.add(\n\t\t\tbalanceManagerMoveCalls.id({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { balanceManager: managerId },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the owner of the referral (DeepBookPoolReferral)\n\t * @param {string} referralId The ID of the referral to get the owner of\n\t * @returns A function that takes a Transaction object\n\t */\n\tbalanceManagerReferralOwner = (referralId: string) => (tx: Transaction) => {\n\t\treturn tx.add(\n\t\t\tbalanceManagerMoveCalls.balanceManagerReferralOwner({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { referral: referralId },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the pool ID associated with a referral (DeepBookPoolReferral)\n\t * @param {string} referralId The ID of the referral to get the pool ID of\n\t * @returns A function that takes a Transaction object\n\t */\n\tbalanceManagerReferralPoolId = (referralId: string) => (tx: Transaction) => {\n\t\treturn tx.add(\n\t\t\tbalanceManagerMoveCalls.balanceManagerReferralPoolId({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { referral: referralId },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the referral ID from the balance manager for a specific pool\n\t * @param {string} managerKey The name of the BalanceManager\n\t * @param {string} poolKey Key of the pool to get the referral for\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetBalanceManagerReferralId = (managerKey: string, poolKey: string) => (tx: Transaction) => {\n\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\tconst poolId = this.#config.getPool(poolKey).address;\n\t\treturn tx.add(\n\t\t\tbalanceManagerMoveCalls.getBalanceManagerReferralId({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { balanceManager: managerId, poolId },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Revoke a TradeCap. This also revokes the associated DepositCap and WithdrawCap.\n\t * @param {string} managerKey The name of the BalanceManager\n\t * @param {string} tradeCapId The ID of the TradeCap to revoke\n\t * @returns A function that takes a Transaction object\n\t */\n\trevokeTradeCap = (managerKey: string, tradeCapId: string) => (tx: Transaction) => {\n\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\t\ttx.add(\n\t\t\tbalanceManagerMoveCalls.revokeTradeCap({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { balanceManager: managerId, tradeCapId },\n\t\t\t}),\n\t\t);\n\t};\n}\n"],"mappings":";;;;;;;;AAYA,IAAa,yBAAb,MAAoC;CACnC;;;;CAKA,YAAY,QAAwB;6CAQE,OAAoB;GAMzD,MAAM,UAAU,GAAG,SAAS,EAC3B,QAAQ,GAAG,MAAKA,OAAQ,oBAAoB,yBAC5C,CAAC;AAEF,MAAG,SAAS;IACX,QAAQ;IACR,WAAW,CAAC,QAAQ;IACpB,eAAe,CAAC,GAAG,MAAKA,OAAQ,oBAAoB,mCAAmC;IACvF,CAAC;;wCAO8B,kBAA0B,OAAoB;AAC9E,UAAO,GAAG,IACTC,mBAA2C;IAC1C,SAAS,MAAKD,OAAQ;IACtB,WAAW,EAAE,OAAO,cAAc;IAClC,CAAC,CACF;;8BAQqB,aAAkC,OAAoB;AAG5E,MAAG,SAAS;IACX,QAAQ;IACR,WAAW,CAAC,QAAQ;IACpB,eAAe,CAAC,GAAG,MAAKA,OAAQ,oBAAoB,mCAAmC;IACvF,CAAC;;6BAWD,YAAoB,SAAiB,qBAA6B,OAAoB;AACtF,MAAG,kBAAkB,MAAKA,OAAQ,QAAQ;GAC1C,MAAM,YAAY,MAAKA,OAAQ,kBAAkB,WAAW,CAAC;GAC7D,MAAM,OAAO,MAAKA,OAAQ,QAAQ,QAAQ;GAC1C,MAAM,eAAe,gBAAgB,iBAAiB,KAAK,OAAO;GAClE,MAAME,YAAU,gBAAgB;IAC/B,MAAM,KAAK;IACX,SAAS;IACT,CAAC;AAEF,MAAG,IACFC,QAAgC;IAC/B,SAAS,MAAKH,OAAQ;IACtB,WAAW;KAAE,gBAAgB;KAAW,MAAME;KAAS;IACvD,eAAe,CAAC,KAAK,KAAK;IAC1B,CAAC,CACF;;8BAYD,Y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