@mysten/deepbook-v3 0.26.4 → 0.26.6
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/CHANGELOG.md +12 -0
- package/dist/cjs/transactions/marginMaintainer.d.ts +17 -11
- package/dist/cjs/transactions/marginMaintainer.js +34 -4
- package/dist/cjs/transactions/marginMaintainer.js.map +2 -2
- package/dist/cjs/types/index.d.ts +5 -0
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/utils/constants.js +3 -3
- package/dist/cjs/utils/constants.js.map +1 -1
- package/dist/esm/transactions/marginMaintainer.d.ts +17 -11
- package/dist/esm/transactions/marginMaintainer.js +34 -4
- package/dist/esm/transactions/marginMaintainer.js.map +2 -2
- package/dist/esm/types/index.d.ts +5 -0
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm/utils/constants.js +3 -3
- package/dist/esm/utils/constants.js.map +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/transactions/marginMaintainer.ts +61 -11
- package/src/types/index.ts +6 -0
- package/src/utils/constants.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { Transaction } from '@mysten/sui/transactions';
|
|
1
|
+
import type { Transaction, TransactionArgument, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
2
2
|
import type { DeepBookConfig } from '../utils/config.js';
|
|
3
|
-
import type {
|
|
4
|
-
import type { MarginPoolConfigParams, InterestConfigParams } from '../types/index.js';
|
|
3
|
+
import type { MarginPoolConfigParams, MarginPoolConfigWithRateLimitParams, InterestConfigParams } from '../types/index.js';
|
|
5
4
|
/**
|
|
6
5
|
* DeepBookMaintainerContract class for managing maintainer actions.
|
|
7
6
|
*/
|
|
@@ -33,6 +32,13 @@ export declare class MarginMaintainerContract {
|
|
|
33
32
|
* @returns A function that takes a Transaction object
|
|
34
33
|
*/
|
|
35
34
|
newMarginPoolConfig: (coinKey: string, marginPoolConfig: MarginPoolConfigParams) => (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
35
|
+
/**
|
|
36
|
+
* @description Create a new margin pool config with rate limit
|
|
37
|
+
* @param {string} coinKey The key to identify the coin
|
|
38
|
+
* @param {MarginPoolConfigWithRateLimitParams} marginPoolConfig The configuration for the margin pool with rate limit
|
|
39
|
+
* @returns A function that takes a Transaction object
|
|
40
|
+
*/
|
|
41
|
+
newMarginPoolConfigWithRateLimit: (coinKey: string, marginPoolConfig: MarginPoolConfigWithRateLimitParams) => (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
36
42
|
/**
|
|
37
43
|
* @description Create a new interest config
|
|
38
44
|
* @param {InterestConfigParams} interestConfig The configuration for the interest
|
|
@@ -43,32 +49,32 @@ export declare class MarginMaintainerContract {
|
|
|
43
49
|
* @description Enable a deepbook pool for loan
|
|
44
50
|
* @param {string} deepbookPoolKey The key to identify the deepbook pool
|
|
45
51
|
* @param {string} coinKey The key to identify the margin pool
|
|
46
|
-
* @param {
|
|
52
|
+
* @param {TransactionObjectArgument} marginPoolCap The margin pool cap
|
|
47
53
|
* @returns A function that takes a Transaction object
|
|
48
54
|
*/
|
|
49
|
-
enableDeepbookPoolForLoan: (deepbookPoolKey: string, coinKey: string, marginPoolCap:
|
|
55
|
+
enableDeepbookPoolForLoan: (deepbookPoolKey: string, coinKey: string, marginPoolCap: TransactionObjectArgument) => (tx: Transaction) => void;
|
|
50
56
|
/**
|
|
51
57
|
* @description Disable a deepbook pool for loan
|
|
52
58
|
* @param {string} deepbookPoolKey The key to identify the deepbook pool
|
|
53
59
|
* @param {string} coinKey The key to identify the margin pool
|
|
54
|
-
* @param {
|
|
60
|
+
* @param {TransactionObjectArgument} marginPoolCap The margin pool cap
|
|
55
61
|
* @returns A function that takes a Transaction object
|
|
56
62
|
*/
|
|
57
|
-
disableDeepbookPoolForLoan: (deepbookPoolKey: string, coinKey: string, marginPoolCap:
|
|
63
|
+
disableDeepbookPoolForLoan: (deepbookPoolKey: string, coinKey: string, marginPoolCap: TransactionObjectArgument) => (tx: Transaction) => void;
|
|
58
64
|
/**
|
|
59
65
|
* @description Update the interest params
|
|
60
66
|
* @param {string} coinKey The key to identify the margin pool
|
|
61
|
-
* @param {
|
|
67
|
+
* @param {TransactionObjectArgument} marginPoolCap The margin pool cap
|
|
62
68
|
* @param {InterestConfigParams} interestConfig The configuration for the interest
|
|
63
69
|
* @returns A function that takes a Transaction object
|
|
64
70
|
*/
|
|
65
|
-
updateInterestParams: (coinKey: string, marginPoolCap:
|
|
71
|
+
updateInterestParams: (coinKey: string, marginPoolCap: TransactionObjectArgument, interestConfig: InterestConfigParams) => (tx: Transaction) => void;
|
|
66
72
|
/**
|
|
67
73
|
* @description Update the margin pool config
|
|
68
74
|
* @param {string} coinKey The key to identify the margin pool
|
|
69
|
-
* @param {
|
|
75
|
+
* @param {TransactionObjectArgument} marginPoolCap The margin pool cap
|
|
70
76
|
* @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool
|
|
71
77
|
* @returns A function that takes a Transaction object
|
|
72
78
|
*/
|
|
73
|
-
updateMarginPoolConfig: (coinKey: string, marginPoolCap:
|
|
79
|
+
updateMarginPoolConfig: (coinKey: string, marginPoolCap: TransactionObjectArgument, marginPoolConfig: MarginPoolConfigParams) => (tx: Transaction) => void;
|
|
74
80
|
}
|
|
@@ -91,6 +91,36 @@ class MarginMaintainerContract {
|
|
|
91
91
|
]
|
|
92
92
|
});
|
|
93
93
|
};
|
|
94
|
+
/**
|
|
95
|
+
* @description Create a new margin pool config with rate limit
|
|
96
|
+
* @param {string} coinKey The key to identify the coin
|
|
97
|
+
* @param {MarginPoolConfigWithRateLimitParams} marginPoolConfig The configuration for the margin pool with rate limit
|
|
98
|
+
* @returns A function that takes a Transaction object
|
|
99
|
+
*/
|
|
100
|
+
this.newMarginPoolConfigWithRateLimit = (coinKey, marginPoolConfig) => (tx) => {
|
|
101
|
+
const coin = __privateGet(this, _config).getCoin(coinKey);
|
|
102
|
+
const {
|
|
103
|
+
supplyCap,
|
|
104
|
+
maxUtilizationRate,
|
|
105
|
+
referralSpread,
|
|
106
|
+
minBorrow,
|
|
107
|
+
rateLimitCapacity,
|
|
108
|
+
rateLimitRefillRatePerMs,
|
|
109
|
+
rateLimitEnabled
|
|
110
|
+
} = marginPoolConfig;
|
|
111
|
+
return tx.moveCall({
|
|
112
|
+
target: `${__privateGet(this, _config).MARGIN_PACKAGE_ID}::protocol_config::new_margin_pool_config_with_rate_limit`,
|
|
113
|
+
arguments: [
|
|
114
|
+
tx.pure.u64(supplyCap * coin.scalar),
|
|
115
|
+
tx.pure.u64(maxUtilizationRate * import_config.FLOAT_SCALAR),
|
|
116
|
+
tx.pure.u64(referralSpread * import_config.FLOAT_SCALAR),
|
|
117
|
+
tx.pure.u64(Math.round(minBorrow * coin.scalar)),
|
|
118
|
+
tx.pure.u64(Math.round(rateLimitCapacity * coin.scalar)),
|
|
119
|
+
tx.pure.u64(Math.round(rateLimitRefillRatePerMs * coin.scalar)),
|
|
120
|
+
tx.pure.bool(rateLimitEnabled)
|
|
121
|
+
]
|
|
122
|
+
});
|
|
123
|
+
};
|
|
94
124
|
/**
|
|
95
125
|
* @description Create a new interest config
|
|
96
126
|
* @param {InterestConfigParams} interestConfig The configuration for the interest
|
|
@@ -112,7 +142,7 @@ class MarginMaintainerContract {
|
|
|
112
142
|
* @description Enable a deepbook pool for loan
|
|
113
143
|
* @param {string} deepbookPoolKey The key to identify the deepbook pool
|
|
114
144
|
* @param {string} coinKey The key to identify the margin pool
|
|
115
|
-
* @param {
|
|
145
|
+
* @param {TransactionObjectArgument} marginPoolCap The margin pool cap
|
|
116
146
|
* @returns A function that takes a Transaction object
|
|
117
147
|
*/
|
|
118
148
|
this.enableDeepbookPoolForLoan = (deepbookPoolKey, coinKey, marginPoolCap) => (tx) => {
|
|
@@ -134,7 +164,7 @@ class MarginMaintainerContract {
|
|
|
134
164
|
* @description Disable a deepbook pool for loan
|
|
135
165
|
* @param {string} deepbookPoolKey The key to identify the deepbook pool
|
|
136
166
|
* @param {string} coinKey The key to identify the margin pool
|
|
137
|
-
* @param {
|
|
167
|
+
* @param {TransactionObjectArgument} marginPoolCap The margin pool cap
|
|
138
168
|
* @returns A function that takes a Transaction object
|
|
139
169
|
*/
|
|
140
170
|
this.disableDeepbookPoolForLoan = (deepbookPoolKey, coinKey, marginPoolCap) => (tx) => {
|
|
@@ -155,7 +185,7 @@ class MarginMaintainerContract {
|
|
|
155
185
|
/**
|
|
156
186
|
* @description Update the interest params
|
|
157
187
|
* @param {string} coinKey The key to identify the margin pool
|
|
158
|
-
* @param {
|
|
188
|
+
* @param {TransactionObjectArgument} marginPoolCap The margin pool cap
|
|
159
189
|
* @param {InterestConfigParams} interestConfig The configuration for the interest
|
|
160
190
|
* @returns A function that takes a Transaction object
|
|
161
191
|
*/
|
|
@@ -177,7 +207,7 @@ class MarginMaintainerContract {
|
|
|
177
207
|
/**
|
|
178
208
|
* @description Update the margin pool config
|
|
179
209
|
* @param {string} coinKey The key to identify the margin pool
|
|
180
|
-
* @param {
|
|
210
|
+
* @param {TransactionObjectArgument} marginPoolCap The margin pool cap
|
|
181
211
|
* @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool
|
|
182
212
|
* @returns A function that takes a Transaction object
|
|
183
213
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/transactions/marginMaintainer.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport type { TransactionArgument } from '@mysten/sui/transactions';\nimport type { MarginPoolConfigParams, InterestConfigParams } from '../types/index.js';\nimport { FLOAT_SCALAR } from '../utils/config.js';\n\n/**\n * DeepBookMaintainerContract class for managing maintainer actions.\n */\nexport class MarginMaintainerContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for MarginMaintainerContract\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#marginMaintainerCap() {\n\t\tconst marginMaintainerCap = this.#config.marginMaintainerCap;\n\t\tif (!marginMaintainerCap) {\n\t\t\tthrow new Error('MARGIN_ADMIN_CAP environment variable not set');\n\t\t}\n\t\treturn marginMaintainerCap;\n\t}\n\n\t/**\n\t * @description Create a new margin pool\n\t * @param {string} coinKey The key to identify the coin\n\t * @param {TransactionArgument} poolConfig The configuration for the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreateMarginPool = (coinKey: string, poolConfig: TransactionArgument) => (tx: Transaction) => {\n\t\tconst coin = this.#config.getCoin(coinKey);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::create_margin_pool`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\tpoolConfig,\n\t\t\t\ttx.object(this.#marginMaintainerCap()),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [coin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Create a new protocol config\n\t * @param {string} coinKey The key to identify the coin\n\t * @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool\n\t * @param {InterestConfigParams} interestConfig The configuration for the interest\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewProtocolConfig =\n\t\t(\n\t\t\tcoinKey: string,\n\t\t\tmarginPoolConfig: MarginPoolConfigParams,\n\t\t\tinterestConfig: InterestConfigParams,\n\t\t) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst marginPoolConfigObject = this.newMarginPoolConfig(coinKey, marginPoolConfig)(tx);\n\t\t\tconst interestConfigObject = this.newInterestConfig(interestConfig)(tx);\n\t\t\treturn tx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::protocol_config::new_protocol_config`,\n\t\t\t\targuments: [marginPoolConfigObject, interestConfigObject],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Create a new margin pool config\n\t * @param {string} coinKey The key to identify the coin\n\t * @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewMarginPoolConfig =\n\t\t(coinKey: string, marginPoolConfig: MarginPoolConfigParams) => (tx: Transaction) => {\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst { supplyCap, maxUtilizationRate, referralSpread, minBorrow } = marginPoolConfig;\n\t\t\treturn tx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::protocol_config::new_margin_pool_config`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.pure.u64(supplyCap * coin.scalar),\n\t\t\t\t\ttx.pure.u64(maxUtilizationRate * FLOAT_SCALAR),\n\t\t\t\t\ttx.pure.u64(referralSpread * FLOAT_SCALAR),\n\t\t\t\t\ttx.pure.u64(Math.round(minBorrow * coin.scalar)),\n\t\t\t\t],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Create a new interest config\n\t * @param {InterestConfigParams} interestConfig The configuration for the interest\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewInterestConfig = (interestConfig: InterestConfigParams) => (tx: Transaction) => {\n\t\tconst { baseRate, baseSlope, optimalUtilization, excessSlope } = interestConfig;\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::protocol_config::new_interest_config`,\n\t\t\targuments: [\n\t\t\t\ttx.pure.u64(baseRate * FLOAT_SCALAR),\n\t\t\t\ttx.pure.u64(baseSlope * FLOAT_SCALAR),\n\t\t\t\ttx.pure.u64(optimalUtilization * FLOAT_SCALAR),\n\t\t\t\ttx.pure.u64(excessSlope * FLOAT_SCALAR),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Enable a deepbook pool for loan\n\t * @param {string} deepbookPoolKey The key to identify the deepbook pool\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @param {string} marginPoolCap The margin pool cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableDeepbookPoolForLoan =\n\t\t(deepbookPoolKey: string, coinKey: string, marginPoolCap: string) => (tx: Transaction) => {\n\t\t\tconst deepbookPool = this.#config.getPool(deepbookPoolKey);\n\t\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::enable_deepbook_pool_for_loan`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(marginPool.address),\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\ttx.pure.id(deepbookPool.address),\n\t\t\t\t\ttx.object(marginPoolCap),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [marginPool.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Disable a deepbook pool for loan\n\t * @param {string} deepbookPoolKey The key to identify the deepbook pool\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @param {string} marginPoolCap The margin pool cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableDeepbookPoolForLoan =\n\t\t(deepbookPoolKey: string, coinKey: string, marginPoolCap: string) => (tx: Transaction) => {\n\t\t\tconst deepbookPool = this.#config.getPool(deepbookPoolKey);\n\t\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::disable_deepbook_pool_for_loan`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(marginPool.address),\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\ttx.pure.id(deepbookPool.address),\n\t\t\t\t\ttx.object(marginPoolCap),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [marginPool.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Update the interest params\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @param {string} marginPoolCap The margin pool cap\n\t * @param {InterestConfigParams} interestConfig The configuration for the interest\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdateInterestParams =\n\t\t(coinKey: string, marginPoolCap: string, interestConfig: InterestConfigParams) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\t\tconst interestConfigObject = this.newInterestConfig(interestConfig)(tx);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::update_interest_params`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(marginPool.address),\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\tinterestConfigObject,\n\t\t\t\t\ttx.object(marginPoolCap),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [marginPool.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Update the margin pool config\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @param {string} marginPoolCap The margin pool cap\n\t * @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdateMarginPoolConfig =\n\t\t(coinKey: string, marginPoolCap: string, marginPoolConfig: MarginPoolConfigParams) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\t\tconst marginPoolConfigObject = this.newMarginPoolConfig(coinKey, marginPoolConfig)(tx);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::update_margin_pool_config`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(marginPool.address),\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\tmarginPoolConfigObject,\n\t\t\t\t\ttx.object(marginPoolCap),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [marginPool.type],\n\t\t\t});\n\t\t};\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n\tTransaction,\n\tTransactionArgument,\n\tTransactionObjectArgument,\n} from '@mysten/sui/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport type {\n\tMarginPoolConfigParams,\n\tMarginPoolConfigWithRateLimitParams,\n\tInterestConfigParams,\n} from '../types/index.js';\nimport { FLOAT_SCALAR } from '../utils/config.js';\n\n/**\n * DeepBookMaintainerContract class for managing maintainer actions.\n */\nexport class MarginMaintainerContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for MarginMaintainerContract\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#marginMaintainerCap() {\n\t\tconst marginMaintainerCap = this.#config.marginMaintainerCap;\n\t\tif (!marginMaintainerCap) {\n\t\t\tthrow new Error('MARGIN_ADMIN_CAP environment variable not set');\n\t\t}\n\t\treturn marginMaintainerCap;\n\t}\n\n\t/**\n\t * @description Create a new margin pool\n\t * @param {string} coinKey The key to identify the coin\n\t * @param {TransactionArgument} poolConfig The configuration for the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreateMarginPool = (coinKey: string, poolConfig: TransactionArgument) => (tx: Transaction) => {\n\t\tconst coin = this.#config.getCoin(coinKey);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::create_margin_pool`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\tpoolConfig,\n\t\t\t\ttx.object(this.#marginMaintainerCap()),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [coin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Create a new protocol config\n\t * @param {string} coinKey The key to identify the coin\n\t * @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool\n\t * @param {InterestConfigParams} interestConfig The configuration for the interest\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewProtocolConfig =\n\t\t(\n\t\t\tcoinKey: string,\n\t\t\tmarginPoolConfig: MarginPoolConfigParams,\n\t\t\tinterestConfig: InterestConfigParams,\n\t\t) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst marginPoolConfigObject = this.newMarginPoolConfig(coinKey, marginPoolConfig)(tx);\n\t\t\tconst interestConfigObject = this.newInterestConfig(interestConfig)(tx);\n\t\t\treturn tx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::protocol_config::new_protocol_config`,\n\t\t\t\targuments: [marginPoolConfigObject, interestConfigObject],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Create a new margin pool config\n\t * @param {string} coinKey The key to identify the coin\n\t * @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewMarginPoolConfig =\n\t\t(coinKey: string, marginPoolConfig: MarginPoolConfigParams) => (tx: Transaction) => {\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst { supplyCap, maxUtilizationRate, referralSpread, minBorrow } = marginPoolConfig;\n\t\t\treturn tx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::protocol_config::new_margin_pool_config`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.pure.u64(supplyCap * coin.scalar),\n\t\t\t\t\ttx.pure.u64(maxUtilizationRate * FLOAT_SCALAR),\n\t\t\t\t\ttx.pure.u64(referralSpread * FLOAT_SCALAR),\n\t\t\t\t\ttx.pure.u64(Math.round(minBorrow * coin.scalar)),\n\t\t\t\t],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Create a new margin pool config with rate limit\n\t * @param {string} coinKey The key to identify the coin\n\t * @param {MarginPoolConfigWithRateLimitParams} marginPoolConfig The configuration for the margin pool with rate limit\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewMarginPoolConfigWithRateLimit =\n\t\t(coinKey: string, marginPoolConfig: MarginPoolConfigWithRateLimitParams) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst {\n\t\t\t\tsupplyCap,\n\t\t\t\tmaxUtilizationRate,\n\t\t\t\treferralSpread,\n\t\t\t\tminBorrow,\n\t\t\t\trateLimitCapacity,\n\t\t\t\trateLimitRefillRatePerMs,\n\t\t\t\trateLimitEnabled,\n\t\t\t} = marginPoolConfig;\n\t\t\treturn tx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::protocol_config::new_margin_pool_config_with_rate_limit`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.pure.u64(supplyCap * coin.scalar),\n\t\t\t\t\ttx.pure.u64(maxUtilizationRate * FLOAT_SCALAR),\n\t\t\t\t\ttx.pure.u64(referralSpread * FLOAT_SCALAR),\n\t\t\t\t\ttx.pure.u64(Math.round(minBorrow * coin.scalar)),\n\t\t\t\t\ttx.pure.u64(Math.round(rateLimitCapacity * coin.scalar)),\n\t\t\t\t\ttx.pure.u64(Math.round(rateLimitRefillRatePerMs * coin.scalar)),\n\t\t\t\t\ttx.pure.bool(rateLimitEnabled),\n\t\t\t\t],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Create a new interest config\n\t * @param {InterestConfigParams} interestConfig The configuration for the interest\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewInterestConfig = (interestConfig: InterestConfigParams) => (tx: Transaction) => {\n\t\tconst { baseRate, baseSlope, optimalUtilization, excessSlope } = interestConfig;\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::protocol_config::new_interest_config`,\n\t\t\targuments: [\n\t\t\t\ttx.pure.u64(baseRate * FLOAT_SCALAR),\n\t\t\t\ttx.pure.u64(baseSlope * FLOAT_SCALAR),\n\t\t\t\ttx.pure.u64(optimalUtilization * FLOAT_SCALAR),\n\t\t\t\ttx.pure.u64(excessSlope * FLOAT_SCALAR),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Enable a deepbook pool for loan\n\t * @param {string} deepbookPoolKey The key to identify the deepbook pool\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @param {TransactionObjectArgument} marginPoolCap The margin pool cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableDeepbookPoolForLoan =\n\t\t(deepbookPoolKey: string, coinKey: string, marginPoolCap: TransactionObjectArgument) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst deepbookPool = this.#config.getPool(deepbookPoolKey);\n\t\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::enable_deepbook_pool_for_loan`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(marginPool.address),\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\ttx.pure.id(deepbookPool.address),\n\t\t\t\t\ttx.object(marginPoolCap),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [marginPool.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Disable a deepbook pool for loan\n\t * @param {string} deepbookPoolKey The key to identify the deepbook pool\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @param {TransactionObjectArgument} marginPoolCap The margin pool cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableDeepbookPoolForLoan =\n\t\t(deepbookPoolKey: string, coinKey: string, marginPoolCap: TransactionObjectArgument) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst deepbookPool = this.#config.getPool(deepbookPoolKey);\n\t\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::disable_deepbook_pool_for_loan`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(marginPool.address),\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\ttx.pure.id(deepbookPool.address),\n\t\t\t\t\ttx.object(marginPoolCap),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [marginPool.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Update the interest params\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @param {TransactionObjectArgument} marginPoolCap The margin pool cap\n\t * @param {InterestConfigParams} interestConfig The configuration for the interest\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdateInterestParams =\n\t\t(\n\t\t\tcoinKey: string,\n\t\t\tmarginPoolCap: TransactionObjectArgument,\n\t\t\tinterestConfig: InterestConfigParams,\n\t\t) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\t\tconst interestConfigObject = this.newInterestConfig(interestConfig)(tx);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::update_interest_params`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(marginPool.address),\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\tinterestConfigObject,\n\t\t\t\t\ttx.object(marginPoolCap),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [marginPool.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Update the margin pool config\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @param {TransactionObjectArgument} marginPoolCap The margin pool cap\n\t * @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdateMarginPoolConfig =\n\t\t(\n\t\t\tcoinKey: string,\n\t\t\tmarginPoolCap: TransactionObjectArgument,\n\t\t\tmarginPoolConfig: MarginPoolConfigParams,\n\t\t) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\t\tconst marginPoolConfigObject = this.newMarginPoolConfig(coinKey, marginPoolConfig)(tx);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::update_margin_pool_config`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(marginPool.address),\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\tmarginPoolConfigObject,\n\t\t\t\t\ttx.object(marginPoolCap),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [marginPool.type],\n\t\t\t});\n\t\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeA,oBAA6B;AAf7B;AAoBO,MAAM,yBAAyB;AAAA;AAAA;AAAA;AAAA,EAMrC,YAAY,QAAwB;AAN9B;AACN;AA2BA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAmB,CAAC,SAAiB,eAAoC,CAAC,OAAoB;AAC7F,YAAM,OAAO,mBAAK,SAAQ,QAAQ,OAAO;AACzC,SAAG,SAAS;AAAA,QACX,QAAQ,GAAG,mBAAK,SAAQ,iBAAiB;AAAA,QACzC,WAAW;AAAA,UACV,GAAG,OAAO,mBAAK,SA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M;AAAA,QACjB;AAAA,QACA,eAAe,CAAC,WAAW,IAAI;AAAA,MAChC,CAAC;AAAA,IACF;AASD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCACC,CACC,SACA,eACA,qBAED,CAAC,OAAoB;AACpB,YAAM,aAAa,mBAAK,SAAQ,cAAc,OAAO;AACrD,YAAM,yBAAyB,KAAK,oBAAoB,SAAS,gBAAgB,EAAE,EAAE;AACrF,SAAG,SAAS;AAAA,QACX,QAAQ,GAAG,mBAAK,SAAQ,iBAAiB;AAAA,QACzC,WAAW;AAAA,UACV,GAAG,OAAO,WAAW,OAAO;AAAA,UAC5B,GAAG,OAAO,mBAAK,SAAQ,kBAAkB;AAAA,UACzC;AAAA,UACA,GAAG,OAAO,aAAa;AAAA,UACvB,GAAG,OAAO,MAAM;AAAA,QACjB;AAAA,QACA,eAAe,CAAC,WAAW,IAAI;AAAA,MAChC,CAAC;AAAA,IACF;AA3OA,uBAAK,SAAU;AAAA,EAChB;AA2OD;AAlPC;AADM;AAAA;AAAA;AAAA;AAAA;AAcN,yBAAoB,WAAG;AACtB,QAAM,sBAAsB,mBAAK,SAAQ;AACzC,MAAI,CAAC,qBAAqB;AACzB,UAAM,IAAI,MAAM,+CAA+C;AAAA,EAChE;AACA,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -201,6 +201,11 @@ export interface MarginPoolConfigParams {
|
|
|
201
201
|
referralSpread: number;
|
|
202
202
|
minBorrow: number;
|
|
203
203
|
}
|
|
204
|
+
export interface MarginPoolConfigWithRateLimitParams extends MarginPoolConfigParams {
|
|
205
|
+
rateLimitCapacity: number;
|
|
206
|
+
rateLimitRefillRatePerMs: number;
|
|
207
|
+
rateLimitEnabled: boolean;
|
|
208
|
+
}
|
|
204
209
|
export interface InterestConfigParams {
|
|
205
210
|
baseRate: number;
|
|
206
211
|
baseSlope: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/types/index.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { TransactionObjectArgument } from '@mysten/sui/transactions';\n\n// SPDX-License-Identifier: Apache-2.0\nexport interface BalanceManager {\n\taddress: string;\n\ttradeCap?: string;\n\tdepositCap?: string;\n\twithdrawCap?: string;\n}\n\nexport interface MarginManager {\n\taddress: string;\n\tpoolKey: string;\n}\n\nexport interface Coin {\n\taddress: string;\n\ttype: string;\n\tscalar: number;\n\tfeed?: string;\n\tcurrencyId?: string;\n\tpriceInfoObjectId?: string;\n}\n\nexport interface Pool {\n\taddress: string;\n\tbaseCoin: string;\n\tquoteCoin: string;\n}\n\nexport interface MarginPool {\n\taddress: string;\n\ttype: string;\n}\n\n// Trading constants\nexport enum OrderType {\n\tNO_RESTRICTION,\n\tIMMEDIATE_OR_CANCEL,\n\tFILL_OR_KILL,\n\tPOST_ONLY,\n}\n\n// Self matching options\nexport enum SelfMatchingOptions {\n\tSELF_MATCHING_ALLOWED,\n\tCANCEL_TAKER,\n\tCANCEL_MAKER,\n}\n\nexport interface PlaceLimitOrderParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tclientOrderId: string;\n\tprice: number;\n\tquantity: number;\n\tisBid: boolean;\n\texpiration?: number | bigint;\n\torderType?: OrderType;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tpayWithDeep?: boolean;\n}\n\nexport interface PlaceMarketOrderParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tclientOrderId: string;\n\tquantity: number;\n\tisBid: boolean;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tpayWithDeep?: boolean;\n}\n\nexport interface CanPlaceLimitOrderParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tprice: number;\n\tquantity: number;\n\tisBid: boolean;\n\tpayWithDeep: boolean;\n\texpireTimestamp: number;\n}\n\nexport interface CanPlaceMarketOrderParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tquantity: number;\n\tisBid: boolean;\n\tpayWithDeep: boolean;\n}\n\nexport interface PlaceMarginLimitOrderParams {\n\tpoolKey: string;\n\tmarginManagerKey: string;\n\tclientOrderId: string;\n\tprice: number;\n\tquantity: number;\n\tisBid: boolean;\n\texpiration?: number | bigint;\n\torderType?: OrderType;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tpayWithDeep?: boolean;\n}\n\nexport interface PlaceMarginMarketOrderParams {\n\tpoolKey: string;\n\tmarginManagerKey: string;\n\tclientOrderId: string;\n\tquantity: number;\n\tisBid: boolean;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tpayWithDeep?: boolean;\n}\n\nexport interface PendingLimitOrderParams {\n\tclientOrderId: string;\n\torderType?: OrderType;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tprice: number;\n\tquantity: number;\n\tisBid: boolean;\n\tpayWithDeep?: boolean;\n\texpireTimestamp?: number | bigint;\n}\n\nexport interface PendingMarketOrderParams {\n\tclientOrderId: string;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tquantity: number;\n\tisBid: boolean;\n\tpayWithDeep?: boolean;\n}\n\nexport interface AddConditionalOrderParams {\n\tmarginManagerKey: string;\n\tconditionalOrderId: string;\n\ttriggerBelowPrice: boolean;\n\ttriggerPrice: number;\n\tpendingOrder: PendingLimitOrderParams | PendingMarketOrderParams;\n}\n\nexport interface ProposalParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\ttakerFee: number;\n\tmakerFee: number;\n\tstakeRequired: number;\n}\n\nexport interface MarginProposalParams {\n\ttakerFee: number;\n\tmakerFee: number;\n\tstakeRequired: number;\n}\n\nexport interface SwapParams {\n\tpoolKey: string;\n\tamount: number;\n\tdeepAmount: number;\n\tminOut: number;\n\tdeepCoin?: TransactionObjectArgument;\n\tbaseCoin?: TransactionObjectArgument;\n\tquoteCoin?: TransactionObjectArgument;\n}\n\nexport interface SwapWithManagerParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\ttradeCap: string;\n\tdepositCap: string;\n\twithdrawCap: string;\n\tamount: number;\n\tminOut: number;\n\tbaseCoin?: TransactionObjectArgument;\n\tquoteCoin?: TransactionObjectArgument;\n}\n\nexport interface StakeParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tamount: number;\n}\n\nexport interface VoteParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tproposalId: string;\n}\n\nexport interface FlashLoanParams {\n\tpoolKey: string;\n\tamount: number;\n}\n\nexport interface CreatePoolAdminParams {\n\tbaseCoinKey: string;\n\tquoteCoinKey: string;\n\ttickSize: number;\n\tlotSize: number;\n\tminSize: number;\n\twhitelisted: boolean;\n\tstablePool: boolean;\n}\n\nexport interface CreatePermissionlessPoolParams {\n\tbaseCoinKey: string;\n\tquoteCoinKey: string;\n\ttickSize: number;\n\tlotSize: number;\n\tminSize: number;\n\tdeepCoin?: TransactionObjectArgument;\n}\n\nexport interface SetEwmaParams {\n\talpha: number;\n\tzScoreThreshold: number;\n\tadditionalTakerFee: number;\n}\n\nexport interface PoolConfigParams {\n\tminWithdrawRiskRatio: number;\n\tminBorrowRiskRatio: number;\n\tliquidationRiskRatio: number;\n\ttargetLiquidationRiskRatio: number;\n\tuserLiquidationReward: number;\n\tpoolLiquidationReward: number;\n}\n\nexport interface MarginPoolConfigParams {\n\tsupplyCap: number;\n\tmaxUtilizationRate: number;\n\treferralSpread: number;\n\tminBorrow: number;\n}\n\nexport interface InterestConfigParams {\n\tbaseRate: number;\n\tbaseSlope: number;\n\toptimalUtilization: number;\n\texcessSlope: number;\n}\n\nexport interface Config {\n\tDEEPBOOK_PACKAGE_ID: string;\n\tREGISTRY_ID: string;\n\tDEEP_TREASURY_ID: string;\n}\n\nexport type Environment = 'mainnet' | 'testnet';\n"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { TransactionObjectArgument } from '@mysten/sui/transactions';\n\n// SPDX-License-Identifier: Apache-2.0\nexport interface BalanceManager {\n\taddress: string;\n\ttradeCap?: string;\n\tdepositCap?: string;\n\twithdrawCap?: string;\n}\n\nexport interface MarginManager {\n\taddress: string;\n\tpoolKey: string;\n}\n\nexport interface Coin {\n\taddress: string;\n\ttype: string;\n\tscalar: number;\n\tfeed?: string;\n\tcurrencyId?: string;\n\tpriceInfoObjectId?: string;\n}\n\nexport interface Pool {\n\taddress: string;\n\tbaseCoin: string;\n\tquoteCoin: string;\n}\n\nexport interface MarginPool {\n\taddress: string;\n\ttype: string;\n}\n\n// Trading constants\nexport enum OrderType {\n\tNO_RESTRICTION,\n\tIMMEDIATE_OR_CANCEL,\n\tFILL_OR_KILL,\n\tPOST_ONLY,\n}\n\n// Self matching options\nexport enum SelfMatchingOptions {\n\tSELF_MATCHING_ALLOWED,\n\tCANCEL_TAKER,\n\tCANCEL_MAKER,\n}\n\nexport interface PlaceLimitOrderParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tclientOrderId: string;\n\tprice: number;\n\tquantity: number;\n\tisBid: boolean;\n\texpiration?: number | bigint;\n\torderType?: OrderType;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tpayWithDeep?: boolean;\n}\n\nexport interface PlaceMarketOrderParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tclientOrderId: string;\n\tquantity: number;\n\tisBid: boolean;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tpayWithDeep?: boolean;\n}\n\nexport interface CanPlaceLimitOrderParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tprice: number;\n\tquantity: number;\n\tisBid: boolean;\n\tpayWithDeep: boolean;\n\texpireTimestamp: number;\n}\n\nexport interface CanPlaceMarketOrderParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tquantity: number;\n\tisBid: boolean;\n\tpayWithDeep: boolean;\n}\n\nexport interface PlaceMarginLimitOrderParams {\n\tpoolKey: string;\n\tmarginManagerKey: string;\n\tclientOrderId: string;\n\tprice: number;\n\tquantity: number;\n\tisBid: boolean;\n\texpiration?: number | bigint;\n\torderType?: OrderType;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tpayWithDeep?: boolean;\n}\n\nexport interface PlaceMarginMarketOrderParams {\n\tpoolKey: string;\n\tmarginManagerKey: string;\n\tclientOrderId: string;\n\tquantity: number;\n\tisBid: boolean;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tpayWithDeep?: boolean;\n}\n\nexport interface PendingLimitOrderParams {\n\tclientOrderId: string;\n\torderType?: OrderType;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tprice: number;\n\tquantity: number;\n\tisBid: boolean;\n\tpayWithDeep?: boolean;\n\texpireTimestamp?: number | bigint;\n}\n\nexport interface PendingMarketOrderParams {\n\tclientOrderId: string;\n\tselfMatchingOption?: SelfMatchingOptions;\n\tquantity: number;\n\tisBid: boolean;\n\tpayWithDeep?: boolean;\n}\n\nexport interface AddConditionalOrderParams {\n\tmarginManagerKey: string;\n\tconditionalOrderId: string;\n\ttriggerBelowPrice: boolean;\n\ttriggerPrice: number;\n\tpendingOrder: PendingLimitOrderParams | PendingMarketOrderParams;\n}\n\nexport interface ProposalParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\ttakerFee: number;\n\tmakerFee: number;\n\tstakeRequired: number;\n}\n\nexport interface MarginProposalParams {\n\ttakerFee: number;\n\tmakerFee: number;\n\tstakeRequired: number;\n}\n\nexport interface SwapParams {\n\tpoolKey: string;\n\tamount: number;\n\tdeepAmount: number;\n\tminOut: number;\n\tdeepCoin?: TransactionObjectArgument;\n\tbaseCoin?: TransactionObjectArgument;\n\tquoteCoin?: TransactionObjectArgument;\n}\n\nexport interface SwapWithManagerParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\ttradeCap: string;\n\tdepositCap: string;\n\twithdrawCap: string;\n\tamount: number;\n\tminOut: number;\n\tbaseCoin?: TransactionObjectArgument;\n\tquoteCoin?: TransactionObjectArgument;\n}\n\nexport interface StakeParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tamount: number;\n}\n\nexport interface VoteParams {\n\tpoolKey: string;\n\tbalanceManagerKey: string;\n\tproposalId: string;\n}\n\nexport interface FlashLoanParams {\n\tpoolKey: string;\n\tamount: number;\n}\n\nexport interface CreatePoolAdminParams {\n\tbaseCoinKey: string;\n\tquoteCoinKey: string;\n\ttickSize: number;\n\tlotSize: number;\n\tminSize: number;\n\twhitelisted: boolean;\n\tstablePool: boolean;\n}\n\nexport interface CreatePermissionlessPoolParams {\n\tbaseCoinKey: string;\n\tquoteCoinKey: string;\n\ttickSize: number;\n\tlotSize: number;\n\tminSize: number;\n\tdeepCoin?: TransactionObjectArgument;\n}\n\nexport interface SetEwmaParams {\n\talpha: number;\n\tzScoreThreshold: number;\n\tadditionalTakerFee: number;\n}\n\nexport interface PoolConfigParams {\n\tminWithdrawRiskRatio: number;\n\tminBorrowRiskRatio: number;\n\tliquidationRiskRatio: number;\n\ttargetLiquidationRiskRatio: number;\n\tuserLiquidationReward: number;\n\tpoolLiquidationReward: number;\n}\n\nexport interface MarginPoolConfigParams {\n\tsupplyCap: number;\n\tmaxUtilizationRate: number;\n\treferralSpread: number;\n\tminBorrow: number;\n}\n\nexport interface MarginPoolConfigWithRateLimitParams extends MarginPoolConfigParams {\n\trateLimitCapacity: number;\n\trateLimitRefillRatePerMs: number;\n\trateLimitEnabled: boolean;\n}\n\nexport interface InterestConfigParams {\n\tbaseRate: number;\n\tbaseSlope: number;\n\toptimalUtilization: number;\n\texcessSlope: number;\n}\n\nexport interface Config {\n\tDEEPBOOK_PACKAGE_ID: string;\n\tREGISTRY_ID: string;\n\tDEEP_TREASURY_ID: string;\n}\n\nexport type Environment = 'mainnet' | 'testnet';\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuCO,IAAK,YAAL,kBAAKA,eAAL;AACN,EAAAA,sBAAA;AACA,EAAAA,sBAAA;AACA,EAAAA,sBAAA;AACA,EAAAA,sBAAA;AAJW,SAAAA;AAAA,GAAA;AAQL,IAAK,sBAAL,kBAAKC,yBAAL;AACN,EAAAA,0CAAA;AACA,EAAAA,0CAAA;AACA,EAAAA,0CAAA;AAHW,SAAAA;AAAA,GAAA;",
|
|
6
6
|
"names": ["OrderType", "SelfMatchingOptions"]
|
|
7
7
|
}
|
|
@@ -42,9 +42,9 @@ const mainnetPackageIds = {
|
|
|
42
42
|
DEEPBOOK_PACKAGE_ID: "0x337f4f4f6567fcd778d5454f27c16c70e2f274cc6377ea6249ddf491482ef497",
|
|
43
43
|
REGISTRY_ID: "0xaf16199a2dff736e9f07a845f23c5da6df6f756eddb631aed9d24a93efc4549d",
|
|
44
44
|
DEEP_TREASURY_ID: "0x032abf8948dda67a271bcc18e776dbbcfb0d58c8d288a700ff0d5521e57a1ffe",
|
|
45
|
-
MARGIN_PACKAGE_ID: "",
|
|
46
|
-
MARGIN_REGISTRY_ID: "",
|
|
47
|
-
LIQUIDATION_PACKAGE_ID: ""
|
|
45
|
+
MARGIN_PACKAGE_ID: "0xdd8400e6da54a2d4216f157f9f242af9ec81d011acc75756ff6bcc81dd78d3be",
|
|
46
|
+
MARGIN_REGISTRY_ID: "0x8bf55075f01a63cff03a8b01577d444d8bdc55b0e0d6b3f10a9af9b281001544",
|
|
47
|
+
LIQUIDATION_PACKAGE_ID: "0x1d4ba3438932a2201ad05156e3d2b5f216558e63cbc7a28a968617bb4e0ed547"
|
|
48
48
|
};
|
|
49
49
|
const testnetCoins = {
|
|
50
50
|
DEEP: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/utils/constants.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Coin, Pool, MarginPool } from '../types/index.js';\n\nexport type CoinMap = Record<string, Coin>;\nexport type PoolMap = Record<string, Pool>;\nexport type MarginPoolMap = Record<string, MarginPool>;\nexport interface DeepbookPackageIds {\n\tDEEPBOOK_PACKAGE_ID: string;\n\tREGISTRY_ID: string;\n\tDEEP_TREASURY_ID: string;\n\tMARGIN_PACKAGE_ID: string;\n\tMARGIN_REGISTRY_ID: string;\n\tLIQUIDATION_PACKAGE_ID: string;\n}\n\nexport const testnetPackageIds = {\n\tDEEPBOOK_PACKAGE_ID: '0x22be4cade64bf2d02412c7e8d0e8beea2f78828b948118d46735315409371a3c',\n\tREGISTRY_ID: '0x7c256edbda983a2cd6f946655f4bf3f00a41043993781f8674a7046e8c0e11d1',\n\tDEEP_TREASURY_ID: '0x69fffdae0075f8f71f4fa793549c11079266910e8905169845af1f5d00e09dcb',\n\tMARGIN_PACKAGE_ID: '0xd6a42f4df4db73d68cbeb52be66698d2fe6a9464f45ad113ca52b0c6ebd918b6',\n\tMARGIN_REGISTRY_ID: '0x48d7640dfae2c6e9ceeada197a7a1643984b5a24c55a0c6c023dac77e0339f75',\n\tLIQUIDATION_PACKAGE_ID: '0x8d69c3ef3ef580e5bf87b933ce28de19a5d0323588d1a44b9c60b4001741aa24',\n} satisfies DeepbookPackageIds;\n\nexport const mainnetPackageIds = {\n\tDEEPBOOK_PACKAGE_ID: '0x337f4f4f6567fcd778d5454f27c16c70e2f274cc6377ea6249ddf491482ef497',\n\tREGISTRY_ID: '0xaf16199a2dff736e9f07a845f23c5da6df6f756eddb631aed9d24a93efc4549d',\n\tDEEP_TREASURY_ID: '0x032abf8948dda67a271bcc18e776dbbcfb0d58c8d288a700ff0d5521e57a1ffe',\n\tMARGIN_PACKAGE_ID: '',\n\tMARGIN_REGISTRY_ID: '',\n\tLIQUIDATION_PACKAGE_ID: '',\n} satisfies DeepbookPackageIds;\n\nexport const testnetCoins: CoinMap = {\n\tDEEP: {\n\t\taddress: `0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8`,\n\t\ttype: `0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP`,\n\t\tscalar: 1000000,\n\t\tfeed: '0x99137a18354efa7fb6840889d059fdb04c46a6ce21be97ab60d9ad93e91ac758', // DEEP uses HFT feed on testnet\n\t\tcurrencyId: '0xbf1b77e244f649c736a44898585cc8ac939fbb0bbdf1d8d2a183978cc312e613',\n\t\tpriceInfoObjectId: '0x3d52fffa2cd9e54b39bb36d282bdda560b15b8b4fdf4766a3c58499ef172bafc',\n\t},\n\tSUI: {\n\t\taddress: `0x0000000000000000000000000000000000000000000000000000000000000002`,\n\t\ttype: `0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI`,\n\t\tscalar: 1000000000,\n\t\tfeed: '0x50c67b3fd225db8912a424dd4baed60ffdde625ed2feaaf283724f9608fea266',\n\t\tcurrencyId: '0xf256d3fb6a50eaa748d94335b34f2982fbc3b63ceec78cafaa29ebc9ebaf2bbc',\n\t\tpriceInfoObjectId: '0x1ebb295c789cc42b3b2a1606482cd1c7124076a0f5676718501fda8c7fd075a0',\n\t},\n\tDBUSDC: {\n\t\taddress: `0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7`,\n\t\ttype: `0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7::DBUSDC::DBUSDC`,\n\t\tscalar: 1000000,\n\t\tfeed: '0x41f3625971ca2ed2263e78573fe5ce23e13d2558ed3f2e47ab0f84fb9e7ae722',\n\t\tcurrencyId: '0x509db0f9283c9ee4fdc5b99028a439d3639f49e9709e3d7a6de14b3bfdb0c784',\n\t\tpriceInfoObjectId: '0x9c4dd4008297ffa5e480684b8100ec21cc934405ed9a25d4e4d7b6259aad9c81',\n\t},\n\tDBTC: {\n\t\taddress: `0x6502dae813dbe5e42643c119a6450a518481f03063febc7e20238e43b6ea9e86`,\n\t\ttype: `0x6502dae813dbe5e42643c119a6450a518481f03063febc7e20238e43b6ea9e86::dbtc::DBTC`,\n\t\tscalar: 100000000,\n\t\tfeed: '0xf9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b',\n\t\tcurrencyId: '0x3ef2afa2126704bf721b9c8495d94288f6bd090fc454fe3e1613eb765a8a348f',\n\t\tpriceInfoObjectId: '0x72431a238277695d3f31e4425225a4462674ee6cceeea9d66447b210755fffba',\n\t},\n\tDBUSDT: {\n\t\taddress: `0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7`,\n\t\ttype: `0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7::DBUSDT::DBUSDT`,\n\t\tscalar: 1000000,\n\t},\n\tWAL: {\n\t\taddress: `0x9ef7676a9f81937a52ae4b2af8d511a28a0b080477c0c2db40b0ab8882240d76`,\n\t\ttype: `0x9ef7676a9f81937a52ae4b2af8d511a28a0b080477c0c2db40b0ab8882240d76::wal::WAL`,\n\t\tscalar: 1000000000,\n\t},\n};\n\nexport const mainnetCoins: CoinMap = {\n\tDEEP: {\n\t\taddress: `0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270`,\n\t\ttype: `0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP`,\n\t\tscalar: 1000000,\n\t\tfeed: '0x29bdd5248234e33bd93d3b81100b5fa32eaa5997843847e2c2cb16d7c6d9f7ff',\n\t\tcurrencyId: '0x3f2afb7c5f245870a8b8a3808e6dd7042446a0e7504e9d2795372da053858cd9',\n\t},\n\tSUI: {\n\t\taddress: `0x0000000000000000000000000000000000000000000000000000000000000002`,\n\t\ttype: `0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI`,\n\t\tscalar: 1000000000,\n\t\tfeed: '0x23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',\n\t\tcurrencyId: '0xf256d3fb6a50eaa748d94335b34f2982fbc3b63ceec78cafaa29ebc9ebaf2bbc',\n\t},\n\tUSDC: {\n\t\taddress: `0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7`,\n\t\ttype: `0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC`,\n\t\tscalar: 1000000,\n\t\tfeed: '0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a',\n\t\tcurrencyId: '0x75cfbbf8c962d542e99a1d15731e6069f60a00db895407785b15d14f606f2b4a',\n\t},\n\tWAL: {\n\t\taddress: `0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59`,\n\t\ttype: `0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL`,\n\t\tscalar: 1000000000,\n\t\tfeed: '0xeba0732395fae9dec4bae12e52760b35fc1c5671e2da8b449c9af4efe5d54341',\n\t\tcurrencyId: '0xb6a0c0bacb1c87c3be4dff20c22ef1012125b5724b5b0ff424f852a2651b23fa',\n\t},\n\tWUSDC: {\n\t\taddress: `0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf`,\n\t\ttype: `0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN`,\n\t\tscalar: 1000000,\n\t},\n\tWETH: {\n\t\taddress: `0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5`,\n\t\ttype: `0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN`,\n\t\tscalar: 100000000,\n\t},\n\tBETH: {\n\t\taddress: `0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29`,\n\t\ttype: `0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH`,\n\t\tscalar: 100000000,\n\t},\n\tWBTC: {\n\t\taddress: `0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881`,\n\t\ttype: `0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN`,\n\t\tscalar: 100000000,\n\t},\n\tWUSDT: {\n\t\taddress: `0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c`,\n\t\ttype: `0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN`,\n\t\tscalar: 1000000,\n\t},\n\tNS: {\n\t\taddress: `0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178`,\n\t\ttype: `0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS`,\n\t\tscalar: 1000000,\n\t},\n\tTYPUS: {\n\t\taddress: `0xf82dc05634970553615eef6112a1ac4fb7bf10272bf6cbe0f80ef44a6c489385`,\n\t\ttype: `0xf82dc05634970553615eef6112a1ac4fb7bf10272bf6cbe0f80ef44a6c489385::typus::TYPUS`,\n\t\tscalar: 1000000000,\n\t},\n\tAUSD: {\n\t\taddress: `0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2`,\n\t\ttype: `0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD`,\n\t\tscalar: 1000000,\n\t},\n\tDRF: {\n\t\taddress: `0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e`,\n\t\ttype: `0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF`,\n\t\tscalar: 1000000,\n\t},\n\tSEND: {\n\t\taddress: `0xb45fcfcc2cc07ce0702cc2d229621e046c906ef14d9b25e8e4d25f6e8763fef7`,\n\t\ttype: `0xb45fcfcc2cc07ce0702cc2d229621e046c906ef14d9b25e8e4d25f6e8763fef7::send::SEND`,\n\t\tscalar: 1000000,\n\t},\n\tXBTC: {\n\t\taddress: `0x876a4b7bce8aeaef60464c11f4026903e9afacab79b9b142686158aa86560b50`,\n\t\ttype: `0x876a4b7bce8aeaef60464c11f4026903e9afacab79b9b142686158aa86560b50::xbtc::XBTC`,\n\t\tscalar: 100000000,\n\t},\n\tIKA: {\n\t\taddress: `0x7262fb2f7a3a14c888c438a3cd9b912469a58cf60f367352c46584262e8299aa`,\n\t\ttype: `0x7262fb2f7a3a14c888c438a3cd9b912469a58cf60f367352c46584262e8299aa::ika::IKA`,\n\t\tscalar: 1000000000,\n\t},\n\tALKIMI: {\n\t\taddress: `0x1a8f4bc33f8ef7fbc851f156857aa65d397a6a6fd27a7ac2ca717b51f2fd9489`,\n\t\ttype: `0x1a8f4bc33f8ef7fbc851f156857aa65d397a6a6fd27a7ac2ca717b51f2fd9489::alkimi::ALKIMI`,\n\t\tscalar: 1000000000,\n\t},\n\tLZWBTC: {\n\t\taddress: `0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942`,\n\t\ttype: `0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942::wbtc::WBTC`,\n\t\tscalar: 100000000,\n\t},\n\t// This coin is experimental\n\tWGIGA: {\n\t\taddress: `0xec32640add6d02a1d5f0425d72705eb76d9de7edfd4f34e0dba68e62ecceb05b`,\n\t\ttype: `0xec32640add6d02a1d5f0425d72705eb76d9de7edfd4f34e0dba68e62ecceb05b::coin::COIN`,\n\t\tscalar: 100000,\n\t},\n};\n\nexport const testnetPools: PoolMap = {\n\tDEEP_SUI: {\n\t\taddress: `0x48c95963e9eac37a316b7ae04a0deb761bcdcc2b67912374d6036e7f0e9bae9f`,\n\t\tbaseCoin: 'DEEP',\n\t\tquoteCoin: 'SUI',\n\t},\n\tSUI_DBUSDC: {\n\t\taddress: `0x1c19362ca52b8ffd7a33cee805a67d40f31e6ba303753fd3a4cfdfacea7163a5`,\n\t\tbaseCoin: 'SUI',\n\t\tquoteCoin: 'DBUSDC',\n\t},\n\tDEEP_DBUSDC: {\n\t\taddress: `0xe86b991f8632217505fd859445f9803967ac84a9d4a1219065bf191fcb74b622`,\n\t\tbaseCoin: 'DEEP',\n\t\tquoteCoin: 'DBUSDC',\n\t},\n\tDBUSDT_DBUSDC: {\n\t\taddress: `0x83970bb02e3636efdff8c141ab06af5e3c9a22e2f74d7f02a9c3430d0d10c1ca`,\n\t\tbaseCoin: 'DBUSDT',\n\t\tquoteCoin: 'DBUSDC',\n\t},\n\tWAL_DBUSDC: {\n\t\taddress: `0xeb524b6aea0ec4b494878582e0b78924208339d360b62aec4a8ecd4031520dbb`,\n\t\tbaseCoin: 'WAL',\n\t\tquoteCoin: 'DBUSDC',\n\t},\n\tWAL_SUI: {\n\t\taddress: `0x8c1c1b186c4fddab1ebd53e0895a36c1d1b3b9a77cd34e607bef49a38af0150a`,\n\t\tbaseCoin: 'WAL',\n\t\tquoteCoin: 'SUI',\n\t},\n\tDBTC_DBUSDC: {\n\t\taddress: `0x0dce0aa771074eb83d1f4a29d48be8248d4d2190976a5241f66b43ec18fa34de`,\n\t\tbaseCoin: 'DBTC',\n\t\tquoteCoin: 'DBUSDC',\n\t},\n};\n\nexport const mainnetPools: PoolMap = {\n\tDEEP_SUI: {\n\t\taddress: `0xb663828d6217467c8a1838a03793da896cbe745b150ebd57d82f814ca579fc22`,\n\t\tbaseCoin: 'DEEP',\n\t\tquoteCoin: 'SUI',\n\t},\n\tSUI_USDC: {\n\t\taddress: `0xe05dafb5133bcffb8d59f4e12465dc0e9faeaa05e3e342a08fe135800e3e4407`,\n\t\tbaseCoin: 'SUI',\n\t\tquoteCoin: 'USDC',\n\t},\n\tDEEP_USDC: {\n\t\taddress: `0xf948981b806057580f91622417534f491da5f61aeaf33d0ed8e69fd5691c95ce`,\n\t\tbaseCoin: 'DEEP',\n\t\tquoteCoin: 'USDC',\n\t},\n\tWUSDT_USDC: {\n\t\taddress: `0x4e2ca3988246e1d50b9bf209abb9c1cbfec65bd95afdacc620a36c67bdb8452f`,\n\t\tbaseCoin: 'WUSDT',\n\t\tquoteCoin: 'USDC',\n\t},\n\tWUSDC_USDC: {\n\t\taddress: `0xa0b9ebefb38c963fd115f52d71fa64501b79d1adcb5270563f92ce0442376545`,\n\t\tbaseCoin: 'WUSDC',\n\t\tquoteCoin: 'USDC',\n\t},\n\tBETH_USDC: {\n\t\taddress: `0x1109352b9112717bd2a7c3eb9a416fff1ba6951760f5bdd5424cf5e4e5b3e65c`,\n\t\tbaseCoin: 'BETH',\n\t\tquoteCoin: 'USDC',\n\t},\n\tNS_USDC: {\n\t\taddress: `0x0c0fdd4008740d81a8a7d4281322aee71a1b62c449eb5b142656753d89ebc060`,\n\t\tbaseCoin: 'NS',\n\t\tquoteCoin: 'USDC',\n\t},\n\tNS_SUI: {\n\t\taddress: `0x27c4fdb3b846aa3ae4a65ef5127a309aa3c1f466671471a806d8912a18b253e8`,\n\t\tbaseCoin: 'NS',\n\t\tquoteCoin: 'SUI',\n\t},\n\tTYPUS_SUI: {\n\t\taddress: `0xe8e56f377ab5a261449b92ac42c8ddaacd5671e9fec2179d7933dd1a91200eec`,\n\t\tbaseCoin: 'TYPUS',\n\t\tquoteCoin: 'SUI',\n\t},\n\tSUI_AUSD: {\n\t\taddress: `0x183df694ebc852a5f90a959f0f563b82ac9691e42357e9a9fe961d71a1b809c8`,\n\t\tbaseCoin: 'SUI',\n\t\tquoteCoin: 'AUSD',\n\t},\n\tAUSD_USDC: {\n\t\taddress: `0x5661fc7f88fbeb8cb881150a810758cf13700bb4e1f31274a244581b37c303c3`,\n\t\tbaseCoin: 'AUSD',\n\t\tquoteCoin: 'USDC',\n\t},\n\tDRF_SUI: {\n\t\taddress: `0x126865a0197d6ab44bfd15fd052da6db92fd2eb831ff9663451bbfa1219e2af2`,\n\t\tbaseCoin: 'DRF',\n\t\tquoteCoin: 'SUI',\n\t},\n\tSEND_USDC: {\n\t\taddress: `0x1fe7b99c28ded39774f37327b509d58e2be7fff94899c06d22b407496a6fa990`,\n\t\tbaseCoin: 'SEND',\n\t\tquoteCoin: 'USDC',\n\t},\n\tWAL_USDC: {\n\t\taddress: `0x56a1c985c1f1123181d6b881714793689321ba24301b3585eec427436eb1c76d`,\n\t\tbaseCoin: 'WAL',\n\t\tquoteCoin: 'USDC',\n\t},\n\tWAL_SUI: {\n\t\taddress: `0x81f5339934c83ea19dd6bcc75c52e83509629a5f71d3257428c2ce47cc94d08b`,\n\t\tbaseCoin: 'WAL',\n\t\tquoteCoin: 'SUI',\n\t},\n\tXBTC_USDC: {\n\t\taddress: `0x20b9a3ec7a02d4f344aa1ebc5774b7b0ccafa9a5d76230662fdc0300bb215307`,\n\t\tbaseCoin: 'XBTC',\n\t\tquoteCoin: 'USDC',\n\t},\n\tIKA_USDC: {\n\t\taddress: `0xfa732993af2b60d04d7049511f801e79426b2b6a5103e22769c0cead982b0f47`,\n\t\tbaseCoin: 'IKA',\n\t\tquoteCoin: 'USDC',\n\t},\n\tALKIMI_SUI: {\n\t\taddress: `0x84752993c6dc6fce70e25ddeb4daddb6592d6b9b0912a0a91c07cfff5a721d89`,\n\t\tbaseCoin: 'ALKIMI',\n\t\tquoteCoin: 'SUI',\n\t},\n\tLZWBTC_USDC: {\n\t\taddress: `0xf5142aafa24866107df628bf92d0358c7da6acc46c2f10951690fd2b8570f117`,\n\t\tbaseCoin: 'LZWBTC',\n\t\tquoteCoin: 'USDC',\n\t},\n};\n\nexport const testnetMarginPools = {\n\tSUI: {\n\t\taddress: '0xcdbbe6a72e639b647296788e2e4b1cac5cea4246028ba388ba1332ff9a382eea',\n\t\ttype: '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',\n\t},\n\tDBUSDC: {\n\t\taddress: '0xf08568da93834e1ee04f09902ac7b1e78d3fdf113ab4d2106c7265e95318b14d',\n\t\ttype: '0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7::DBUSDC::DBUSDC',\n\t},\n\tDEEP: {\n\t\taddress: '0x610640613f21d9e688d6f8103d17df22315c32e0c80590ce64951a1991378b55',\n\t\ttype: '0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP',\n\t},\n\tDBTC: {\n\t\taddress: '0xf3440b4aafcc8b12fc4b242e9590c52873b8238a0d0e52fbf9dae61d2970796a',\n\t\ttype: '0x6502dae813dbe5e42643c119a6450a518481f03063febc7e20238e43b6ea9e86::dbtc::DBTC',\n\t},\n};\n\nexport const mainnetMarginPools = {\n\tSUI: {\n\t\taddress: '',\n\t\ttype: '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',\n\t},\n\tUSDC: {\n\t\taddress: '',\n\t\ttype: '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC',\n\t},\n\tDEEP: {\n\t\taddress: '',\n\t\ttype: '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP',\n\t},\n};\n\nexport const testnetPythConfigs = {\n\tpythStateId: '0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c',\n\twormholeStateId: '0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790',\n};\n\nexport const mainnetPythConfigs = {\n\tpythStateId: '0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8',\n\twormholeStateId: '0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c',\n};\n"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Coin, Pool, MarginPool } from '../types/index.js';\n\nexport type CoinMap = Record<string, Coin>;\nexport type PoolMap = Record<string, Pool>;\nexport type MarginPoolMap = Record<string, MarginPool>;\nexport interface DeepbookPackageIds {\n\tDEEPBOOK_PACKAGE_ID: string;\n\tREGISTRY_ID: string;\n\tDEEP_TREASURY_ID: string;\n\tMARGIN_PACKAGE_ID: string;\n\tMARGIN_REGISTRY_ID: string;\n\tLIQUIDATION_PACKAGE_ID: string;\n}\n\nexport const testnetPackageIds = {\n\tDEEPBOOK_PACKAGE_ID: '0x22be4cade64bf2d02412c7e8d0e8beea2f78828b948118d46735315409371a3c',\n\tREGISTRY_ID: '0x7c256edbda983a2cd6f946655f4bf3f00a41043993781f8674a7046e8c0e11d1',\n\tDEEP_TREASURY_ID: '0x69fffdae0075f8f71f4fa793549c11079266910e8905169845af1f5d00e09dcb',\n\tMARGIN_PACKAGE_ID: '0xd6a42f4df4db73d68cbeb52be66698d2fe6a9464f45ad113ca52b0c6ebd918b6',\n\tMARGIN_REGISTRY_ID: '0x48d7640dfae2c6e9ceeada197a7a1643984b5a24c55a0c6c023dac77e0339f75',\n\tLIQUIDATION_PACKAGE_ID: '0x8d69c3ef3ef580e5bf87b933ce28de19a5d0323588d1a44b9c60b4001741aa24',\n} satisfies DeepbookPackageIds;\n\nexport const mainnetPackageIds = {\n\tDEEPBOOK_PACKAGE_ID: '0x337f4f4f6567fcd778d5454f27c16c70e2f274cc6377ea6249ddf491482ef497',\n\tREGISTRY_ID: '0xaf16199a2dff736e9f07a845f23c5da6df6f756eddb631aed9d24a93efc4549d',\n\tDEEP_TREASURY_ID: '0x032abf8948dda67a271bcc18e776dbbcfb0d58c8d288a700ff0d5521e57a1ffe',\n\tMARGIN_PACKAGE_ID: '0xdd8400e6da54a2d4216f157f9f242af9ec81d011acc75756ff6bcc81dd78d3be',\n\tMARGIN_REGISTRY_ID: '0x8bf55075f01a63cff03a8b01577d444d8bdc55b0e0d6b3f10a9af9b281001544',\n\tLIQUIDATION_PACKAGE_ID: '0x1d4ba3438932a2201ad05156e3d2b5f216558e63cbc7a28a968617bb4e0ed547',\n} satisfies DeepbookPackageIds;\n\nexport const testnetCoins: CoinMap = {\n\tDEEP: {\n\t\taddress: `0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8`,\n\t\ttype: `0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP`,\n\t\tscalar: 1000000,\n\t\tfeed: '0x99137a18354efa7fb6840889d059fdb04c46a6ce21be97ab60d9ad93e91ac758', // DEEP uses HFT feed on testnet\n\t\tcurrencyId: '0xbf1b77e244f649c736a44898585cc8ac939fbb0bbdf1d8d2a183978cc312e613',\n\t\tpriceInfoObjectId: '0x3d52fffa2cd9e54b39bb36d282bdda560b15b8b4fdf4766a3c58499ef172bafc',\n\t},\n\tSUI: {\n\t\taddress: `0x0000000000000000000000000000000000000000000000000000000000000002`,\n\t\ttype: `0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI`,\n\t\tscalar: 1000000000,\n\t\tfeed: '0x50c67b3fd225db8912a424dd4baed60ffdde625ed2feaaf283724f9608fea266',\n\t\tcurrencyId: '0xf256d3fb6a50eaa748d94335b34f2982fbc3b63ceec78cafaa29ebc9ebaf2bbc',\n\t\tpriceInfoObjectId: '0x1ebb295c789cc42b3b2a1606482cd1c7124076a0f5676718501fda8c7fd075a0',\n\t},\n\tDBUSDC: {\n\t\taddress: `0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7`,\n\t\ttype: `0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7::DBUSDC::DBUSDC`,\n\t\tscalar: 1000000,\n\t\tfeed: '0x41f3625971ca2ed2263e78573fe5ce23e13d2558ed3f2e47ab0f84fb9e7ae722',\n\t\tcurrencyId: '0x509db0f9283c9ee4fdc5b99028a439d3639f49e9709e3d7a6de14b3bfdb0c784',\n\t\tpriceInfoObjectId: '0x9c4dd4008297ffa5e480684b8100ec21cc934405ed9a25d4e4d7b6259aad9c81',\n\t},\n\tDBTC: {\n\t\taddress: `0x6502dae813dbe5e42643c119a6450a518481f03063febc7e20238e43b6ea9e86`,\n\t\ttype: `0x6502dae813dbe5e42643c119a6450a518481f03063febc7e20238e43b6ea9e86::dbtc::DBTC`,\n\t\tscalar: 100000000,\n\t\tfeed: '0xf9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b',\n\t\tcurrencyId: '0x3ef2afa2126704bf721b9c8495d94288f6bd090fc454fe3e1613eb765a8a348f',\n\t\tpriceInfoObjectId: '0x72431a238277695d3f31e4425225a4462674ee6cceeea9d66447b210755fffba',\n\t},\n\tDBUSDT: {\n\t\taddress: `0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7`,\n\t\ttype: `0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7::DBUSDT::DBUSDT`,\n\t\tscalar: 1000000,\n\t},\n\tWAL: {\n\t\taddress: `0x9ef7676a9f81937a52ae4b2af8d511a28a0b080477c0c2db40b0ab8882240d76`,\n\t\ttype: `0x9ef7676a9f81937a52ae4b2af8d511a28a0b080477c0c2db40b0ab8882240d76::wal::WAL`,\n\t\tscalar: 1000000000,\n\t},\n};\n\nexport const mainnetCoins: CoinMap = {\n\tDEEP: {\n\t\taddress: `0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270`,\n\t\ttype: `0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP`,\n\t\tscalar: 1000000,\n\t\tfeed: '0x29bdd5248234e33bd93d3b81100b5fa32eaa5997843847e2c2cb16d7c6d9f7ff',\n\t\tcurrencyId: '0x3f2afb7c5f245870a8b8a3808e6dd7042446a0e7504e9d2795372da053858cd9',\n\t},\n\tSUI: {\n\t\taddress: `0x0000000000000000000000000000000000000000000000000000000000000002`,\n\t\ttype: `0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI`,\n\t\tscalar: 1000000000,\n\t\tfeed: '0x23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',\n\t\tcurrencyId: '0xf256d3fb6a50eaa748d94335b34f2982fbc3b63ceec78cafaa29ebc9ebaf2bbc',\n\t},\n\tUSDC: {\n\t\taddress: `0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7`,\n\t\ttype: `0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC`,\n\t\tscalar: 1000000,\n\t\tfeed: '0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a',\n\t\tcurrencyId: '0x75cfbbf8c962d542e99a1d15731e6069f60a00db895407785b15d14f606f2b4a',\n\t},\n\tWAL: {\n\t\taddress: `0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59`,\n\t\ttype: `0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL`,\n\t\tscalar: 1000000000,\n\t\tfeed: '0xeba0732395fae9dec4bae12e52760b35fc1c5671e2da8b449c9af4efe5d54341',\n\t\tcurrencyId: '0xb6a0c0bacb1c87c3be4dff20c22ef1012125b5724b5b0ff424f852a2651b23fa',\n\t},\n\tWUSDC: {\n\t\taddress: `0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf`,\n\t\ttype: `0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN`,\n\t\tscalar: 1000000,\n\t},\n\tWETH: {\n\t\taddress: `0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5`,\n\t\ttype: `0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN`,\n\t\tscalar: 100000000,\n\t},\n\tBETH: {\n\t\taddress: `0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29`,\n\t\ttype: `0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH`,\n\t\tscalar: 100000000,\n\t},\n\tWBTC: {\n\t\taddress: `0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881`,\n\t\ttype: `0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN`,\n\t\tscalar: 100000000,\n\t},\n\tWUSDT: {\n\t\taddress: `0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c`,\n\t\ttype: `0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN`,\n\t\tscalar: 1000000,\n\t},\n\tNS: {\n\t\taddress: `0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178`,\n\t\ttype: `0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS`,\n\t\tscalar: 1000000,\n\t},\n\tTYPUS: {\n\t\taddress: `0xf82dc05634970553615eef6112a1ac4fb7bf10272bf6cbe0f80ef44a6c489385`,\n\t\ttype: `0xf82dc05634970553615eef6112a1ac4fb7bf10272bf6cbe0f80ef44a6c489385::typus::TYPUS`,\n\t\tscalar: 1000000000,\n\t},\n\tAUSD: {\n\t\taddress: `0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2`,\n\t\ttype: `0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD`,\n\t\tscalar: 1000000,\n\t},\n\tDRF: {\n\t\taddress: `0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e`,\n\t\ttype: `0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF`,\n\t\tscalar: 1000000,\n\t},\n\tSEND: {\n\t\taddress: `0xb45fcfcc2cc07ce0702cc2d229621e046c906ef14d9b25e8e4d25f6e8763fef7`,\n\t\ttype: `0xb45fcfcc2cc07ce0702cc2d229621e046c906ef14d9b25e8e4d25f6e8763fef7::send::SEND`,\n\t\tscalar: 1000000,\n\t},\n\tXBTC: {\n\t\taddress: `0x876a4b7bce8aeaef60464c11f4026903e9afacab79b9b142686158aa86560b50`,\n\t\ttype: `0x876a4b7bce8aeaef60464c11f4026903e9afacab79b9b142686158aa86560b50::xbtc::XBTC`,\n\t\tscalar: 100000000,\n\t},\n\tIKA: {\n\t\taddress: `0x7262fb2f7a3a14c888c438a3cd9b912469a58cf60f367352c46584262e8299aa`,\n\t\ttype: `0x7262fb2f7a3a14c888c438a3cd9b912469a58cf60f367352c46584262e8299aa::ika::IKA`,\n\t\tscalar: 1000000000,\n\t},\n\tALKIMI: {\n\t\taddress: `0x1a8f4bc33f8ef7fbc851f156857aa65d397a6a6fd27a7ac2ca717b51f2fd9489`,\n\t\ttype: `0x1a8f4bc33f8ef7fbc851f156857aa65d397a6a6fd27a7ac2ca717b51f2fd9489::alkimi::ALKIMI`,\n\t\tscalar: 1000000000,\n\t},\n\tLZWBTC: {\n\t\taddress: `0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942`,\n\t\ttype: `0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942::wbtc::WBTC`,\n\t\tscalar: 100000000,\n\t},\n\t// This coin is experimental\n\tWGIGA: {\n\t\taddress: `0xec32640add6d02a1d5f0425d72705eb76d9de7edfd4f34e0dba68e62ecceb05b`,\n\t\ttype: `0xec32640add6d02a1d5f0425d72705eb76d9de7edfd4f34e0dba68e62ecceb05b::coin::COIN`,\n\t\tscalar: 100000,\n\t},\n};\n\nexport const testnetPools: PoolMap = {\n\tDEEP_SUI: {\n\t\taddress: `0x48c95963e9eac37a316b7ae04a0deb761bcdcc2b67912374d6036e7f0e9bae9f`,\n\t\tbaseCoin: 'DEEP',\n\t\tquoteCoin: 'SUI',\n\t},\n\tSUI_DBUSDC: {\n\t\taddress: `0x1c19362ca52b8ffd7a33cee805a67d40f31e6ba303753fd3a4cfdfacea7163a5`,\n\t\tbaseCoin: 'SUI',\n\t\tquoteCoin: 'DBUSDC',\n\t},\n\tDEEP_DBUSDC: {\n\t\taddress: `0xe86b991f8632217505fd859445f9803967ac84a9d4a1219065bf191fcb74b622`,\n\t\tbaseCoin: 'DEEP',\n\t\tquoteCoin: 'DBUSDC',\n\t},\n\tDBUSDT_DBUSDC: {\n\t\taddress: `0x83970bb02e3636efdff8c141ab06af5e3c9a22e2f74d7f02a9c3430d0d10c1ca`,\n\t\tbaseCoin: 'DBUSDT',\n\t\tquoteCoin: 'DBUSDC',\n\t},\n\tWAL_DBUSDC: {\n\t\taddress: `0xeb524b6aea0ec4b494878582e0b78924208339d360b62aec4a8ecd4031520dbb`,\n\t\tbaseCoin: 'WAL',\n\t\tquoteCoin: 'DBUSDC',\n\t},\n\tWAL_SUI: {\n\t\taddress: `0x8c1c1b186c4fddab1ebd53e0895a36c1d1b3b9a77cd34e607bef49a38af0150a`,\n\t\tbaseCoin: 'WAL',\n\t\tquoteCoin: 'SUI',\n\t},\n\tDBTC_DBUSDC: {\n\t\taddress: `0x0dce0aa771074eb83d1f4a29d48be8248d4d2190976a5241f66b43ec18fa34de`,\n\t\tbaseCoin: 'DBTC',\n\t\tquoteCoin: 'DBUSDC',\n\t},\n};\n\nexport const mainnetPools: PoolMap = {\n\tDEEP_SUI: {\n\t\taddress: `0xb663828d6217467c8a1838a03793da896cbe745b150ebd57d82f814ca579fc22`,\n\t\tbaseCoin: 'DEEP',\n\t\tquoteCoin: 'SUI',\n\t},\n\tSUI_USDC: {\n\t\taddress: `0xe05dafb5133bcffb8d59f4e12465dc0e9faeaa05e3e342a08fe135800e3e4407`,\n\t\tbaseCoin: 'SUI',\n\t\tquoteCoin: 'USDC',\n\t},\n\tDEEP_USDC: {\n\t\taddress: `0xf948981b806057580f91622417534f491da5f61aeaf33d0ed8e69fd5691c95ce`,\n\t\tbaseCoin: 'DEEP',\n\t\tquoteCoin: 'USDC',\n\t},\n\tWUSDT_USDC: {\n\t\taddress: `0x4e2ca3988246e1d50b9bf209abb9c1cbfec65bd95afdacc620a36c67bdb8452f`,\n\t\tbaseCoin: 'WUSDT',\n\t\tquoteCoin: 'USDC',\n\t},\n\tWUSDC_USDC: {\n\t\taddress: `0xa0b9ebefb38c963fd115f52d71fa64501b79d1adcb5270563f92ce0442376545`,\n\t\tbaseCoin: 'WUSDC',\n\t\tquoteCoin: 'USDC',\n\t},\n\tBETH_USDC: {\n\t\taddress: `0x1109352b9112717bd2a7c3eb9a416fff1ba6951760f5bdd5424cf5e4e5b3e65c`,\n\t\tbaseCoin: 'BETH',\n\t\tquoteCoin: 'USDC',\n\t},\n\tNS_USDC: {\n\t\taddress: `0x0c0fdd4008740d81a8a7d4281322aee71a1b62c449eb5b142656753d89ebc060`,\n\t\tbaseCoin: 'NS',\n\t\tquoteCoin: 'USDC',\n\t},\n\tNS_SUI: {\n\t\taddress: `0x27c4fdb3b846aa3ae4a65ef5127a309aa3c1f466671471a806d8912a18b253e8`,\n\t\tbaseCoin: 'NS',\n\t\tquoteCoin: 'SUI',\n\t},\n\tTYPUS_SUI: {\n\t\taddress: `0xe8e56f377ab5a261449b92ac42c8ddaacd5671e9fec2179d7933dd1a91200eec`,\n\t\tbaseCoin: 'TYPUS',\n\t\tquoteCoin: 'SUI',\n\t},\n\tSUI_AUSD: {\n\t\taddress: `0x183df694ebc852a5f90a959f0f563b82ac9691e42357e9a9fe961d71a1b809c8`,\n\t\tbaseCoin: 'SUI',\n\t\tquoteCoin: 'AUSD',\n\t},\n\tAUSD_USDC: {\n\t\taddress: `0x5661fc7f88fbeb8cb881150a810758cf13700bb4e1f31274a244581b37c303c3`,\n\t\tbaseCoin: 'AUSD',\n\t\tquoteCoin: 'USDC',\n\t},\n\tDRF_SUI: {\n\t\taddress: `0x126865a0197d6ab44bfd15fd052da6db92fd2eb831ff9663451bbfa1219e2af2`,\n\t\tbaseCoin: 'DRF',\n\t\tquoteCoin: 'SUI',\n\t},\n\tSEND_USDC: {\n\t\taddress: `0x1fe7b99c28ded39774f37327b509d58e2be7fff94899c06d22b407496a6fa990`,\n\t\tbaseCoin: 'SEND',\n\t\tquoteCoin: 'USDC',\n\t},\n\tWAL_USDC: {\n\t\taddress: `0x56a1c985c1f1123181d6b881714793689321ba24301b3585eec427436eb1c76d`,\n\t\tbaseCoin: 'WAL',\n\t\tquoteCoin: 'USDC',\n\t},\n\tWAL_SUI: {\n\t\taddress: `0x81f5339934c83ea19dd6bcc75c52e83509629a5f71d3257428c2ce47cc94d08b`,\n\t\tbaseCoin: 'WAL',\n\t\tquoteCoin: 'SUI',\n\t},\n\tXBTC_USDC: {\n\t\taddress: `0x20b9a3ec7a02d4f344aa1ebc5774b7b0ccafa9a5d76230662fdc0300bb215307`,\n\t\tbaseCoin: 'XBTC',\n\t\tquoteCoin: 'USDC',\n\t},\n\tIKA_USDC: {\n\t\taddress: `0xfa732993af2b60d04d7049511f801e79426b2b6a5103e22769c0cead982b0f47`,\n\t\tbaseCoin: 'IKA',\n\t\tquoteCoin: 'USDC',\n\t},\n\tALKIMI_SUI: {\n\t\taddress: `0x84752993c6dc6fce70e25ddeb4daddb6592d6b9b0912a0a91c07cfff5a721d89`,\n\t\tbaseCoin: 'ALKIMI',\n\t\tquoteCoin: 'SUI',\n\t},\n\tLZWBTC_USDC: {\n\t\taddress: `0xf5142aafa24866107df628bf92d0358c7da6acc46c2f10951690fd2b8570f117`,\n\t\tbaseCoin: 'LZWBTC',\n\t\tquoteCoin: 'USDC',\n\t},\n};\n\nexport const testnetMarginPools = {\n\tSUI: {\n\t\taddress: '0xcdbbe6a72e639b647296788e2e4b1cac5cea4246028ba388ba1332ff9a382eea',\n\t\ttype: '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',\n\t},\n\tDBUSDC: {\n\t\taddress: '0xf08568da93834e1ee04f09902ac7b1e78d3fdf113ab4d2106c7265e95318b14d',\n\t\ttype: '0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7::DBUSDC::DBUSDC',\n\t},\n\tDEEP: {\n\t\taddress: '0x610640613f21d9e688d6f8103d17df22315c32e0c80590ce64951a1991378b55',\n\t\ttype: '0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP',\n\t},\n\tDBTC: {\n\t\taddress: '0xf3440b4aafcc8b12fc4b242e9590c52873b8238a0d0e52fbf9dae61d2970796a',\n\t\ttype: '0x6502dae813dbe5e42643c119a6450a518481f03063febc7e20238e43b6ea9e86::dbtc::DBTC',\n\t},\n};\n\nexport const mainnetMarginPools = {\n\tSUI: {\n\t\taddress: '',\n\t\ttype: '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',\n\t},\n\tUSDC: {\n\t\taddress: '',\n\t\ttype: '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC',\n\t},\n\tDEEP: {\n\t\taddress: '',\n\t\ttype: '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP',\n\t},\n};\n\nexport const testnetPythConfigs = {\n\tpythStateId: '0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c',\n\twormholeStateId: '0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790',\n};\n\nexport const mainnetPythConfigs = {\n\tpythStateId: '0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8',\n\twormholeStateId: '0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c',\n};\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBO,MAAM,oBAAoB;AAAA,EAChC,qBAAqB;AAAA,EACrB,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,wBAAwB;AACzB;AAEO,MAAM,oBAAoB;AAAA,EAChC,qBAAqB;AAA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AqB;AAAA,EACjC,KAAK;AAAA,IACJ,SAAS;AAAA,IACT,MAAM;AAAA,EACP;AAAA,EACA,MAAM;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,EACP;AAAA,EACA,MAAM;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,EACP;AACD;AAEO,MAAM,qBAAqB;AAAA,EACjC,aAAa;AAAA,EACb,iBAAiB;AAClB;AAEO,MAAM,qBAAqB;AAAA,EACjC,aAAa;AAAA,EACb,iBAAiB;AAClB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { Transaction } from '@mysten/sui/transactions';
|
|
1
|
+
import type { Transaction, TransactionArgument, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
2
2
|
import type { DeepBookConfig } from '../utils/config.js';
|
|
3
|
-
import type {
|
|
4
|
-
import type { MarginPoolConfigParams, InterestConfigParams } from '../types/index.js';
|
|
3
|
+
import type { MarginPoolConfigParams, MarginPoolConfigWithRateLimitParams, InterestConfigParams } from '../types/index.js';
|
|
5
4
|
/**
|
|
6
5
|
* DeepBookMaintainerContract class for managing maintainer actions.
|
|
7
6
|
*/
|
|
@@ -33,6 +32,13 @@ export declare class MarginMaintainerContract {
|
|
|
33
32
|
* @returns A function that takes a Transaction object
|
|
34
33
|
*/
|
|
35
34
|
newMarginPoolConfig: (coinKey: string, marginPoolConfig: MarginPoolConfigParams) => (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
35
|
+
/**
|
|
36
|
+
* @description Create a new margin pool config with rate limit
|
|
37
|
+
* @param {string} coinKey The key to identify the coin
|
|
38
|
+
* @param {MarginPoolConfigWithRateLimitParams} marginPoolConfig The configuration for the margin pool with rate limit
|
|
39
|
+
* @returns A function that takes a Transaction object
|
|
40
|
+
*/
|
|
41
|
+
newMarginPoolConfigWithRateLimit: (coinKey: string, marginPoolConfig: MarginPoolConfigWithRateLimitParams) => (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
36
42
|
/**
|
|
37
43
|
* @description Create a new interest config
|
|
38
44
|
* @param {InterestConfigParams} interestConfig The configuration for the interest
|
|
@@ -43,32 +49,32 @@ export declare class MarginMaintainerContract {
|
|
|
43
49
|
* @description Enable a deepbook pool for loan
|
|
44
50
|
* @param {string} deepbookPoolKey The key to identify the deepbook pool
|
|
45
51
|
* @param {string} coinKey The key to identify the margin pool
|
|
46
|
-
* @param {
|
|
52
|
+
* @param {TransactionObjectArgument} marginPoolCap The margin pool cap
|
|
47
53
|
* @returns A function that takes a Transaction object
|
|
48
54
|
*/
|
|
49
|
-
enableDeepbookPoolForLoan: (deepbookPoolKey: string, coinKey: string, marginPoolCap:
|
|
55
|
+
enableDeepbookPoolForLoan: (deepbookPoolKey: string, coinKey: string, marginPoolCap: TransactionObjectArgument) => (tx: Transaction) => void;
|
|
50
56
|
/**
|
|
51
57
|
* @description Disable a deepbook pool for loan
|
|
52
58
|
* @param {string} deepbookPoolKey The key to identify the deepbook pool
|
|
53
59
|
* @param {string} coinKey The key to identify the margin pool
|
|
54
|
-
* @param {
|
|
60
|
+
* @param {TransactionObjectArgument} marginPoolCap The margin pool cap
|
|
55
61
|
* @returns A function that takes a Transaction object
|
|
56
62
|
*/
|
|
57
|
-
disableDeepbookPoolForLoan: (deepbookPoolKey: string, coinKey: string, marginPoolCap:
|
|
63
|
+
disableDeepbookPoolForLoan: (deepbookPoolKey: string, coinKey: string, marginPoolCap: TransactionObjectArgument) => (tx: Transaction) => void;
|
|
58
64
|
/**
|
|
59
65
|
* @description Update the interest params
|
|
60
66
|
* @param {string} coinKey The key to identify the margin pool
|
|
61
|
-
* @param {
|
|
67
|
+
* @param {TransactionObjectArgument} marginPoolCap The margin pool cap
|
|
62
68
|
* @param {InterestConfigParams} interestConfig The configuration for the interest
|
|
63
69
|
* @returns A function that takes a Transaction object
|
|
64
70
|
*/
|
|
65
|
-
updateInterestParams: (coinKey: string, marginPoolCap:
|
|
71
|
+
updateInterestParams: (coinKey: string, marginPoolCap: TransactionObjectArgument, interestConfig: InterestConfigParams) => (tx: Transaction) => void;
|
|
66
72
|
/**
|
|
67
73
|
* @description Update the margin pool config
|
|
68
74
|
* @param {string} coinKey The key to identify the margin pool
|
|
69
|
-
* @param {
|
|
75
|
+
* @param {TransactionObjectArgument} marginPoolCap The margin pool cap
|
|
70
76
|
* @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool
|
|
71
77
|
* @returns A function that takes a Transaction object
|
|
72
78
|
*/
|
|
73
|
-
updateMarginPoolConfig: (coinKey: string, marginPoolCap:
|
|
79
|
+
updateMarginPoolConfig: (coinKey: string, marginPoolCap: TransactionObjectArgument, marginPoolConfig: MarginPoolConfigParams) => (tx: Transaction) => void;
|
|
74
80
|
}
|
|
@@ -68,6 +68,36 @@ class MarginMaintainerContract {
|
|
|
68
68
|
]
|
|
69
69
|
});
|
|
70
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* @description Create a new margin pool config with rate limit
|
|
73
|
+
* @param {string} coinKey The key to identify the coin
|
|
74
|
+
* @param {MarginPoolConfigWithRateLimitParams} marginPoolConfig The configuration for the margin pool with rate limit
|
|
75
|
+
* @returns A function that takes a Transaction object
|
|
76
|
+
*/
|
|
77
|
+
this.newMarginPoolConfigWithRateLimit = (coinKey, marginPoolConfig) => (tx) => {
|
|
78
|
+
const coin = __privateGet(this, _config).getCoin(coinKey);
|
|
79
|
+
const {
|
|
80
|
+
supplyCap,
|
|
81
|
+
maxUtilizationRate,
|
|
82
|
+
referralSpread,
|
|
83
|
+
minBorrow,
|
|
84
|
+
rateLimitCapacity,
|
|
85
|
+
rateLimitRefillRatePerMs,
|
|
86
|
+
rateLimitEnabled
|
|
87
|
+
} = marginPoolConfig;
|
|
88
|
+
return tx.moveCall({
|
|
89
|
+
target: `${__privateGet(this, _config).MARGIN_PACKAGE_ID}::protocol_config::new_margin_pool_config_with_rate_limit`,
|
|
90
|
+
arguments: [
|
|
91
|
+
tx.pure.u64(supplyCap * coin.scalar),
|
|
92
|
+
tx.pure.u64(maxUtilizationRate * FLOAT_SCALAR),
|
|
93
|
+
tx.pure.u64(referralSpread * FLOAT_SCALAR),
|
|
94
|
+
tx.pure.u64(Math.round(minBorrow * coin.scalar)),
|
|
95
|
+
tx.pure.u64(Math.round(rateLimitCapacity * coin.scalar)),
|
|
96
|
+
tx.pure.u64(Math.round(rateLimitRefillRatePerMs * coin.scalar)),
|
|
97
|
+
tx.pure.bool(rateLimitEnabled)
|
|
98
|
+
]
|
|
99
|
+
});
|
|
100
|
+
};
|
|
71
101
|
/**
|
|
72
102
|
* @description Create a new interest config
|
|
73
103
|
* @param {InterestConfigParams} interestConfig The configuration for the interest
|
|
@@ -89,7 +119,7 @@ class MarginMaintainerContract {
|
|
|
89
119
|
* @description Enable a deepbook pool for loan
|
|
90
120
|
* @param {string} deepbookPoolKey The key to identify the deepbook pool
|
|
91
121
|
* @param {string} coinKey The key to identify the margin pool
|
|
92
|
-
* @param {
|
|
122
|
+
* @param {TransactionObjectArgument} marginPoolCap The margin pool cap
|
|
93
123
|
* @returns A function that takes a Transaction object
|
|
94
124
|
*/
|
|
95
125
|
this.enableDeepbookPoolForLoan = (deepbookPoolKey, coinKey, marginPoolCap) => (tx) => {
|
|
@@ -111,7 +141,7 @@ class MarginMaintainerContract {
|
|
|
111
141
|
* @description Disable a deepbook pool for loan
|
|
112
142
|
* @param {string} deepbookPoolKey The key to identify the deepbook pool
|
|
113
143
|
* @param {string} coinKey The key to identify the margin pool
|
|
114
|
-
* @param {
|
|
144
|
+
* @param {TransactionObjectArgument} marginPoolCap The margin pool cap
|
|
115
145
|
* @returns A function that takes a Transaction object
|
|
116
146
|
*/
|
|
117
147
|
this.disableDeepbookPoolForLoan = (deepbookPoolKey, coinKey, marginPoolCap) => (tx) => {
|
|
@@ -132,7 +162,7 @@ class MarginMaintainerContract {
|
|
|
132
162
|
/**
|
|
133
163
|
* @description Update the interest params
|
|
134
164
|
* @param {string} coinKey The key to identify the margin pool
|
|
135
|
-
* @param {
|
|
165
|
+
* @param {TransactionObjectArgument} marginPoolCap The margin pool cap
|
|
136
166
|
* @param {InterestConfigParams} interestConfig The configuration for the interest
|
|
137
167
|
* @returns A function that takes a Transaction object
|
|
138
168
|
*/
|
|
@@ -154,7 +184,7 @@ class MarginMaintainerContract {
|
|
|
154
184
|
/**
|
|
155
185
|
* @description Update the margin pool config
|
|
156
186
|
* @param {string} coinKey The key to identify the margin pool
|
|
157
|
-
* @param {
|
|
187
|
+
* @param {TransactionObjectArgument} marginPoolCap The margin pool cap
|
|
158
188
|
* @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool
|
|
159
189
|
* @returns A function that takes a Transaction object
|
|
160
190
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/transactions/marginMaintainer.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport type { TransactionArgument } from '@mysten/sui/transactions';\nimport type { MarginPoolConfigParams, InterestConfigParams } from '../types/index.js';\nimport { FLOAT_SCALAR } from '../utils/config.js';\n\n/**\n * DeepBookMaintainerContract class for managing maintainer actions.\n */\nexport class MarginMaintainerContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for MarginMaintainerContract\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#marginMaintainerCap() {\n\t\tconst marginMaintainerCap = this.#config.marginMaintainerCap;\n\t\tif (!marginMaintainerCap) {\n\t\t\tthrow new Error('MARGIN_ADMIN_CAP environment variable not set');\n\t\t}\n\t\treturn marginMaintainerCap;\n\t}\n\n\t/**\n\t * @description Create a new margin pool\n\t * @param {string} coinKey The key to identify the coin\n\t * @param {TransactionArgument} poolConfig The configuration for the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreateMarginPool = (coinKey: string, poolConfig: TransactionArgument) => (tx: Transaction) => {\n\t\tconst coin = this.#config.getCoin(coinKey);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::create_margin_pool`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\tpoolConfig,\n\t\t\t\ttx.object(this.#marginMaintainerCap()),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [coin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Create a new protocol config\n\t * @param {string} coinKey The key to identify the coin\n\t * @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool\n\t * @param {InterestConfigParams} interestConfig The configuration for the interest\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewProtocolConfig =\n\t\t(\n\t\t\tcoinKey: string,\n\t\t\tmarginPoolConfig: MarginPoolConfigParams,\n\t\t\tinterestConfig: InterestConfigParams,\n\t\t) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst marginPoolConfigObject = this.newMarginPoolConfig(coinKey, marginPoolConfig)(tx);\n\t\t\tconst interestConfigObject = this.newInterestConfig(interestConfig)(tx);\n\t\t\treturn tx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::protocol_config::new_protocol_config`,\n\t\t\t\targuments: [marginPoolConfigObject, interestConfigObject],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Create a new margin pool config\n\t * @param {string} coinKey The key to identify the coin\n\t * @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewMarginPoolConfig =\n\t\t(coinKey: string, marginPoolConfig: MarginPoolConfigParams) => (tx: Transaction) => {\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst { supplyCap, maxUtilizationRate, referralSpread, minBorrow } = marginPoolConfig;\n\t\t\treturn tx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::protocol_config::new_margin_pool_config`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.pure.u64(supplyCap * coin.scalar),\n\t\t\t\t\ttx.pure.u64(maxUtilizationRate * FLOAT_SCALAR),\n\t\t\t\t\ttx.pure.u64(referralSpread * FLOAT_SCALAR),\n\t\t\t\t\ttx.pure.u64(Math.round(minBorrow * coin.scalar)),\n\t\t\t\t],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Create a new interest config\n\t * @param {InterestConfigParams} interestConfig The configuration for the interest\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewInterestConfig = (interestConfig: InterestConfigParams) => (tx: Transaction) => {\n\t\tconst { baseRate, baseSlope, optimalUtilization, excessSlope } = interestConfig;\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::protocol_config::new_interest_config`,\n\t\t\targuments: [\n\t\t\t\ttx.pure.u64(baseRate * FLOAT_SCALAR),\n\t\t\t\ttx.pure.u64(baseSlope * FLOAT_SCALAR),\n\t\t\t\ttx.pure.u64(optimalUtilization * FLOAT_SCALAR),\n\t\t\t\ttx.pure.u64(excessSlope * FLOAT_SCALAR),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Enable a deepbook pool for loan\n\t * @param {string} deepbookPoolKey The key to identify the deepbook pool\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @param {string} marginPoolCap The margin pool cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableDeepbookPoolForLoan =\n\t\t(deepbookPoolKey: string, coinKey: string, marginPoolCap: string) => (tx: Transaction) => {\n\t\t\tconst deepbookPool = this.#config.getPool(deepbookPoolKey);\n\t\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::enable_deepbook_pool_for_loan`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(marginPool.address),\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\ttx.pure.id(deepbookPool.address),\n\t\t\t\t\ttx.object(marginPoolCap),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [marginPool.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Disable a deepbook pool for loan\n\t * @param {string} deepbookPoolKey The key to identify the deepbook pool\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @param {string} marginPoolCap The margin pool cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableDeepbookPoolForLoan =\n\t\t(deepbookPoolKey: string, coinKey: string, marginPoolCap: string) => (tx: Transaction) => {\n\t\t\tconst deepbookPool = this.#config.getPool(deepbookPoolKey);\n\t\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::disable_deepbook_pool_for_loan`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(marginPool.address),\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\ttx.pure.id(deepbookPool.address),\n\t\t\t\t\ttx.object(marginPoolCap),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [marginPool.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Update the interest params\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @param {string} marginPoolCap The margin pool cap\n\t * @param {InterestConfigParams} interestConfig The configuration for the interest\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdateInterestParams =\n\t\t(coinKey: string, marginPoolCap: string, interestConfig: InterestConfigParams) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\t\tconst interestConfigObject = this.newInterestConfig(interestConfig)(tx);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::update_interest_params`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(marginPool.address),\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\tinterestConfigObject,\n\t\t\t\t\ttx.object(marginPoolCap),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [marginPool.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Update the margin pool config\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @param {string} marginPoolCap The margin pool cap\n\t * @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdateMarginPoolConfig =\n\t\t(coinKey: string, marginPoolCap: string, marginPoolConfig: MarginPoolConfigParams) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\t\tconst marginPoolConfigObject = this.newMarginPoolConfig(coinKey, marginPoolConfig)(tx);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::update_margin_pool_config`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(marginPool.address),\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\tmarginPoolConfigObject,\n\t\t\t\t\ttx.object(marginPoolCap),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [marginPool.type],\n\t\t\t});\n\t\t};\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;AAAA;
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n\tTransaction,\n\tTransactionArgument,\n\tTransactionObjectArgument,\n} from '@mysten/sui/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport type {\n\tMarginPoolConfigParams,\n\tMarginPoolConfigWithRateLimitParams,\n\tInterestConfigParams,\n} from '../types/index.js';\nimport { FLOAT_SCALAR } from '../utils/config.js';\n\n/**\n * DeepBookMaintainerContract class for managing maintainer actions.\n */\nexport class MarginMaintainerContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for MarginMaintainerContract\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#marginMaintainerCap() {\n\t\tconst marginMaintainerCap = this.#config.marginMaintainerCap;\n\t\tif (!marginMaintainerCap) {\n\t\t\tthrow new Error('MARGIN_ADMIN_CAP environment variable not set');\n\t\t}\n\t\treturn marginMaintainerCap;\n\t}\n\n\t/**\n\t * @description Create a new margin pool\n\t * @param {string} coinKey The key to identify the coin\n\t * @param {TransactionArgument} poolConfig The configuration for the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreateMarginPool = (coinKey: string, poolConfig: TransactionArgument) => (tx: Transaction) => {\n\t\tconst coin = this.#config.getCoin(coinKey);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::create_margin_pool`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\tpoolConfig,\n\t\t\t\ttx.object(this.#marginMaintainerCap()),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [coin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Create a new protocol config\n\t * @param {string} coinKey The key to identify the coin\n\t * @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool\n\t * @param {InterestConfigParams} interestConfig The configuration for the interest\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewProtocolConfig =\n\t\t(\n\t\t\tcoinKey: string,\n\t\t\tmarginPoolConfig: MarginPoolConfigParams,\n\t\t\tinterestConfig: InterestConfigParams,\n\t\t) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst marginPoolConfigObject = this.newMarginPoolConfig(coinKey, marginPoolConfig)(tx);\n\t\t\tconst interestConfigObject = this.newInterestConfig(interestConfig)(tx);\n\t\t\treturn tx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::protocol_config::new_protocol_config`,\n\t\t\t\targuments: [marginPoolConfigObject, interestConfigObject],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Create a new margin pool config\n\t * @param {string} coinKey The key to identify the coin\n\t * @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewMarginPoolConfig =\n\t\t(coinKey: string, marginPoolConfig: MarginPoolConfigParams) => (tx: Transaction) => {\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst { supplyCap, maxUtilizationRate, referralSpread, minBorrow } = marginPoolConfig;\n\t\t\treturn tx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::protocol_config::new_margin_pool_config`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.pure.u64(supplyCap * coin.scalar),\n\t\t\t\t\ttx.pure.u64(maxUtilizationRate * FLOAT_SCALAR),\n\t\t\t\t\ttx.pure.u64(referralSpread * FLOAT_SCALAR),\n\t\t\t\t\ttx.pure.u64(Math.round(minBorrow * coin.scalar)),\n\t\t\t\t],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Create a new margin pool config with rate limit\n\t * @param {string} coinKey The key to identify the coin\n\t * @param {MarginPoolConfigWithRateLimitParams} marginPoolConfig The configuration for the margin pool with rate limit\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewMarginPoolConfigWithRateLimit =\n\t\t(coinKey: string, marginPoolConfig: MarginPoolConfigWithRateLimitParams) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tconst {\n\t\t\t\tsupplyCap,\n\t\t\t\tmaxUtilizationRate,\n\t\t\t\treferralSpread,\n\t\t\t\tminBorrow,\n\t\t\t\trateLimitCapacity,\n\t\t\t\trateLimitRefillRatePerMs,\n\t\t\t\trateLimitEnabled,\n\t\t\t} = marginPoolConfig;\n\t\t\treturn tx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::protocol_config::new_margin_pool_config_with_rate_limit`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.pure.u64(supplyCap * coin.scalar),\n\t\t\t\t\ttx.pure.u64(maxUtilizationRate * FLOAT_SCALAR),\n\t\t\t\t\ttx.pure.u64(referralSpread * FLOAT_SCALAR),\n\t\t\t\t\ttx.pure.u64(Math.round(minBorrow * coin.scalar)),\n\t\t\t\t\ttx.pure.u64(Math.round(rateLimitCapacity * coin.scalar)),\n\t\t\t\t\ttx.pure.u64(Math.round(rateLimitRefillRatePerMs * coin.scalar)),\n\t\t\t\t\ttx.pure.bool(rateLimitEnabled),\n\t\t\t\t],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Create a new interest config\n\t * @param {InterestConfigParams} interestConfig The configuration for the interest\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewInterestConfig = (interestConfig: InterestConfigParams) => (tx: Transaction) => {\n\t\tconst { baseRate, baseSlope, optimalUtilization, excessSlope } = interestConfig;\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::protocol_config::new_interest_config`,\n\t\t\targuments: [\n\t\t\t\ttx.pure.u64(baseRate * FLOAT_SCALAR),\n\t\t\t\ttx.pure.u64(baseSlope * FLOAT_SCALAR),\n\t\t\t\ttx.pure.u64(optimalUtilization * FLOAT_SCALAR),\n\t\t\t\ttx.pure.u64(excessSlope * FLOAT_SCALAR),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Enable a deepbook pool for loan\n\t * @param {string} deepbookPoolKey The key to identify the deepbook pool\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @param {TransactionObjectArgument} marginPoolCap The margin pool cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableDeepbookPoolForLoan =\n\t\t(deepbookPoolKey: string, coinKey: string, marginPoolCap: TransactionObjectArgument) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst deepbookPool = this.#config.getPool(deepbookPoolKey);\n\t\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::enable_deepbook_pool_for_loan`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(marginPool.address),\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\ttx.pure.id(deepbookPool.address),\n\t\t\t\t\ttx.object(marginPoolCap),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [marginPool.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Disable a deepbook pool for loan\n\t * @param {string} deepbookPoolKey The key to identify the deepbook pool\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @param {TransactionObjectArgument} marginPoolCap The margin pool cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableDeepbookPoolForLoan =\n\t\t(deepbookPoolKey: string, coinKey: string, marginPoolCap: TransactionObjectArgument) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst deepbookPool = this.#config.getPool(deepbookPoolKey);\n\t\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::disable_deepbook_pool_for_loan`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(marginPool.address),\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\ttx.pure.id(deepbookPool.address),\n\t\t\t\t\ttx.object(marginPoolCap),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [marginPool.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Update the interest params\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @param {TransactionObjectArgument} marginPoolCap The margin pool cap\n\t * @param {InterestConfigParams} interestConfig The configuration for the interest\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdateInterestParams =\n\t\t(\n\t\t\tcoinKey: string,\n\t\t\tmarginPoolCap: TransactionObjectArgument,\n\t\t\tinterestConfig: InterestConfigParams,\n\t\t) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\t\tconst interestConfigObject = this.newInterestConfig(interestConfig)(tx);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::update_interest_params`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(marginPool.address),\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\tinterestConfigObject,\n\t\t\t\t\ttx.object(marginPoolCap),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [marginPool.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Update the margin pool config\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @param {TransactionObjectArgument} marginPoolCap The margin pool cap\n\t * @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdateMarginPoolConfig =\n\t\t(\n\t\t\tcoinKey: string,\n\t\t\tmarginPoolCap: TransactionObjectArgument,\n\t\t\tmarginPoolConfig: MarginPoolConfigParams,\n\t\t) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\t\tconst marginPoolConfigObject = this.newMarginPoolConfig(coinKey, marginPoolConfig)(tx);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::update_margin_pool_config`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(marginPool.address),\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\tmarginPoolConfigObject,\n\t\t\t\t\ttx.object(marginPoolCap),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [marginPool.type],\n\t\t\t});\n\t\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAAA;AAeA,SAAS,oBAAoB;AAKtB,MAAM,yBAAyB;AAAA;AAAA;AAAA;AAAA,EAMrC,YAAY,QAAwB;AAN9B;AACN;AA2BA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAmB,CAAC,SAAiB,eAAoC,CAAC,OAAoB;AAC7F,YAAM,OAAO,mBAAK,SAAQ,QAAQ,OAAO;AACzC,SAAG,SAAS;AAAA,QACX,QAAQ,GAAG,mBAAK,SAAQ,iBAAiB;AAAA,QACzC,WAAW;AAAA,UACV,GAAG,OAAO,mBAAK,SAAQ,kBAAkB;AAAA,UACzC;AAAA,UACA,GAAG,OAAO,sBAAK,6DAAL,UAA2B;AAAA,UACrC,GAAG,OAAO,MAAM;AAAA,QACjB;AAAA,QACA,eAAe,CAAC,KAAK,IAAI;AAAA,MAC1B,CAAC;AAAA,IACF;AASA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BACC,CACC,SACA,kBACA,mBAED,CAAC,OAAoB;AACpB,YAAM,yBAAyB,KAAK,oBAAoB,SAAS,gBAAgB,EAAE,EAAE;AACrF,YAAM,uBAAuB,KAAK,kBAAkB,cAAc,EAAE,EAAE;AACtE,aAAO,GAAG,SAAS;AAAA,QAClB,QAAQ,GAAG,mBAAK,SAAQ,iBAAiB;AAAA,QACzC,WAAW,CAAC,wBAAwB,oBAAoB;AAA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M;AAAA,QACjB;AAAA,QACA,eAAe,CAAC,WAAW,IAAI;AAAA,MAChC,CAAC;AAAA,IACF;AA3OA,uBAAK,SAAU;AAAA,EAChB;AA2OD;AAlPC;AADM;AAAA;AAAA;AAAA;AAAA;AAcN,yBAAoB,WAAG;AACtB,QAAM,sBAAsB,mBAAK,SAAQ;AACzC,MAAI,CAAC,qBAAqB;AACzB,UAAM,IAAI,MAAM,+CAA+C;AAAA,EAChE;AACA,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -201,6 +201,11 @@ export interface MarginPoolConfigParams {
|
|
|
201
201
|
referralSpread: number;
|
|
202
202
|
minBorrow: number;
|
|
203
203
|
}
|
|
204
|
+
export interface MarginPoolConfigWithRateLimitParams extends MarginPoolConfigParams {
|
|
205
|
+
rateLimitCapacity: number;
|
|
206
|
+
rateLimitRefillRatePerMs: number;
|
|
207
|
+
rateLimitEnabled: boolean;
|
|
208
|
+
}
|
|
204
209
|
export interface InterestConfigParams {
|
|
205
210
|
baseRate: number;
|
|
206
211
|
baseSlope: number;
|