@typus/typus-sdk 1.4.18 → 1.4.20
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/dist/config-mainnet.json +3 -3
- package/dist/src/auto-bid/index.d.ts +1 -0
- package/dist/src/auto-bid/index.js +1 -0
- package/dist/src/auto-bid/token-user-entry.d.ts +9 -0
- package/dist/src/auto-bid/token-user-entry.js +126 -0
- package/dist/src/typus/airdrop/authority-entry.d.ts +14 -2
- package/dist/src/typus/airdrop/authority-entry.js +27 -32
- package/dist/src/typus/airdrop/user-entry.d.ts +2 -5
- package/dist/src/typus/airdrop/user-entry.js +8 -8
- package/dist/src/typus/airdrop/view-function.d.ts +2 -5
- package/dist/src/typus/airdrop/view-function.js +5 -5
- package/dist/src/typus/leaderboard/authority-entry.d.ts +10 -2
- package/dist/src/typus/leaderboard/authority-entry.js +12 -13
- package/dist/src/typus/leaderboard/view-function.d.ts +2 -5
- package/dist/src/typus/leaderboard/view-function.js +6 -6
- package/dist/src/typus/tails-staking/authority-entry.d.ts +12 -55
- package/dist/src/typus/tails-staking/authority-entry.js +73 -97
- package/dist/src/typus/tails-staking/user-entry.d.ts +14 -44
- package/dist/src/typus/tails-staking/user-entry.js +123 -123
- package/dist/src/typus/tails-staking/view-function.d.ts +3 -11
- package/dist/src/typus/tails-staking/view-function.js +10 -10
- package/dist/src/typus/user/view-function.d.ts +2 -5
- package/dist/src/typus/user/view-function.js +5 -5
- package/dist/src/typus-dov-single-v2/authority-entry.d.ts +26 -18
- package/dist/src/typus-dov-single-v2/authority-entry.js +23 -114
- package/dist/src/typus-dov-single-v2/function/bidding.js +4 -5
- package/dist/src/typus-dov-single-v2/token-user-entry.d.ts +11 -84
- package/dist/src/typus-dov-single-v2/token-user-entry.js +191 -316
- package/dist/src/typus-dov-single-v2/user-entry.d.ts +11 -69
- package/dist/src/typus-dov-single-v2/user-entry.js +183 -194
- package/dist/src/typus-dov-single-v2/view-function.d.ts +20 -6
- package/dist/src/typus-dov-single-v2/view-function.js +37 -43
- package/dist/src/typus-perp/user/orderWithBidReceipt.js +1 -5
- package/dist/src/typus-safu/index.d.ts +2 -1
- package/dist/src/typus-safu/index.js +2 -1
- package/dist/src/typus-safu/user-history.d.ts +12 -0
- package/dist/src/typus-safu/user-history.js +312 -0
- package/dist/src/utils/typusConfig.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,417 +1,292 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
-
if (!m) return o;
|
|
5
|
-
var i = m.call(o), r, ar = [], e;
|
|
6
|
-
try {
|
|
7
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
-
}
|
|
9
|
-
catch (error) { e = { error: error }; }
|
|
10
|
-
finally {
|
|
11
|
-
try {
|
|
12
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
-
}
|
|
14
|
-
finally { if (e) throw e.error; }
|
|
15
|
-
}
|
|
16
|
-
return ar;
|
|
17
|
-
};
|
|
18
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
3
|
+
exports.getTokenRaiseFundTx = getTokenRaiseFundTx;
|
|
4
|
+
exports.getTokenReduceFundTx = getTokenReduceFundTx;
|
|
5
|
+
exports.getTokenNewBidTx = getTokenNewBidTx;
|
|
6
|
+
exports.getTokenExerciseTx = getTokenExerciseTx;
|
|
7
|
+
exports.getTokenRebateTx = getTokenRebateTx;
|
|
8
|
+
exports.getTokenCompoundWithRedeemTx = getTokenCompoundWithRedeemTx;
|
|
9
|
+
var constants_1 = require("src/constants");
|
|
10
|
+
function getTokenRaiseFundTx(config, tx, input) {
|
|
11
|
+
var typusTokenRegistry = "";
|
|
12
|
+
switch (input.typusTokenType.split("::")[1]) {
|
|
13
|
+
case "mfud":
|
|
14
|
+
typusTokenRegistry = config.registry.token.mfud;
|
|
15
|
+
break;
|
|
16
|
+
default:
|
|
17
|
+
console.log("No such token exists!");
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
33
20
|
var typusTokenBalance = input.raiseCoins.length > 0
|
|
34
|
-
?
|
|
21
|
+
? tx.moveCall({
|
|
35
22
|
target: "0x2::coin::into_balance",
|
|
36
23
|
typeArguments: [input.typusTokenType],
|
|
37
24
|
arguments: [
|
|
38
|
-
|
|
39
|
-
target: "".concat(
|
|
25
|
+
tx.object(tx.moveCall({
|
|
26
|
+
target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::mint"),
|
|
40
27
|
arguments: [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
28
|
+
tx.object(typusTokenRegistry),
|
|
29
|
+
tx.makeMoveVec({ objects: input.raiseCoins }),
|
|
30
|
+
tx.pure(input.raiseAmount),
|
|
44
31
|
],
|
|
45
32
|
})),
|
|
46
33
|
],
|
|
47
34
|
})
|
|
48
|
-
:
|
|
35
|
+
: tx.moveCall({
|
|
49
36
|
target: "0x2::balance::zero",
|
|
50
37
|
typeArguments: [input.typusTokenType],
|
|
51
38
|
arguments: [],
|
|
52
39
|
});
|
|
53
|
-
var result =
|
|
54
|
-
target: "".concat(
|
|
40
|
+
var result = tx.moveCall({
|
|
41
|
+
target: "".concat(config.package.dovSingle, "::tds_user_entry::public_raise_fund"),
|
|
55
42
|
typeArguments: input.typeArguments,
|
|
56
43
|
arguments: [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
type: "".concat(
|
|
64
|
-
objects: input.receipts.map(function (receipt) { return
|
|
44
|
+
tx.object(config.version.typus),
|
|
45
|
+
tx.object(config.registry.typus.user),
|
|
46
|
+
tx.object(config.registry.typus.leaderboard),
|
|
47
|
+
tx.object(config.registry.dov.dovSingle),
|
|
48
|
+
tx.pure(input.index),
|
|
49
|
+
tx.makeMoveVec({
|
|
50
|
+
type: "".concat(config.packageOrigin.framework, "::vault::TypusDepositReceipt"),
|
|
51
|
+
objects: input.receipts.map(function (receipt) { return tx.object(receipt); }),
|
|
65
52
|
}),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
53
|
+
tx.object(typusTokenBalance),
|
|
54
|
+
tx.pure(input.raiseFromPremium),
|
|
55
|
+
tx.pure(input.raiseFromInactive),
|
|
56
|
+
tx.object(constants_1.CLOCK),
|
|
70
57
|
],
|
|
71
58
|
});
|
|
72
|
-
|
|
73
|
-
return
|
|
59
|
+
tx.transferObjects([tx.object(result[0])], input.user);
|
|
60
|
+
return tx;
|
|
74
61
|
}
|
|
75
|
-
function
|
|
76
|
-
var
|
|
77
|
-
|
|
62
|
+
function getTokenReduceFundTx(config, tx, input) {
|
|
63
|
+
var typusTokenRegistry = "";
|
|
64
|
+
switch (input.typusTokenType.split("::")[1]) {
|
|
65
|
+
case "mfud":
|
|
66
|
+
typusTokenRegistry = config.registry.token.mfud;
|
|
67
|
+
break;
|
|
68
|
+
default:
|
|
69
|
+
console.log("No such token exists!");
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
var result = tx.moveCall({
|
|
73
|
+
target: "".concat(config.package.dovSingle, "::tds_user_entry::public_reduce_fund"),
|
|
78
74
|
typeArguments: input.typeArguments,
|
|
79
75
|
arguments: [
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
type: "".concat(
|
|
87
|
-
objects: input.receipts.map(function (receipt) { return
|
|
76
|
+
tx.object(config.version.typus),
|
|
77
|
+
tx.object(config.registry.typus.user),
|
|
78
|
+
tx.object(config.registry.typus.leaderboard),
|
|
79
|
+
tx.object(config.registry.dov.dovSingle),
|
|
80
|
+
tx.pure(input.index),
|
|
81
|
+
tx.makeMoveVec({
|
|
82
|
+
type: "".concat(config.packageOrigin.framework, "::vault::TypusDepositReceipt"),
|
|
83
|
+
objects: input.receipts.map(function (receipt) { return tx.object(receipt); }),
|
|
88
84
|
}),
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
85
|
+
tx.pure(input.reduceFromWarmup),
|
|
86
|
+
tx.pure(input.reduceFromActive),
|
|
87
|
+
tx.pure(input.reduceFromPremium),
|
|
88
|
+
tx.pure(input.reduceFromInactive),
|
|
89
|
+
tx.pure(input.reduceFromIncentive),
|
|
90
|
+
tx.object(constants_1.CLOCK),
|
|
95
91
|
],
|
|
96
92
|
});
|
|
97
|
-
|
|
98
|
-
target: "".concat(
|
|
99
|
-
arguments: [
|
|
93
|
+
tx.moveCall({
|
|
94
|
+
target: "".concat(config.package.framework, "::vault::transfer_deposit_receipt"),
|
|
95
|
+
arguments: [tx.object(result[0]), tx.pure(input.user)],
|
|
100
96
|
});
|
|
101
97
|
if (input.typeArguments[0] == input.typusTokenType) {
|
|
102
|
-
var typusToken =
|
|
98
|
+
var typusToken = tx.moveCall({
|
|
103
99
|
target: "0x2::coin::from_balance",
|
|
104
100
|
typeArguments: [input.typeArguments[0]],
|
|
105
|
-
arguments: [
|
|
101
|
+
arguments: [tx.object(result[1])],
|
|
106
102
|
});
|
|
107
|
-
var token =
|
|
108
|
-
target: "".concat(
|
|
109
|
-
arguments: [
|
|
103
|
+
var token = tx.moveCall({
|
|
104
|
+
target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::burn"),
|
|
105
|
+
arguments: [tx.object(typusTokenRegistry), tx.object(typusToken)],
|
|
110
106
|
});
|
|
111
|
-
|
|
107
|
+
tx.transferObjects([tx.object(token)], input.user);
|
|
112
108
|
}
|
|
113
109
|
else {
|
|
114
|
-
|
|
115
|
-
target: "".concat(
|
|
110
|
+
tx.moveCall({
|
|
111
|
+
target: "".concat(config.package.framework, "::utils::transfer_balance"),
|
|
116
112
|
typeArguments: [input.typeArguments[0]],
|
|
117
|
-
arguments: [
|
|
113
|
+
arguments: [tx.object(result[1]), tx.pure(input.user)],
|
|
118
114
|
});
|
|
119
115
|
}
|
|
120
116
|
if (input.typeArguments[1] == input.typusTokenType) {
|
|
121
|
-
var typusToken =
|
|
117
|
+
var typusToken = tx.moveCall({
|
|
122
118
|
target: "0x2::coin::from_balance",
|
|
123
119
|
typeArguments: [input.typeArguments[1]],
|
|
124
|
-
arguments: [
|
|
120
|
+
arguments: [tx.object(result[2])],
|
|
125
121
|
});
|
|
126
|
-
var token =
|
|
127
|
-
target: "".concat(
|
|
128
|
-
arguments: [
|
|
122
|
+
var token = tx.moveCall({
|
|
123
|
+
target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::burn"),
|
|
124
|
+
arguments: [tx.object(typusTokenRegistry), tx.object(typusToken)],
|
|
129
125
|
});
|
|
130
|
-
|
|
126
|
+
tx.transferObjects([tx.object(token)], input.user);
|
|
131
127
|
}
|
|
132
128
|
else {
|
|
133
|
-
|
|
134
|
-
target: "".concat(
|
|
129
|
+
tx.moveCall({
|
|
130
|
+
target: "".concat(config.package.framework, "::utils::transfer_balance"),
|
|
135
131
|
typeArguments: [input.typeArguments[1]],
|
|
136
|
-
arguments: [
|
|
132
|
+
arguments: [tx.object(result[2]), tx.pure(input.user)],
|
|
137
133
|
});
|
|
138
134
|
}
|
|
139
135
|
if (input.typeArguments[2] == input.typusTokenType) {
|
|
140
|
-
var typusToken =
|
|
136
|
+
var typusToken = tx.moveCall({
|
|
141
137
|
target: "0x2::coin::from_balance",
|
|
142
138
|
typeArguments: [input.typeArguments[2]],
|
|
143
|
-
arguments: [
|
|
139
|
+
arguments: [tx.object(result[3])],
|
|
144
140
|
});
|
|
145
|
-
var token =
|
|
146
|
-
target: "".concat(
|
|
147
|
-
arguments: [
|
|
141
|
+
var token = tx.moveCall({
|
|
142
|
+
target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::burn"),
|
|
143
|
+
arguments: [tx.object(typusTokenRegistry), tx.object(typusToken)],
|
|
148
144
|
});
|
|
149
|
-
|
|
145
|
+
tx.transferObjects([tx.object(token)], input.user);
|
|
150
146
|
}
|
|
151
147
|
else {
|
|
152
|
-
|
|
153
|
-
target: "".concat(
|
|
148
|
+
tx.moveCall({
|
|
149
|
+
target: "".concat(config.package.framework, "::utils::transfer_balance"),
|
|
154
150
|
typeArguments: [input.typeArguments[2]],
|
|
155
|
-
arguments: [
|
|
151
|
+
arguments: [tx.object(result[3]), tx.pure(input.user)],
|
|
156
152
|
});
|
|
157
153
|
}
|
|
158
|
-
return
|
|
159
|
-
}
|
|
160
|
-
function getMfudDepositTx(input) {
|
|
161
|
-
var mfud = input.tx.moveCall({
|
|
162
|
-
target: "".concat(input.mfudPackageId, "::mfud::mint"),
|
|
163
|
-
arguments: [
|
|
164
|
-
input.tx.object(input.mfudRegistry),
|
|
165
|
-
input.tx.makeMoveVec({ objects: input.coins.map(function (id) { return input.tx.object(id); }) }),
|
|
166
|
-
input.tx.pure(input.mfudAmount),
|
|
167
|
-
],
|
|
168
|
-
});
|
|
169
|
-
var result = input.tx.moveCall({
|
|
170
|
-
target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::public_deposit"),
|
|
171
|
-
typeArguments: input.typeArguments,
|
|
172
|
-
arguments: [
|
|
173
|
-
input.tx.object(input.typusEcosystemVersion),
|
|
174
|
-
input.tx.object(input.typusUserRegistry),
|
|
175
|
-
input.tx.object(input.typusLeaderboardRegistry),
|
|
176
|
-
input.tx.object(input.typusDovSingleRegistry),
|
|
177
|
-
input.tx.pure(input.index),
|
|
178
|
-
input.tx.makeMoveVec({ objects: [mfud] }),
|
|
179
|
-
input.tx.pure(input.mfudAmount),
|
|
180
|
-
input.tx.makeMoveVec({
|
|
181
|
-
type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
182
|
-
objects: input.receipts.map(function (id) { return input.tx.object(id); }),
|
|
183
|
-
}),
|
|
184
|
-
input.tx.object(constants_1.CLOCK),
|
|
185
|
-
],
|
|
186
|
-
});
|
|
187
|
-
input.tx.moveCall({
|
|
188
|
-
target: "0x1::vector::destroy_empty",
|
|
189
|
-
typeArguments: ["0x2::coin::Coin<" + input.typeArguments[0] + ">"],
|
|
190
|
-
arguments: [input.tx.object(result[0])],
|
|
191
|
-
});
|
|
192
|
-
input.tx.transferObjects([input.tx.object(result[1])], input.user);
|
|
193
|
-
return input.tx;
|
|
154
|
+
return tx;
|
|
194
155
|
}
|
|
195
|
-
function
|
|
196
|
-
var
|
|
197
|
-
|
|
156
|
+
function getTokenNewBidTx(config, tx, input) {
|
|
157
|
+
var typusTokenRegistry = "";
|
|
158
|
+
switch (input.typusTokenType.split("::")[1]) {
|
|
159
|
+
case "mfud":
|
|
160
|
+
typusTokenRegistry = config.registry.token.mfud;
|
|
161
|
+
break;
|
|
162
|
+
default:
|
|
163
|
+
console.log("No such token exists!");
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
var mfud = tx.moveCall({
|
|
167
|
+
target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::mint"),
|
|
198
168
|
arguments: [
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
169
|
+
tx.object(typusTokenRegistry),
|
|
170
|
+
tx.makeMoveVec({ objects: input.coins.map(function (id) { return tx.object(id); }) }),
|
|
171
|
+
tx.pure(input.premium_required),
|
|
202
172
|
],
|
|
203
173
|
});
|
|
204
|
-
var result =
|
|
205
|
-
target: "".concat(
|
|
174
|
+
var result = tx.moveCall({
|
|
175
|
+
target: "".concat(config.package.dovSingle, "::tds_user_entry::public_bid"),
|
|
206
176
|
typeArguments: input.typeArguments,
|
|
207
177
|
arguments: [
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
178
|
+
tx.object(config.version.typus),
|
|
179
|
+
tx.object(config.registry.typus.user),
|
|
180
|
+
tx.object(config.registry.typus.tgld),
|
|
181
|
+
tx.object(config.registry.typus.leaderboard),
|
|
182
|
+
tx.object(config.registry.dov.dovSingle),
|
|
183
|
+
tx.pure(input.index),
|
|
184
|
+
tx.makeMoveVec({ objects: [mfud] }),
|
|
185
|
+
tx.pure(input.size),
|
|
186
|
+
tx.pure("0x6"),
|
|
217
187
|
],
|
|
218
188
|
});
|
|
219
|
-
|
|
220
|
-
var fud_coin =
|
|
221
|
-
target: "".concat(input.
|
|
222
|
-
arguments: [
|
|
189
|
+
tx.transferObjects([tx.object(result[0])], input.user);
|
|
190
|
+
var fud_coin = tx.moveCall({
|
|
191
|
+
target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::burn"),
|
|
192
|
+
arguments: [tx.object(typusTokenRegistry), tx.object(result[1])],
|
|
223
193
|
});
|
|
224
|
-
|
|
225
|
-
return
|
|
194
|
+
tx.transferObjects([tx.object(fud_coin)], input.user);
|
|
195
|
+
return tx;
|
|
226
196
|
}
|
|
227
|
-
function
|
|
228
|
-
var
|
|
229
|
-
|
|
197
|
+
function getTokenExerciseTx(config, tx, input) {
|
|
198
|
+
var typusTokenRegistry = "";
|
|
199
|
+
switch (input.typusTokenType.split("::")[1]) {
|
|
200
|
+
case "mfud":
|
|
201
|
+
typusTokenRegistry = config.registry.token.mfud;
|
|
202
|
+
break;
|
|
203
|
+
default:
|
|
204
|
+
console.log("No such token exists!");
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
var result = tx.moveCall({
|
|
208
|
+
target: "".concat(config.package.dovSingle, "::tds_user_entry::exercise"),
|
|
230
209
|
typeArguments: input.typeArguments,
|
|
231
210
|
arguments: [
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
type: "".concat(
|
|
236
|
-
objects: input.receipts.map(function (receipt) { return
|
|
211
|
+
tx.object(config.registry.dov.dovSingle),
|
|
212
|
+
tx.pure(input.index),
|
|
213
|
+
tx.makeMoveVec({
|
|
214
|
+
type: "".concat(config.packageOrigin.framework, "::vault::TypusBidReceipt"),
|
|
215
|
+
objects: input.receipts.map(function (receipt) { return tx.object(receipt); }),
|
|
237
216
|
}),
|
|
238
217
|
],
|
|
239
218
|
});
|
|
240
|
-
var mfud_coin =
|
|
219
|
+
var mfud_coin = tx.moveCall({
|
|
241
220
|
target: "0x2::coin::from_balance",
|
|
242
221
|
typeArguments: [input.typeArguments[0]],
|
|
243
|
-
arguments: [
|
|
222
|
+
arguments: [tx.object(result[0])],
|
|
244
223
|
});
|
|
245
|
-
var fud_coin =
|
|
246
|
-
target: "".concat(input.
|
|
247
|
-
arguments: [
|
|
224
|
+
var fud_coin = tx.moveCall({
|
|
225
|
+
target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::burn"),
|
|
226
|
+
arguments: [tx.object(typusTokenRegistry), tx.object(mfud_coin)],
|
|
248
227
|
});
|
|
249
|
-
|
|
250
|
-
return
|
|
228
|
+
tx.transferObjects([tx.object(fud_coin)], input.user);
|
|
229
|
+
return tx;
|
|
251
230
|
}
|
|
252
|
-
function
|
|
253
|
-
var
|
|
254
|
-
|
|
231
|
+
function getTokenRebateTx(config, tx, input) {
|
|
232
|
+
var typusTokenRegistry = "";
|
|
233
|
+
switch (input.typusTokenType.split("::")[1]) {
|
|
234
|
+
case "mfud":
|
|
235
|
+
typusTokenRegistry = config.registry.token.mfud;
|
|
236
|
+
break;
|
|
237
|
+
default:
|
|
238
|
+
console.log("No such token exists!");
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
var result = tx.moveCall({
|
|
242
|
+
target: "".concat(config.package.dovSingle, "::tds_user_entry::rebate"),
|
|
255
243
|
typeArguments: [input.typeArgument],
|
|
256
|
-
arguments: [
|
|
244
|
+
arguments: [tx.object(config.registry.dov.dovSingle)],
|
|
257
245
|
});
|
|
258
|
-
var balance =
|
|
246
|
+
var balance = tx.moveCall({
|
|
259
247
|
target: "0x1::option::destroy_some",
|
|
260
248
|
typeArguments: ["0x2::balance::Balance<".concat(input.typeArgument, ">")],
|
|
261
|
-
arguments: [
|
|
249
|
+
arguments: [tx.object(result[0])],
|
|
262
250
|
});
|
|
263
|
-
var mfud_coin =
|
|
251
|
+
var mfud_coin = tx.moveCall({
|
|
264
252
|
target: "0x2::coin::from_balance",
|
|
265
253
|
typeArguments: [input.typeArgument],
|
|
266
|
-
arguments: [
|
|
267
|
-
});
|
|
268
|
-
var fud_coin = input.tx.moveCall({
|
|
269
|
-
target: "".concat(input.mfudPackageId, "::mfud::burn"),
|
|
270
|
-
arguments: [input.tx.object(input.mfudRegistry), input.tx.object(mfud_coin)],
|
|
254
|
+
arguments: [tx.object(balance)],
|
|
271
255
|
});
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
function getMfudNewStrategyTx(gasBudget, packageId, typeArguments, // D_TOKEN, B_TOKEN
|
|
276
|
-
registry, strategy_pool, vault_index, signal_index, coins, mfudPackageId, mfudRegistry, mfudAmount, size, price_percentage, max_times, target_rounds) {
|
|
277
|
-
var tx = new transactions_1.TransactionBlock();
|
|
278
|
-
var input_coin = tx.moveCall({
|
|
279
|
-
target: "".concat(mfudPackageId, "::mfud::mint"),
|
|
280
|
-
arguments: [tx.object(mfudRegistry), tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }), tx.pure(mfudAmount)],
|
|
256
|
+
var fud_coin = tx.moveCall({
|
|
257
|
+
target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::burn"),
|
|
258
|
+
arguments: [tx.object(typusTokenRegistry), tx.object(mfud_coin)],
|
|
281
259
|
});
|
|
282
|
-
tx.
|
|
283
|
-
target: "".concat(packageId, "::auto_bid::new_strategy"),
|
|
284
|
-
typeArguments: typeArguments,
|
|
285
|
-
arguments: [
|
|
286
|
-
tx.object(registry),
|
|
287
|
-
tx.object(strategy_pool),
|
|
288
|
-
tx.pure(vault_index),
|
|
289
|
-
tx.pure(signal_index),
|
|
290
|
-
tx.pure(size),
|
|
291
|
-
tx.pure(price_percentage),
|
|
292
|
-
tx.pure(max_times),
|
|
293
|
-
tx.pure(target_rounds),
|
|
294
|
-
input_coin,
|
|
295
|
-
],
|
|
296
|
-
});
|
|
297
|
-
tx.setGasBudget(gasBudget);
|
|
298
|
-
return tx;
|
|
299
|
-
}
|
|
300
|
-
function getMfudUpdateStrategyTx(gasBudget, packageId, typeArguments, // D_TOKEN, B_TOKEN
|
|
301
|
-
registry, strategy_pool, vault_index, signal_index, strategy_index, coins, mfudPackageId, mfudRegistry, mfudAmount, size, price_percentage, max_times, target_rounds) {
|
|
302
|
-
var tx = new transactions_1.TransactionBlock();
|
|
303
|
-
var _a = __read(tx.moveCall({
|
|
304
|
-
target: "".concat(mfudPackageId, "::mfud::mint"),
|
|
305
|
-
arguments: [tx.object(mfudRegistry), tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }), tx.pure(mfudAmount)],
|
|
306
|
-
}), 1), input_coin = _a[0];
|
|
307
|
-
tx.moveCall({
|
|
308
|
-
target: "".concat(packageId, "::auto_bid::update_strategy"),
|
|
309
|
-
typeArguments: typeArguments,
|
|
310
|
-
arguments: [
|
|
311
|
-
tx.object(registry),
|
|
312
|
-
tx.object(strategy_pool),
|
|
313
|
-
tx.pure(vault_index),
|
|
314
|
-
tx.pure(signal_index),
|
|
315
|
-
tx.pure(strategy_index),
|
|
316
|
-
tx.pure(size ? [size] : []),
|
|
317
|
-
tx.pure(price_percentage ? [price_percentage] : []),
|
|
318
|
-
tx.pure(max_times ? [max_times] : []),
|
|
319
|
-
tx.pure(target_rounds),
|
|
320
|
-
tx.makeMoveVec({ objects: [input_coin] }),
|
|
321
|
-
],
|
|
322
|
-
});
|
|
323
|
-
tx.setGasBudget(gasBudget);
|
|
324
|
-
return tx;
|
|
325
|
-
}
|
|
326
|
-
function getMfudCloseStrategyTx(gasBudget, packageId, typeArguments, // D_TOKEN, B_TOKEN
|
|
327
|
-
registry, strategy_pool, vault_index, signal_index, strategy_index, mfudPackageId, mfudRegistry, sender) {
|
|
328
|
-
var tx = new transactions_1.TransactionBlock();
|
|
329
|
-
var _a = __read(tx.moveCall({
|
|
330
|
-
target: "".concat(packageId, "::auto_bid::close_strategy"),
|
|
331
|
-
typeArguments: typeArguments,
|
|
332
|
-
arguments: [tx.object(registry), tx.object(strategy_pool), tx.pure(vault_index), tx.pure(signal_index), tx.pure(strategy_index)],
|
|
333
|
-
}), 2), d_token = _a[0], b_token = _a[1];
|
|
334
|
-
if (typeArguments[0].endsWith("MFUD")) {
|
|
335
|
-
var fud_coin = tx.moveCall({
|
|
336
|
-
target: "".concat(mfudPackageId, "::mfud::burn"),
|
|
337
|
-
arguments: [tx.object(mfudRegistry), d_token],
|
|
338
|
-
});
|
|
339
|
-
tx.transferObjects([tx.object(fud_coin)], sender);
|
|
340
|
-
}
|
|
341
|
-
else {
|
|
342
|
-
tx.transferObjects([d_token], sender);
|
|
343
|
-
}
|
|
344
|
-
if (typeArguments[1].endsWith("MFUD")) {
|
|
345
|
-
var fud_coin = tx.moveCall({
|
|
346
|
-
target: "".concat(mfudPackageId, "::mfud::burn"),
|
|
347
|
-
arguments: [tx.object(mfudRegistry), b_token],
|
|
348
|
-
});
|
|
349
|
-
tx.transferObjects([tx.object(fud_coin)], sender);
|
|
350
|
-
}
|
|
351
|
-
else {
|
|
352
|
-
tx.transferObjects([b_token], sender);
|
|
353
|
-
}
|
|
354
|
-
tx.setGasBudget(gasBudget);
|
|
355
|
-
return tx;
|
|
356
|
-
}
|
|
357
|
-
function getMfudWithdrawProfitStrategyTx(gasBudget, packageId, typeArguments, // D_TOKEN, B_TOKEN
|
|
358
|
-
registry, strategy_pool, vault_index, signal_index, strategy_index, mfudPackageId, mfudRegistry, sender, txBlock) {
|
|
359
|
-
var tx = txBlock ? txBlock : new transactions_1.TransactionBlock();
|
|
360
|
-
var d_token = tx.moveCall({
|
|
361
|
-
target: "".concat(packageId, "::auto_bid::withdraw_profit"),
|
|
362
|
-
typeArguments: typeArguments,
|
|
363
|
-
arguments: [tx.object(registry), tx.object(strategy_pool), tx.pure(vault_index), tx.pure(signal_index), tx.pure(strategy_index)],
|
|
364
|
-
});
|
|
365
|
-
if (typeArguments[0].endsWith("MFUD")) {
|
|
366
|
-
var fud_coin = tx.moveCall({
|
|
367
|
-
target: "".concat(mfudPackageId, "::mfud::burn"),
|
|
368
|
-
arguments: [tx.object(mfudRegistry), d_token],
|
|
369
|
-
});
|
|
370
|
-
tx.transferObjects([tx.object(fud_coin)], sender);
|
|
371
|
-
}
|
|
372
|
-
else {
|
|
373
|
-
tx.transferObjects([d_token], sender);
|
|
374
|
-
}
|
|
375
|
-
tx.setGasBudget(gasBudget);
|
|
260
|
+
tx.transferObjects([tx.object(fud_coin)], input.user);
|
|
376
261
|
return tx;
|
|
377
262
|
}
|
|
378
|
-
function
|
|
379
|
-
var raiseBalance =
|
|
263
|
+
function getTokenCompoundWithRedeemTx(config, tx, input) {
|
|
264
|
+
var raiseBalance = tx.moveCall({
|
|
380
265
|
target: "0x2::balance::zero",
|
|
381
266
|
typeArguments: [input.typeArguments[0]],
|
|
382
267
|
arguments: [],
|
|
383
268
|
});
|
|
384
|
-
var result =
|
|
385
|
-
target: "".concat(
|
|
269
|
+
var result = tx.moveCall({
|
|
270
|
+
target: "".concat(config.package.dovSingle, "::tds_user_entry::public_raise_fund"),
|
|
386
271
|
typeArguments: [input.typeArguments[0], input.typeArguments[1]],
|
|
387
272
|
arguments: [
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
type: "".concat(
|
|
395
|
-
objects: input.receipts.map(function (receipt) { return
|
|
273
|
+
tx.object(config.version.typus),
|
|
274
|
+
tx.object(config.registry.typus.user),
|
|
275
|
+
tx.object(config.registry.typus.leaderboard),
|
|
276
|
+
tx.object(config.registry.dov.dovSingle),
|
|
277
|
+
tx.pure(input.index),
|
|
278
|
+
tx.makeMoveVec({
|
|
279
|
+
type: "".concat(config.packageOrigin.framework, "::vault::TypusDepositReceipt"),
|
|
280
|
+
objects: input.receipts.map(function (receipt) { return tx.object(receipt); }),
|
|
396
281
|
}),
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
282
|
+
tx.object(raiseBalance),
|
|
283
|
+
tx.pure(true),
|
|
284
|
+
tx.pure(false),
|
|
285
|
+
tx.object(constants_1.CLOCK),
|
|
401
286
|
],
|
|
402
287
|
});
|
|
403
|
-
return
|
|
404
|
-
tx: input.tx,
|
|
405
|
-
typusEcosystemVersion: input.typusEcosystemVersion,
|
|
406
|
-
typusUserRegistry: input.typusUserRegistry,
|
|
407
|
-
typusLeaderboardRegistry: input.typusLeaderboardRegistry,
|
|
408
|
-
typusFrameworkOriginPackageId: input.typusFrameworkOriginPackageId,
|
|
409
|
-
typusFrameworkPackageId: input.typusFrameworkPackageId,
|
|
410
|
-
typusDovSinglePackageId: input.typusDovSinglePackageId,
|
|
411
|
-
typusDovSingleRegistry: input.typusDovSingleRegistry,
|
|
288
|
+
return getTokenReduceFundTx(config, tx, {
|
|
412
289
|
typeArguments: input.typeArguments,
|
|
413
|
-
typusTokenPackageId: input.typusTokenPackageId,
|
|
414
|
-
typusTokenRegistry: input.typusTokenRegistry,
|
|
415
290
|
typusTokenType: input.typusTokenType,
|
|
416
291
|
index: input.index,
|
|
417
292
|
receipts: [result[0]],
|