@mento-protocol/mento-sdk 3.0.0-beta.2 → 3.0.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -0
- package/dist/cache/routes.d.ts +13 -0
- package/dist/cache/routes.d.ts.map +1 -0
- package/dist/cache/routes.js +130 -0
- package/dist/cache/routes.js.map +1 -0
- package/dist/cache/tokens.d.ts +67 -0
- package/dist/cache/tokens.d.ts.map +1 -0
- package/dist/cache/tokens.js +379 -0
- package/dist/cache/tokens.js.map +1 -0
- package/dist/core/abis/activePool.d.ts +2 -0
- package/dist/core/abis/activePool.d.ts.map +1 -0
- package/dist/core/abis/activePool.js +14 -0
- package/dist/core/abis/activePool.js.map +1 -0
- package/dist/core/abis/addressesRegistry.d.ts +2 -0
- package/dist/core/abis/addressesRegistry.d.ts.map +1 -0
- package/dist/core/abis/addressesRegistry.js +26 -0
- package/dist/core/abis/addressesRegistry.js.map +1 -0
- package/dist/core/abis/borrowerOperations.d.ts +9 -0
- package/dist/core/abis/borrowerOperations.d.ts.map +1 -0
- package/dist/core/abis/borrowerOperations.js +89 -0
- package/dist/core/abis/borrowerOperations.js.map +1 -0
- package/dist/core/abis/breakerbox.d.ts +13 -0
- package/dist/core/abis/breakerbox.d.ts.map +1 -0
- package/dist/core/abis/breakerbox.js +8 -0
- package/dist/core/abis/breakerbox.js.map +1 -0
- package/dist/core/abis/erc20.d.ts +7 -0
- package/dist/core/abis/erc20.d.ts.map +1 -1
- package/dist/core/abis/erc20.js +7 -0
- package/dist/core/abis/erc20.js.map +1 -1
- package/dist/core/abis/fpmm.d.ts +128 -0
- package/dist/core/abis/fpmm.d.ts.map +1 -1
- package/dist/core/abis/fpmm.js +10 -0
- package/dist/core/abis/fpmm.js.map +1 -1
- package/dist/core/abis/hintHelpers.d.ts +2 -0
- package/dist/core/abis/hintHelpers.d.ts.map +1 -0
- package/dist/core/abis/hintHelpers.js +14 -0
- package/dist/core/abis/hintHelpers.js.map +1 -0
- package/dist/core/abis/index.d.ts +12 -0
- package/dist/core/abis/index.d.ts.map +1 -1
- package/dist/core/abis/index.js +12 -0
- package/dist/core/abis/index.js.map +1 -1
- package/dist/core/abis/multiTroveGetter.d.ts +8 -0
- package/dist/core/abis/multiTroveGetter.d.ts.map +1 -0
- package/dist/core/abis/multiTroveGetter.js +15 -0
- package/dist/core/abis/multiTroveGetter.js.map +1 -0
- package/dist/core/abis/priceFeed.d.ts +7 -0
- package/dist/core/abis/priceFeed.d.ts.map +1 -0
- package/dist/core/abis/priceFeed.js +16 -0
- package/dist/core/abis/priceFeed.js.map +1 -0
- package/dist/core/abis/router.d.ts +436 -1
- package/dist/core/abis/router.d.ts.map +1 -1
- package/dist/core/abis/router.js +13 -0
- package/dist/core/abis/router.js.map +1 -1
- package/dist/core/abis/sortedTroves.d.ts +2 -0
- package/dist/core/abis/sortedTroves.d.ts.map +1 -0
- package/dist/core/abis/sortedTroves.js +15 -0
- package/dist/core/abis/sortedTroves.js.map +1 -0
- package/dist/core/abis/systemParams.d.ts +2 -0
- package/dist/core/abis/systemParams.d.ts.map +1 -0
- package/dist/core/abis/systemParams.js +14 -0
- package/dist/core/abis/systemParams.js.map +1 -0
- package/dist/core/abis/troveManager.d.ts +2 -0
- package/dist/core/abis/troveManager.d.ts.map +1 -0
- package/dist/core/abis/troveManager.js +27 -0
- package/dist/core/abis/troveManager.js.map +1 -0
- package/dist/core/abis/troveNFT.d.ts +2 -0
- package/dist/core/abis/troveNFT.d.ts.map +1 -0
- package/dist/core/abis/troveNFT.js +9 -0
- package/dist/core/abis/troveNFT.js.map +1 -0
- package/dist/core/abis/virtualPool.d.ts +40 -0
- package/dist/core/abis/virtualPool.d.ts.map +1 -1
- package/dist/core/abis/virtualPool.js +6 -1
- package/dist/core/abis/virtualPool.js.map +1 -1
- package/dist/core/abis/virtualPoolFactory.d.ts +8 -0
- package/dist/core/abis/virtualPoolFactory.d.ts.map +1 -1
- package/dist/core/abis/virtualPoolFactory.js +1 -0
- package/dist/core/abis/virtualPoolFactory.js.map +1 -1
- package/dist/core/constants/aaveConfig.js +2 -2
- package/dist/core/constants/addresses.d.ts.map +1 -1
- package/dist/core/constants/addresses.js +9 -4
- package/dist/core/constants/addresses.js.map +1 -1
- package/dist/core/constants/borrowConstants.d.ts +10 -0
- package/dist/core/constants/borrowConstants.d.ts.map +1 -0
- package/dist/core/constants/borrowConstants.js +16 -0
- package/dist/core/constants/borrowConstants.js.map +1 -0
- package/dist/core/constants/borrowRegistries.d.ts +7 -0
- package/dist/core/constants/borrowRegistries.d.ts.map +1 -0
- package/dist/core/constants/borrowRegistries.js +31 -0
- package/dist/core/constants/borrowRegistries.js.map +1 -0
- package/dist/core/constants/index.d.ts +2 -0
- package/dist/core/constants/index.d.ts.map +1 -1
- package/dist/core/constants/index.js +2 -0
- package/dist/core/constants/index.js.map +1 -1
- package/dist/core/errors/index.d.ts +1 -0
- package/dist/core/errors/index.d.ts.map +1 -1
- package/dist/core/errors/index.js +1 -0
- package/dist/core/errors/index.js.map +1 -1
- package/dist/core/errors/oracle.d.ts +9 -0
- package/dist/core/errors/oracle.d.ts.map +1 -0
- package/dist/core/errors/oracle.js +15 -0
- package/dist/core/errors/oracle.js.map +1 -0
- package/dist/core/errors/router.d.ts +6 -0
- package/dist/core/errors/router.d.ts.map +1 -1
- package/dist/core/errors/router.js +11 -1
- package/dist/core/errors/router.js.map +1 -1
- package/dist/core/types/borrow.d.ts +87 -0
- package/dist/core/types/borrow.d.ts.map +1 -0
- package/dist/core/types/borrow.js +3 -0
- package/dist/core/types/borrow.js.map +1 -0
- package/dist/core/types/contractAddresses.d.ts +2 -0
- package/dist/core/types/contractAddresses.d.ts.map +1 -1
- package/dist/core/types/index.d.ts +5 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/core/types/index.js +5 -1
- package/dist/core/types/index.js.map +1 -1
- package/dist/core/types/liquidity.d.ts +117 -0
- package/dist/core/types/liquidity.d.ts.map +1 -0
- package/dist/core/types/liquidity.js +3 -0
- package/dist/core/types/liquidity.js.map +1 -0
- package/dist/core/types/pool.d.ts +110 -0
- package/dist/core/types/pool.d.ts.map +1 -1
- package/dist/core/types/provider.d.ts.map +1 -1
- package/dist/core/types/provider.js +0 -1
- package/dist/core/types/provider.js.map +1 -1
- package/dist/core/types/route.d.ts +3 -3
- package/dist/core/types/route.d.ts.map +1 -1
- package/dist/core/types/token.d.ts +13 -3
- package/dist/core/types/token.d.ts.map +1 -1
- package/dist/core/types/tradingLimits.d.ts +91 -0
- package/dist/core/types/tradingLimits.d.ts.map +1 -0
- package/dist/core/types/tradingLimits.js +3 -0
- package/dist/core/types/tradingLimits.js.map +1 -0
- package/dist/core/types/tradingMode.d.ts +24 -0
- package/dist/core/types/tradingMode.d.ts.map +1 -0
- package/dist/core/types/tradingMode.js +31 -0
- package/dist/core/types/tradingMode.js.map +1 -0
- package/dist/core/types/transaction.d.ts +45 -0
- package/dist/core/types/transaction.d.ts.map +1 -0
- package/dist/core/types/transaction.js +3 -0
- package/dist/core/types/transaction.js.map +1 -0
- package/dist/index.d.ts +34 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +47 -10
- package/dist/index.js.map +1 -1
- package/dist/services/borrow/BorrowService.d.ts +54 -0
- package/dist/services/borrow/BorrowService.d.ts.map +1 -0
- package/dist/services/borrow/BorrowService.js +129 -0
- package/dist/services/borrow/BorrowService.js.map +1 -0
- package/dist/services/borrow/borrowHelpers.d.ts +4 -0
- package/dist/services/borrow/borrowHelpers.d.ts.map +1 -0
- package/dist/services/borrow/borrowHelpers.js +13 -0
- package/dist/services/borrow/borrowHelpers.js.map +1 -0
- package/dist/services/borrow/borrowMath.d.ts +13 -0
- package/dist/services/borrow/borrowMath.d.ts.map +1 -0
- package/dist/services/borrow/borrowMath.js +129 -0
- package/dist/services/borrow/borrowMath.js.map +1 -0
- package/dist/services/borrow/index.d.ts +2 -0
- package/dist/services/borrow/index.d.ts.map +1 -0
- package/dist/services/borrow/index.js +18 -0
- package/dist/services/borrow/index.js.map +1 -0
- package/dist/services/borrow/internal/borrowApprovalService.d.ts +14 -0
- package/dist/services/borrow/internal/borrowApprovalService.d.ts.map +1 -0
- package/dist/services/borrow/internal/borrowApprovalService.js +53 -0
- package/dist/services/borrow/internal/borrowApprovalService.js.map +1 -0
- package/dist/services/borrow/internal/borrowContextStore.d.ts +11 -0
- package/dist/services/borrow/internal/borrowContextStore.d.ts.map +1 -0
- package/dist/services/borrow/internal/borrowContextStore.js +40 -0
- package/dist/services/borrow/internal/borrowContextStore.js.map +1 -0
- package/dist/services/borrow/internal/borrowErc20.d.ts +5 -0
- package/dist/services/borrow/internal/borrowErc20.d.ts.map +1 -0
- package/dist/services/borrow/internal/borrowErc20.js +43 -0
- package/dist/services/borrow/internal/borrowErc20.js.map +1 -0
- package/dist/services/borrow/internal/borrowHints.d.ts +7 -0
- package/dist/services/borrow/internal/borrowHints.d.ts.map +1 -0
- package/dist/services/borrow/internal/borrowHints.js +31 -0
- package/dist/services/borrow/internal/borrowHints.js.map +1 -0
- package/dist/services/borrow/internal/borrowPositionParser.d.ts +4 -0
- package/dist/services/borrow/internal/borrowPositionParser.d.ts.map +1 -0
- package/dist/services/borrow/internal/borrowPositionParser.js +87 -0
- package/dist/services/borrow/internal/borrowPositionParser.js.map +1 -0
- package/dist/services/borrow/internal/borrowReadService.d.ts +28 -0
- package/dist/services/borrow/internal/borrowReadService.d.ts.map +1 -0
- package/dist/services/borrow/internal/borrowReadService.js +218 -0
- package/dist/services/borrow/internal/borrowReadService.js.map +1 -0
- package/dist/services/borrow/internal/borrowRegistryReader.d.ts +5 -0
- package/dist/services/borrow/internal/borrowRegistryReader.d.ts.map +1 -0
- package/dist/services/borrow/internal/borrowRegistryReader.js +96 -0
- package/dist/services/borrow/internal/borrowRegistryReader.js.map +1 -0
- package/dist/services/borrow/internal/borrowTransactionService.d.ts +23 -0
- package/dist/services/borrow/internal/borrowTransactionService.d.ts.map +1 -0
- package/dist/services/borrow/internal/borrowTransactionService.js +276 -0
- package/dist/services/borrow/internal/borrowTransactionService.js.map +1 -0
- package/dist/services/borrow/internal/borrowTypes.d.ts +15 -0
- package/dist/services/borrow/internal/borrowTypes.d.ts.map +1 -0
- package/dist/services/borrow/internal/borrowTypes.js +3 -0
- package/dist/services/borrow/internal/borrowTypes.js.map +1 -0
- package/dist/services/borrow/internal/borrowValidation.d.ts +13 -0
- package/dist/services/borrow/internal/borrowValidation.d.ts.map +1 -0
- package/dist/services/borrow/internal/borrowValidation.js +96 -0
- package/dist/services/borrow/internal/borrowValidation.js.map +1 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +2 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/liquidity/LiquidityService.d.ts +154 -0
- package/dist/services/liquidity/LiquidityService.d.ts.map +1 -0
- package/dist/services/liquidity/LiquidityService.js +184 -0
- package/dist/services/liquidity/LiquidityService.js.map +1 -0
- package/dist/services/liquidity/basicLiquidity.d.ts +11 -0
- package/dist/services/liquidity/basicLiquidity.d.ts.map +1 -0
- package/dist/services/liquidity/basicLiquidity.js +172 -0
- package/dist/services/liquidity/basicLiquidity.js.map +1 -0
- package/dist/services/liquidity/index.d.ts +2 -0
- package/dist/services/liquidity/index.d.ts.map +1 -0
- package/dist/services/liquidity/index.js +18 -0
- package/dist/services/liquidity/index.js.map +1 -0
- package/dist/services/liquidity/liquidityHelpers.d.ts +13 -0
- package/dist/services/liquidity/liquidityHelpers.d.ts.map +1 -0
- package/dist/services/liquidity/liquidityHelpers.js +74 -0
- package/dist/services/liquidity/liquidityHelpers.js.map +1 -0
- package/dist/services/liquidity/zapHelpers.d.ts +66 -0
- package/dist/services/liquidity/zapHelpers.d.ts.map +1 -0
- package/dist/services/liquidity/zapHelpers.js +133 -0
- package/dist/services/liquidity/zapHelpers.js.map +1 -0
- package/dist/services/liquidity/zapIn.d.ts +17 -0
- package/dist/services/liquidity/zapIn.d.ts.map +1 -0
- package/dist/services/liquidity/zapIn.js +125 -0
- package/dist/services/liquidity/zapIn.js.map +1 -0
- package/dist/services/liquidity/zapOut.d.ts +17 -0
- package/dist/services/liquidity/zapOut.d.ts.map +1 -0
- package/dist/services/liquidity/zapOut.js +242 -0
- package/dist/services/liquidity/zapOut.js.map +1 -0
- package/dist/services/pools/PoolService.d.ts +35 -10
- package/dist/services/pools/PoolService.d.ts.map +1 -1
- package/dist/services/pools/PoolService.js +61 -109
- package/dist/services/pools/PoolService.js.map +1 -1
- package/dist/services/pools/poolDetails.d.ts +11 -0
- package/dist/services/pools/poolDetails.d.ts.map +1 -0
- package/dist/services/pools/poolDetails.js +145 -0
- package/dist/services/pools/poolDetails.js.map +1 -0
- package/dist/services/pools/poolDiscovery.d.ts +12 -0
- package/dist/services/pools/poolDiscovery.d.ts.map +1 -0
- package/dist/services/pools/poolDiscovery.js +114 -0
- package/dist/services/pools/poolDiscovery.js.map +1 -0
- package/dist/services/quotes/QuoteService.d.ts +21 -12
- package/dist/services/quotes/QuoteService.d.ts.map +1 -1
- package/dist/services/quotes/QuoteService.js +41 -17
- package/dist/services/quotes/QuoteService.js.map +1 -1
- package/dist/services/routes/RouteService.d.ts +3 -3
- package/dist/services/routes/RouteService.d.ts.map +1 -1
- package/dist/services/routes/RouteService.js +3 -5
- package/dist/services/routes/RouteService.js.map +1 -1
- package/dist/services/swap/SwapService.d.ts +23 -19
- package/dist/services/swap/SwapService.d.ts.map +1 -1
- package/dist/services/swap/SwapService.js +36 -15
- package/dist/services/swap/SwapService.js.map +1 -1
- package/dist/services/tokens/supplyAdjustmentService.d.ts +0 -4
- package/dist/services/tokens/supplyAdjustmentService.d.ts.map +1 -1
- package/dist/services/tokens/supplyAdjustmentService.js +3 -8
- package/dist/services/tokens/supplyAdjustmentService.js.map +1 -1
- package/dist/services/tokens/tokenService.d.ts.map +1 -1
- package/dist/services/tokens/tokenService.js +2 -2
- package/dist/services/tokens/tokenService.js.map +1 -1
- package/dist/services/trading/TradingLimitsService.d.ts +38 -0
- package/dist/services/trading/TradingLimitsService.d.ts.map +1 -0
- package/dist/services/trading/TradingLimitsService.js +157 -0
- package/dist/services/trading/TradingLimitsService.js.map +1 -0
- package/dist/services/trading/TradingService.d.ts +110 -0
- package/dist/services/trading/TradingService.d.ts.map +1 -0
- package/dist/services/trading/TradingService.js +162 -0
- package/dist/services/trading/TradingService.js.map +1 -0
- package/dist/services/trading/index.d.ts +3 -0
- package/dist/services/trading/index.d.ts.map +1 -0
- package/dist/services/trading/index.js +19 -0
- package/dist/services/trading/index.js.map +1 -0
- package/dist/utils/costUtils.js +4 -4
- package/dist/utils/costUtils.js.map +1 -1
- package/dist/utils/deadline.d.ts +21 -0
- package/dist/utils/deadline.d.ts.map +1 -0
- package/dist/utils/deadline.js +26 -0
- package/dist/utils/deadline.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/pathEncoder.d.ts +8 -2
- package/dist/utils/pathEncoder.d.ts.map +1 -1
- package/dist/utils/pathEncoder.js +19 -3
- package/dist/utils/pathEncoder.js.map +1 -1
- package/dist/utils/rateFeed.d.ts +18 -0
- package/dist/utils/rateFeed.d.ts.map +1 -0
- package/dist/utils/rateFeed.js +27 -0
- package/dist/utils/rateFeed.js.map +1 -0
- package/dist/utils/routeUtils.d.ts +53 -53
- package/dist/utils/routeUtils.d.ts.map +1 -1
- package/dist/utils/routeUtils.js +41 -41
- package/dist/utils/routeUtils.js.map +1 -1
- package/dist/utils/routes.d.ts +2 -8
- package/dist/utils/routes.d.ts.map +1 -1
- package/dist/utils/routes.js +5 -46
- package/dist/utils/routes.js.map +1 -1
- package/dist/utils/tokens.d.ts +1 -77
- package/dist/utils/tokens.d.ts.map +1 -1
- package/dist/utils/tokens.js +10 -178
- package/dist/utils/tokens.js.map +1 -1
- package/dist/utils/tradingLimits.d.ts +41 -0
- package/dist/utils/tradingLimits.d.ts.map +1 -0
- package/dist/utils/tradingLimits.js +171 -0
- package/dist/utils/tradingLimits.js.map +1 -0
- package/dist/utils/validation.d.ts +19 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +34 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +3 -1
- package/dist/cache/routes.11142220.js +0 -1
- package/dist/cache/routes.42220.d.ts +0 -3
- package/dist/cache/routes.42220.d.ts.map +0 -1
- package/dist/cache/routes.42220.js +0 -112
- package/dist/cache/routes.42220.js.map +0 -1
- package/dist/cache/tokens.11142220.d.ts +0 -3
- package/dist/cache/tokens.11142220.d.ts.map +0 -1
- package/dist/cache/tokens.11142220.js +0 -129
- package/dist/cache/tokens.11142220.js.map +0 -1
- package/dist/cache/tokens.42220.d.ts +0 -3
- package/dist/cache/tokens.42220.d.ts.map +0 -1
- package/dist/cache/tokens.42220.js +0 -129
- package/dist/cache/tokens.42220.js.map +0 -1
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BorrowTransactionService = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const abis_1 = require("../../../core/abis");
|
|
6
|
+
const borrowHints_1 = require("./borrowHints");
|
|
7
|
+
const borrowValidation_1 = require("./borrowValidation");
|
|
8
|
+
const ZERO_VALUE_HEX = '0x0';
|
|
9
|
+
class BorrowTransactionService {
|
|
10
|
+
constructor(publicClient) {
|
|
11
|
+
this.publicClient = publicClient;
|
|
12
|
+
}
|
|
13
|
+
async buildOpenTroveTransaction(ctx, params) {
|
|
14
|
+
const owner = (0, borrowValidation_1.requireAddress)(params.owner, 'owner');
|
|
15
|
+
const ownerIndex = (0, borrowValidation_1.requireNonNegativeInteger)(params.ownerIndex, 'ownerIndex');
|
|
16
|
+
const collAmount = (0, borrowValidation_1.requirePositiveBigInt)(params.collAmount, 'collAmount');
|
|
17
|
+
const boldAmount = (0, borrowValidation_1.requirePositiveBigInt)(params.boldAmount, 'boldAmount');
|
|
18
|
+
const annualInterestRate = (0, borrowValidation_1.requireNonNegativeBigInt)(params.annualInterestRate, 'annualInterestRate');
|
|
19
|
+
const maxUpfrontFee = (0, borrowValidation_1.requireNonNegativeBigInt)(params.maxUpfrontFee, 'maxUpfrontFee');
|
|
20
|
+
const addManager = (0, borrowValidation_1.optionalAddressOrZero)(params.addManager, 'addManager');
|
|
21
|
+
const removeManager = (0, borrowValidation_1.optionalAddressOrZero)(params.removeManager, 'removeManager');
|
|
22
|
+
const receiver = (0, borrowValidation_1.optionalAddressOrZero)(params.receiver, 'receiver');
|
|
23
|
+
const hints = await (0, borrowHints_1.getTroveOperationHints)(this.publicClient, ctx, annualInterestRate);
|
|
24
|
+
const data = params.interestBatchManager
|
|
25
|
+
? (0, viem_1.encodeFunctionData)({
|
|
26
|
+
abi: abis_1.BORROWER_OPERATIONS_ABI,
|
|
27
|
+
functionName: 'openTroveAndJoinInterestBatchManager',
|
|
28
|
+
args: [
|
|
29
|
+
{
|
|
30
|
+
owner,
|
|
31
|
+
ownerIndex: BigInt(ownerIndex),
|
|
32
|
+
collAmount,
|
|
33
|
+
boldAmount,
|
|
34
|
+
upperHint: hints.upper,
|
|
35
|
+
lowerHint: hints.lower,
|
|
36
|
+
interestBatchManager: (0, borrowValidation_1.requireAddress)(params.interestBatchManager, 'interestBatchManager'),
|
|
37
|
+
maxUpfrontFee,
|
|
38
|
+
addManager,
|
|
39
|
+
removeManager,
|
|
40
|
+
receiver,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
})
|
|
44
|
+
: (0, viem_1.encodeFunctionData)({
|
|
45
|
+
abi: abis_1.BORROWER_OPERATIONS_ABI,
|
|
46
|
+
functionName: 'openTrove',
|
|
47
|
+
args: [
|
|
48
|
+
owner,
|
|
49
|
+
BigInt(ownerIndex),
|
|
50
|
+
collAmount,
|
|
51
|
+
boldAmount,
|
|
52
|
+
hints.upper,
|
|
53
|
+
hints.lower,
|
|
54
|
+
annualInterestRate,
|
|
55
|
+
maxUpfrontFee,
|
|
56
|
+
addManager,
|
|
57
|
+
removeManager,
|
|
58
|
+
receiver,
|
|
59
|
+
],
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
to: ctx.addresses.borrowerOperations,
|
|
63
|
+
data,
|
|
64
|
+
value: ZERO_VALUE_HEX,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
buildAdjustTroveTransaction(ctx, params) {
|
|
68
|
+
const troveId = (0, borrowValidation_1.parseTroveId)(params.troveId);
|
|
69
|
+
const collChange = (0, borrowValidation_1.requireNonNegativeBigInt)(params.collChange, 'collChange');
|
|
70
|
+
const debtChange = (0, borrowValidation_1.requireNonNegativeBigInt)(params.debtChange, 'debtChange');
|
|
71
|
+
const maxUpfrontFee = (0, borrowValidation_1.requireNonNegativeBigInt)(params.maxUpfrontFee, 'maxUpfrontFee');
|
|
72
|
+
const data = (0, viem_1.encodeFunctionData)({
|
|
73
|
+
abi: abis_1.BORROWER_OPERATIONS_ABI,
|
|
74
|
+
functionName: 'adjustTrove',
|
|
75
|
+
args: [troveId, collChange, params.isCollIncrease, debtChange, params.isDebtIncrease, maxUpfrontFee],
|
|
76
|
+
});
|
|
77
|
+
return { to: ctx.addresses.borrowerOperations, data, value: ZERO_VALUE_HEX };
|
|
78
|
+
}
|
|
79
|
+
async buildAdjustZombieTroveTransaction(ctx, params) {
|
|
80
|
+
const troveId = (0, borrowValidation_1.parseTroveId)(params.troveId);
|
|
81
|
+
const collChange = (0, borrowValidation_1.requireNonNegativeBigInt)(params.collChange, 'collChange');
|
|
82
|
+
const debtChange = (0, borrowValidation_1.requireNonNegativeBigInt)(params.debtChange, 'debtChange');
|
|
83
|
+
const maxUpfrontFee = (0, borrowValidation_1.requireNonNegativeBigInt)(params.maxUpfrontFee, 'maxUpfrontFee');
|
|
84
|
+
const currentRate = (await this.publicClient.readContract({
|
|
85
|
+
address: ctx.addresses.troveManager,
|
|
86
|
+
abi: abis_1.TROVE_MANAGER_ABI,
|
|
87
|
+
functionName: 'getTroveAnnualInterestRate',
|
|
88
|
+
args: [troveId],
|
|
89
|
+
}));
|
|
90
|
+
const hints = await (0, borrowHints_1.getTroveOperationHints)(this.publicClient, ctx, currentRate);
|
|
91
|
+
const data = (0, viem_1.encodeFunctionData)({
|
|
92
|
+
abi: abis_1.BORROWER_OPERATIONS_ABI,
|
|
93
|
+
functionName: 'adjustZombieTrove',
|
|
94
|
+
args: [
|
|
95
|
+
troveId,
|
|
96
|
+
collChange,
|
|
97
|
+
params.isCollIncrease,
|
|
98
|
+
debtChange,
|
|
99
|
+
params.isDebtIncrease,
|
|
100
|
+
hints.upper,
|
|
101
|
+
hints.lower,
|
|
102
|
+
maxUpfrontFee,
|
|
103
|
+
],
|
|
104
|
+
});
|
|
105
|
+
return { to: ctx.addresses.borrowerOperations, data, value: ZERO_VALUE_HEX };
|
|
106
|
+
}
|
|
107
|
+
buildCloseTroveTransaction(ctx, troveId) {
|
|
108
|
+
const parsedTroveId = (0, borrowValidation_1.parseTroveId)(troveId);
|
|
109
|
+
const data = (0, viem_1.encodeFunctionData)({
|
|
110
|
+
abi: abis_1.BORROWER_OPERATIONS_ABI,
|
|
111
|
+
functionName: 'closeTrove',
|
|
112
|
+
args: [parsedTroveId],
|
|
113
|
+
});
|
|
114
|
+
return { to: ctx.addresses.borrowerOperations, data, value: ZERO_VALUE_HEX };
|
|
115
|
+
}
|
|
116
|
+
buildAddCollTransaction(ctx, troveId, amount) {
|
|
117
|
+
const parsedTroveId = (0, borrowValidation_1.parseTroveId)(troveId);
|
|
118
|
+
const collAmount = (0, borrowValidation_1.requirePositiveBigInt)(amount, 'amount');
|
|
119
|
+
const data = (0, viem_1.encodeFunctionData)({
|
|
120
|
+
abi: abis_1.BORROWER_OPERATIONS_ABI,
|
|
121
|
+
functionName: 'addColl',
|
|
122
|
+
args: [parsedTroveId, collAmount],
|
|
123
|
+
});
|
|
124
|
+
return { to: ctx.addresses.borrowerOperations, data, value: ZERO_VALUE_HEX };
|
|
125
|
+
}
|
|
126
|
+
buildWithdrawCollTransaction(ctx, troveId, amount) {
|
|
127
|
+
const parsedTroveId = (0, borrowValidation_1.parseTroveId)(troveId);
|
|
128
|
+
const collAmount = (0, borrowValidation_1.requirePositiveBigInt)(amount, 'amount');
|
|
129
|
+
const data = (0, viem_1.encodeFunctionData)({
|
|
130
|
+
abi: abis_1.BORROWER_OPERATIONS_ABI,
|
|
131
|
+
functionName: 'withdrawColl',
|
|
132
|
+
args: [parsedTroveId, collAmount],
|
|
133
|
+
});
|
|
134
|
+
return { to: ctx.addresses.borrowerOperations, data, value: ZERO_VALUE_HEX };
|
|
135
|
+
}
|
|
136
|
+
buildBorrowMoreTransaction(ctx, troveId, amount, maxFee) {
|
|
137
|
+
const parsedTroveId = (0, borrowValidation_1.parseTroveId)(troveId);
|
|
138
|
+
const borrowAmount = (0, borrowValidation_1.requirePositiveBigInt)(amount, 'amount');
|
|
139
|
+
const maxUpfrontFee = (0, borrowValidation_1.requireNonNegativeBigInt)(maxFee, 'maxFee');
|
|
140
|
+
const data = (0, viem_1.encodeFunctionData)({
|
|
141
|
+
abi: abis_1.BORROWER_OPERATIONS_ABI,
|
|
142
|
+
functionName: 'withdrawBold',
|
|
143
|
+
args: [parsedTroveId, borrowAmount, maxUpfrontFee],
|
|
144
|
+
});
|
|
145
|
+
return { to: ctx.addresses.borrowerOperations, data, value: ZERO_VALUE_HEX };
|
|
146
|
+
}
|
|
147
|
+
buildRepayDebtTransaction(ctx, troveId, amount) {
|
|
148
|
+
const parsedTroveId = (0, borrowValidation_1.parseTroveId)(troveId);
|
|
149
|
+
const repayAmount = (0, borrowValidation_1.requirePositiveBigInt)(amount, 'amount');
|
|
150
|
+
const data = (0, viem_1.encodeFunctionData)({
|
|
151
|
+
abi: abis_1.BORROWER_OPERATIONS_ABI,
|
|
152
|
+
functionName: 'repayBold',
|
|
153
|
+
args: [parsedTroveId, repayAmount],
|
|
154
|
+
});
|
|
155
|
+
return { to: ctx.addresses.borrowerOperations, data, value: ZERO_VALUE_HEX };
|
|
156
|
+
}
|
|
157
|
+
async buildAdjustInterestRateTransaction(ctx, troveId, newRate, maxFee) {
|
|
158
|
+
const parsedTroveId = (0, borrowValidation_1.parseTroveId)(troveId);
|
|
159
|
+
const newAnnualInterestRate = (0, borrowValidation_1.requireNonNegativeBigInt)(newRate, 'newRate');
|
|
160
|
+
const maxUpfrontFee = (0, borrowValidation_1.requireNonNegativeBigInt)(maxFee, 'maxFee');
|
|
161
|
+
const hints = await (0, borrowHints_1.getTroveOperationHints)(this.publicClient, ctx, newAnnualInterestRate);
|
|
162
|
+
const data = (0, viem_1.encodeFunctionData)({
|
|
163
|
+
abi: abis_1.BORROWER_OPERATIONS_ABI,
|
|
164
|
+
functionName: 'adjustTroveInterestRate',
|
|
165
|
+
args: [parsedTroveId, newAnnualInterestRate, hints.upper, hints.lower, maxUpfrontFee],
|
|
166
|
+
});
|
|
167
|
+
return { to: ctx.addresses.borrowerOperations, data, value: ZERO_VALUE_HEX };
|
|
168
|
+
}
|
|
169
|
+
buildClaimCollateralTransaction(ctx) {
|
|
170
|
+
const data = (0, viem_1.encodeFunctionData)({
|
|
171
|
+
abi: abis_1.BORROWER_OPERATIONS_ABI,
|
|
172
|
+
functionName: 'claimCollateral',
|
|
173
|
+
args: [],
|
|
174
|
+
});
|
|
175
|
+
return { to: ctx.addresses.borrowerOperations, data, value: ZERO_VALUE_HEX };
|
|
176
|
+
}
|
|
177
|
+
async buildSetBatchManagerTransaction(ctx, troveId, manager, maxFee) {
|
|
178
|
+
const parsedTroveId = (0, borrowValidation_1.parseTroveId)(troveId);
|
|
179
|
+
const newBatchManager = (0, borrowValidation_1.requireAddress)(manager, 'manager');
|
|
180
|
+
const maxUpfrontFee = (0, borrowValidation_1.requireNonNegativeBigInt)(maxFee, 'maxFee');
|
|
181
|
+
const currentRate = (await this.publicClient.readContract({
|
|
182
|
+
address: ctx.addresses.troveManager,
|
|
183
|
+
abi: abis_1.TROVE_MANAGER_ABI,
|
|
184
|
+
functionName: 'getTroveAnnualInterestRate',
|
|
185
|
+
args: [parsedTroveId],
|
|
186
|
+
}));
|
|
187
|
+
const hints = await (0, borrowHints_1.getTroveOperationHints)(this.publicClient, ctx, currentRate);
|
|
188
|
+
const data = (0, viem_1.encodeFunctionData)({
|
|
189
|
+
abi: abis_1.BORROWER_OPERATIONS_ABI,
|
|
190
|
+
functionName: 'setInterestBatchManager',
|
|
191
|
+
args: [parsedTroveId, newBatchManager, hints.upper, hints.lower, maxUpfrontFee],
|
|
192
|
+
});
|
|
193
|
+
return { to: ctx.addresses.borrowerOperations, data, value: ZERO_VALUE_HEX };
|
|
194
|
+
}
|
|
195
|
+
async buildRemoveFromBatchTransaction(ctx, troveId, newRate, maxFee) {
|
|
196
|
+
const parsedTroveId = (0, borrowValidation_1.parseTroveId)(troveId);
|
|
197
|
+
const newAnnualInterestRate = (0, borrowValidation_1.requireNonNegativeBigInt)(newRate, 'newRate');
|
|
198
|
+
const maxUpfrontFee = (0, borrowValidation_1.requireNonNegativeBigInt)(maxFee, 'maxFee');
|
|
199
|
+
const hints = await (0, borrowHints_1.getTroveOperationHints)(this.publicClient, ctx, newAnnualInterestRate);
|
|
200
|
+
const data = (0, viem_1.encodeFunctionData)({
|
|
201
|
+
abi: abis_1.BORROWER_OPERATIONS_ABI,
|
|
202
|
+
functionName: 'removeFromBatch',
|
|
203
|
+
args: [parsedTroveId, newAnnualInterestRate, hints.upper, hints.lower, maxUpfrontFee],
|
|
204
|
+
});
|
|
205
|
+
return { to: ctx.addresses.borrowerOperations, data, value: ZERO_VALUE_HEX };
|
|
206
|
+
}
|
|
207
|
+
async buildSwitchBatchManagerTransaction(ctx, troveId, newManager, maxFee) {
|
|
208
|
+
const parsedTroveId = (0, borrowValidation_1.parseTroveId)(troveId);
|
|
209
|
+
const managerAddress = (0, borrowValidation_1.requireAddress)(newManager, 'newManager');
|
|
210
|
+
const maxUpfrontFee = (0, borrowValidation_1.requireNonNegativeBigInt)(maxFee, 'maxFee');
|
|
211
|
+
const currentRate = (await this.publicClient.readContract({
|
|
212
|
+
address: ctx.addresses.troveManager,
|
|
213
|
+
abi: abis_1.TROVE_MANAGER_ABI,
|
|
214
|
+
functionName: 'getTroveAnnualInterestRate',
|
|
215
|
+
args: [parsedTroveId],
|
|
216
|
+
}));
|
|
217
|
+
const [removeHints, addHints] = await Promise.all([
|
|
218
|
+
(0, borrowHints_1.getTroveOperationHints)(this.publicClient, ctx, currentRate),
|
|
219
|
+
(0, borrowHints_1.getTroveOperationHints)(this.publicClient, ctx, currentRate),
|
|
220
|
+
]);
|
|
221
|
+
const data = (0, viem_1.encodeFunctionData)({
|
|
222
|
+
abi: abis_1.BORROWER_OPERATIONS_ABI,
|
|
223
|
+
functionName: 'switchBatchManager',
|
|
224
|
+
args: [
|
|
225
|
+
parsedTroveId,
|
|
226
|
+
removeHints.upper,
|
|
227
|
+
removeHints.lower,
|
|
228
|
+
managerAddress,
|
|
229
|
+
addHints.upper,
|
|
230
|
+
addHints.lower,
|
|
231
|
+
maxUpfrontFee,
|
|
232
|
+
],
|
|
233
|
+
});
|
|
234
|
+
return { to: ctx.addresses.borrowerOperations, data, value: ZERO_VALUE_HEX };
|
|
235
|
+
}
|
|
236
|
+
async buildSetInterestDelegateTransaction(ctx, troveId, delegate, minRate, maxRate, newRate, maxFee, minChangePeriod) {
|
|
237
|
+
const parsedTroveId = (0, borrowValidation_1.parseTroveId)(troveId);
|
|
238
|
+
const delegateAddress = (0, borrowValidation_1.requireAddress)(delegate, 'delegate');
|
|
239
|
+
const minInterestRate = (0, borrowValidation_1.requireUint128)(minRate, 'minRate');
|
|
240
|
+
const maxInterestRate = (0, borrowValidation_1.requireUint128)(maxRate, 'maxRate');
|
|
241
|
+
const newAnnualInterestRate = (0, borrowValidation_1.requireNonNegativeBigInt)(newRate, 'newRate');
|
|
242
|
+
const maxUpfrontFee = (0, borrowValidation_1.requireNonNegativeBigInt)(maxFee, 'maxFee');
|
|
243
|
+
const minRateChangePeriod = (0, borrowValidation_1.requireNonNegativeBigInt)(minChangePeriod, 'minChangePeriod');
|
|
244
|
+
if (minInterestRate > maxInterestRate) {
|
|
245
|
+
throw new Error('minRate cannot be greater than maxRate');
|
|
246
|
+
}
|
|
247
|
+
const hints = await (0, borrowHints_1.getTroveOperationHints)(this.publicClient, ctx, newAnnualInterestRate);
|
|
248
|
+
const data = (0, viem_1.encodeFunctionData)({
|
|
249
|
+
abi: abis_1.BORROWER_OPERATIONS_ABI,
|
|
250
|
+
functionName: 'setInterestIndividualDelegate',
|
|
251
|
+
args: [
|
|
252
|
+
parsedTroveId,
|
|
253
|
+
delegateAddress,
|
|
254
|
+
minInterestRate,
|
|
255
|
+
maxInterestRate,
|
|
256
|
+
newAnnualInterestRate,
|
|
257
|
+
hints.upper,
|
|
258
|
+
hints.lower,
|
|
259
|
+
maxUpfrontFee,
|
|
260
|
+
minRateChangePeriod,
|
|
261
|
+
],
|
|
262
|
+
});
|
|
263
|
+
return { to: ctx.addresses.borrowerOperations, data, value: ZERO_VALUE_HEX };
|
|
264
|
+
}
|
|
265
|
+
buildRemoveInterestDelegateTransaction(ctx, troveId) {
|
|
266
|
+
const parsedTroveId = (0, borrowValidation_1.parseTroveId)(troveId);
|
|
267
|
+
const data = (0, viem_1.encodeFunctionData)({
|
|
268
|
+
abi: abis_1.BORROWER_OPERATIONS_ABI,
|
|
269
|
+
functionName: 'removeInterestIndividualDelegate',
|
|
270
|
+
args: [parsedTroveId],
|
|
271
|
+
});
|
|
272
|
+
return { to: ctx.addresses.borrowerOperations, data, value: ZERO_VALUE_HEX };
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
exports.BorrowTransactionService = BorrowTransactionService;
|
|
276
|
+
//# sourceMappingURL=borrowTransactionService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"borrowTransactionService.js","sourceRoot":"","sources":["../../../../src/services/borrow/internal/borrowTransactionService.ts"],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IAAI,CAAC,YAAY,EAAE,GAAG,EAAE,qBAAqB,CAAC,CAAA;QAEzF,MAAM,IAAI,GAAG,IAAA,yBAAkB,EAAC;YAC9B,GAAG,EAAE,8BAAuB;YAC5B,YAAY,EAAE,+BAA+B;YAC7C,IAAI,EAAE;gBACJ,aAAa;gBACb,eAAe;gBACf,eAAe;gBACf,eAAe;gBACf,qBAAqB;gBACrB,KAAK,CAAC,KAAK;gBACX,KAAK,CAAC,KAAK;gBACX,aAAa;gBACb,mBAAmB;aACpB;SACF,CAAC,CAAA;QAEF,OAAO,EAAE,EAAE,EAAE,GAAG,CAAC,SAAS,CAAC,kBAAkB,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,CAAA;IAC9E,CAAC;IAED,sCAAsC,CAAC,GAAsB,EAAE,OAAe;QAC5E,MAAM,aAAa,GAAG,IAAA,+BAAY,EAAC,OAAO,CAAC,CAAA;QAE3C,MAAM,IAAI,GAAG,IAAA,yBAAkB,EAAC;YAC9B,GAAG,EAAE,8BAAuB;YAC5B,YAAY,EAAE,kCAAkC;YAChD,IAAI,EAAE,CAAC,aAAa,CAAC;SACtB,CAAC,CAAA;QAEF,OAAO,EAAE,EAAE,EAAE,GAAG,CAAC,SAAS,CAAC,kBAAkB,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,CAAA;IAC9E,CAAC;CACF;AAtWD,4DAsWC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BorrowContractAddresses, SystemParams } from '../../../core/types';
|
|
2
|
+
export interface DeploymentContext {
|
|
3
|
+
addresses: BorrowContractAddresses;
|
|
4
|
+
systemParams: SystemParams;
|
|
5
|
+
}
|
|
6
|
+
export type InterestBatchManagerData = {
|
|
7
|
+
minInterestRate: bigint;
|
|
8
|
+
maxInterestRate: bigint;
|
|
9
|
+
minInterestRateChangePeriod: bigint;
|
|
10
|
+
};
|
|
11
|
+
export type DebtPerInterestRateItem = {
|
|
12
|
+
interestRate: bigint;
|
|
13
|
+
debt: bigint;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=borrowTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"borrowTypes.d.ts","sourceRoot":"","sources":["../../../../src/services/borrow/internal/borrowTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAE3E,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,uBAAuB,CAAA;IAClC,YAAY,EAAE,YAAY,CAAA;CAC3B;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,eAAe,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,2BAA2B,EAAE,MAAM,CAAA;CACpC,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"borrowTypes.js","sourceRoot":"","sources":["../../../../src/services/borrow/internal/borrowTypes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
export declare const MAX_SAFE_INTEGER_BIGINT: bigint;
|
|
3
|
+
export declare function requireDebtTokenSymbol(symbol: string): string;
|
|
4
|
+
export declare function requireAddress(address: string, fieldName: string): Address;
|
|
5
|
+
export declare function optionalAddressOrZero(value: string | undefined, fieldName: string): Address;
|
|
6
|
+
export declare function parseTroveId(troveId: string): bigint;
|
|
7
|
+
export declare function formatTroveId(troveId: bigint): string;
|
|
8
|
+
export declare function requireNonNegativeInteger(value: number, fieldName: string): number;
|
|
9
|
+
export declare function requireNonNegativeBigInt(value: bigint, fieldName: string): bigint;
|
|
10
|
+
export declare function requirePositiveBigInt(value: bigint, fieldName: string): bigint;
|
|
11
|
+
export declare function requireUint128(value: bigint, fieldName: string): bigint;
|
|
12
|
+
export declare function ceilSqrt(value: bigint): bigint;
|
|
13
|
+
//# sourceMappingURL=borrowValidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"borrowValidation.d.ts","sourceRoot":"","sources":["../../../../src/services/borrow/internal/borrowValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAe,MAAM,MAAM,CAAA;AAI3C,eAAO,MAAM,uBAAuB,QAAkC,CAAA;AAEtE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAK7D;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAG1E;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAG3F;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAiBpD;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAKlF;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAKjF;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAK9E;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAMvE;AAoBD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAG9C"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MAX_SAFE_INTEGER_BIGINT = void 0;
|
|
4
|
+
exports.requireDebtTokenSymbol = requireDebtTokenSymbol;
|
|
5
|
+
exports.requireAddress = requireAddress;
|
|
6
|
+
exports.optionalAddressOrZero = optionalAddressOrZero;
|
|
7
|
+
exports.parseTroveId = parseTroveId;
|
|
8
|
+
exports.formatTroveId = formatTroveId;
|
|
9
|
+
exports.requireNonNegativeInteger = requireNonNegativeInteger;
|
|
10
|
+
exports.requireNonNegativeBigInt = requireNonNegativeBigInt;
|
|
11
|
+
exports.requirePositiveBigInt = requirePositiveBigInt;
|
|
12
|
+
exports.requireUint128 = requireUint128;
|
|
13
|
+
exports.ceilSqrt = ceilSqrt;
|
|
14
|
+
const viem_1 = require("viem");
|
|
15
|
+
const validation_1 = require("../../../utils/validation");
|
|
16
|
+
const UINT128_MAX = (1n << 128n) - 1n;
|
|
17
|
+
exports.MAX_SAFE_INTEGER_BIGINT = BigInt(Number.MAX_SAFE_INTEGER);
|
|
18
|
+
function requireDebtTokenSymbol(symbol) {
|
|
19
|
+
if (typeof symbol !== 'string' || symbol.trim().length === 0) {
|
|
20
|
+
throw new Error('debtTokenSymbol must be a non-empty string');
|
|
21
|
+
}
|
|
22
|
+
return symbol.trim();
|
|
23
|
+
}
|
|
24
|
+
function requireAddress(address, fieldName) {
|
|
25
|
+
(0, validation_1.validateAddress)(address, fieldName);
|
|
26
|
+
return address;
|
|
27
|
+
}
|
|
28
|
+
function optionalAddressOrZero(value, fieldName) {
|
|
29
|
+
if (!value)
|
|
30
|
+
return viem_1.zeroAddress;
|
|
31
|
+
return requireAddress(value, fieldName);
|
|
32
|
+
}
|
|
33
|
+
function parseTroveId(troveId) {
|
|
34
|
+
if (typeof troveId !== 'string' || troveId.trim().length === 0) {
|
|
35
|
+
throw new Error('troveId must be a non-empty string');
|
|
36
|
+
}
|
|
37
|
+
let parsed;
|
|
38
|
+
try {
|
|
39
|
+
parsed = BigInt(troveId);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
throw new Error(`Invalid troveId: ${troveId}`);
|
|
43
|
+
}
|
|
44
|
+
if (parsed < 0n) {
|
|
45
|
+
throw new Error('troveId cannot be negative');
|
|
46
|
+
}
|
|
47
|
+
return parsed;
|
|
48
|
+
}
|
|
49
|
+
function formatTroveId(troveId) {
|
|
50
|
+
return `0x${troveId.toString(16)}`;
|
|
51
|
+
}
|
|
52
|
+
function requireNonNegativeInteger(value, fieldName) {
|
|
53
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
54
|
+
throw new Error(`${fieldName} must be a non-negative safe integer`);
|
|
55
|
+
}
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
58
|
+
function requireNonNegativeBigInt(value, fieldName) {
|
|
59
|
+
if (typeof value !== 'bigint' || value < 0n) {
|
|
60
|
+
throw new Error(`${fieldName} must be a non-negative bigint`);
|
|
61
|
+
}
|
|
62
|
+
return value;
|
|
63
|
+
}
|
|
64
|
+
function requirePositiveBigInt(value, fieldName) {
|
|
65
|
+
if (typeof value !== 'bigint' || value <= 0n) {
|
|
66
|
+
throw new Error(`${fieldName} must be a positive bigint`);
|
|
67
|
+
}
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
function requireUint128(value, fieldName) {
|
|
71
|
+
const parsed = requireNonNegativeBigInt(value, fieldName);
|
|
72
|
+
if (parsed > UINT128_MAX) {
|
|
73
|
+
throw new Error(`${fieldName} exceeds uint128 max value`);
|
|
74
|
+
}
|
|
75
|
+
return parsed;
|
|
76
|
+
}
|
|
77
|
+
function integerSqrt(value) {
|
|
78
|
+
if (value < 0n) {
|
|
79
|
+
throw new Error('Cannot compute square root of a negative bigint');
|
|
80
|
+
}
|
|
81
|
+
if (value < 2n) {
|
|
82
|
+
return value;
|
|
83
|
+
}
|
|
84
|
+
let x0 = value;
|
|
85
|
+
let x1 = (x0 + 1n) >> 1n;
|
|
86
|
+
while (x1 < x0) {
|
|
87
|
+
x0 = x1;
|
|
88
|
+
x1 = (x1 + value / x1) >> 1n;
|
|
89
|
+
}
|
|
90
|
+
return x0;
|
|
91
|
+
}
|
|
92
|
+
function ceilSqrt(value) {
|
|
93
|
+
const floor = integerSqrt(value);
|
|
94
|
+
return floor * floor === value ? floor : floor + 1n;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=borrowValidation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"borrowValidation.js","sourceRoot":"","sources":["../../../../src/services/borrow/internal/borrowValidation.ts"],"names":[],"mappings":";;;AAMA,wDAKC;AAED,wCAGC;AAED,sDAGC;AAED,oCAiBC;AAED,sCAEC;AAED,8DAKC;AAED,4DAKC;AAED,sDAKC;AAED,wCAMC;AAoBD,4BAGC;AAhGD,+BAA2C;AAC3C,0DAA2D;AAE3D,MAAM,WAAW,GAAG,CAAC,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAA;AACxB,QAAA,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAA;AAEtE,SAAgB,sBAAsB,CAAC,MAAc;IACnD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7D,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;IAC/D,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,EAAE,CAAA;AACtB,CAAC;AAED,SAAgB,cAAc,CAAC,OAAe,EAAE,SAAiB;IAC/D,IAAA,4BAAe,EAAC,OAAO,EAAE,SAAS,CAAC,CAAA;IACnC,OAAO,OAAkB,CAAA;AAC3B,CAAC;AAED,SAAgB,qBAAqB,CAAC,KAAyB,EAAE,SAAiB;IAChF,IAAI,CAAC,KAAK;QAAE,OAAO,kBAAW,CAAA;IAC9B,OAAO,cAAc,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;AACzC,CAAC;AAED,SAAgB,YAAY,CAAC,OAAe;IAC1C,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OA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C;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAgB,cAAc,CAAC,KAAa,EAAE,SAAiB;IAC7D,MAAM,MAAM,GAAG,wBAAwB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;IACzD,IAAI,MAAM,GAAG,WAAW,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,4BAA4B,CAAC,CAAA;IAC3D,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,IAAI,KAAK,GAAG,EAAE,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAA;IACpE,CAAC;IACD,IAAI,KAAK,GAAG,EAAE,EAAE,CAAC;QACf,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,EAAE,GAAG,KAAK,CAAA;IACd,IAAI,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAA;IACxB,OAAO,EAAE,GAAG,EAAE,EAAE,CAAC;QACf,EAAE,GAAG,EAAE,CAAA;QACP,EAAE,GAAG,CAAC,EAAE,GAAG,KAAK,GAAG,EAAE,CAAC,IAAI,EAAE,CAAA;IAC9B,CAAC;IAED,OAAO,EAAE,CAAA;AACX,CAAC;AAED,SAAgB,QAAQ,CAAC,KAAa;IACpC,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,CAAA;IAChC,OAAO,KAAK,GAAG,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAA;AACrD,CAAC"}
|
package/dist/services/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAA;AAChD,cAAc,iBAAiB,CAAA;AAC/B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAA;AAChD,cAAc,iBAAiB,CAAA;AAC/B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA"}
|
package/dist/services/index.js
CHANGED
|
@@ -20,4 +20,6 @@ __exportStar(require("./pools"), exports);
|
|
|
20
20
|
__exportStar(require("./routes"), exports);
|
|
21
21
|
__exportStar(require("./quotes"), exports);
|
|
22
22
|
__exportStar(require("./swap"), exports);
|
|
23
|
+
__exportStar(require("./trading"), exports);
|
|
24
|
+
__exportStar(require("./borrow"), exports);
|
|
23
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAgD;AAChD,kDAA+B;AAC/B,0CAAuB;AACvB,2CAAwB;AACxB,2CAAwB;AACxB,yCAAsB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAgD;AAChD,kDAA+B;AAC/B,0CAAuB;AACvB,2CAAwB;AACxB,2CAAwB;AACxB,yCAAsB;AACtB,4CAAyB;AACzB,2CAAwB"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { PublicClient } from 'viem';
|
|
2
|
+
import { PoolService } from '../pools';
|
|
3
|
+
import { RouteService } from '../routes';
|
|
4
|
+
import { LiquidityOptions, AddLiquidityQuote, RemoveLiquidityQuote, AddLiquidityDetails, RemoveLiquidityDetails, AddLiquidityTransaction, RemoveLiquidityTransaction, LPTokenBalance, ZapInQuote, ZapOutQuote, ZapInDetails, ZapOutDetails, ZapInTransaction, ZapOutTransaction } from '../../core/types';
|
|
5
|
+
export declare class LiquidityService {
|
|
6
|
+
private publicClient;
|
|
7
|
+
private chainId;
|
|
8
|
+
private poolService;
|
|
9
|
+
private routeService;
|
|
10
|
+
constructor(publicClient: PublicClient, chainId: number, poolService: PoolService, routeService: RouteService);
|
|
11
|
+
/**
|
|
12
|
+
* Builds add liquidity transaction with token approvals if needed.
|
|
13
|
+
* Provide two tokens in any order - the Router handles token ordering automatically.
|
|
14
|
+
* @param poolAddress - FPMM pool address
|
|
15
|
+
* @param tokenA - First token address
|
|
16
|
+
* @param amountA - Amount of first token
|
|
17
|
+
* @param tokenB - Second token address
|
|
18
|
+
* @param amountB - Amount of second token
|
|
19
|
+
* @param recipient - Address to receive LP tokens
|
|
20
|
+
* @param owner - Address that owns the input tokens (for checking allowances)
|
|
21
|
+
* @param options - Slippage tolerance and deadline
|
|
22
|
+
* @returns Transaction with approvals (if needed) and add liquidity call
|
|
23
|
+
*/
|
|
24
|
+
buildAddLiquidityTransaction(poolAddress: string, tokenA: string, amountA: bigint, tokenB: string, amountB: bigint, recipient: string, owner: string, options: LiquidityOptions): Promise<AddLiquidityTransaction>;
|
|
25
|
+
/**
|
|
26
|
+
* Builds add liquidity transaction parameters without checking token approvals.
|
|
27
|
+
* Use buildAddLiquidityTransaction if you need approval handling.
|
|
28
|
+
* @param poolAddress - FPMM pool address
|
|
29
|
+
* @param tokenA - First token address
|
|
30
|
+
* @param amountA - Amount of first token
|
|
31
|
+
* @param tokenB - Second token address
|
|
32
|
+
* @param amountB - Amount of second token
|
|
33
|
+
* @param recipient - Address to receive LP tokens
|
|
34
|
+
* @param options - Slippage tolerance and deadline
|
|
35
|
+
* @returns Transaction details with encoded call data
|
|
36
|
+
*/
|
|
37
|
+
buildAddLiquidityParams(poolAddress: string, tokenA: string, amountA: bigint, tokenB: string, amountB: bigint, recipient: string, options: LiquidityOptions): Promise<AddLiquidityDetails>;
|
|
38
|
+
/**
|
|
39
|
+
* Builds remove liquidity transaction with LP token approval if needed.
|
|
40
|
+
* @param poolAddress - FPMM pool address (also the LP token address)
|
|
41
|
+
* @param liquidity - Amount of LP tokens to burn
|
|
42
|
+
* @param recipient - Address to receive the underlying tokens
|
|
43
|
+
* @param owner - Address that owns the LP tokens (for checking allowance)
|
|
44
|
+
* @param options - Slippage tolerance and deadline
|
|
45
|
+
* @returns Transaction with approval (if needed) and remove liquidity call
|
|
46
|
+
*/
|
|
47
|
+
buildRemoveLiquidityTransaction(poolAddress: string, liquidity: bigint, recipient: string, owner: string, options: LiquidityOptions): Promise<RemoveLiquidityTransaction>;
|
|
48
|
+
/**
|
|
49
|
+
* Builds remove liquidity transaction parameters without checking LP token approval.
|
|
50
|
+
* Use buildRemoveLiquidityTransaction if you need approval handling.
|
|
51
|
+
* @param poolAddress - FPMM pool address
|
|
52
|
+
* @param liquidity - Amount of LP tokens to burn
|
|
53
|
+
* @param recipient - Address to receive the underlying tokens
|
|
54
|
+
* @param options - Slippage tolerance and deadline
|
|
55
|
+
* @returns Transaction details with encoded call data
|
|
56
|
+
*/
|
|
57
|
+
buildRemoveLiquidityParams(poolAddress: string, liquidity: bigint, recipient: string, options: LiquidityOptions): Promise<RemoveLiquidityDetails>;
|
|
58
|
+
/**
|
|
59
|
+
* Quotes an add liquidity operation (read-only call).
|
|
60
|
+
* Returns expected amounts and LP tokens based on current pool reserves.
|
|
61
|
+
* @param poolAddress - FPMM pool address
|
|
62
|
+
* @param tokenA - First token address
|
|
63
|
+
* @param amountA - Amount of first token
|
|
64
|
+
* @param tokenB - Second token address
|
|
65
|
+
* @param amountB - Amount of second token
|
|
66
|
+
* @returns Expected amounts and LP tokens to be minted
|
|
67
|
+
*/
|
|
68
|
+
quoteAddLiquidity(poolAddress: string, tokenA: string, amountA: bigint, tokenB: string, amountB: bigint): Promise<AddLiquidityQuote>;
|
|
69
|
+
/**
|
|
70
|
+
* Quotes a remove liquidity operation (read-only call).
|
|
71
|
+
* Returns expected token amounts based on current pool reserves.
|
|
72
|
+
* @param poolAddress - FPMM pool address
|
|
73
|
+
* @param liquidity - Amount of LP tokens to burn
|
|
74
|
+
* @returns Expected amounts of token0 and token1
|
|
75
|
+
*/
|
|
76
|
+
quoteRemoveLiquidity(poolAddress: string, liquidity: bigint): Promise<RemoveLiquidityQuote>;
|
|
77
|
+
/**
|
|
78
|
+
* Gets LP token balance and pool share percentage for an address.
|
|
79
|
+
* @param poolAddress - FPMM pool address (also the LP token address)
|
|
80
|
+
* @param owner - Address to check balance for
|
|
81
|
+
* @returns Balance, total supply, and share percentage
|
|
82
|
+
*/
|
|
83
|
+
getLPTokenBalance(poolAddress: string, owner: string): Promise<LPTokenBalance>;
|
|
84
|
+
/**
|
|
85
|
+
* Builds zap in transaction with approval if needed.
|
|
86
|
+
* Adds liquidity using a single input token - the Router swaps it to both pool tokens automatically.
|
|
87
|
+
* @param poolAddress - FPMM pool address
|
|
88
|
+
* @param tokenIn - Input token address
|
|
89
|
+
* @param amountIn - Total input amount
|
|
90
|
+
* @param amountInSplit - How to split input between pool tokens (0-1, e.g., 0.5 for 50/50)
|
|
91
|
+
* @param recipient - Address to receive LP tokens
|
|
92
|
+
* @param owner - Address that owns the input token
|
|
93
|
+
* @param options - Slippage tolerance and deadline
|
|
94
|
+
* @returns Transaction with approval (if needed) and zap in call
|
|
95
|
+
*/
|
|
96
|
+
buildZapInTransaction(poolAddress: string, tokenIn: string, amountIn: bigint, amountInSplit: number, recipient: string, owner: string, options: LiquidityOptions): Promise<ZapInTransaction>;
|
|
97
|
+
/**
|
|
98
|
+
* Builds zap in transaction parameters without checking approval.
|
|
99
|
+
* Use buildZapInTransaction if you need approval handling.
|
|
100
|
+
* @param poolAddress - FPMM pool address
|
|
101
|
+
* @param tokenIn - Input token address
|
|
102
|
+
* @param amountIn - Total input amount
|
|
103
|
+
* @param amountInSplit - Split ratio (0-1)
|
|
104
|
+
* @param recipient - Address to receive LP tokens
|
|
105
|
+
* @param options - Slippage tolerance and deadline
|
|
106
|
+
* @returns Transaction details with encoded call data and routing information
|
|
107
|
+
*/
|
|
108
|
+
buildZapInParams(poolAddress: string, tokenIn: string, amountIn: bigint, amountInSplit: number, recipient: string, options: LiquidityOptions): Promise<ZapInDetails>;
|
|
109
|
+
/**
|
|
110
|
+
* Builds zap out transaction with approval if needed.
|
|
111
|
+
* Removes liquidity and swaps both tokens to a single output token.
|
|
112
|
+
* @param poolAddress - FPMM pool address
|
|
113
|
+
* @param tokenOut - Output token address
|
|
114
|
+
* @param liquidity - Amount of LP tokens to burn
|
|
115
|
+
* @param recipient - Address to receive output tokens
|
|
116
|
+
* @param owner - Address that owns the LP tokens
|
|
117
|
+
* @param options - Slippage tolerance and deadline
|
|
118
|
+
* @returns Transaction with approval (if needed) and zap out call
|
|
119
|
+
*/
|
|
120
|
+
buildZapOutTransaction(poolAddress: string, tokenOut: string, liquidity: bigint, recipient: string, owner: string, options: LiquidityOptions): Promise<ZapOutTransaction>;
|
|
121
|
+
/**
|
|
122
|
+
* Builds zap out transaction parameters without checking approval.
|
|
123
|
+
* Use buildZapOutTransaction if you need approval handling.
|
|
124
|
+
* @param poolAddress - FPMM pool address
|
|
125
|
+
* @param tokenOut - Output token address
|
|
126
|
+
* @param liquidity - Amount of LP tokens to burn
|
|
127
|
+
* @param recipient - Address to receive output tokens
|
|
128
|
+
* @param options - Slippage tolerance and deadline
|
|
129
|
+
* @returns Transaction details with encoded call data and routing information
|
|
130
|
+
*/
|
|
131
|
+
buildZapOutParams(poolAddress: string, tokenOut: string, liquidity: bigint, recipient: string, options: LiquidityOptions): Promise<ZapOutDetails>;
|
|
132
|
+
/**
|
|
133
|
+
* Quotes a zap in operation (read-only call).
|
|
134
|
+
* Estimates expected LP tokens and minimum amounts after swaps and slippage.
|
|
135
|
+
* @param poolAddress - FPMM pool address
|
|
136
|
+
* @param tokenIn - Input token address
|
|
137
|
+
* @param amountIn - Total input amount
|
|
138
|
+
* @param amountInSplit - Split ratio (0-1)
|
|
139
|
+
* @param options - Slippage tolerance and deadline
|
|
140
|
+
* @returns Expected LP tokens and minimum amounts for both pool tokens
|
|
141
|
+
*/
|
|
142
|
+
quoteZapIn(poolAddress: string, tokenIn: string, amountIn: bigint, amountInSplit: number, options: LiquidityOptions): Promise<ZapInQuote>;
|
|
143
|
+
/**
|
|
144
|
+
* Quotes a zap out operation (read-only call).
|
|
145
|
+
* Estimates expected output tokens after removing liquidity and swapping.
|
|
146
|
+
* @param poolAddress - FPMM pool address
|
|
147
|
+
* @param tokenOut - Output token address
|
|
148
|
+
* @param liquidity - Amount of LP tokens to burn
|
|
149
|
+
* @param options - Slippage tolerance and deadline
|
|
150
|
+
* @returns Expected output amount and minimum amounts after slippage
|
|
151
|
+
*/
|
|
152
|
+
quoteZapOut(poolAddress: string, tokenOut: string, liquidity: bigint, options: LiquidityOptions): Promise<ZapOutQuote>;
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=LiquidityService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiquidityService.d.ts","sourceRoot":"","sources":["../../../src/services/liquidity/LiquidityService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAC1B,cAAc,EACd,UAAU,EACV,WAAW,EACX,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,kBAAkB,CAAA;AAqBzB,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,WAAW;IACnB,OAAO,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