@scallop-io/sui-scallop-sdk 1.4.24-alpha.1 → 1.5.0-alpha.1
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/constants/common.d.ts +4 -4
- package/dist/constants/enum.d.ts +2 -2
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/xoracle.d.ts +2 -0
- package/dist/index.js +580 -685
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +590 -696
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopIndexer.d.ts +1 -0
- package/dist/models/scallopPrice.d.ts +0 -0
- package/dist/models/scallopQuery.d.ts +30 -13
- package/dist/models/scallopUtils.d.ts +2 -2
- package/dist/queries/borrowIncentiveQuery.d.ts +0 -2
- package/dist/queries/coreQuery.d.ts +1 -1
- package/dist/queries/index.d.ts +1 -0
- package/dist/queries/poolAddressesQuery.d.ts +1 -1
- package/dist/queries/portfolioQuery.d.ts +3 -4
- package/dist/queries/priceQuery.d.ts +1 -3
- package/dist/queries/sCoinQuery.d.ts +1 -1
- package/dist/queries/xOracleQuery.d.ts +13 -0
- package/dist/types/address.d.ts +1 -0
- package/dist/types/constant/index.d.ts +1 -0
- package/dist/types/constant/xOracle.d.ts +9 -0
- package/package.json +1 -1
- package/src/builders/borrowIncentiveBuilder.ts +11 -25
- package/src/builders/coreBuilder.ts +15 -72
- package/src/builders/oracle.ts +73 -46
- package/src/builders/referralBuilder.ts +9 -20
- package/src/builders/spoolBuilder.ts +10 -38
- package/src/builders/vescaBuilder.ts +11 -26
- package/src/constants/coinGecko.ts +4 -12
- package/src/constants/common.ts +0 -2
- package/src/constants/enum.ts +10 -13
- package/src/constants/index.ts +1 -0
- package/src/constants/poolAddress.ts +343 -218
- package/src/constants/pyth.ts +0 -1
- package/src/constants/testAddress.ts +35 -254
- package/src/constants/xoracle.ts +25 -0
- package/src/models/scallopIndexer.ts +11 -0
- package/src/models/scallopPrice.ts +0 -0
- package/src/models/scallopQuery.ts +58 -13
- package/src/models/scallopUtils.ts +1 -1
- package/src/queries/coreQuery.ts +16 -6
- package/src/queries/index.ts +1 -0
- package/src/queries/poolAddressesQuery.ts +2 -2
- package/src/queries/priceQuery.ts +10 -3
- package/src/queries/vescaQuery.ts +8 -17
- package/src/queries/xOracleQuery.ts +124 -0
- package/src/types/address.ts +1 -0
- package/src/types/constant/index.ts +1 -0
- package/src/types/constant/xOracle.ts +11 -0
- package/src/utils/util.ts +4 -9
package/src/builders/oracle.ts
CHANGED
|
@@ -7,8 +7,14 @@ import { SUPPORT_COLLATERALS, SUPPORT_POOLS } from '../constants';
|
|
|
7
7
|
import type { TransactionArgument } from '@mysten/sui/transactions';
|
|
8
8
|
import type { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
|
|
9
9
|
import type { ScallopBuilder } from '../models';
|
|
10
|
-
import type {
|
|
10
|
+
import type {
|
|
11
|
+
SupportAssetCoins,
|
|
12
|
+
SupportOracleType,
|
|
13
|
+
xOracleRules,
|
|
14
|
+
xOracleRuleType,
|
|
15
|
+
} from '../types';
|
|
11
16
|
import { PYTH_ENDPOINTS } from 'src/constants/pyth';
|
|
17
|
+
import { xOracleList } from 'src/constants';
|
|
12
18
|
|
|
13
19
|
/**
|
|
14
20
|
* Update the price of the oracle for multiple coin.
|
|
@@ -21,18 +27,26 @@ import { PYTH_ENDPOINTS } from 'src/constants/pyth';
|
|
|
21
27
|
export const updateOracles = async (
|
|
22
28
|
builder: ScallopBuilder,
|
|
23
29
|
txBlock: SuiKitTxBlock,
|
|
24
|
-
assetCoinNames
|
|
30
|
+
assetCoinNames: SupportAssetCoins[] = [
|
|
31
|
+
...new Set([...SUPPORT_POOLS, ...SUPPORT_COLLATERALS]),
|
|
32
|
+
],
|
|
25
33
|
options: {
|
|
26
34
|
usePythPullModel: boolean;
|
|
27
35
|
} = { usePythPullModel: true }
|
|
28
36
|
) => {
|
|
29
37
|
const usePythPullModel =
|
|
30
38
|
builder.params.usePythPullModel ?? options.usePythPullModel;
|
|
31
|
-
|
|
32
|
-
|
|
39
|
+
// const rules: SupportOracleType[] = builder.isTestnet ? ['pyth'] : ['pyth'];
|
|
40
|
+
const flattenedRules: SupportOracleType[] = [
|
|
41
|
+
...new Set(
|
|
42
|
+
Object.values(xOracleList).flatMap(({ primary, secondary }) => [
|
|
43
|
+
...primary,
|
|
44
|
+
...secondary,
|
|
45
|
+
])
|
|
46
|
+
),
|
|
33
47
|
];
|
|
34
|
-
|
|
35
|
-
if (
|
|
48
|
+
|
|
49
|
+
if (flattenedRules.includes('pyth') && usePythPullModel) {
|
|
36
50
|
const pythClient = new SuiPythClient(
|
|
37
51
|
builder.suiKit.client(),
|
|
38
52
|
builder.address.get('core.oracles.pyth.state'),
|
|
@@ -69,7 +83,12 @@ export const updateOracles = async (
|
|
|
69
83
|
// Remove duplicate coin names.
|
|
70
84
|
const updateAssetCoinNames = [...new Set(assetCoinNames)];
|
|
71
85
|
for (const assetCoinName of updateAssetCoinNames) {
|
|
72
|
-
await updateOracle(
|
|
86
|
+
await updateOracle(
|
|
87
|
+
builder,
|
|
88
|
+
txBlock,
|
|
89
|
+
assetCoinName,
|
|
90
|
+
xOracleList[assetCoinName]
|
|
91
|
+
);
|
|
73
92
|
}
|
|
74
93
|
};
|
|
75
94
|
|
|
@@ -84,7 +103,7 @@ const updateOracle = async (
|
|
|
84
103
|
builder: ScallopBuilder,
|
|
85
104
|
txBlock: SuiKitTxBlock,
|
|
86
105
|
assetCoinName: SupportAssetCoins,
|
|
87
|
-
rules:
|
|
106
|
+
rules: xOracleRules
|
|
88
107
|
) => {
|
|
89
108
|
const coinType = builder.utils.parseCoinType(assetCoinName);
|
|
90
109
|
|
|
@@ -129,7 +148,7 @@ const updateOracle = async (
|
|
|
129
148
|
*/
|
|
130
149
|
const updatePrice = (
|
|
131
150
|
txBlock: SuiKitTxBlock,
|
|
132
|
-
rules:
|
|
151
|
+
rules: xOracleRules,
|
|
133
152
|
xOraclePackageId: string,
|
|
134
153
|
xOracleId: TransactionArgument | string,
|
|
135
154
|
pythPackageId: string,
|
|
@@ -150,37 +169,42 @@ const updatePrice = (
|
|
|
150
169
|
xOracleId,
|
|
151
170
|
coinType
|
|
152
171
|
);
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
172
|
+
Object.entries(rules).forEach(([type, rule]: [any, SupportOracleType[]]) => {
|
|
173
|
+
if (rule.includes('pyth')) {
|
|
174
|
+
updatePythPrice(
|
|
175
|
+
type,
|
|
176
|
+
txBlock,
|
|
177
|
+
pythPackageId,
|
|
178
|
+
request,
|
|
179
|
+
pythStateId,
|
|
180
|
+
pythFeedObjectId,
|
|
181
|
+
pythRegistryId,
|
|
182
|
+
coinType
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
if (rule.includes('supra')) {
|
|
186
|
+
updateSupraPrice(
|
|
187
|
+
type,
|
|
188
|
+
txBlock,
|
|
189
|
+
supraPackageId,
|
|
190
|
+
request,
|
|
191
|
+
supraHolderId,
|
|
192
|
+
supraRegistryId,
|
|
193
|
+
coinType
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
if (rule.includes('switchboard')) {
|
|
197
|
+
updateSwitchboardPrice(
|
|
198
|
+
type,
|
|
199
|
+
txBlock,
|
|
200
|
+
switchboardPackageId,
|
|
201
|
+
request,
|
|
202
|
+
switchboardAggregatorId,
|
|
203
|
+
switchboardRegistryId,
|
|
204
|
+
coinType
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
184
208
|
|
|
185
209
|
confirmPriceUpdateRequest(
|
|
186
210
|
txBlock,
|
|
@@ -260,6 +284,7 @@ const confirmPriceUpdateRequest = (
|
|
|
260
284
|
* @return TxBlock created by SuiKit.
|
|
261
285
|
*/
|
|
262
286
|
const updateSupraPrice = (
|
|
287
|
+
type: xOracleRuleType,
|
|
263
288
|
txBlock: SuiKitTxBlock,
|
|
264
289
|
packageId: string,
|
|
265
290
|
request: TransactionArgument,
|
|
@@ -268,15 +293,15 @@ const updateSupraPrice = (
|
|
|
268
293
|
coinType: string
|
|
269
294
|
) => {
|
|
270
295
|
txBlock.moveCall(
|
|
271
|
-
`${packageId}::rule::
|
|
296
|
+
`${packageId}::rule::set_price_as_${type}`,
|
|
272
297
|
[
|
|
273
298
|
request,
|
|
274
299
|
holderId,
|
|
275
300
|
registryId,
|
|
276
301
|
txBlock.sharedObjectRef({
|
|
277
302
|
objectId: SUI_CLOCK_OBJECT_ID,
|
|
278
|
-
mutable: false,
|
|
279
303
|
initialSharedVersion: '1',
|
|
304
|
+
mutable: false,
|
|
280
305
|
}),
|
|
281
306
|
],
|
|
282
307
|
[coinType]
|
|
@@ -296,6 +321,7 @@ const updateSupraPrice = (
|
|
|
296
321
|
* @return TxBlock created by SuiKit.
|
|
297
322
|
*/
|
|
298
323
|
const updateSwitchboardPrice = (
|
|
324
|
+
type: xOracleRuleType,
|
|
299
325
|
txBlock: SuiKitTxBlock,
|
|
300
326
|
packageId: string,
|
|
301
327
|
request: TransactionArgument,
|
|
@@ -304,15 +330,15 @@ const updateSwitchboardPrice = (
|
|
|
304
330
|
coinType: string
|
|
305
331
|
) => {
|
|
306
332
|
txBlock.moveCall(
|
|
307
|
-
`${packageId}::rule::
|
|
333
|
+
`${packageId}::rule::set_price_as_${type}`,
|
|
308
334
|
[
|
|
309
335
|
request,
|
|
310
336
|
aggregatorId,
|
|
311
337
|
registryId,
|
|
312
338
|
txBlock.sharedObjectRef({
|
|
313
339
|
objectId: SUI_CLOCK_OBJECT_ID,
|
|
314
|
-
mutable: false,
|
|
315
340
|
initialSharedVersion: '1',
|
|
341
|
+
mutable: false,
|
|
316
342
|
}),
|
|
317
343
|
],
|
|
318
344
|
[coinType]
|
|
@@ -335,6 +361,7 @@ const updateSwitchboardPrice = (
|
|
|
335
361
|
* @return TxBlock created by SuiKit.
|
|
336
362
|
*/
|
|
337
363
|
const updatePythPrice = (
|
|
364
|
+
type: xOracleRuleType,
|
|
338
365
|
txBlock: SuiKitTxBlock,
|
|
339
366
|
packageId: string,
|
|
340
367
|
request: TransactionArgument,
|
|
@@ -344,7 +371,7 @@ const updatePythPrice = (
|
|
|
344
371
|
coinType: string
|
|
345
372
|
) => {
|
|
346
373
|
txBlock.moveCall(
|
|
347
|
-
`${packageId}::rule::
|
|
374
|
+
`${packageId}::rule::set_price_as_${type}`,
|
|
348
375
|
[
|
|
349
376
|
request,
|
|
350
377
|
stateId,
|
|
@@ -352,8 +379,8 @@ const updatePythPrice = (
|
|
|
352
379
|
registryId,
|
|
353
380
|
txBlock.sharedObjectRef({
|
|
354
381
|
objectId: SUI_CLOCK_OBJECT_ID,
|
|
355
|
-
mutable: false,
|
|
356
382
|
initialSharedVersion: '1',
|
|
383
|
+
mutable: false,
|
|
357
384
|
}),
|
|
358
385
|
],
|
|
359
386
|
[coinType]
|
|
@@ -32,6 +32,11 @@ const generateReferralNormalMethod: GenerateReferralNormalMethod = ({
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
const veScaTable = builder.address.get('vesca.table');
|
|
35
|
+
const clockObjectRef = txBlock.sharedObjectRef({
|
|
36
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
37
|
+
mutable: false,
|
|
38
|
+
initialSharedVersion: '1',
|
|
39
|
+
});
|
|
35
40
|
|
|
36
41
|
return {
|
|
37
42
|
bindToReferral: (veScaKeyId: string) => {
|
|
@@ -42,11 +47,7 @@ const generateReferralNormalMethod: GenerateReferralNormalMethod = ({
|
|
|
42
47
|
referralIds.referralBindings,
|
|
43
48
|
txBlock.pure.id(veScaKeyId),
|
|
44
49
|
veScaTable,
|
|
45
|
-
|
|
46
|
-
objectId: SUI_CLOCK_OBJECT_ID,
|
|
47
|
-
mutable: false,
|
|
48
|
-
initialSharedVersion: '1',
|
|
49
|
-
}),
|
|
50
|
+
clockObjectRef,
|
|
50
51
|
],
|
|
51
52
|
[]
|
|
52
53
|
);
|
|
@@ -62,11 +63,7 @@ const generateReferralNormalMethod: GenerateReferralNormalMethod = ({
|
|
|
62
63
|
referralIds.referralBindings,
|
|
63
64
|
referralIds.authorizedWitnessList,
|
|
64
65
|
referralIds.referralTiers,
|
|
65
|
-
|
|
66
|
-
objectId: SUI_CLOCK_OBJECT_ID,
|
|
67
|
-
mutable: false,
|
|
68
|
-
initialSharedVersion: '1',
|
|
69
|
-
}),
|
|
66
|
+
clockObjectRef,
|
|
70
67
|
],
|
|
71
68
|
[coinType]
|
|
72
69
|
);
|
|
@@ -80,11 +77,7 @@ const generateReferralNormalMethod: GenerateReferralNormalMethod = ({
|
|
|
80
77
|
referralIds.version,
|
|
81
78
|
ticket,
|
|
82
79
|
referralIds.referralRevenuePool,
|
|
83
|
-
|
|
84
|
-
objectId: SUI_CLOCK_OBJECT_ID,
|
|
85
|
-
mutable: false,
|
|
86
|
-
initialSharedVersion: '1',
|
|
87
|
-
}),
|
|
80
|
+
clockObjectRef,
|
|
88
81
|
],
|
|
89
82
|
[coinType]
|
|
90
83
|
);
|
|
@@ -101,11 +94,7 @@ const generateReferralNormalMethod: GenerateReferralNormalMethod = ({
|
|
|
101
94
|
referralIds.version,
|
|
102
95
|
referralIds.referralRevenuePool,
|
|
103
96
|
veScaKey,
|
|
104
|
-
|
|
105
|
-
objectId: SUI_CLOCK_OBJECT_ID,
|
|
106
|
-
mutable: false,
|
|
107
|
-
initialSharedVersion: '1',
|
|
108
|
-
}),
|
|
97
|
+
clockObjectRef,
|
|
109
98
|
],
|
|
110
99
|
[coinType]
|
|
111
100
|
);
|
|
@@ -126,6 +126,12 @@ const generateSpoolNormalMethod: GenerateSpoolNormalMethod = ({
|
|
|
126
126
|
const spoolIds: SpoolIds = {
|
|
127
127
|
spoolPkg: builder.address.get('spool.id'),
|
|
128
128
|
};
|
|
129
|
+
const clockObjectRef = txBlock.sharedObjectRef({
|
|
130
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
131
|
+
mutable: false,
|
|
132
|
+
initialSharedVersion: '1',
|
|
133
|
+
});
|
|
134
|
+
|
|
129
135
|
return {
|
|
130
136
|
createStakeAccount: (stakeMarketCoinName) => {
|
|
131
137
|
const marketCoinType =
|
|
@@ -136,14 +142,7 @@ const generateSpoolNormalMethod: GenerateSpoolNormalMethod = ({
|
|
|
136
142
|
return builder.moveCall(
|
|
137
143
|
txBlock,
|
|
138
144
|
`${spoolIds.spoolPkg}::user::new_spool_account`,
|
|
139
|
-
[
|
|
140
|
-
stakePoolId,
|
|
141
|
-
txBlock.sharedObjectRef({
|
|
142
|
-
objectId: SUI_CLOCK_OBJECT_ID,
|
|
143
|
-
mutable: false,
|
|
144
|
-
initialSharedVersion: '1',
|
|
145
|
-
}),
|
|
146
|
-
],
|
|
145
|
+
[stakePoolId, clockObjectRef],
|
|
147
146
|
[marketCoinType]
|
|
148
147
|
);
|
|
149
148
|
},
|
|
@@ -156,16 +155,7 @@ const generateSpoolNormalMethod: GenerateSpoolNormalMethod = ({
|
|
|
156
155
|
builder.moveCall(
|
|
157
156
|
txBlock,
|
|
158
157
|
`${spoolIds.spoolPkg}::user::stake`,
|
|
159
|
-
[
|
|
160
|
-
stakePoolId,
|
|
161
|
-
stakeAccount,
|
|
162
|
-
coin,
|
|
163
|
-
txBlock.sharedObjectRef({
|
|
164
|
-
objectId: SUI_CLOCK_OBJECT_ID,
|
|
165
|
-
mutable: false,
|
|
166
|
-
initialSharedVersion: '1',
|
|
167
|
-
}),
|
|
168
|
-
],
|
|
158
|
+
[stakePoolId, stakeAccount, coin, clockObjectRef],
|
|
169
159
|
[marketCoinType]
|
|
170
160
|
);
|
|
171
161
|
},
|
|
@@ -178,16 +168,7 @@ const generateSpoolNormalMethod: GenerateSpoolNormalMethod = ({
|
|
|
178
168
|
return builder.moveCall(
|
|
179
169
|
txBlock,
|
|
180
170
|
`${spoolIds.spoolPkg}::user::unstake`,
|
|
181
|
-
[
|
|
182
|
-
stakePoolId,
|
|
183
|
-
stakeAccount,
|
|
184
|
-
amount,
|
|
185
|
-
txBlock.sharedObjectRef({
|
|
186
|
-
objectId: SUI_CLOCK_OBJECT_ID,
|
|
187
|
-
mutable: false,
|
|
188
|
-
initialSharedVersion: '1',
|
|
189
|
-
}),
|
|
190
|
-
],
|
|
171
|
+
[stakePoolId, stakeAccount, amount, clockObjectRef],
|
|
191
172
|
[marketCoinType]
|
|
192
173
|
);
|
|
193
174
|
},
|
|
@@ -205,16 +186,7 @@ const generateSpoolNormalMethod: GenerateSpoolNormalMethod = ({
|
|
|
205
186
|
return builder.moveCall(
|
|
206
187
|
txBlock,
|
|
207
188
|
`${spoolIds.spoolPkg}::user::redeem_rewards`,
|
|
208
|
-
[
|
|
209
|
-
stakePoolId,
|
|
210
|
-
rewardPoolId,
|
|
211
|
-
stakeAccount,
|
|
212
|
-
txBlock.sharedObjectRef({
|
|
213
|
-
objectId: SUI_CLOCK_OBJECT_ID,
|
|
214
|
-
mutable: false,
|
|
215
|
-
initialSharedVersion: '1',
|
|
216
|
-
}),
|
|
217
|
-
],
|
|
189
|
+
[stakePoolId, rewardPoolId, stakeAccount, clockObjectRef],
|
|
218
190
|
[marketCoinType, rewardCoinType]
|
|
219
191
|
);
|
|
220
192
|
},
|
|
@@ -87,6 +87,11 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
|
|
|
87
87
|
treasury: builder.address.get('vesca.treasury'),
|
|
88
88
|
config: builder.address.get('vesca.config'),
|
|
89
89
|
};
|
|
90
|
+
const clockObjectRef = txBlock.sharedObjectRef({
|
|
91
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
92
|
+
mutable: false,
|
|
93
|
+
initialSharedVersion: '1',
|
|
94
|
+
});
|
|
90
95
|
|
|
91
96
|
return {
|
|
92
97
|
lockSca: (scaCoin, unlockAtInSecondTimestamp) => {
|
|
@@ -99,11 +104,7 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
|
|
|
99
104
|
veScaIds.treasury,
|
|
100
105
|
scaCoin,
|
|
101
106
|
unlockAtInSecondTimestamp,
|
|
102
|
-
|
|
103
|
-
objectId: SUI_CLOCK_OBJECT_ID,
|
|
104
|
-
mutable: false,
|
|
105
|
-
initialSharedVersion: '1',
|
|
106
|
-
}),
|
|
107
|
+
clockObjectRef,
|
|
107
108
|
],
|
|
108
109
|
[]
|
|
109
110
|
);
|
|
@@ -118,11 +119,7 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
|
|
|
118
119
|
veScaIds.table,
|
|
119
120
|
veScaIds.treasury,
|
|
120
121
|
newUnlockAtInSecondTimestamp,
|
|
121
|
-
|
|
122
|
-
objectId: SUI_CLOCK_OBJECT_ID,
|
|
123
|
-
mutable: false,
|
|
124
|
-
initialSharedVersion: '1',
|
|
125
|
-
}),
|
|
122
|
+
clockObjectRef,
|
|
126
123
|
],
|
|
127
124
|
[]
|
|
128
125
|
);
|
|
@@ -137,11 +134,7 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
|
|
|
137
134
|
veScaIds.table,
|
|
138
135
|
veScaIds.treasury,
|
|
139
136
|
scaCoin,
|
|
140
|
-
|
|
141
|
-
objectId: SUI_CLOCK_OBJECT_ID,
|
|
142
|
-
mutable: false,
|
|
143
|
-
initialSharedVersion: '1',
|
|
144
|
-
}),
|
|
137
|
+
clockObjectRef,
|
|
145
138
|
],
|
|
146
139
|
[]
|
|
147
140
|
);
|
|
@@ -157,11 +150,7 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
|
|
|
157
150
|
veScaIds.treasury,
|
|
158
151
|
scaCoin,
|
|
159
152
|
newUnlockAtInSecondTimestamp,
|
|
160
|
-
|
|
161
|
-
objectId: SUI_CLOCK_OBJECT_ID,
|
|
162
|
-
mutable: false,
|
|
163
|
-
initialSharedVersion: '1',
|
|
164
|
-
}),
|
|
153
|
+
clockObjectRef,
|
|
165
154
|
],
|
|
166
155
|
[]
|
|
167
156
|
);
|
|
@@ -175,11 +164,7 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
|
|
|
175
164
|
veScaKey,
|
|
176
165
|
veScaIds.table,
|
|
177
166
|
veScaIds.treasury,
|
|
178
|
-
|
|
179
|
-
objectId: SUI_CLOCK_OBJECT_ID,
|
|
180
|
-
mutable: false,
|
|
181
|
-
initialSharedVersion: '1',
|
|
182
|
-
}),
|
|
167
|
+
clockObjectRef,
|
|
183
168
|
],
|
|
184
169
|
[]
|
|
185
170
|
);
|
|
@@ -372,7 +357,7 @@ const generateQuickVeScaMethod: GenerateVeScaQuickMethod = ({
|
|
|
372
357
|
checkVesca(veSca?.unlockAt);
|
|
373
358
|
|
|
374
359
|
if (veSca) {
|
|
375
|
-
const sca =
|
|
360
|
+
const sca = txBlock.redeemSca(veSca.keyId);
|
|
376
361
|
if (transferSca) {
|
|
377
362
|
txBlock.transferObjects([sca], sender);
|
|
378
363
|
return;
|
|
@@ -1,32 +1,24 @@
|
|
|
1
1
|
import { SupportPoolCoins } from 'src/types/constant/common';
|
|
2
2
|
|
|
3
3
|
export const COIN_GECKGO_IDS: Record<SupportPoolCoins, string> = {
|
|
4
|
-
|
|
4
|
+
usdc: 'usdc',
|
|
5
5
|
sbeth: 'ethereum',
|
|
6
6
|
sbusdt: 'tether',
|
|
7
7
|
sbwbtc: 'bitcoin',
|
|
8
|
-
// Wormhole
|
|
9
8
|
weth: 'ethereum',
|
|
10
9
|
wbtc: 'bitcoin',
|
|
11
10
|
wusdc: 'usdc',
|
|
12
11
|
wusdt: 'tether',
|
|
12
|
+
sui: 'sui',
|
|
13
13
|
wapt: 'aptos',
|
|
14
14
|
wsol: 'solana',
|
|
15
|
-
|
|
16
|
-
usdc: 'usdc',
|
|
17
|
-
// Sui LST
|
|
18
|
-
sui: 'sui',
|
|
15
|
+
cetus: 'cetus-protocol',
|
|
19
16
|
afsui: 'sui',
|
|
20
17
|
hasui: 'sui',
|
|
21
18
|
vsui: 'sui',
|
|
22
|
-
// Stable
|
|
23
|
-
fdusd: 'first-digital-usd',
|
|
24
|
-
// DeFi
|
|
25
|
-
cetus: 'cetus-protocol',
|
|
26
19
|
sca: 'scallop-2',
|
|
20
|
+
fdusd: 'first-digital-usd',
|
|
27
21
|
deep: 'deepbook',
|
|
28
|
-
// Isolated Asset
|
|
29
22
|
fud: 'fud-the-pug',
|
|
30
23
|
blub: 'blub',
|
|
31
|
-
musd: '', // @TODO: add coinGecko id
|
|
32
24
|
};
|
package/src/constants/common.ts
CHANGED
|
@@ -50,7 +50,6 @@ export const SUPPORT_POOLS = [
|
|
|
50
50
|
'deep',
|
|
51
51
|
'fdusd',
|
|
52
52
|
'blub',
|
|
53
|
-
'musd',
|
|
54
53
|
] as const;
|
|
55
54
|
|
|
56
55
|
export const SUPPORT_COLLATERALS = [
|
|
@@ -105,7 +104,6 @@ export const SUPPORT_SCOIN = [
|
|
|
105
104
|
'sfud',
|
|
106
105
|
'sfdusd',
|
|
107
106
|
'sblub',
|
|
108
|
-
'smusd',
|
|
109
107
|
] as const;
|
|
110
108
|
|
|
111
109
|
export const SUPPORT_SUI_BRIDGE = ['sbeth', 'sbusdt', 'sbwbtc'] as const;
|
package/src/constants/enum.ts
CHANGED
|
@@ -22,7 +22,6 @@ export const coinDecimals: types.SupportCoinDecimals = {
|
|
|
22
22
|
deep: 6,
|
|
23
23
|
fud: 5,
|
|
24
24
|
blub: 2,
|
|
25
|
-
musd: 9,
|
|
26
25
|
susdc: 6,
|
|
27
26
|
sweth: 8,
|
|
28
27
|
ssbeth: 8,
|
|
@@ -43,7 +42,6 @@ export const coinDecimals: types.SupportCoinDecimals = {
|
|
|
43
42
|
sdeep: 6,
|
|
44
43
|
sfud: 5,
|
|
45
44
|
sblub: 2,
|
|
46
|
-
smusd: 9,
|
|
47
45
|
};
|
|
48
46
|
|
|
49
47
|
export const assetCoins: types.AssetCoins = {
|
|
@@ -67,7 +65,6 @@ export const assetCoins: types.AssetCoins = {
|
|
|
67
65
|
deep: 'deep',
|
|
68
66
|
fud: 'fud',
|
|
69
67
|
blub: 'blub',
|
|
70
|
-
musd: 'musd',
|
|
71
68
|
};
|
|
72
69
|
|
|
73
70
|
export const marketCoins: types.MarketCoins = {
|
|
@@ -91,7 +88,6 @@ export const marketCoins: types.MarketCoins = {
|
|
|
91
88
|
sdeep: 'sdeep',
|
|
92
89
|
sfud: 'sfud',
|
|
93
90
|
sblub: 'sblub',
|
|
94
|
-
smusd: 'smusd',
|
|
95
91
|
};
|
|
96
92
|
|
|
97
93
|
export const sCoins: types.SCoins = {
|
|
@@ -114,7 +110,6 @@ export const sCoins: types.SCoins = {
|
|
|
114
110
|
sfud: 'sfud',
|
|
115
111
|
sdeep: 'sdeep',
|
|
116
112
|
sblub: 'sblub',
|
|
117
|
-
smusd: 'smusd',
|
|
118
113
|
};
|
|
119
114
|
|
|
120
115
|
export const stakeMarketCoins: types.StakeMarketCoins = {
|
|
@@ -175,7 +170,6 @@ export const coinIds: types.AssetCoinIds = {
|
|
|
175
170
|
sbeth: '0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29',
|
|
176
171
|
sbusdt: '0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068',
|
|
177
172
|
sbwbtc: '0xaafb102dd0902f5055cadecd687fb5b71ca82ef0e0285d90afde828ec58ca96b',
|
|
178
|
-
musd: '0xe44df51c0b21a27ab915fa1fe2ca610cd3eaa6d9666fe5e62b988bf7f0bd8722',
|
|
179
173
|
};
|
|
180
174
|
|
|
181
175
|
export const wormholeCoinIds: types.WormholeCoinIds = {
|
|
@@ -193,8 +187,10 @@ export const voloCoinIds: types.VoloCoinIds = {
|
|
|
193
187
|
|
|
194
188
|
// PROD VERSION
|
|
195
189
|
export const sCoinIds: types.SCoinIds = {
|
|
196
|
-
ssui: '0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI',
|
|
197
|
-
|
|
190
|
+
// ssui: '0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI', // @TODO: restore on prod
|
|
191
|
+
ssui: '0x88618204de2dfdc2597681a8441ee726b0dc13494c41e319c3264eb7b35fea90::scallop_sui::SCALLOP_SUI',
|
|
192
|
+
// ssca: '0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA', // @TODO: restore on prod
|
|
193
|
+
ssca: '0x9f64a180373a6b66595025ae16a4ab701f0af1dd5c7ce1ac91dc112e52c2a3f8::scallop_sca::SCALLOP_SCA',
|
|
198
194
|
scetus:
|
|
199
195
|
'0xea346ce428f91ab007210443efcea5f5cdbbb3aae7e9affc0ca93f9203c31f0c::scallop_cetus::SCALLOP_CETUS',
|
|
200
196
|
// Wormhole assets
|
|
@@ -213,7 +209,8 @@ export const sCoinIds: types.SCoinIds = {
|
|
|
213
209
|
'0xe1a1cc6bcf0001a015eab84bcc6713393ce20535f55b8b6f35c142e057a25fbe::scallop_v_sui::SCALLOP_V_SUI',
|
|
214
210
|
// stable coins
|
|
215
211
|
susdc:
|
|
216
|
-
'0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC',
|
|
212
|
+
// '0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC', // @TODO: restore on prod
|
|
213
|
+
'0x55ed015f9f006c0c96ad36ebe3b3570d088e8498f52defea48e5634c110e485c::scallop_usdc::SCALLOP_USDC',
|
|
217
214
|
swusdc:
|
|
218
215
|
'0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
|
|
219
216
|
swusdt:
|
|
@@ -222,8 +219,10 @@ export const sCoinIds: types.SCoinIds = {
|
|
|
222
219
|
'0x6711551c1e7652a270d9fbf0eee25d99594c157cde3cb5fbb49035eb59b1b001::scallop_fdusd::SCALLOP_FDUSD',
|
|
223
220
|
// isolated assets
|
|
224
221
|
sdeep:
|
|
225
|
-
'0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP',
|
|
226
|
-
|
|
222
|
+
// '0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP', // @TODO: restore on prod
|
|
223
|
+
'0x34f0a2e793e1f79ceac72cfe3bb95f65541da449418289ccd12922d16140c882::scallop_deep::SCALLOP_DEEP',
|
|
224
|
+
// sfud: '0xe56d5167f427cbe597da9e8150ef5c337839aaf46891d62468dcf80bdd8e10d1::scallop_fud::SCALLOP_FUD', // @TODO: restore on prod
|
|
225
|
+
sfud: '0x3b23c05f917052255a0b16a534dbd4446911aa4a30bd3497cdf5b736551e7ef8::scallop_fud::SCALLOP_FUD',
|
|
227
226
|
sblub:
|
|
228
227
|
'0xe72f65446eabfad2103037af2d49d24599106fb44bf4c046c1e7e9acf6844dd0::scallop_blub::SCALLOP_BLUB',
|
|
229
228
|
// Sui bridge assets
|
|
@@ -233,8 +232,6 @@ export const sCoinIds: types.SCoinIds = {
|
|
|
233
232
|
'0xb1d7df34829d1513b73ba17cb7ad90c88d1e104bb65ab8f62f13e0cc103783d3::scallop_sb_usdt::SCALLOP_SB_USDT',
|
|
234
233
|
ssbwbtc:
|
|
235
234
|
'0x08c0fe357d3a138f4552bee393ce3a28a45bebcca43373d6a90bc44ab76f82e2::scallop_sb_wbtc::SCALLOP_SB_WBTC',
|
|
236
|
-
smusd:
|
|
237
|
-
'0x0a228d1c59071eccf3716076a1f71216846ee256d9fb07ea11fb7c1eb56435a5::scallop_musd::SCALLOP_MUSD',
|
|
238
235
|
} as const;
|
|
239
236
|
|
|
240
237
|
export const sCoinTypeToName = Object.entries(sCoinIds).reduce(
|
package/src/constants/index.ts
CHANGED