@gearbox-protocol/sdk 4.1.6 → 4.1.7
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.
|
@@ -173,22 +173,32 @@ class AccountOpener extends import_sdk.SDKConstruct {
|
|
|
173
173
|
target: symbol
|
|
174
174
|
});
|
|
175
175
|
const leverage = this.#getLeverage(input);
|
|
176
|
-
logger?.debug(`using leverage ${leverage}`);
|
|
177
176
|
const { minDebt, underlying } = cm.creditFacade;
|
|
177
|
+
const expectedUnderlyingBalance = minDebt * leverage / import_sdk.PERCENTAGE_FACTOR;
|
|
178
178
|
const expectedBalances = [];
|
|
179
179
|
const leftoverBalances = [];
|
|
180
180
|
for (const t of cm.creditManager.collateralTokens) {
|
|
181
181
|
const token = t;
|
|
182
182
|
expectedBalances.push({
|
|
183
183
|
token,
|
|
184
|
-
balance: token === underlying ?
|
|
184
|
+
balance: token === underlying ? expectedUnderlyingBalance : 1n
|
|
185
185
|
});
|
|
186
186
|
leftoverBalances.push({
|
|
187
187
|
token,
|
|
188
188
|
balance: 1n
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
|
-
logger?.debug(
|
|
191
|
+
logger?.debug(
|
|
192
|
+
{
|
|
193
|
+
minDebt: this.sdk.tokensMeta.formatBN(underlying, minDebt),
|
|
194
|
+
leverage: leverage.toString(),
|
|
195
|
+
expectedUnderlyingBalance: this.sdk.tokensMeta.formatBN(
|
|
196
|
+
underlying,
|
|
197
|
+
expectedUnderlyingBalance
|
|
198
|
+
)
|
|
199
|
+
},
|
|
200
|
+
"looking for open strategy"
|
|
201
|
+
);
|
|
192
202
|
const strategy = await this.sdk.routerFor(cm).findOpenStrategyPath({
|
|
193
203
|
creditManager: cm.creditManager,
|
|
194
204
|
expectedBalances,
|
|
@@ -159,22 +159,32 @@ class AccountOpener extends SDKConstruct {
|
|
|
159
159
|
target: symbol
|
|
160
160
|
});
|
|
161
161
|
const leverage = this.#getLeverage(input);
|
|
162
|
-
logger?.debug(`using leverage ${leverage}`);
|
|
163
162
|
const { minDebt, underlying } = cm.creditFacade;
|
|
163
|
+
const expectedUnderlyingBalance = minDebt * leverage / PERCENTAGE_FACTOR;
|
|
164
164
|
const expectedBalances = [];
|
|
165
165
|
const leftoverBalances = [];
|
|
166
166
|
for (const t of cm.creditManager.collateralTokens) {
|
|
167
167
|
const token = t;
|
|
168
168
|
expectedBalances.push({
|
|
169
169
|
token,
|
|
170
|
-
balance: token === underlying ?
|
|
170
|
+
balance: token === underlying ? expectedUnderlyingBalance : 1n
|
|
171
171
|
});
|
|
172
172
|
leftoverBalances.push({
|
|
173
173
|
token,
|
|
174
174
|
balance: 1n
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
|
-
logger?.debug(
|
|
177
|
+
logger?.debug(
|
|
178
|
+
{
|
|
179
|
+
minDebt: this.sdk.tokensMeta.formatBN(underlying, minDebt),
|
|
180
|
+
leverage: leverage.toString(),
|
|
181
|
+
expectedUnderlyingBalance: this.sdk.tokensMeta.formatBN(
|
|
182
|
+
underlying,
|
|
183
|
+
expectedUnderlyingBalance
|
|
184
|
+
)
|
|
185
|
+
},
|
|
186
|
+
"looking for open strategy"
|
|
187
|
+
);
|
|
178
188
|
const strategy = await this.sdk.routerFor(cm).findOpenStrategyPath({
|
|
179
189
|
creditManager: cm.creditManager,
|
|
180
190
|
expectedBalances,
|