@mysten/deepbook-v3 0.0.0-experimental-20240730220552
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 +8 -0
- package/LICENSE +201 -0
- package/README.md +1 -0
- package/dist/cjs/client.d.ts +177 -0
- package/dist/cjs/client.js +387 -0
- package/dist/cjs/client.js.map +7 -0
- package/dist/cjs/index.d.ts +7 -0
- package/dist/cjs/index.js +37 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/package.json +4 -0
- package/dist/cjs/transactions/balanceManager.d.ts +80 -0
- package/dist/cjs/transactions/balanceManager.js +185 -0
- package/dist/cjs/transactions/balanceManager.js.map +7 -0
- package/dist/cjs/transactions/deepbook.d.ts +183 -0
- package/dist/cjs/transactions/deepbook.js +545 -0
- package/dist/cjs/transactions/deepbook.js.map +7 -0
- package/dist/cjs/transactions/deepbookAdmin.d.ts +43 -0
- package/dist/cjs/transactions/deepbookAdmin.js +159 -0
- package/dist/cjs/transactions/deepbookAdmin.js.map +7 -0
- package/dist/cjs/transactions/flashLoans.d.ts +56 -0
- package/dist/cjs/transactions/flashLoans.js +122 -0
- package/dist/cjs/transactions/flashLoans.js.map +7 -0
- package/dist/cjs/transactions/governance.d.ts +42 -0
- package/dist/cjs/transactions/governance.js +131 -0
- package/dist/cjs/transactions/governance.js.map +7 -0
- package/dist/cjs/types/index.d.ts +80 -0
- package/dist/cjs/types/index.js +38 -0
- package/dist/cjs/types/index.js.map +7 -0
- package/dist/cjs/utils/config.d.ts +38 -0
- package/dist/cjs/utils/config.js +103 -0
- package/dist/cjs/utils/config.js.map +7 -0
- package/dist/cjs/utils/constants.d.ts +22 -0
- package/dist/cjs/utils/constants.js +117 -0
- package/dist/cjs/utils/constants.js.map +7 -0
- package/dist/esm/client.d.ts +177 -0
- package/dist/esm/client.js +367 -0
- package/dist/esm/client.js.map +7 -0
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.js +17 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/package.json +4 -0
- package/dist/esm/transactions/balanceManager.d.ts +80 -0
- package/dist/esm/transactions/balanceManager.js +165 -0
- package/dist/esm/transactions/balanceManager.js.map +7 -0
- package/dist/esm/transactions/deepbook.d.ts +183 -0
- package/dist/esm/transactions/deepbook.js +525 -0
- package/dist/esm/transactions/deepbook.js.map +7 -0
- package/dist/esm/transactions/deepbookAdmin.d.ts +43 -0
- package/dist/esm/transactions/deepbookAdmin.js +139 -0
- package/dist/esm/transactions/deepbookAdmin.js.map +7 -0
- package/dist/esm/transactions/flashLoans.d.ts +56 -0
- package/dist/esm/transactions/flashLoans.js +102 -0
- package/dist/esm/transactions/flashLoans.js.map +7 -0
- package/dist/esm/transactions/governance.d.ts +42 -0
- package/dist/esm/transactions/governance.js +111 -0
- package/dist/esm/transactions/governance.js.map +7 -0
- package/dist/esm/types/index.d.ts +80 -0
- package/dist/esm/types/index.js +18 -0
- package/dist/esm/types/index.js.map +7 -0
- package/dist/esm/utils/config.d.ts +38 -0
- package/dist/esm/utils/config.js +90 -0
- package/dist/esm/utils/config.js.map +7 -0
- package/dist/esm/utils/constants.d.ts +22 -0
- package/dist/esm/utils/constants.js +97 -0
- package/dist/esm/utils/constants.js.map +7 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +52 -0
- package/src/client.ts +429 -0
- package/src/index.ts +10 -0
- package/src/transactions/balanceManager.ts +182 -0
- package/src/transactions/deepbook.ts +587 -0
- package/src/transactions/deepbookAdmin.ts +140 -0
- package/src/transactions/flashLoans.ts +121 -0
- package/src/transactions/governance.ts +119 -0
- package/src/types/index.ts +98 -0
- package/src/utils/config.ts +103 -0
- package/src/utils/constants.ts +106 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Transaction } from '@mysten/sui/transactions';
|
|
2
|
+
import type { CreatePoolAdminParams } from '../types/index.js';
|
|
3
|
+
import type { DeepBookConfig } from '../utils/config.js';
|
|
4
|
+
/**
|
|
5
|
+
* DeepBookAdminContract class for managing admin actions.
|
|
6
|
+
*/
|
|
7
|
+
export declare class DeepBookAdminContract {
|
|
8
|
+
#private;
|
|
9
|
+
/**
|
|
10
|
+
* @param {DeepBookConfig} config Configuration for DeepBookAdminContract
|
|
11
|
+
*/
|
|
12
|
+
constructor(config: DeepBookConfig);
|
|
13
|
+
/**
|
|
14
|
+
* @description Create a new pool as admin
|
|
15
|
+
* @param {CreatePoolAdminParams} params Parameters for creating pool as admin
|
|
16
|
+
* @returns A function that takes a Transaction object
|
|
17
|
+
*/
|
|
18
|
+
createPoolAdmin: (params: CreatePoolAdminParams) => (tx: Transaction) => void;
|
|
19
|
+
/**
|
|
20
|
+
* @description Unregister a pool as admin
|
|
21
|
+
* @param {string} poolKey The key of the pool to be unregistered by admin
|
|
22
|
+
* @returns A function that takes a Transaction object
|
|
23
|
+
*/
|
|
24
|
+
unregisterPoolAdmin: (poolKey: string) => (tx: Transaction) => void;
|
|
25
|
+
/**
|
|
26
|
+
* @description Update the allowed versions for a pool
|
|
27
|
+
* @param {string} poolKey The key of the pool to be updated
|
|
28
|
+
* @returns A function that takes a Transaction object
|
|
29
|
+
*/
|
|
30
|
+
updateAllowedVersions: (poolKey: string) => (tx: Transaction) => void;
|
|
31
|
+
/**
|
|
32
|
+
* @description Enable a specific version
|
|
33
|
+
* @param {number} version The version to be enabled
|
|
34
|
+
* @returns A function that takes a Transaction object
|
|
35
|
+
*/
|
|
36
|
+
enableVersion: (version: number) => (tx: Transaction) => void;
|
|
37
|
+
/**
|
|
38
|
+
* @description Disable a specific version
|
|
39
|
+
* @param {number} version The version to be disabled
|
|
40
|
+
* @returns A function that takes a Transaction object
|
|
41
|
+
*/
|
|
42
|
+
disableVersion: (version: number) => (tx: Transaction) => void;
|
|
43
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __typeError = (msg) => {
|
|
7
|
+
throw TypeError(msg);
|
|
8
|
+
};
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
23
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
24
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
25
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
26
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
27
|
+
var deepbookAdmin_exports = {};
|
|
28
|
+
__export(deepbookAdmin_exports, {
|
|
29
|
+
DeepBookAdminContract: () => DeepBookAdminContract
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(deepbookAdmin_exports);
|
|
32
|
+
var import_transactions = require("@mysten/sui/transactions");
|
|
33
|
+
var import_config = require("../utils/config.js");
|
|
34
|
+
var _config, _DeepBookAdminContract_instances, adminCap_fn;
|
|
35
|
+
class DeepBookAdminContract {
|
|
36
|
+
/**
|
|
37
|
+
* @param {DeepBookConfig} config Configuration for DeepBookAdminContract
|
|
38
|
+
*/
|
|
39
|
+
constructor(config) {
|
|
40
|
+
__privateAdd(this, _DeepBookAdminContract_instances);
|
|
41
|
+
__privateAdd(this, _config);
|
|
42
|
+
/**
|
|
43
|
+
* @description Create a new pool as admin
|
|
44
|
+
* @param {CreatePoolAdminParams} params Parameters for creating pool as admin
|
|
45
|
+
* @returns A function that takes a Transaction object
|
|
46
|
+
*/
|
|
47
|
+
this.createPoolAdmin = (params) => (tx) => {
|
|
48
|
+
tx.setSenderIfNotSet(__privateGet(this, _config).address);
|
|
49
|
+
const { baseCoinKey, quoteCoinKey, tickSize, lotSize, minSize, whitelisted, stablePool } = params;
|
|
50
|
+
const baseCoin = __privateGet(this, _config).getCoin(baseCoinKey);
|
|
51
|
+
const quoteCoin = __privateGet(this, _config).getCoin(quoteCoinKey);
|
|
52
|
+
const deepCoinType = __privateGet(this, _config).getCoin("DEEP").type;
|
|
53
|
+
const creationFee = (0, import_transactions.coinWithBalance)({ type: deepCoinType, balance: import_config.POOL_CREATION_FEE });
|
|
54
|
+
const baseScalar = baseCoin.scalar;
|
|
55
|
+
const quoteScalar = quoteCoin.scalar;
|
|
56
|
+
const adjustedTickSize = tickSize * import_config.FLOAT_SCALAR * quoteScalar / baseScalar;
|
|
57
|
+
const adjustedLotSize = lotSize * baseScalar;
|
|
58
|
+
const adjustedMinSize = minSize * baseScalar;
|
|
59
|
+
tx.moveCall({
|
|
60
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::pool::create_pool_admin`,
|
|
61
|
+
arguments: [
|
|
62
|
+
tx.object(__privateGet(this, _config).REGISTRY_ID),
|
|
63
|
+
// registry_id
|
|
64
|
+
tx.pure.u64(adjustedTickSize),
|
|
65
|
+
// adjusted tick_size
|
|
66
|
+
tx.pure.u64(adjustedLotSize),
|
|
67
|
+
// adjusted lot_size
|
|
68
|
+
tx.pure.u64(adjustedMinSize),
|
|
69
|
+
// adjusted min_size
|
|
70
|
+
creationFee,
|
|
71
|
+
// 0x2::balance::Balance<0x2::sui::SUI>
|
|
72
|
+
tx.pure.bool(whitelisted),
|
|
73
|
+
tx.pure.bool(stablePool),
|
|
74
|
+
tx.object(__privateMethod(this, _DeepBookAdminContract_instances, adminCap_fn).call(this))
|
|
75
|
+
],
|
|
76
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* @description Unregister a pool as admin
|
|
81
|
+
* @param {string} poolKey The key of the pool to be unregistered by admin
|
|
82
|
+
* @returns A function that takes a Transaction object
|
|
83
|
+
*/
|
|
84
|
+
this.unregisterPoolAdmin = (poolKey) => (tx) => {
|
|
85
|
+
const pool = __privateGet(this, _config).getPool(poolKey);
|
|
86
|
+
const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
|
|
87
|
+
const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
|
|
88
|
+
tx.moveCall({
|
|
89
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::pool::unregister_pool_admin`,
|
|
90
|
+
arguments: [tx.object(__privateGet(this, _config).REGISTRY_ID), tx.object(__privateMethod(this, _DeepBookAdminContract_instances, adminCap_fn).call(this))],
|
|
91
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* @description Update the allowed versions for a pool
|
|
96
|
+
* @param {string} poolKey The key of the pool to be updated
|
|
97
|
+
* @returns A function that takes a Transaction object
|
|
98
|
+
*/
|
|
99
|
+
this.updateAllowedVersions = (poolKey) => (tx) => {
|
|
100
|
+
const pool = __privateGet(this, _config).getPool(poolKey);
|
|
101
|
+
const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
|
|
102
|
+
const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
|
|
103
|
+
tx.moveCall({
|
|
104
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::pool::update_allowed_versions`,
|
|
105
|
+
arguments: [
|
|
106
|
+
tx.object(pool.address),
|
|
107
|
+
tx.object(__privateGet(this, _config).REGISTRY_ID),
|
|
108
|
+
tx.object(__privateMethod(this, _DeepBookAdminContract_instances, adminCap_fn).call(this))
|
|
109
|
+
],
|
|
110
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* @description Enable a specific version
|
|
115
|
+
* @param {number} version The version to be enabled
|
|
116
|
+
* @returns A function that takes a Transaction object
|
|
117
|
+
*/
|
|
118
|
+
this.enableVersion = (version) => (tx) => {
|
|
119
|
+
tx.moveCall({
|
|
120
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::registry::enable_version`,
|
|
121
|
+
arguments: [
|
|
122
|
+
tx.object(__privateGet(this, _config).REGISTRY_ID),
|
|
123
|
+
tx.pure.u64(version),
|
|
124
|
+
tx.object(__privateMethod(this, _DeepBookAdminContract_instances, adminCap_fn).call(this))
|
|
125
|
+
]
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* @description Disable a specific version
|
|
130
|
+
* @param {number} version The version to be disabled
|
|
131
|
+
* @returns A function that takes a Transaction object
|
|
132
|
+
*/
|
|
133
|
+
this.disableVersion = (version) => (tx) => {
|
|
134
|
+
tx.moveCall({
|
|
135
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::registry::disable_version`,
|
|
136
|
+
arguments: [
|
|
137
|
+
tx.object(__privateGet(this, _config).REGISTRY_ID),
|
|
138
|
+
tx.pure.u64(version),
|
|
139
|
+
tx.object(__privateMethod(this, _DeepBookAdminContract_instances, adminCap_fn).call(this))
|
|
140
|
+
]
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
__privateSet(this, _config, config);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
_config = new WeakMap();
|
|
147
|
+
_DeepBookAdminContract_instances = new WeakSet();
|
|
148
|
+
/**
|
|
149
|
+
* @returns The admin capability required for admin operations
|
|
150
|
+
* @throws Error if the admin capability is not set
|
|
151
|
+
*/
|
|
152
|
+
adminCap_fn = function() {
|
|
153
|
+
const adminCap = __privateGet(this, _config).adminCap;
|
|
154
|
+
if (!adminCap) {
|
|
155
|
+
throw new Error("ADMIN_CAP environment variable not set");
|
|
156
|
+
}
|
|
157
|
+
return adminCap;
|
|
158
|
+
};
|
|
159
|
+
//# sourceMappingURL=deepbookAdmin.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/transactions/deepbookAdmin.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { coinWithBalance } from '@mysten/sui/transactions';\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport type { CreatePoolAdminParams } from '../types/index.js';\nimport type { DeepBookConfig } from '../utils/config.js';\nimport { FLOAT_SCALAR, POOL_CREATION_FEE } from '../utils/config.js';\n\n/**\n * DeepBookAdminContract class for managing admin actions.\n */\nexport class DeepBookAdminContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for DeepBookAdminContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @returns The admin capability required for admin operations\n\t * @throws Error if the admin capability is not set\n\t */\n\t#adminCap() {\n\t\tconst adminCap = this.#config.adminCap;\n\t\tif (!adminCap) {\n\t\t\tthrow new Error('ADMIN_CAP environment variable not set');\n\t\t}\n\t\treturn adminCap;\n\t}\n\n\t/**\n\t * @description Create a new pool as admin\n\t * @param {CreatePoolAdminParams} params Parameters for creating pool as admin\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreatePoolAdmin = (params: CreatePoolAdminParams) => (tx: Transaction) => {\n\t\ttx.setSenderIfNotSet(this.#config.address);\n\t\tconst { baseCoinKey, quoteCoinKey, tickSize, lotSize, minSize, whitelisted, stablePool } =\n\t\t\tparams;\n\t\tconst baseCoin = this.#config.getCoin(baseCoinKey);\n\t\tconst quoteCoin = this.#config.getCoin(quoteCoinKey);\n\t\tconst deepCoinType = this.#config.getCoin('DEEP').type;\n\n\t\tconst creationFee = coinWithBalance({ type: deepCoinType, balance: POOL_CREATION_FEE });\n\t\tconst baseScalar = baseCoin.scalar;\n\t\tconst quoteScalar = quoteCoin.scalar;\n\n\t\tconst adjustedTickSize = (tickSize * FLOAT_SCALAR * quoteScalar) / baseScalar;\n\t\tconst adjustedLotSize = lotSize * baseScalar;\n\t\tconst adjustedMinSize = minSize * baseScalar;\n\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::create_pool_admin`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.REGISTRY_ID), // registry_id\n\t\t\t\ttx.pure.u64(adjustedTickSize), // adjusted tick_size\n\t\t\t\ttx.pure.u64(adjustedLotSize), // adjusted lot_size\n\t\t\t\ttx.pure.u64(adjustedMinSize), // adjusted min_size\n\t\t\t\tcreationFee, // 0x2::balance::Balance<0x2::sui::SUI>\n\t\t\t\ttx.pure.bool(whitelisted),\n\t\t\t\ttx.pure.bool(stablePool),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Unregister a pool as admin\n\t * @param {string} poolKey The key of the pool to be unregistered by admin\n\t * @returns A function that takes a Transaction object\n\t */\n\tunregisterPoolAdmin = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::unregister_pool_admin`,\n\t\t\targuments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Update the allowed versions for a pool\n\t * @param {string} poolKey The key of the pool to be updated\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdateAllowedVersions = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::update_allowed_versions`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.DEEPBOOK_PACKAGE_ID}::registry::enable_version`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\ttx.pure.u64(version),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Disable a specific version\n\t * @param {number} version The version to be disabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableVersion = (version: number) => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t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AAoB;AACzD,SAAG,SAAS;AAAA,QACX,QAAQ,GAAG,mBAAK,SAAQ,mBAAmB;AAAA,QAC3C,WAAW;AAAA,UACV,GAAG,OAAO,mBAAK,SAAQ,WAAW;AAAA,UAClC,GAAG,KAAK,IAAI,OAAO;AAAA,UACnB,GAAG,OAAO,sBAAK,+CAAL,UAAgB;AAAA,QAC3B;AAAA,MACD,CAAC;AAAA,IACF;AAOA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAiB,CAAC,YAAoB,CAAC,OAAoB;AAC1D,SAAG,SAAS;AAAA,QACX,QAAQ,GAAG,mBAAK,SAAQ,mBAAmB;AAAA,QAC3C,WAAW;AAAA,UACV,GAAG,OAAO,mBAAK,SAAQ,WAAW;AAAA,UAClC,GAAG,KAAK,IAAI,OAAO;AAAA,UACnB,GAAG,OAAO,sBAAK,+CAAL,UAAgB;AAAA,QAC3B;AAAA,MACD,CAAC;AAAA,IACF;AAtHC,uBAAK,SAAU;AAAA,EAChB;AAsHD;AA7HC;AADM;AAAA;AAAA;AAAA;AAAA;AAcN,cAAS,WAAG;AACX,QAAM,WAAW,mBAAK,SAAQ;AAC9B,MAAI,CAAC,UAAU;AACd,UAAM,IAAI,MAAM,wCAAwC;AAAA,EACzD;AACA,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
2
|
+
import type { DeepBookConfig } from '../utils/config.js';
|
|
3
|
+
/**
|
|
4
|
+
* FlashLoanContract class for managing flash loans.
|
|
5
|
+
*/
|
|
6
|
+
export declare class FlashLoanContract {
|
|
7
|
+
#private;
|
|
8
|
+
/**
|
|
9
|
+
* @param {DeepBookConfig} config Configuration object for DeepBook
|
|
10
|
+
*/
|
|
11
|
+
constructor(config: DeepBookConfig);
|
|
12
|
+
/**
|
|
13
|
+
* @description Borrow base asset from the pool
|
|
14
|
+
* @param {string} poolKey The key to identify the pool
|
|
15
|
+
* @param {number} borrowAmount The amount to borrow
|
|
16
|
+
* @returns A function that takes a Transaction object
|
|
17
|
+
*/
|
|
18
|
+
borrowBaseAsset: (poolKey: string, borrowAmount: number) => (tx: Transaction) => readonly [{
|
|
19
|
+
$kind: "NestedResult";
|
|
20
|
+
NestedResult: [number, number];
|
|
21
|
+
}, {
|
|
22
|
+
$kind: "NestedResult";
|
|
23
|
+
NestedResult: [number, number];
|
|
24
|
+
}];
|
|
25
|
+
/**
|
|
26
|
+
* @description Return base asset to the pool after a flash loan.
|
|
27
|
+
* @param {string} poolKey The key to identify the pool
|
|
28
|
+
* @param {number} borrowAmount The amount of the base asset to return
|
|
29
|
+
* @param {TransactionObjectArgument} baseCoinInput Coin object representing the base asset to be returned
|
|
30
|
+
* @param {TransactionObjectArgument} flashLoan FlashLoan object representing the loan to be settled
|
|
31
|
+
* @returns A function that takes a Transaction object
|
|
32
|
+
*/
|
|
33
|
+
returnBaseAsset: (poolKey: string, borrowAmount: number, baseCoinInput: TransactionObjectArgument, flashLoan: TransactionObjectArgument) => (tx: Transaction) => TransactionObjectArgument;
|
|
34
|
+
/**
|
|
35
|
+
* @description Borrow quote asset from the pool
|
|
36
|
+
* @param {string} poolKey The key to identify the pool
|
|
37
|
+
* @param {number} borrowAmount The amount to borrow
|
|
38
|
+
* @returns A function that takes a Transaction object
|
|
39
|
+
*/
|
|
40
|
+
borrowQuoteAsset: (poolKey: string, borrowAmount: number) => (tx: Transaction) => readonly [{
|
|
41
|
+
$kind: "NestedResult";
|
|
42
|
+
NestedResult: [number, number];
|
|
43
|
+
}, {
|
|
44
|
+
$kind: "NestedResult";
|
|
45
|
+
NestedResult: [number, number];
|
|
46
|
+
}];
|
|
47
|
+
/**
|
|
48
|
+
* @description Return quote asset to the pool after a flash loan.
|
|
49
|
+
* @param {string} poolKey The key to identify the pool
|
|
50
|
+
* @param {number} borrowAmount The amount of the quote asset to return
|
|
51
|
+
* @param {TransactionObjectArgument} quoteCoinInput Coin object representing the quote asset to be returned
|
|
52
|
+
* @param {TransactionObjectArgument} flashLoan FlashLoan object representing the loan to be settled
|
|
53
|
+
* @returns A function that takes a Transaction object
|
|
54
|
+
*/
|
|
55
|
+
returnQuoteAsset: (poolKey: string, borrowAmount: number, quoteCoinInput: TransactionObjectArgument, flashLoan: TransactionObjectArgument) => (tx: Transaction) => TransactionObjectArgument;
|
|
56
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __typeError = (msg) => {
|
|
7
|
+
throw TypeError(msg);
|
|
8
|
+
};
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
23
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
24
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
25
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
26
|
+
var flashLoans_exports = {};
|
|
27
|
+
__export(flashLoans_exports, {
|
|
28
|
+
FlashLoanContract: () => FlashLoanContract
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(flashLoans_exports);
|
|
31
|
+
var _config;
|
|
32
|
+
class FlashLoanContract {
|
|
33
|
+
/**
|
|
34
|
+
* @param {DeepBookConfig} config Configuration object for DeepBook
|
|
35
|
+
*/
|
|
36
|
+
constructor(config) {
|
|
37
|
+
__privateAdd(this, _config);
|
|
38
|
+
/**
|
|
39
|
+
* @description Borrow base asset from the pool
|
|
40
|
+
* @param {string} poolKey The key to identify the pool
|
|
41
|
+
* @param {number} borrowAmount The amount to borrow
|
|
42
|
+
* @returns A function that takes a Transaction object
|
|
43
|
+
*/
|
|
44
|
+
this.borrowBaseAsset = (poolKey, borrowAmount) => (tx) => {
|
|
45
|
+
const pool = __privateGet(this, _config).getPool(poolKey);
|
|
46
|
+
const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
|
|
47
|
+
const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
|
|
48
|
+
const [baseCoinResult, flashLoan] = tx.moveCall({
|
|
49
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::pool::borrow_flashloan_base`,
|
|
50
|
+
arguments: [tx.object(pool.address), tx.pure.u64(borrowAmount * baseCoin.scalar)],
|
|
51
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
52
|
+
});
|
|
53
|
+
return [baseCoinResult, flashLoan];
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* @description Return base asset to the pool after a flash loan.
|
|
57
|
+
* @param {string} poolKey The key to identify the pool
|
|
58
|
+
* @param {number} borrowAmount The amount of the base asset to return
|
|
59
|
+
* @param {TransactionObjectArgument} baseCoinInput Coin object representing the base asset to be returned
|
|
60
|
+
* @param {TransactionObjectArgument} flashLoan FlashLoan object representing the loan to be settled
|
|
61
|
+
* @returns A function that takes a Transaction object
|
|
62
|
+
*/
|
|
63
|
+
this.returnBaseAsset = (poolKey, borrowAmount, baseCoinInput, flashLoan) => (tx) => {
|
|
64
|
+
const pool = __privateGet(this, _config).getPool(poolKey);
|
|
65
|
+
const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
|
|
66
|
+
const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
|
|
67
|
+
const borrowScalar = baseCoin.scalar;
|
|
68
|
+
const [baseCoinReturn] = tx.splitCoins(baseCoinInput, [
|
|
69
|
+
tx.pure.u64(borrowAmount * borrowScalar)
|
|
70
|
+
]);
|
|
71
|
+
tx.moveCall({
|
|
72
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::pool::return_flashloan_base`,
|
|
73
|
+
arguments: [tx.object(pool.address), baseCoinReturn, flashLoan],
|
|
74
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
75
|
+
});
|
|
76
|
+
return baseCoinInput;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* @description Borrow quote asset from the pool
|
|
80
|
+
* @param {string} poolKey The key to identify the pool
|
|
81
|
+
* @param {number} borrowAmount The amount to borrow
|
|
82
|
+
* @returns A function that takes a Transaction object
|
|
83
|
+
*/
|
|
84
|
+
this.borrowQuoteAsset = (poolKey, borrowAmount) => (tx) => {
|
|
85
|
+
const pool = __privateGet(this, _config).getPool(poolKey);
|
|
86
|
+
const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
|
|
87
|
+
const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
|
|
88
|
+
const [quoteCoinResult, flashLoan] = tx.moveCall({
|
|
89
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::pool::borrow_flashloan_quote`,
|
|
90
|
+
arguments: [tx.object(pool.address), tx.pure.u64(borrowAmount * quoteCoin.scalar)],
|
|
91
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
92
|
+
});
|
|
93
|
+
return [quoteCoinResult, flashLoan];
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* @description Return quote asset to the pool after a flash loan.
|
|
97
|
+
* @param {string} poolKey The key to identify the pool
|
|
98
|
+
* @param {number} borrowAmount The amount of the quote asset to return
|
|
99
|
+
* @param {TransactionObjectArgument} quoteCoinInput Coin object representing the quote asset to be returned
|
|
100
|
+
* @param {TransactionObjectArgument} flashLoan FlashLoan object representing the loan to be settled
|
|
101
|
+
* @returns A function that takes a Transaction object
|
|
102
|
+
*/
|
|
103
|
+
this.returnQuoteAsset = (poolKey, borrowAmount, quoteCoinInput, flashLoan) => (tx) => {
|
|
104
|
+
const pool = __privateGet(this, _config).getPool(poolKey);
|
|
105
|
+
const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
|
|
106
|
+
const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
|
|
107
|
+
const borrowScalar = quoteCoin.scalar;
|
|
108
|
+
const [quoteCoinReturn] = tx.splitCoins(quoteCoinInput, [
|
|
109
|
+
tx.pure.u64(borrowAmount * borrowScalar)
|
|
110
|
+
]);
|
|
111
|
+
tx.moveCall({
|
|
112
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::pool::return_flashloan_quote`,
|
|
113
|
+
arguments: [tx.object(pool.address), quoteCoinReturn, flashLoan],
|
|
114
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
115
|
+
});
|
|
116
|
+
return quoteCoinInput;
|
|
117
|
+
};
|
|
118
|
+
__privateSet(this, _config, config);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
_config = new WeakMap();
|
|
122
|
+
//# sourceMappingURL=flashLoans.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/transactions/flashLoans.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport type { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\n\n/**\n * FlashLoanContract class for managing flash loans.\n */\nexport class FlashLoanContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration object for DeepBook\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @description Borrow base asset from the pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} borrowAmount The amount to borrow\n\t * @returns A function that takes a Transaction object\n\t */\n\tborrowBaseAsset = (poolKey: string, borrowAmount: 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\tconst [baseCoinResult, flashLoan] = tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::borrow_flashloan_base`,\n\t\t\targuments: [tx.object(pool.address), tx.pure.u64(borrowAmount * baseCoin.scalar)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t\treturn [baseCoinResult, flashLoan] as const;\n\t};\n\n\t/**\n\t * @description Return base asset to the pool after a flash loan.\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} borrowAmount The amount of the base asset to return\n\t * @param {TransactionObjectArgument} baseCoinInput Coin object representing the base asset to be returned\n\t * @param {TransactionObjectArgument} flashLoan FlashLoan object representing the loan to be settled\n\t * @returns A function that takes a Transaction object\n\t */\n\treturnBaseAsset =\n\t\t(\n\t\t\tpoolKey: string,\n\t\t\tborrowAmount: number,\n\t\t\tbaseCoinInput: TransactionObjectArgument,\n\t\t\tflashLoan: TransactionObjectArgument,\n\t\t) =>\n\t\t(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\tconst borrowScalar = baseCoin.scalar;\n\n\t\t\tconst [baseCoinReturn] = tx.splitCoins(baseCoinInput, [\n\t\t\t\ttx.pure.u64(borrowAmount * borrowScalar),\n\t\t\t]);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::return_flashloan_base`,\n\t\t\t\targuments: [tx.object(pool.address), baseCoinReturn, flashLoan],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t});\n\n\t\t\treturn baseCoinInput;\n\t\t};\n\n\t/**\n\t * @description Borrow quote asset from the pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} borrowAmount The amount to borrow\n\t * @returns A function that takes a Transaction object\n\t */\n\tborrowQuoteAsset = (poolKey: string, borrowAmount: 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\tconst [quoteCoinResult, flashLoan] = tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::borrow_flashloan_quote`,\n\t\t\targuments: [tx.object(pool.address), tx.pure.u64(borrowAmount * quoteCoin.scalar)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t\treturn [quoteCoinResult, flashLoan] as const;\n\t};\n\n\t/**\n\t * @description Return quote asset to the pool after a flash loan.\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} borrowAmount The amount of the quote asset to return\n\t * @param {TransactionObjectArgument} quoteCoinInput Coin object representing the quote asset to be returned\n\t * @param {TransactionObjectArgument} flashLoan FlashLoan object representing the loan to be settled\n\t * @returns A function that takes a Transaction object\n\t */\n\treturnQuoteAsset =\n\t\t(\n\t\t\tpoolKey: string,\n\t\t\tborrowAmount: number,\n\t\t\tquoteCoinInput: TransactionObjectArgument,\n\t\t\tflashLoan: TransactionObjectArgument,\n\t\t) =>\n\t\t(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\tconst borrowScalar = quoteCoin.scalar;\n\n\t\t\tconst [quoteCoinReturn] = tx.splitCoins(quoteCoinInput, [\n\t\t\t\ttx.pure.u64(borrowAmount * borrowScalar),\n\t\t\t]);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::return_flashloan_quote`,\n\t\t\t\targuments: [tx.object(pool.address), quoteCoinReturn, flashLoan],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t});\n\n\t\t\treturn quoteCoinInput;\n\t\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,MAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA,EAM9B,YAAY,QAAwB;AALpC;AAeA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAkB,CAAC,SAAiB,iBAAyB,CAAC,OAAoB;AACjF,YAAM,OAAO,mBAAK,SAAQ,QAAQ,OAAO;AACzC,YAAM,WAAW,mBAAK,SAAQ,QAAQ,KAAK,QAAQ;AACnD,YAAM,YAAY,mBAAK,SAAQ,QAAQ,KAAK,SAAS;AACrD,YAAM,CAAC,gBAAgB,SAAS,IAAI,GAAG,SAAS;AAAA,QAC/C,QAAQ,GAAG,mBAAK,SAAQ,mBAAmB;AAAA,QAC3C,WAAW,CAAC,GAAG,OAAO,KAAK,OAAO,GAAG,GAAG,KAAK,IAAI,eAAe,SAAS,MAAM,CAAC;AAAA,Q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,SAAS;AAAA,IACnC;AAUA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BACC,CACC,SACA,cACA,gBACA,cAED,CAAC,OAAoB;AACpB,YAAM,OAAO,mBAAK,SAAQ,QAAQ,OAAO;AACzC,YAAM,WAAW,mBAAK,SAAQ,QAAQ,KAAK,QAAQ;AACnD,YAAM,YAAY,mBAAK,SAAQ,QAAQ,KAAK,SAAS;AACrD,YAAM,eAAe,UAAU;AAE/B,YAAM,CAAC,eAAe,IAAI,GAAG,WAAW,gBAAgB;AAAA,QACvD,GAAG,KAAK,IAAI,eAAe,YAAY;AAAA,MACxC,CAAC;AACD,SAAG,SAAS;AAAA,QACX,QAAQ,GAAG,mBAAK,SAAQ,mBAAmB;AAAA,QAC3C,WAAW,CAAC,GAAG,OAAO,KAAK,OAAO,GAAG,iBAAiB,SAAS;AAAA,QAC/D,eAAe,CAAC,SAAS,MAAM,UAAU,IAAI;AAAA,MAC9C,CAAC;AAED,aAAO;AAAA,IACR;AAvGA,uBAAK,SAAU;AAAA,EAChB;AAuGD;AA9GC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Transaction } from '@mysten/sui/transactions';
|
|
2
|
+
import type { ProposalParams } from '../types/index.js';
|
|
3
|
+
import type { DeepBookConfig } from '../utils/config.js';
|
|
4
|
+
/**
|
|
5
|
+
* GovernanceContract class for managing governance operations in DeepBook.
|
|
6
|
+
*/
|
|
7
|
+
export declare class GovernanceContract {
|
|
8
|
+
#private;
|
|
9
|
+
/**
|
|
10
|
+
* @param {DeepBookConfig} config Configuration for GovernanceContract
|
|
11
|
+
*/
|
|
12
|
+
constructor(config: DeepBookConfig);
|
|
13
|
+
/**
|
|
14
|
+
* @description Stake a specified amount in the pool
|
|
15
|
+
* @param {string} poolKey The key to identify the pool
|
|
16
|
+
* @param {string} balanceManagerKey The key to identify the BalanceManager
|
|
17
|
+
* @param {number} stakeAmount The amount to stake
|
|
18
|
+
* @returns A function that takes a Transaction object
|
|
19
|
+
*/
|
|
20
|
+
stake: (poolKey: string, balanceManagerKey: string, stakeAmount: number) => (tx: Transaction) => void;
|
|
21
|
+
/**
|
|
22
|
+
* @description Unstake from the pool
|
|
23
|
+
* @param {string} poolKey The key to identify the pool
|
|
24
|
+
* @param {string} balanceManagerKey The key to identify the BalanceManager
|
|
25
|
+
* @returns A function that takes a Transaction object
|
|
26
|
+
*/
|
|
27
|
+
unstake: (poolKey: string, balanceManagerKey: string) => (tx: Transaction) => void;
|
|
28
|
+
/**
|
|
29
|
+
* @description Submit a governance proposal
|
|
30
|
+
* @param {ProposalParams} params Parameters for the proposal
|
|
31
|
+
* @returns A function that takes a Transaction object
|
|
32
|
+
*/
|
|
33
|
+
submitProposal: (params: ProposalParams) => (tx: Transaction) => void;
|
|
34
|
+
/**
|
|
35
|
+
* @description Vote on a proposal
|
|
36
|
+
* @param {string} poolKey The key to identify the pool
|
|
37
|
+
* @param {string} balanceManagerKey The key to identify the BalanceManager
|
|
38
|
+
* @param {string} proposal_id The ID of the proposal to vote on
|
|
39
|
+
* @returns A function that takes a Transaction object
|
|
40
|
+
*/
|
|
41
|
+
vote: (poolKey: string, balanceManagerKey: string, proposal_id: string) => (tx: Transaction) => void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __typeError = (msg) => {
|
|
7
|
+
throw TypeError(msg);
|
|
8
|
+
};
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
23
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
24
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
25
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
26
|
+
var governance_exports = {};
|
|
27
|
+
__export(governance_exports, {
|
|
28
|
+
GovernanceContract: () => GovernanceContract
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(governance_exports);
|
|
31
|
+
var import_config = require("../utils/config.js");
|
|
32
|
+
var _config;
|
|
33
|
+
class GovernanceContract {
|
|
34
|
+
/**
|
|
35
|
+
* @param {DeepBookConfig} config Configuration for GovernanceContract
|
|
36
|
+
*/
|
|
37
|
+
constructor(config) {
|
|
38
|
+
__privateAdd(this, _config);
|
|
39
|
+
/**
|
|
40
|
+
* @description Stake a specified amount in the pool
|
|
41
|
+
* @param {string} poolKey The key to identify the pool
|
|
42
|
+
* @param {string} balanceManagerKey The key to identify the BalanceManager
|
|
43
|
+
* @param {number} stakeAmount The amount to stake
|
|
44
|
+
* @returns A function that takes a Transaction object
|
|
45
|
+
*/
|
|
46
|
+
this.stake = (poolKey, balanceManagerKey, stakeAmount) => (tx) => {
|
|
47
|
+
const pool = __privateGet(this, _config).getPool(poolKey);
|
|
48
|
+
const balanceManager = __privateGet(this, _config).getBalanceManager(balanceManagerKey);
|
|
49
|
+
const tradeProof = tx.add(__privateGet(this, _config).balanceManager.generateProof(balanceManagerKey));
|
|
50
|
+
const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
|
|
51
|
+
const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
|
|
52
|
+
tx.moveCall({
|
|
53
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::pool::stake`,
|
|
54
|
+
arguments: [
|
|
55
|
+
tx.object(pool.address),
|
|
56
|
+
tx.object(balanceManager.address),
|
|
57
|
+
tradeProof,
|
|
58
|
+
tx.pure.u64(stakeAmount * import_config.DEEP_SCALAR)
|
|
59
|
+
],
|
|
60
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* @description Unstake from the pool
|
|
65
|
+
* @param {string} poolKey The key to identify the pool
|
|
66
|
+
* @param {string} balanceManagerKey The key to identify the BalanceManager
|
|
67
|
+
* @returns A function that takes a Transaction object
|
|
68
|
+
*/
|
|
69
|
+
this.unstake = (poolKey, balanceManagerKey) => (tx) => {
|
|
70
|
+
const pool = __privateGet(this, _config).getPool(poolKey);
|
|
71
|
+
const balanceManager = __privateGet(this, _config).getBalanceManager(balanceManagerKey);
|
|
72
|
+
const tradeProof = tx.add(__privateGet(this, _config).balanceManager.generateProof(balanceManagerKey));
|
|
73
|
+
const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
|
|
74
|
+
const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
|
|
75
|
+
tx.moveCall({
|
|
76
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::pool::unstake`,
|
|
77
|
+
arguments: [tx.object(pool.address), tx.object(balanceManager.address), tradeProof],
|
|
78
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* @description Submit a governance proposal
|
|
83
|
+
* @param {ProposalParams} params Parameters for the proposal
|
|
84
|
+
* @returns A function that takes a Transaction object
|
|
85
|
+
*/
|
|
86
|
+
this.submitProposal = (params) => (tx) => {
|
|
87
|
+
const { poolKey, balanceManagerKey, takerFee, makerFee, stakeRequired } = params;
|
|
88
|
+
const pool = __privateGet(this, _config).getPool(poolKey);
|
|
89
|
+
const balanceManager = __privateGet(this, _config).getBalanceManager(balanceManagerKey);
|
|
90
|
+
const tradeProof = tx.add(__privateGet(this, _config).balanceManager.generateProof(balanceManagerKey));
|
|
91
|
+
const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
|
|
92
|
+
const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
|
|
93
|
+
tx.moveCall({
|
|
94
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::pool::submit_proposal`,
|
|
95
|
+
arguments: [
|
|
96
|
+
tx.object(pool.address),
|
|
97
|
+
tx.object(balanceManager.address),
|
|
98
|
+
tradeProof,
|
|
99
|
+
tx.pure.u64(takerFee * import_config.FLOAT_SCALAR),
|
|
100
|
+
tx.pure.u64(makerFee * import_config.FLOAT_SCALAR),
|
|
101
|
+
tx.pure.u64(stakeRequired * import_config.DEEP_SCALAR)
|
|
102
|
+
],
|
|
103
|
+
typeArguments: [baseCoin.type, quoteCoin.type]
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* @description Vote on a proposal
|
|
108
|
+
* @param {string} poolKey The key to identify the pool
|
|
109
|
+
* @param {string} balanceManagerKey The key to identify the BalanceManager
|
|
110
|
+
* @param {string} proposal_id The ID of the proposal to vote on
|
|
111
|
+
* @returns A function that takes a Transaction object
|
|
112
|
+
*/
|
|
113
|
+
this.vote = (poolKey, balanceManagerKey, proposal_id) => (tx) => {
|
|
114
|
+
const pool = __privateGet(this, _config).getPool(poolKey);
|
|
115
|
+
const balanceManager = __privateGet(this, _config).getBalanceManager(balanceManagerKey);
|
|
116
|
+
const tradeProof = tx.add(__privateGet(this, _config).balanceManager.generateProof(balanceManagerKey));
|
|
117
|
+
tx.moveCall({
|
|
118
|
+
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::pool::vote`,
|
|
119
|
+
arguments: [
|
|
120
|
+
tx.object(pool.address),
|
|
121
|
+
tx.object(balanceManager.address),
|
|
122
|
+
tradeProof,
|
|
123
|
+
tx.pure.id(proposal_id)
|
|
124
|
+
]
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
__privateSet(this, _config, config);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
_config = new WeakMap();
|
|
131
|
+
//# sourceMappingURL=governance.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/transactions/governance.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport type { ProposalParams } from '../types/index.js';\nimport type { DeepBookConfig } from '../utils/config.js';\nimport { DEEP_SCALAR, FLOAT_SCALAR } from '../utils/config.js';\n\n/**\n * GovernanceContract class for managing governance operations in DeepBook.\n */\nexport class GovernanceContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for GovernanceContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @description Stake a specified amount in the pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} balanceManagerKey The key to identify the BalanceManager\n\t * @param {number} stakeAmount The amount to stake\n\t * @returns A function that takes a Transaction object\n\t */\n\tstake =\n\t\t(poolKey: string, balanceManagerKey: string, stakeAmount: number) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst balanceManager = this.#config.getBalanceManager(balanceManagerKey);\n\t\t\tconst tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::stake`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(pool.address),\n\t\t\t\t\ttx.object(balanceManager.address),\n\t\t\t\t\ttradeProof,\n\t\t\t\t\ttx.pure.u64(stakeAmount * DEEP_SCALAR),\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 Unstake from the pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} balanceManagerKey The key to identify the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tunstake = (poolKey: string, balanceManagerKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst balanceManager = this.#config.getBalanceManager(balanceManagerKey);\n\t\tconst tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::unstake`,\n\t\t\targuments: [tx.object(pool.address), tx.object(balanceManager.address), tradeProof],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Submit a governance proposal\n\t * @param {ProposalParams} params Parameters for the proposal\n\t * @returns A function that takes a Transaction object\n\t */\n\tsubmitProposal = (params: ProposalParams) => (tx: Transaction) => {\n\t\tconst { poolKey, balanceManagerKey, takerFee, makerFee, stakeRequired } = params;\n\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst balanceManager = this.#config.getBalanceManager(balanceManagerKey);\n\t\tconst tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::submit_proposal`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(balanceManager.address),\n\t\t\t\ttradeProof,\n\t\t\t\ttx.pure.u64(takerFee * FLOAT_SCALAR),\n\t\t\t\ttx.pure.u64(makerFee * FLOAT_SCALAR),\n\t\t\t\ttx.pure.u64(stakeRequired * DEEP_SCALAR),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Vote on a proposal\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} balanceManagerKey The key to identify the BalanceManager\n\t * @param {string} proposal_id The ID of the proposal to vote on\n\t * @returns A function that takes a Transaction object\n\t */\n\tvote = (poolKey: string, balanceManagerKey: string, proposal_id: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst balanceManager = this.#config.getBalanceManager(balanceManagerKey);\n\t\tconst tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));\n\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::vote`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(balanceManager.address),\n\t\t\t\ttradeProof,\n\t\t\t\ttx.pure.id(proposal_id),\n\t\t\t],\n\t\t});\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,oBAA0C;AAN1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