@mysten/deepbook-v3 1.5.8 → 1.6.2
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 +73 -0
- package/dist/client.d.mts +5 -0
- package/dist/client.d.mts.map +1 -1
- package/dist/client.mjs +7 -0
- package/dist/client.mjs.map +1 -1
- package/dist/contracts/deepbook/account.d.mts +18 -18
- package/dist/contracts/deepbook/account.d.mts.map +1 -1
- package/dist/contracts/deepbook/balance_manager.mjs +413 -0
- package/dist/contracts/deepbook/balance_manager.mjs.map +1 -0
- package/dist/contracts/deepbook/big_vector.mjs +43 -0
- package/dist/contracts/deepbook/big_vector.mjs.map +1 -0
- package/dist/contracts/deepbook/book.mjs +29 -0
- package/dist/contracts/deepbook/book.mjs.map +1 -0
- package/dist/contracts/deepbook/deep_price.d.mts +3 -3
- package/dist/contracts/deepbook/deep_price.d.mts.map +1 -1
- package/dist/contracts/deepbook/deep_price.mjs +1 -1
- package/dist/contracts/deepbook/deps/std/type_name.mjs +17 -0
- package/dist/contracts/deepbook/deps/std/type_name.mjs.map +1 -0
- package/dist/contracts/deepbook/deps/sui/bag.mjs +43 -0
- package/dist/contracts/deepbook/deps/sui/bag.mjs.map +1 -0
- package/dist/contracts/deepbook/deps/sui/balance.mjs +21 -0
- package/dist/contracts/deepbook/deps/sui/balance.mjs.map +1 -0
- package/dist/contracts/deepbook/deps/sui/table.mjs +38 -0
- package/dist/contracts/deepbook/deps/sui/table.mjs.map +1 -0
- package/dist/contracts/deepbook/deps/sui/vec_map.mjs +37 -0
- package/dist/contracts/deepbook/deps/sui/vec_map.mjs.map +1 -0
- package/dist/contracts/deepbook/deps/sui/versioned.mjs +19 -0
- package/dist/contracts/deepbook/deps/sui/versioned.mjs.map +1 -0
- package/dist/contracts/deepbook/governance.mjs +49 -0
- package/dist/contracts/deepbook/governance.mjs.map +1 -0
- package/dist/contracts/deepbook/history.mjs +56 -0
- package/dist/contracts/deepbook/history.mjs.map +1 -0
- package/dist/contracts/deepbook/order.d.mts +12 -12
- package/dist/contracts/deepbook/pool.mjs +1739 -0
- package/dist/contracts/deepbook/pool.mjs.map +1 -0
- package/dist/contracts/deepbook/registry.mjs +295 -0
- package/dist/contracts/deepbook/registry.mjs.map +1 -0
- package/dist/contracts/deepbook/state.mjs +89 -0
- package/dist/contracts/deepbook/state.mjs.map +1 -0
- package/dist/contracts/deepbook/trade_params.mjs +21 -0
- package/dist/contracts/deepbook/trade_params.mjs.map +1 -0
- package/dist/contracts/deepbook/vault.mjs +42 -0
- package/dist/contracts/deepbook/vault.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/deepbook/balance_manager.mjs +53 -0
- package/dist/contracts/deepbook_margin/deps/deepbook/balance_manager.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/std/type_name.mjs +17 -0
- package/dist/contracts/deepbook_margin/deps/std/type_name.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/sui/bag.mjs +43 -0
- package/dist/contracts/deepbook_margin/deps/sui/bag.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/sui/balance.mjs +21 -0
- package/dist/contracts/deepbook_margin/deps/sui/balance.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/sui/table.mjs +38 -0
- package/dist/contracts/deepbook_margin/deps/sui/table.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/sui/vec_map.mjs +37 -0
- package/dist/contracts/deepbook_margin/deps/sui/vec_map.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/sui/vec_set.mjs +26 -0
- package/dist/contracts/deepbook_margin/deps/sui/vec_set.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/sui/versioned.mjs +19 -0
- package/dist/contracts/deepbook_margin/deps/sui/versioned.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/margin_manager.mjs +989 -0
- package/dist/contracts/deepbook_margin/margin_manager.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/margin_pool.mjs +550 -0
- package/dist/contracts/deepbook_margin/margin_pool.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/margin_registry.mjs +786 -0
- package/dist/contracts/deepbook_margin/margin_registry.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/margin_state.mjs +30 -0
- package/dist/contracts/deepbook_margin/margin_state.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/oracle.mjs +82 -0
- package/dist/contracts/deepbook_margin/oracle.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/pool_proxy.mjs +644 -0
- package/dist/contracts/deepbook_margin/pool_proxy.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/position_manager.mjs +32 -0
- package/dist/contracts/deepbook_margin/position_manager.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/protocol_config.mjs +122 -0
- package/dist/contracts/deepbook_margin/protocol_config.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/protocol_fees.mjs +58 -0
- package/dist/contracts/deepbook_margin/protocol_fees.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/rate_limiter.mjs +26 -0
- package/dist/contracts/deepbook_margin/rate_limiter.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/tpsl.mjs +171 -0
- package/dist/contracts/deepbook_margin/tpsl.mjs.map +1 -0
- package/dist/contracts/margin_liquidation/deps/sui/bag.mjs +43 -0
- package/dist/contracts/margin_liquidation/deps/sui/bag.mjs.map +1 -0
- package/dist/contracts/margin_liquidation/liquidation_vault.mjs +179 -0
- package/dist/contracts/margin_liquidation/liquidation_vault.mjs.map +1 -0
- package/dist/contracts/utils/index.d.mts +1 -1
- package/dist/contracts/utils/index.mjs +92 -3
- package/dist/contracts/utils/index.mjs.map +1 -1
- package/dist/queries/registryQueries.mjs +13 -0
- package/dist/queries/registryQueries.mjs.map +1 -1
- package/dist/transactions/balanceManager.d.mts.map +1 -1
- package/dist/transactions/balanceManager.mjs +119 -100
- package/dist/transactions/balanceManager.mjs.map +1 -1
- package/dist/transactions/deepbook.d.mts.map +1 -1
- package/dist/transactions/deepbook.mjs +464 -439
- package/dist/transactions/deepbook.mjs.map +1 -1
- package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
- package/dist/transactions/deepbookAdmin.mjs +151 -135
- package/dist/transactions/deepbookAdmin.mjs.map +1 -1
- package/dist/transactions/flashLoans.d.mts.map +1 -1
- package/dist/transactions/flashLoans.mjs +29 -22
- package/dist/transactions/flashLoans.mjs.map +1 -1
- package/dist/transactions/governance.d.mts.map +1 -1
- package/dist/transactions/governance.mjs +34 -33
- package/dist/transactions/governance.mjs.map +1 -1
- package/dist/transactions/marginAdmin.d.mts +17 -7
- package/dist/transactions/marginAdmin.d.mts.map +1 -1
- package/dist/transactions/marginAdmin.mjs +186 -169
- package/dist/transactions/marginAdmin.mjs.map +1 -1
- package/dist/transactions/marginLiquidations.d.mts +3 -3
- package/dist/transactions/marginLiquidations.d.mts.map +1 -1
- package/dist/transactions/marginLiquidations.mjs +53 -54
- package/dist/transactions/marginLiquidations.mjs.map +1 -1
- package/dist/transactions/marginMaintainer.d.mts +5 -5
- package/dist/transactions/marginMaintainer.d.mts.map +1 -1
- package/dist/transactions/marginMaintainer.mjs +83 -83
- package/dist/transactions/marginMaintainer.mjs.map +1 -1
- package/dist/transactions/marginManager.d.mts +32 -32
- package/dist/transactions/marginManager.d.mts.map +1 -1
- package/dist/transactions/marginManager.mjs +330 -317
- package/dist/transactions/marginManager.mjs.map +1 -1
- package/dist/transactions/marginPool.d.mts +18 -18
- package/dist/transactions/marginPool.d.mts.map +1 -1
- package/dist/transactions/marginPool.mjs +93 -89
- package/dist/transactions/marginPool.mjs.map +1 -1
- package/dist/transactions/marginRegistry.d.mts +22 -15
- package/dist/transactions/marginRegistry.d.mts.map +1 -1
- package/dist/transactions/marginRegistry.mjs +101 -68
- package/dist/transactions/marginRegistry.mjs.map +1 -1
- package/dist/transactions/marginTPSL.d.mts +27 -9
- package/dist/transactions/marginTPSL.d.mts.map +1 -1
- package/dist/transactions/marginTPSL.mjs +108 -82
- package/dist/transactions/marginTPSL.mjs.map +1 -1
- package/dist/transactions/poolProxy.d.mts +37 -5
- package/dist/transactions/poolProxy.d.mts.map +1 -1
- package/dist/transactions/poolProxy.mjs +269 -189
- package/dist/transactions/poolProxy.mjs.map +1 -1
- package/dist/utils/constants.mjs +4 -4
- package/dist/utils/constants.mjs.map +1 -1
- package/package.json +3 -3
- package/src/client.ts +8 -0
- package/src/contracts/deepbook/balance_manager.ts +46 -5
- package/src/contracts/deepbook/constants.ts +13 -0
- package/src/contracts/deepbook/pool.ts +133 -0
- package/src/contracts/deepbook/registry.ts +136 -1
- package/src/contracts/deepbook_margin/deps/deepbook/balance_manager.ts +49 -0
- package/src/contracts/deepbook_margin/deps/std/type_name.ts +24 -0
- package/src/contracts/deepbook_margin/deps/sui/bag.ts +41 -0
- package/src/contracts/deepbook_margin/deps/sui/balance.ts +19 -0
- package/src/contracts/deepbook_margin/deps/sui/table.ts +36 -0
- package/src/contracts/deepbook_margin/deps/sui/vec_map.ts +33 -0
- package/src/contracts/deepbook_margin/deps/sui/vec_set.ts +22 -0
- package/src/contracts/deepbook_margin/deps/sui/versioned.ts +13 -0
- package/src/contracts/deepbook_margin/margin_constants.ts +329 -0
- package/src/contracts/deepbook_margin/margin_manager.ts +1772 -0
- package/src/contracts/deepbook_margin/margin_pool.ts +1129 -0
- package/src/contracts/deepbook_margin/margin_registry.ts +1207 -0
- package/src/contracts/deepbook_margin/margin_state.ts +26 -0
- package/src/contracts/deepbook_margin/oracle.ts +99 -0
- package/src/contracts/deepbook_margin/pool_proxy.ts +1298 -0
- package/src/contracts/deepbook_margin/position_manager.ts +28 -0
- package/src/contracts/deepbook_margin/protocol_config.ts +163 -0
- package/src/contracts/deepbook_margin/protocol_fees.ts +153 -0
- package/src/contracts/deepbook_margin/rate_limiter.ts +80 -0
- package/src/contracts/deepbook_margin/tpsl.ts +559 -0
- package/src/contracts/margin_liquidation/deps/sui/bag.ts +41 -0
- package/src/contracts/margin_liquidation/liquidation_vault.ts +401 -0
- package/src/queries/registryQueries.ts +15 -0
- package/src/transactions/balanceManager.ts +140 -90
- package/src/transactions/deepbook.ts +586 -494
- package/src/transactions/deepbookAdmin.ts +154 -146
- package/src/transactions/flashLoans.ts +29 -20
- package/src/transactions/governance.ts +50 -37
- package/src/transactions/marginAdmin.ts +247 -188
- package/src/transactions/marginLiquidations.ts +70 -55
- package/src/transactions/marginMaintainer.ts +106 -88
- package/src/transactions/marginManager.ts +414 -348
- package/src/transactions/marginPool.ts +140 -103
- package/src/transactions/marginRegistry.ts +103 -70
- package/src/transactions/marginTPSL.ts +151 -87
- package/src/transactions/poolProxy.ts +384 -205
- package/src/utils/constants.ts +4 -4
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { convertRate } from "../utils/conversion.mjs";
|
|
2
2
|
import { FLOAT_SCALAR } from "../utils/config.mjs";
|
|
3
|
+
import { addConfig, disableDeepbookPool, disableVersion, disableVersionPauseCap, enableDeepbookPool, enableVersion, mintMaintainerCap, mintPauseCap, newPoolConfig, newPoolConfigWithLeverage, registerDeepbookPool, removeConfig, revokePauseCap, setMaxOrderTtl, setMaxPriceAge, setMinOpenRiskRatio, setPriceTolerance, updateRiskParams } from "../contracts/deepbook_margin/margin_registry.mjs";
|
|
4
|
+
import { adminWithdrawDefaultReferralFees } from "../contracts/deepbook_margin/margin_pool.mjs";
|
|
5
|
+
import { newCoinTypeDataFromCurrency, newPythConfig } from "../contracts/deepbook_margin/oracle.mjs";
|
|
3
6
|
import { hexToBytes } from "@noble/hashes/utils.js";
|
|
4
7
|
|
|
5
8
|
//#region src/transactions/marginAdmin.ts
|
|
@@ -13,14 +16,13 @@ var MarginAdminContract = class {
|
|
|
13
16
|
*/
|
|
14
17
|
constructor(config) {
|
|
15
18
|
this.mintMaintainerCap = () => (tx) => {
|
|
16
|
-
return tx.
|
|
17
|
-
|
|
18
|
-
arguments:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
});
|
|
19
|
+
return tx.add(mintMaintainerCap({
|
|
20
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
21
|
+
arguments: {
|
|
22
|
+
self: this.#config.MARGIN_REGISTRY_ID,
|
|
23
|
+
AdminCap: this.#marginAdminCap()
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
24
26
|
};
|
|
25
27
|
this.revokeMaintainerCap = (maintainerCapId) => (tx) => {
|
|
26
28
|
tx.moveCall({
|
|
@@ -37,248 +39,263 @@ var MarginAdminContract = class {
|
|
|
37
39
|
const pool = this.#config.getPool(poolKey);
|
|
38
40
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
39
41
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
40
|
-
tx.
|
|
41
|
-
|
|
42
|
-
arguments:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
poolConfig
|
|
47
|
-
|
|
48
|
-
],
|
|
42
|
+
tx.add(registerDeepbookPool({
|
|
43
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
44
|
+
arguments: {
|
|
45
|
+
self: this.#config.MARGIN_REGISTRY_ID,
|
|
46
|
+
AdminCap: this.#marginAdminCap(),
|
|
47
|
+
pool: pool.address,
|
|
48
|
+
poolConfig
|
|
49
|
+
},
|
|
49
50
|
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
50
|
-
});
|
|
51
|
+
}));
|
|
51
52
|
};
|
|
52
53
|
this.enableDeepbookPool = (poolKey) => (tx) => {
|
|
53
54
|
const pool = this.#config.getPool(poolKey);
|
|
54
55
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
55
56
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
56
|
-
tx.
|
|
57
|
-
|
|
58
|
-
arguments:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
],
|
|
57
|
+
tx.add(enableDeepbookPool({
|
|
58
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
59
|
+
arguments: {
|
|
60
|
+
self: this.#config.MARGIN_REGISTRY_ID,
|
|
61
|
+
AdminCap: this.#marginAdminCap(),
|
|
62
|
+
pool: pool.address
|
|
63
|
+
},
|
|
64
64
|
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
65
|
-
});
|
|
65
|
+
}));
|
|
66
66
|
};
|
|
67
67
|
this.disableDeepbookPool = (poolKey) => (tx) => {
|
|
68
68
|
const pool = this.#config.getPool(poolKey);
|
|
69
69
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
70
70
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
71
|
-
tx.
|
|
72
|
-
|
|
73
|
-
arguments:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
],
|
|
71
|
+
tx.add(disableDeepbookPool({
|
|
72
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
73
|
+
arguments: {
|
|
74
|
+
self: this.#config.MARGIN_REGISTRY_ID,
|
|
75
|
+
AdminCap: this.#marginAdminCap(),
|
|
76
|
+
pool: pool.address
|
|
77
|
+
},
|
|
79
78
|
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
80
|
-
});
|
|
79
|
+
}));
|
|
81
80
|
};
|
|
82
81
|
this.updateRiskParams = (poolKey, poolConfig) => (tx) => {
|
|
83
82
|
const pool = this.#config.getPool(poolKey);
|
|
84
83
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
85
84
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
86
|
-
tx.
|
|
87
|
-
|
|
88
|
-
arguments:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
poolConfig
|
|
93
|
-
|
|
94
|
-
],
|
|
85
|
+
tx.add(updateRiskParams({
|
|
86
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
87
|
+
arguments: {
|
|
88
|
+
self: this.#config.MARGIN_REGISTRY_ID,
|
|
89
|
+
AdminCap: this.#marginAdminCap(),
|
|
90
|
+
pool: pool.address,
|
|
91
|
+
poolConfig
|
|
92
|
+
},
|
|
95
93
|
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
96
|
-
});
|
|
94
|
+
}));
|
|
97
95
|
};
|
|
98
96
|
this.setPriceTolerance = (poolKey, tolerance) => (tx) => {
|
|
99
97
|
const pool = this.#config.getPool(poolKey);
|
|
100
98
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
101
99
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
102
|
-
tx.
|
|
103
|
-
|
|
104
|
-
arguments:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
],
|
|
100
|
+
tx.add(setPriceTolerance({
|
|
101
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
102
|
+
arguments: {
|
|
103
|
+
self: this.#config.MARGIN_REGISTRY_ID,
|
|
104
|
+
AdminCap: this.#marginAdminCap(),
|
|
105
|
+
pool: pool.address,
|
|
106
|
+
tolerance: convertRate(tolerance, FLOAT_SCALAR)
|
|
107
|
+
},
|
|
111
108
|
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
112
|
-
});
|
|
109
|
+
}));
|
|
113
110
|
};
|
|
114
111
|
this.setMaxPriceAge = (poolKey, maxAgeMs) => (tx) => {
|
|
115
112
|
const pool = this.#config.getPool(poolKey);
|
|
116
113
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
117
114
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
118
|
-
tx.
|
|
119
|
-
|
|
120
|
-
arguments:
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
],
|
|
115
|
+
tx.add(setMaxPriceAge({
|
|
116
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
117
|
+
arguments: {
|
|
118
|
+
self: this.#config.MARGIN_REGISTRY_ID,
|
|
119
|
+
AdminCap: this.#marginAdminCap(),
|
|
120
|
+
pool: pool.address,
|
|
121
|
+
maxAgeMs
|
|
122
|
+
},
|
|
127
123
|
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
128
|
-
});
|
|
124
|
+
}));
|
|
129
125
|
};
|
|
130
126
|
this.setMaxOrderTtl = (poolKey, maxOrderTtlMs) => (tx) => {
|
|
131
127
|
const pool = this.#config.getPool(poolKey);
|
|
132
128
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
133
129
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
134
|
-
tx.
|
|
135
|
-
|
|
136
|
-
arguments:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
],
|
|
130
|
+
tx.add(setMaxOrderTtl({
|
|
131
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
132
|
+
arguments: {
|
|
133
|
+
self: this.#config.MARGIN_REGISTRY_ID,
|
|
134
|
+
AdminCap: this.#marginAdminCap(),
|
|
135
|
+
pool: pool.address,
|
|
136
|
+
maxOrderTtlMs
|
|
137
|
+
},
|
|
143
138
|
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
144
|
-
});
|
|
139
|
+
}));
|
|
140
|
+
};
|
|
141
|
+
this.setMinOpenRiskRatio = (poolKey, minOpenRiskRatio) => (tx) => {
|
|
142
|
+
const pool = this.#config.getPool(poolKey);
|
|
143
|
+
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
144
|
+
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
145
|
+
tx.add(setMinOpenRiskRatio({
|
|
146
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
147
|
+
arguments: {
|
|
148
|
+
self: this.#config.MARGIN_REGISTRY_ID,
|
|
149
|
+
AdminCap: this.#marginAdminCap(),
|
|
150
|
+
pool: pool.address,
|
|
151
|
+
minOpenRiskRatio: convertRate(minOpenRiskRatio, FLOAT_SCALAR)
|
|
152
|
+
},
|
|
153
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
154
|
+
}));
|
|
145
155
|
};
|
|
146
156
|
this.addConfig = (config$1) => (tx) => {
|
|
147
|
-
tx.
|
|
148
|
-
|
|
149
|
-
arguments:
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
config$1
|
|
153
|
-
|
|
157
|
+
tx.add(addConfig({
|
|
158
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
159
|
+
arguments: {
|
|
160
|
+
self: this.#config.MARGIN_REGISTRY_ID,
|
|
161
|
+
AdminCap: this.#marginAdminCap(),
|
|
162
|
+
config: config$1
|
|
163
|
+
},
|
|
154
164
|
typeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::oracle::PythConfig`]
|
|
155
|
-
});
|
|
165
|
+
}));
|
|
156
166
|
};
|
|
157
167
|
this.removeConfig = () => (tx) => {
|
|
158
|
-
tx.
|
|
159
|
-
|
|
160
|
-
arguments:
|
|
168
|
+
tx.add(removeConfig({
|
|
169
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
170
|
+
arguments: {
|
|
171
|
+
self: this.#config.MARGIN_REGISTRY_ID,
|
|
172
|
+
AdminCap: this.#marginAdminCap()
|
|
173
|
+
},
|
|
161
174
|
typeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::oracle::PythConfig`]
|
|
162
|
-
});
|
|
175
|
+
}));
|
|
163
176
|
};
|
|
164
177
|
this.enableVersion = (version) => (tx) => {
|
|
165
|
-
tx.
|
|
166
|
-
|
|
167
|
-
arguments:
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
});
|
|
178
|
+
tx.add(enableVersion({
|
|
179
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
180
|
+
arguments: {
|
|
181
|
+
self: this.#config.MARGIN_REGISTRY_ID,
|
|
182
|
+
version,
|
|
183
|
+
AdminCap: this.#marginAdminCap()
|
|
184
|
+
}
|
|
185
|
+
}));
|
|
173
186
|
};
|
|
174
187
|
this.disableVersion = (version) => (tx) => {
|
|
175
|
-
tx.
|
|
176
|
-
|
|
177
|
-
arguments:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
});
|
|
188
|
+
tx.add(disableVersion({
|
|
189
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
190
|
+
arguments: {
|
|
191
|
+
self: this.#config.MARGIN_REGISTRY_ID,
|
|
192
|
+
version,
|
|
193
|
+
AdminCap: this.#marginAdminCap()
|
|
194
|
+
}
|
|
195
|
+
}));
|
|
183
196
|
};
|
|
184
197
|
this.newPoolConfig = (poolKey, poolConfigParams) => (tx) => {
|
|
185
198
|
const pool = this.#config.getPool(poolKey);
|
|
186
199
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
187
200
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
188
201
|
const { minWithdrawRiskRatio, minBorrowRiskRatio, liquidationRiskRatio, targetLiquidationRiskRatio, userLiquidationReward, poolLiquidationReward } = poolConfigParams;
|
|
189
|
-
return tx.
|
|
190
|
-
|
|
191
|
-
arguments:
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
202
|
+
return tx.add(newPoolConfig({
|
|
203
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
204
|
+
arguments: {
|
|
205
|
+
self: this.#config.MARGIN_REGISTRY_ID,
|
|
206
|
+
minWithdrawRiskRatio: convertRate(minWithdrawRiskRatio, FLOAT_SCALAR),
|
|
207
|
+
minBorrowRiskRatio: convertRate(minBorrowRiskRatio, FLOAT_SCALAR),
|
|
208
|
+
liquidationRiskRatio: convertRate(liquidationRiskRatio, FLOAT_SCALAR),
|
|
209
|
+
targetLiquidationRiskRatio: convertRate(targetLiquidationRiskRatio, FLOAT_SCALAR),
|
|
210
|
+
userLiquidationReward: convertRate(userLiquidationReward, FLOAT_SCALAR),
|
|
211
|
+
poolLiquidationReward: convertRate(poolLiquidationReward, FLOAT_SCALAR)
|
|
212
|
+
},
|
|
200
213
|
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
201
|
-
});
|
|
214
|
+
}));
|
|
202
215
|
};
|
|
203
216
|
this.newPoolConfigWithLeverage = (poolKey, leverage) => (tx) => {
|
|
204
217
|
const pool = this.#config.getPool(poolKey);
|
|
205
218
|
const baseCoin = this.#config.getCoin(pool.baseCoin);
|
|
206
219
|
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
|
|
207
|
-
tx.
|
|
208
|
-
|
|
209
|
-
arguments:
|
|
220
|
+
tx.add(newPoolConfigWithLeverage({
|
|
221
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
222
|
+
arguments: {
|
|
223
|
+
self: this.#config.MARGIN_REGISTRY_ID,
|
|
224
|
+
leverage: convertRate(leverage, FLOAT_SCALAR)
|
|
225
|
+
},
|
|
210
226
|
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
211
|
-
});
|
|
227
|
+
}));
|
|
212
228
|
};
|
|
213
229
|
this.newCoinTypeData = (coinKey, maxConfBps, maxEwmaDifferenceBps) => (tx) => {
|
|
214
230
|
const coin = this.#config.getCoin(coinKey);
|
|
215
231
|
if (!coin.feed) throw new Error("Coin feed not found");
|
|
216
232
|
const priceFeedInput = new Uint8Array(hexToBytes(coin["feed"].startsWith("0x") ? coin.feed.slice(2) : coin["feed"]));
|
|
217
|
-
return tx.
|
|
218
|
-
|
|
219
|
-
arguments:
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
233
|
+
return tx.add(newCoinTypeDataFromCurrency({
|
|
234
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
235
|
+
arguments: {
|
|
236
|
+
currency: coin.currencyId,
|
|
237
|
+
priceFeedId: Array.from(priceFeedInput),
|
|
238
|
+
maxConfBps,
|
|
239
|
+
maxEwmaDifferenceBps
|
|
240
|
+
},
|
|
225
241
|
typeArguments: [coin.type]
|
|
226
|
-
});
|
|
242
|
+
}));
|
|
227
243
|
};
|
|
228
244
|
this.newPythConfig = (coinSetups, maxAgeSeconds) => (tx) => {
|
|
229
245
|
const coinTypeDataList = [];
|
|
230
246
|
for (const setup of coinSetups) coinTypeDataList.push(this.newCoinTypeData(setup.coinKey, setup.maxConfBps, setup.maxEwmaDifferenceBps)(tx));
|
|
231
|
-
return tx.
|
|
232
|
-
|
|
233
|
-
arguments:
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
247
|
+
return tx.add(newPythConfig({
|
|
248
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
249
|
+
arguments: {
|
|
250
|
+
setups: tx.makeMoveVec({
|
|
251
|
+
elements: coinTypeDataList,
|
|
252
|
+
type: `${this.#config.MARGIN_PACKAGE_ID}::oracle::CoinTypeData`
|
|
253
|
+
}),
|
|
254
|
+
maxAgeSecs: maxAgeSeconds
|
|
255
|
+
}
|
|
256
|
+
}));
|
|
238
257
|
};
|
|
239
258
|
this.mintPauseCap = () => (tx) => {
|
|
240
|
-
return tx.
|
|
241
|
-
|
|
242
|
-
arguments:
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
});
|
|
259
|
+
return tx.add(mintPauseCap({
|
|
260
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
261
|
+
arguments: {
|
|
262
|
+
self: this.#config.MARGIN_REGISTRY_ID,
|
|
263
|
+
AdminCap: this.#marginAdminCap()
|
|
264
|
+
}
|
|
265
|
+
}));
|
|
248
266
|
};
|
|
249
267
|
this.revokePauseCap = (pauseCapId) => (tx) => {
|
|
250
|
-
tx.
|
|
251
|
-
|
|
252
|
-
arguments:
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
});
|
|
268
|
+
tx.add(revokePauseCap({
|
|
269
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
270
|
+
arguments: {
|
|
271
|
+
self: this.#config.MARGIN_REGISTRY_ID,
|
|
272
|
+
AdminCap: this.#marginAdminCap(),
|
|
273
|
+
pauseCapId
|
|
274
|
+
}
|
|
275
|
+
}));
|
|
259
276
|
};
|
|
260
277
|
this.disableVersionPauseCap = (version, pauseCapId) => (tx) => {
|
|
261
|
-
tx.
|
|
262
|
-
|
|
263
|
-
arguments:
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
});
|
|
278
|
+
tx.add(disableVersionPauseCap({
|
|
279
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
280
|
+
arguments: {
|
|
281
|
+
self: this.#config.MARGIN_REGISTRY_ID,
|
|
282
|
+
version,
|
|
283
|
+
pauseCap: pauseCapId
|
|
284
|
+
}
|
|
285
|
+
}));
|
|
269
286
|
};
|
|
270
287
|
this.adminWithdrawDefaultReferralFees = (coinKey) => (tx) => {
|
|
271
288
|
const coin = this.#config.getCoin(coinKey);
|
|
272
289
|
const marginPool = this.#config.getMarginPool(coinKey);
|
|
273
|
-
return tx.
|
|
274
|
-
|
|
275
|
-
arguments:
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
290
|
+
return tx.add(adminWithdrawDefaultReferralFees({
|
|
291
|
+
package: this.#config.MARGIN_PACKAGE_ID,
|
|
292
|
+
arguments: {
|
|
293
|
+
self: marginPool.address,
|
|
294
|
+
registry: this.#config.MARGIN_REGISTRY_ID,
|
|
295
|
+
AdminCap: this.#marginAdminCap()
|
|
296
|
+
},
|
|
280
297
|
typeArguments: [coin.type]
|
|
281
|
-
});
|
|
298
|
+
}));
|
|
282
299
|
};
|
|
283
300
|
this.#config = config;
|
|
284
301
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marginAdmin.mjs","names":["#config","#marginAdminCap","config"],"sources":["../../src/transactions/marginAdmin.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport type { TransactionArgument } from '@mysten/sui/transactions';\nimport type { PoolConfigParams } from '../types/index.js';\nimport { FLOAT_SCALAR } from '../utils/config.js';\nimport { convertRate } from '../utils/conversion.js';\nimport { hexToBytes } from '@noble/hashes/utils.js';\n\n/**\n * MarginAdminContract class for managing admin actions.\n */\nexport class MarginAdminContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for MarginAdminContract\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#marginAdminCap() {\n\t\tconst marginAdminCap = this.#config.marginAdminCap;\n\t\tif (!marginAdminCap) {\n\t\t\tthrow new Error('MARGIN_ADMIN_CAP environment variable not set');\n\t\t}\n\t\treturn marginAdminCap;\n\t}\n\n\t/**\n\t * @description Mint a maintainer cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintMaintainerCap = () => (tx: Transaction) => {\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::mint_maintainer_cap`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(this.#marginAdminCap()),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Revoke a maintainer cap\n\t * @returns A function that takes a Transaction object\n\t */\n\trevokeMaintainerCap = (maintainerCapId: string) => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::revoke_maintainer_cap`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(this.#marginAdminCap()),\n\t\t\t\ttx.object(maintainerCapId),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Register a deepbook pool\n\t * @param {string} poolKey The key of the pool to be registered\n\t * @param {TransactionArgument} poolConfig The configuration of the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tregisterDeepbookPool =\n\t\t(poolKey: string, poolConfig: TransactionArgument) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::register_deepbook_pool`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\ttx.object(this.#marginAdminCap()),\n\t\t\t\t\ttx.object(pool.address),\n\t\t\t\t\tpoolConfig,\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Enable a deepbook pool for margin trading\n\t * @param {string} poolKey The key of the pool to be enabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableDeepbookPool = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::enable_deepbook_pool`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(this.#marginAdminCap()),\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Disable a deepbook pool from margin trading\n\t * @param {string} poolKey The key of the pool to be disabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableDeepbookPool = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::disable_deepbook_pool`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(this.#marginAdminCap()),\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Update the risk parameters for a margin\n\t * @param {string} poolKey The key of the pool to be updated\n\t * @param {TransactionArgument} poolConfig The configuration of the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdateRiskParams = (poolKey: string, poolConfig: TransactionArgument) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::update_risk_params`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(this.#marginAdminCap()),\n\t\t\t\ttx.object(pool.address),\n\t\t\t\tpoolConfig,\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Set the price deviation tolerance for a pool. `tolerance` is\n\t * in 9-decimal float scaling (1.0 = `FLOAT_SCALAR`); the SDK applies the\n\t * scaling, so callers pass a human-readable fraction (e.g. `0.1` for 10%).\n\t * Requires the pool's current price to have been initialized via\n\t * `PoolProxyContract.updateCurrentPrice` first.\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} tolerance Tolerance as a fraction (e.g. 0.1 for 10%)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetPriceTolerance = (poolKey: string, tolerance: number | bigint) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::set_price_tolerance`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(this.#marginAdminCap()),\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.pure.u64(convertRate(tolerance, FLOAT_SCALAR)),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Set the maximum acceptable Pyth price age (in milliseconds)\n\t * for a pool. Requires the pool's current price to have been initialized\n\t * via `PoolProxyContract.updateCurrentPrice` first.\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} maxAgeMs Max age in milliseconds (raw u64)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetMaxPriceAge = (poolKey: string, maxAgeMs: number | bigint) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::set_max_price_age`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(this.#marginAdminCap()),\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.pure.u64(maxAgeMs),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Set the maximum lifetime (in milliseconds) of margin limit\n\t * orders for a pool. `pool_proxy::place_limit_order_v2` and\n\t * `place_reduce_only_limit_order_v2` clamp the user-supplied\n\t * `expire_timestamp` to at most `now + max_order_ttl_ms`, bounding margin\n\t * orders' exposure to stale-price exploitation.\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} maxOrderTtlMs Max order TTL in milliseconds (raw u64)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetMaxOrderTtl = (poolKey: string, maxOrderTtlMs: number | bigint) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::set_max_order_ttl`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(this.#marginAdminCap()),\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.pure.u64(maxOrderTtlMs),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Add the PythConfig to the margin registry\n\t * @param {Transaction} tx The transaction object\n\t * @param {TransactionArgument} config The config to be added\n\t * @returns A function that takes a Transaction object\n\t */\n\taddConfig = (config: TransactionArgument) => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::add_config`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(this.#marginAdminCap()),\n\t\t\t\tconfig,\n\t\t\t],\n\t\t\ttypeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::oracle::PythConfig`],\n\t\t});\n\t};\n\n\t/**\n\t * @description Remove the PythConfig from the margin registry\n\t * @param {Transaction} tx The transaction object\n\t * @returns A function that takes a Transaction object\n\t */\n\tremoveConfig = () => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::remove_config`,\n\t\t\targuments: [tx.object(this.#config.MARGIN_REGISTRY_ID), tx.object(this.#marginAdminCap())],\n\t\t\ttypeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::oracle::PythConfig`],\n\t\t});\n\t};\n\n\t/**\n\t * @description Enable a specific version\n\t * @param {number} version The version to be enabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableVersion = (version: number) => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::enable_version`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.pure.u64(version),\n\t\t\t\ttx.object(this.#marginAdminCap()),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Disable a specific version\n\t * @param {number} version The version to be disabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableVersion = (version: number) => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::disable_version`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.pure.u64(version),\n\t\t\t\ttx.object(this.#marginAdminCap()),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Create a new pool config\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {PoolConfigParams} poolConfigParams The parameters for the pool config\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPoolConfig = (poolKey: string, poolConfigParams: PoolConfigParams) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst {\n\t\t\tminWithdrawRiskRatio,\n\t\t\tminBorrowRiskRatio,\n\t\t\tliquidationRiskRatio,\n\t\t\ttargetLiquidationRiskRatio,\n\t\t\tuserLiquidationReward,\n\t\t\tpoolLiquidationReward,\n\t\t} = poolConfigParams;\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::new_pool_config`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.pure.u64(convertRate(minWithdrawRiskRatio, FLOAT_SCALAR)),\n\t\t\t\ttx.pure.u64(convertRate(minBorrowRiskRatio, FLOAT_SCALAR)),\n\t\t\t\ttx.pure.u64(convertRate(liquidationRiskRatio, FLOAT_SCALAR)),\n\t\t\t\ttx.pure.u64(convertRate(targetLiquidationRiskRatio, FLOAT_SCALAR)),\n\t\t\t\ttx.pure.u64(convertRate(userLiquidationReward, FLOAT_SCALAR)),\n\t\t\t\ttx.pure.u64(convertRate(poolLiquidationReward, FLOAT_SCALAR)),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Create a new pool config with leverage\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} leverage The leverage for the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPoolConfigWithLeverage = (poolKey: string, leverage: number) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::new_pool_config_with_leverage`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.pure.u64(convertRate(leverage, FLOAT_SCALAR)),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Create a new coin type data\n\t * @param {string} coinKey The key to identify the coin\n\t * @param {number} maxConfBps The maximum confidence interval in basis points\n\t * @param {number} maxEwmaDifferenceBps The maximum EWMA difference in basis points\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewCoinTypeData =\n\t\t(coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number) => (tx: Transaction) => {\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tif (!coin.feed) {\n\t\t\t\tthrow new Error('Coin feed not found');\n\t\t\t}\n\t\t\tconst priceFeedInput = new Uint8Array(\n\t\t\t\thexToBytes(coin['feed']!.startsWith('0x') ? coin.feed!.slice(2) : coin['feed']),\n\t\t\t);\n\t\t\treturn tx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::oracle::new_coin_type_data_from_currency`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(coin.currencyId!),\n\t\t\t\t\ttx.pure.vector('u8', priceFeedInput),\n\t\t\t\t\ttx.pure.u64(maxConfBps),\n\t\t\t\t\ttx.pure.u64(maxEwmaDifferenceBps),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [coin.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Create a new Pyth config\n\t * @param {Array<{coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number}>} coinSetups The coins with their oracle config to be added to the Pyth config\n\t * @param {number} maxAgeSeconds The max age in seconds for the Pyth config\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPythConfig =\n\t\t(\n\t\t\tcoinSetups: Array<{ coinKey: string; maxConfBps: number; maxEwmaDifferenceBps: number }>,\n\t\t\tmaxAgeSeconds: number,\n\t\t) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst coinTypeDataList = [];\n\t\t\tfor (const setup of coinSetups) {\n\t\t\t\tcoinTypeDataList.push(\n\t\t\t\t\tthis.newCoinTypeData(setup.coinKey, setup.maxConfBps, setup.maxEwmaDifferenceBps)(tx),\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn tx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::oracle::new_pyth_config`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.makeMoveVec({\n\t\t\t\t\t\telements: coinTypeDataList,\n\t\t\t\t\t\ttype: `${this.#config.MARGIN_PACKAGE_ID}::oracle::CoinTypeData`,\n\t\t\t\t\t}),\n\t\t\t\t\ttx.pure.u64(maxAgeSeconds),\n\t\t\t\t],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Mint a pause cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintPauseCap = () => (tx: Transaction) => {\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::mint_pause_cap`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(this.#marginAdminCap()),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Revoke a pause cap\n\t * @param {string} pauseCapId The ID of the pause cap to revoke\n\t * @returns A function that takes a Transaction object\n\t */\n\trevokePauseCap = (pauseCapId: string) => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::revoke_pause_cap`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(this.#marginAdminCap()),\n\t\t\t\ttx.object.clock(),\n\t\t\t\ttx.pure.id(pauseCapId),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Disable a version using pause cap\n\t * @param {number} version The version to disable\n\t * @param {string} pauseCapId The ID of the pause cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableVersionPauseCap = (version: number, pauseCapId: string) => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::disable_version_pause_cap`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.pure.u64(version),\n\t\t\t\ttx.object(pauseCapId),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Withdraw the default referral fees (admin only)\n\t * The default referral at 0x0 doesn't have a SupplyReferral object\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @returns A function that takes a Transaction object and returns a Coin<Asset>\n\t */\n\tadminWithdrawDefaultReferralFees = (coinKey: string) => (tx: Transaction) => {\n\t\tconst coin = this.#config.getCoin(coinKey);\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::admin_withdraw_default_referral_fees`,\n\t\t\targuments: [\n\t\t\t\ttx.object(marginPool.address),\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(this.#marginAdminCap()),\n\t\t\t],\n\t\t\ttypeArguments: [coin.type],\n\t\t});\n\t};\n}\n"],"mappings":";;;;;;;;AAeA,IAAa,sBAAb,MAAiC;CAChC;;;;CAKA,YAAY,QAAwB;kCAoBT,OAAoB;AAC9C,UAAO,GAAG,SAAS;IAClB,QAAQ,GAAG,MAAKA,OAAQ,kBAAkB;IAC1C,WAAW;KACV,GAAG,OAAO,MAAKA,OAAQ,mBAAmB;KAC1C,GAAG,OAAO,MAAKC,gBAAiB,CAAC;KACjC,GAA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AW;KACV,GAAG,OAAO,WAAW,QAAQ;KAC7B,GAAG,OAAO,MAAKA,OAAQ,mBAAmB;KAC1C,GAAG,OAAO,MAAKC,gBAAiB,CAAC;KACjC;IACD,eAAe,CAAC,KAAK,KAAK;IAC1B,CAAC;;AAtcF,QAAKD,SAAU;;;;;;CAOhB,kBAAkB;EACjB,MAAM,iBAAiB,MAAKA,OAAQ;AACpC,MAAI,CAAC,eACJ,OAAM,IAAI,MAAM,gDAAgD;AAEjE,SAAO"}
|
|
1
|
+
{"version":3,"file":"marginAdmin.mjs","names":["marginRegistryMoveCalls.mintMaintainerCap","#config","#marginAdminCap","marginRegistryMoveCalls.registerDeepbookPool","marginRegistryMoveCalls.enableDeepbookPool","marginRegistryMoveCalls.disableDeepbookPool","marginRegistryMoveCalls.updateRiskParams","marginRegistryMoveCalls.setPriceTolerance","marginRegistryMoveCalls.setMaxPriceAge","marginRegistryMoveCalls.setMaxOrderTtl","marginRegistryMoveCalls.setMinOpenRiskRatio","marginRegistryMoveCalls.addConfig","marginRegistryMoveCalls.removeConfig","marginRegistryMoveCalls.enableVersion","marginRegistryMoveCalls.disableVersion","marginRegistryMoveCalls.newPoolConfig","marginRegistryMoveCalls.newPoolConfigWithLeverage","oracleMoveCalls.newCoinTypeDataFromCurrency","oracleMoveCalls.newPythConfig","marginRegistryMoveCalls.mintPauseCap","marginRegistryMoveCalls.revokePauseCap","marginRegistryMoveCalls.disableVersionPauseCap","marginPoolMoveCalls.adminWithdrawDefaultReferralFees"],"sources":["../../src/transactions/marginAdmin.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport type { TransactionArgument } from '@mysten/sui/transactions';\nimport type { PoolConfigParams } from '../types/index.js';\nimport { FLOAT_SCALAR } from '../utils/config.js';\nimport { convertRate } from '../utils/conversion.js';\nimport { hexToBytes } from '@noble/hashes/utils.js';\nimport * as marginRegistryMoveCalls from '../contracts/deepbook_margin/margin_registry.js';\nimport * as marginPoolMoveCalls from '../contracts/deepbook_margin/margin_pool.js';\nimport * as oracleMoveCalls from '../contracts/deepbook_margin/oracle.js';\n\n/**\n * MarginAdminContract class for managing admin actions.\n */\nexport class MarginAdminContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for MarginAdminContract\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#marginAdminCap() {\n\t\tconst marginAdminCap = this.#config.marginAdminCap;\n\t\tif (!marginAdminCap) {\n\t\t\tthrow new Error('MARGIN_ADMIN_CAP environment variable not set');\n\t\t}\n\t\treturn marginAdminCap;\n\t}\n\n\t/**\n\t * @description Mint a maintainer cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintMaintainerCap = () => (tx: Transaction) => {\n\t\treturn tx.add(\n\t\t\tmarginRegistryMoveCalls.mintMaintainerCap({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.MARGIN_REGISTRY_ID, AdminCap: this.#marginAdminCap() },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Revoke a maintainer cap\n\t * @returns A function that takes a Transaction object\n\t */\n\trevokeMaintainerCap = (maintainerCapId: string) => (tx: Transaction) => {\n\t\t// NOTE: left as a positional moveCall (not codegen). The original passes\n\t\t// `maintainerCapId` as an object reference (`tx.object`), whereas the\n\t\t// generated binding encodes it as a pure `ID` value — migrating would change\n\t\t// the emitted PTB. Kept verbatim to stay byte-identical.\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::revoke_maintainer_cap`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(this.#marginAdminCap()),\n\t\t\t\ttx.object(maintainerCapId),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Register a deepbook pool\n\t * @param {string} poolKey The key of the pool to be registered\n\t * @param {TransactionArgument} poolConfig The configuration of the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tregisterDeepbookPool =\n\t\t(poolKey: string, poolConfig: TransactionArgument) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\ttx.add(\n\t\t\t\tmarginRegistryMoveCalls.registerDeepbookPool({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\tpoolConfig,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Enable a deepbook pool for margin trading\n\t * @param {string} poolKey The key of the pool to be enabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableDeepbookPool = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.enableDeepbookPool({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Disable a deepbook pool from margin trading\n\t * @param {string} poolKey The key of the pool to be disabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableDeepbookPool = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.disableDeepbookPool({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Update the risk parameters for a margin\n\t * @param {string} poolKey The key of the pool to be updated\n\t * @param {TransactionArgument} poolConfig The configuration of the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdateRiskParams = (poolKey: string, poolConfig: TransactionArgument) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.updateRiskParams({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tpoolConfig,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the price deviation tolerance for a pool. `tolerance` is\n\t * in 9-decimal float scaling (1.0 = `FLOAT_SCALAR`); the SDK applies the\n\t * scaling, so callers pass a human-readable fraction (e.g. `0.1` for 10%).\n\t * Requires the pool's current price to have been initialized via\n\t * `PoolProxyContract.updateCurrentPrice` first.\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} tolerance Tolerance as a fraction (e.g. 0.1 for 10%)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetPriceTolerance = (poolKey: string, tolerance: number | bigint) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.setPriceTolerance({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\ttolerance: convertRate(tolerance, FLOAT_SCALAR),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the maximum acceptable Pyth price age (in milliseconds)\n\t * for a pool. Requires the pool's current price to have been initialized\n\t * via `PoolProxyContract.updateCurrentPrice` first.\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} maxAgeMs Max age in milliseconds (raw u64)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetMaxPriceAge = (poolKey: string, maxAgeMs: number | bigint) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.setMaxPriceAge({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tmaxAgeMs,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the maximum lifetime (in milliseconds) of margin limit\n\t * orders for a pool. `pool_proxy::place_limit_order_v2` and\n\t * `place_reduce_only_limit_order_v2` clamp the user-supplied\n\t * `expire_timestamp` to at most `now + max_order_ttl_ms`, bounding margin\n\t * orders' exposure to stale-price exploitation.\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} maxOrderTtlMs Max order TTL in milliseconds (raw u64)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetMaxOrderTtl = (poolKey: string, maxOrderTtlMs: number | bigint) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.setMaxOrderTtl({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tmaxOrderTtlMs,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Set the minimum risk ratio required to open a new position on\n\t * a pool. Distinct from the borrow floor: this gates position opening, not\n\t * borrowing. Stored in 9-decimal float scaling (1.0 = `FLOAT_SCALAR`); the SDK\n\t * applies the scaling, so callers pass a human-readable ratio (e.g. `1.25`).\n\t * @param {string} poolKey The key of the pool to update\n\t * @param {number | bigint} minOpenRiskRatio Minimum open risk ratio (e.g. 1.25)\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetMinOpenRiskRatio =\n\t\t(poolKey: string, minOpenRiskRatio: number | bigint) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\ttx.add(\n\t\t\t\tmarginRegistryMoveCalls.setMinOpenRiskRatio({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\tminOpenRiskRatio: convertRate(minOpenRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Add the PythConfig to the margin registry\n\t * @param {Transaction} tx The transaction object\n\t * @param {TransactionArgument} config The config to be added\n\t * @returns A function that takes a Transaction object\n\t */\n\taddConfig = (config: TransactionArgument) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.addConfig({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tconfig,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::oracle::PythConfig`],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Remove the PythConfig from the margin registry\n\t * @param {Transaction} tx The transaction object\n\t * @returns A function that takes a Transaction object\n\t */\n\tremoveConfig = () => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.removeConfig({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.MARGIN_REGISTRY_ID, AdminCap: this.#marginAdminCap() },\n\t\t\t\ttypeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::oracle::PythConfig`],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Enable a specific version\n\t * @param {number} version The version to be enabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableVersion = (version: number) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.enableVersion({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tversion,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Disable a specific version\n\t * @param {number} version The version to be disabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableVersion = (version: number) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.disableVersion({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tversion,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Create a new pool config\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {PoolConfigParams} poolConfigParams The parameters for the pool config\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPoolConfig = (poolKey: string, poolConfigParams: PoolConfigParams) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst {\n\t\t\tminWithdrawRiskRatio,\n\t\t\tminBorrowRiskRatio,\n\t\t\tliquidationRiskRatio,\n\t\t\ttargetLiquidationRiskRatio,\n\t\t\tuserLiquidationReward,\n\t\t\tpoolLiquidationReward,\n\t\t} = poolConfigParams;\n\t\treturn tx.add(\n\t\t\tmarginRegistryMoveCalls.newPoolConfig({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tminWithdrawRiskRatio: convertRate(minWithdrawRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\tminBorrowRiskRatio: convertRate(minBorrowRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\tliquidationRiskRatio: convertRate(liquidationRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\ttargetLiquidationRiskRatio: convertRate(targetLiquidationRiskRatio, FLOAT_SCALAR),\n\t\t\t\t\tuserLiquidationReward: convertRate(userLiquidationReward, FLOAT_SCALAR),\n\t\t\t\t\tpoolLiquidationReward: convertRate(poolLiquidationReward, FLOAT_SCALAR),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Create a new pool config with leverage\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} leverage The leverage for the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPoolConfigWithLeverage = (poolKey: string, leverage: number) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.newPoolConfigWithLeverage({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tleverage: convertRate(leverage, FLOAT_SCALAR),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Create a new coin type data\n\t * @param {string} coinKey The key to identify the coin\n\t * @param {number} maxConfBps The maximum confidence interval in basis points\n\t * @param {number} maxEwmaDifferenceBps The maximum EWMA difference in basis points\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewCoinTypeData =\n\t\t(coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number) => (tx: Transaction) => {\n\t\t\tconst coin = this.#config.getCoin(coinKey);\n\t\t\tif (!coin.feed) {\n\t\t\t\tthrow new Error('Coin feed not found');\n\t\t\t}\n\t\t\tconst priceFeedInput = new Uint8Array(\n\t\t\t\thexToBytes(coin['feed']!.startsWith('0x') ? coin.feed!.slice(2) : coin['feed']),\n\t\t\t);\n\t\t\treturn tx.add(\n\t\t\t\toracleMoveCalls.newCoinTypeDataFromCurrency({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tcurrency: coin.currencyId!,\n\t\t\t\t\t\tpriceFeedId: Array.from(priceFeedInput),\n\t\t\t\t\t\tmaxConfBps,\n\t\t\t\t\t\tmaxEwmaDifferenceBps,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [coin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Create a new Pyth config\n\t * @param {Array<{coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number}>} coinSetups The coins with their oracle config to be added to the Pyth config\n\t * @param {number} maxAgeSeconds The max age in seconds for the Pyth config\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPythConfig =\n\t\t(\n\t\t\tcoinSetups: Array<{ coinKey: string; maxConfBps: number; maxEwmaDifferenceBps: number }>,\n\t\t\tmaxAgeSeconds: number,\n\t\t) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst coinTypeDataList = [];\n\t\t\tfor (const setup of coinSetups) {\n\t\t\t\tcoinTypeDataList.push(\n\t\t\t\t\tthis.newCoinTypeData(setup.coinKey, setup.maxConfBps, setup.maxEwmaDifferenceBps)(tx),\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn tx.add(\n\t\t\t\toracleMoveCalls.newPythConfig({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tsetups: tx.makeMoveVec({\n\t\t\t\t\t\t\telements: coinTypeDataList,\n\t\t\t\t\t\t\ttype: `${this.#config.MARGIN_PACKAGE_ID}::oracle::CoinTypeData`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tmaxAgeSecs: maxAgeSeconds,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Mint a pause cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintPauseCap = () => (tx: Transaction) => {\n\t\treturn tx.add(\n\t\t\tmarginRegistryMoveCalls.mintPauseCap({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.MARGIN_REGISTRY_ID, AdminCap: this.#marginAdminCap() },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Revoke a pause cap\n\t * @param {string} pauseCapId The ID of the pause cap to revoke\n\t * @returns A function that takes a Transaction object\n\t */\n\trevokePauseCap = (pauseCapId: string) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.revokePauseCap({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t\tpauseCapId,\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Disable a version using pause cap\n\t * @param {number} version The version to disable\n\t * @param {string} pauseCapId The ID of the pause cap\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableVersionPauseCap = (version: number, pauseCapId: string) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tmarginRegistryMoveCalls.disableVersionPauseCap({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tversion,\n\t\t\t\t\tpauseCap: pauseCapId,\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Withdraw the default referral fees (admin only)\n\t * The default referral at 0x0 doesn't have a SupplyReferral object\n\t * @param {string} coinKey The key to identify the margin pool\n\t * @returns A function that takes a Transaction object and returns a Coin<Asset>\n\t */\n\tadminWithdrawDefaultReferralFees = (coinKey: string) => (tx: Transaction) => {\n\t\tconst coin = this.#config.getCoin(coinKey);\n\t\tconst marginPool = this.#config.getMarginPool(coinKey);\n\t\treturn tx.add(\n\t\t\tmarginPoolMoveCalls.adminWithdrawDefaultReferralFees({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: marginPool.address,\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tAdminCap: this.#marginAdminCap(),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [coin.type],\n\t\t\t}),\n\t\t);\n\t};\n}\n"],"mappings":";;;;;;;;;;;AAkBA,IAAa,sBAAb,MAAiC;CAChC;;;;CAKA,YAAY,QAAwB;kCAoBT,OAAoB;AAC9C,UAAO,GAAG,IACTA,kBAA0C;IACzC,SAAS,MAAKC,OAAQ;IACtB,WAAW;KAAE,MAAM,MAAKA,OAAQ;KAAoB,UAAU,MAAKC,gBAAiB;KAAE;IACtF,CAAC,CACF;;8BAOqB,qBAA6B,OAAoB;AAK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AAQ;IACtB,WAAW;KACV,MAAM,MAAKA,OAAQ;KACnB,UAAU,MAAKC,gBAAiB;KAChC;KACA;IACD,CAAC,CACF;;iCASwB,SAAiB,gBAAwB,OAAoB;AACtF,MAAG,IACFmB,uBAA+C;IAC9C,SAAS,MAAKpB,OAAQ;IACtB,WAAW;KACV,MAAM,MAAKA,OAAQ;KACnB;KACA,UAAU;KACV;IACD,CAAC,CACF;;2CASkC,aAAqB,OAAoB;GAC5E,MAAM,OAAO,MAAKA,OAAQ,QAAQ,QAAQ;GAC1C,MAAM,aAAa,MAAKA,OAAQ,cAAc,QAAQ;AACtD,UAAO,GAAG,IACTqB,iCAAqD;IACpD,SAAS,MAAKrB,OAAQ;IACtB,WAAW;KACV,MAAM,WAAW;KACjB,UAAU,MAAKA,OAAQ;KACvB,UAAU,MAAKC,gBAAiB;KAChC;IACD,eAAe,CAAC,KAAK,KAAK;IAC1B,CAAC,CACF;;AA9fD,QAAKD,SAAU;;;;;;CAOhB,kBAAkB;EACjB,MAAM,iBAAiB,MAAKA,OAAQ;AACpC,MAAI,CAAC,eACJ,OAAM,IAAI,MAAM,gDAAgD;AAEjE,SAAO"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DeepBookConfig } from "../utils/config.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _mysten_sui_transactions121 from "@mysten/sui/transactions";
|
|
3
3
|
import { Transaction } from "@mysten/sui/transactions";
|
|
4
4
|
|
|
5
5
|
//#region src/transactions/marginLiquidations.d.ts
|
|
@@ -35,7 +35,7 @@ declare class MarginLiquidationsContract {
|
|
|
35
35
|
* @param {number} amount The amount to withdraw
|
|
36
36
|
* @returns A function that takes a Transaction object and returns the withdrawn coin
|
|
37
37
|
*/
|
|
38
|
-
withdraw: (vaultId: string, liquidationAdminCap: string, coinKey: string, amount: number) => (tx: Transaction) =>
|
|
38
|
+
withdraw: (vaultId: string, liquidationAdminCap: string, coinKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions121.TransactionResult;
|
|
39
39
|
/**
|
|
40
40
|
* @description Liquidate a margin manager by repaying base debt
|
|
41
41
|
* @param {string} vaultId The liquidation vault object ID
|
|
@@ -60,7 +60,7 @@ declare class MarginLiquidationsContract {
|
|
|
60
60
|
* @param {string} coinKey The key to identify the coin type
|
|
61
61
|
* @returns A function that takes a Transaction object
|
|
62
62
|
*/
|
|
63
|
-
balance: (vaultId: string, coinKey: string) => (tx: Transaction) =>
|
|
63
|
+
balance: (vaultId: string, coinKey: string) => (tx: Transaction) => _mysten_sui_transactions121.TransactionResult;
|
|
64
64
|
}
|
|
65
65
|
//#endregion
|
|
66
66
|
export { MarginLiquidationsContract };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marginLiquidations.d.mts","names":[],"sources":["../../src/transactions/marginLiquidations.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"marginLiquidations.d.mts","names":[],"sources":["../../src/transactions/marginLiquidations.ts"],"mappings":";;;;;;;;cAYa,0BAAA;EAAA;;;;cAMA,MAAA,EAAQ,cAAA;EAqDd;;;;;EA5CN,sBAAA,GAA0B,mBAAA,cAAiC,EAAA,EAAI,WAAA;EAyJC;;;;;;;;EAxIhE,OAAA,GACE,OAAA,UAAiB,mBAAA,UAA6B,OAAA,UAAiB,MAAA,cAC/D,EAAA,EAAI,WAAA;EAnBqD;;;;;;;;EA0C3D,QAAA,GACE,OAAA,UAAiB,mBAAA,UAA6B,OAAA,UAAiB,MAAA,cAC/D,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA;EADf;;;;;;;;EAwBF,aAAA,GACE,OAAA,UAAiB,cAAA,UAAwB,OAAA,UAAiB,WAAA,eAC1D,EAAA,EAAI,WAAA;EADa;;;;;;;;EA0CnB,cAAA,GACE,OAAA,UAAiB,cAAA,UAAwB,OAAA,UAAiB,WAAA,eAC1D,EAAA,EAAI,WAAA;EADsD;;;;;;EA0C5D,OAAA,GAAW,OAAA,UAAiB,OAAA,cAAqB,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA;AAAA"}
|