@scallop-io/sui-scallop-sdk 2.0.13-merge-split-ve-sca-alpha.2 → 2.0.13-merge-split-ve-sca-alpha.4
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/package.json
CHANGED
|
@@ -122,7 +122,7 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
|
|
|
122
122
|
stakeObligationWithVesca: (obligationId, obligationKey, veScaKey) => {
|
|
123
123
|
builder.moveCall(
|
|
124
124
|
txBlock,
|
|
125
|
-
`${borrowIncentiveIds.borrowIncentivePkg}::user::
|
|
125
|
+
`${borrowIncentiveIds.borrowIncentivePkg}::user::stake_with_ve_sca_v2`,
|
|
126
126
|
[
|
|
127
127
|
borrowIncentiveIds.config,
|
|
128
128
|
borrowIncentiveIds.incentivePools,
|
|
@@ -134,6 +134,8 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
|
|
|
134
134
|
veScaIds.treasury,
|
|
135
135
|
veScaIds.table,
|
|
136
136
|
veScaKey,
|
|
137
|
+
builder.address.get('vesca.subsTable'),
|
|
138
|
+
builder.address.get('vesca.subsWhitelist'),
|
|
137
139
|
clockObjectRef,
|
|
138
140
|
],
|
|
139
141
|
[]
|
|
@@ -142,13 +144,15 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
|
|
|
142
144
|
unstakeObligation: (obligationId, obligationKey) => {
|
|
143
145
|
builder.moveCall(
|
|
144
146
|
txBlock,
|
|
145
|
-
`${borrowIncentiveIds.borrowIncentivePkg}::user::
|
|
147
|
+
`${borrowIncentiveIds.borrowIncentivePkg}::user::unstake_v2`,
|
|
146
148
|
[
|
|
147
149
|
borrowIncentiveIds.config,
|
|
148
150
|
borrowIncentiveIds.incentivePools,
|
|
149
151
|
borrowIncentiveIds.incentiveAccounts,
|
|
150
152
|
obligationKey,
|
|
151
153
|
obligationId,
|
|
154
|
+
builder.address.get('vesca.subsTable'),
|
|
155
|
+
builder.address.get('vesca.subsWhitelist'),
|
|
152
156
|
clockObjectRef,
|
|
153
157
|
]
|
|
154
158
|
);
|
|
@@ -219,6 +223,8 @@ const generateBorrowIncentiveQuickMethod: GenerateBorrowIncentiveQuickMethod =
|
|
|
219
223
|
txn.kind === 'MoveCall' &&
|
|
220
224
|
(txn.target ===
|
|
221
225
|
`${OLD_BORROW_INCENTIVE_PROTOCOL_ID}::user::unstake` ||
|
|
226
|
+
txn.target ===
|
|
227
|
+
`${builder.address.get('borrowIncentive.id')}::user::unstake_v2` ||
|
|
222
228
|
txn.target ===
|
|
223
229
|
`${builder.address.get('borrowIncentive.id')}::user::unstake`)
|
|
224
230
|
);
|
|
@@ -249,6 +255,8 @@ const generateBorrowIncentiveQuickMethod: GenerateBorrowIncentiveQuickMethod =
|
|
|
249
255
|
txn.kind === 'MoveCall' &&
|
|
250
256
|
(txn.target ===
|
|
251
257
|
`${OLD_BORROW_INCENTIVE_PROTOCOL_ID}::user::unstake` ||
|
|
258
|
+
txn.target ===
|
|
259
|
+
`${builder.address.get('borrowIncentive.id')}::user::unstake_v2` ||
|
|
252
260
|
txn.target ===
|
|
253
261
|
`${builder.address.get('borrowIncentive.id')}::user::unstake`)
|
|
254
262
|
);
|
|
@@ -426,7 +426,16 @@ const generateQuickVeScaMethod: GenerateVeScaQuickMethod = ({
|
|
|
426
426
|
veScaKey,
|
|
427
427
|
builder.address.get('vesca.subsTable')
|
|
428
428
|
);
|
|
429
|
-
|
|
429
|
+
|
|
430
|
+
const unstakeObligationBeforeStake =
|
|
431
|
+
!!txBlock.txBlock.blockData.transactions.find(
|
|
432
|
+
(txn) =>
|
|
433
|
+
txn.kind === 'MoveCall' &&
|
|
434
|
+
txn.target ===
|
|
435
|
+
`${builder.address.get('borrowIncentive.id')}::user::unstake_v2`
|
|
436
|
+
);
|
|
437
|
+
|
|
438
|
+
if (isKeyInSubTable && !unstakeObligationBeforeStake) {
|
|
430
439
|
throw new Error(
|
|
431
440
|
'Key cannot be in the subs table, please call unsubscribe vesca or unstake obligation first'
|
|
432
441
|
);
|
|
@@ -455,9 +464,18 @@ const generateQuickVeScaMethod: GenerateVeScaQuickMethod = ({
|
|
|
455
464
|
),
|
|
456
465
|
]);
|
|
457
466
|
|
|
458
|
-
|
|
467
|
+
const unstakeObligationBeforeStake =
|
|
468
|
+
!!txBlock.txBlock.blockData.transactions.find(
|
|
469
|
+
(txn) =>
|
|
470
|
+
txn.kind === 'MoveCall' &&
|
|
471
|
+
txn.target ===
|
|
472
|
+
`${builder.address.get('borrowIncentive.id')}::user::unstake_v2`
|
|
473
|
+
);
|
|
459
474
|
|
|
460
|
-
if (
|
|
475
|
+
if (
|
|
476
|
+
(isTargetInSubTable || isSourceInSubTable) &&
|
|
477
|
+
!unstakeObligationBeforeStake
|
|
478
|
+
) {
|
|
461
479
|
throw new Error(
|
|
462
480
|
'Both target and source cannot be in the subs table. Please call unsubscribe vesca or unstake obligation first'
|
|
463
481
|
);
|