@gearbox-protocol/sdk 3.0.0-vfour.157 → 3.0.0-vfour.158
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/cjs/dev/index.cjs +17 -3
- package/dist/esm/dev/index.mjs +17 -3
- package/package.json +1 -1
package/dist/cjs/dev/index.cjs
CHANGED
|
@@ -231,7 +231,21 @@ var AccountOpener = class {
|
|
|
231
231
|
}
|
|
232
232
|
async #approve(token, cm) {
|
|
233
233
|
const borrower = await this.#getBorrower();
|
|
234
|
+
const symbol = this.#service.sdk.tokensMeta.symbol(token);
|
|
234
235
|
try {
|
|
236
|
+
if (symbol === "USDT") {
|
|
237
|
+
const hash2 = await this.#anvil.writeContract({
|
|
238
|
+
account: borrower,
|
|
239
|
+
address: token,
|
|
240
|
+
abi: sdk.ierc20Abi,
|
|
241
|
+
functionName: "approve",
|
|
242
|
+
args: [cm.creditManager.address, 0n],
|
|
243
|
+
chain: this.#anvil.chain
|
|
244
|
+
});
|
|
245
|
+
await this.#anvil.waitForTransactionReceipt({
|
|
246
|
+
hash: hash2
|
|
247
|
+
});
|
|
248
|
+
}
|
|
235
249
|
const hash = await this.#anvil.writeContract({
|
|
236
250
|
account: borrower,
|
|
237
251
|
address: token,
|
|
@@ -245,16 +259,16 @@ var AccountOpener = class {
|
|
|
245
259
|
});
|
|
246
260
|
if (receipt.status === "reverted") {
|
|
247
261
|
this.#logger?.error(
|
|
248
|
-
`failed to allowed credit manager ${cm.creditManager.name} to spend ${token}, tx reverted: ${hash}`
|
|
262
|
+
`failed to allowed credit manager ${cm.creditManager.name} to spend ${symbol} (${token}), tx reverted: ${hash}`
|
|
249
263
|
);
|
|
250
264
|
} else {
|
|
251
265
|
this.#logger?.debug(
|
|
252
|
-
`allowed credit manager ${cm.creditManager.name} to spend ${token}, tx: ${hash}`
|
|
266
|
+
`allowed credit manager ${cm.creditManager.name} to spend ${symbol} (${token}), tx: ${hash}`
|
|
253
267
|
);
|
|
254
268
|
}
|
|
255
269
|
} catch (e) {
|
|
256
270
|
this.#logger?.error(
|
|
257
|
-
`failed to allowed credit manager ${cm.creditManager.name} to spend ${token}: ${e}`
|
|
271
|
+
`failed to allowed credit manager ${cm.creditManager.name} to spend ${symbol} (${token}): ${e}`
|
|
258
272
|
);
|
|
259
273
|
}
|
|
260
274
|
}
|
package/dist/esm/dev/index.mjs
CHANGED
|
@@ -229,7 +229,21 @@ var AccountOpener = class {
|
|
|
229
229
|
}
|
|
230
230
|
async #approve(token, cm) {
|
|
231
231
|
const borrower = await this.#getBorrower();
|
|
232
|
+
const symbol = this.#service.sdk.tokensMeta.symbol(token);
|
|
232
233
|
try {
|
|
234
|
+
if (symbol === "USDT") {
|
|
235
|
+
const hash2 = await this.#anvil.writeContract({
|
|
236
|
+
account: borrower,
|
|
237
|
+
address: token,
|
|
238
|
+
abi: ierc20Abi,
|
|
239
|
+
functionName: "approve",
|
|
240
|
+
args: [cm.creditManager.address, 0n],
|
|
241
|
+
chain: this.#anvil.chain
|
|
242
|
+
});
|
|
243
|
+
await this.#anvil.waitForTransactionReceipt({
|
|
244
|
+
hash: hash2
|
|
245
|
+
});
|
|
246
|
+
}
|
|
233
247
|
const hash = await this.#anvil.writeContract({
|
|
234
248
|
account: borrower,
|
|
235
249
|
address: token,
|
|
@@ -243,16 +257,16 @@ var AccountOpener = class {
|
|
|
243
257
|
});
|
|
244
258
|
if (receipt.status === "reverted") {
|
|
245
259
|
this.#logger?.error(
|
|
246
|
-
`failed to allowed credit manager ${cm.creditManager.name} to spend ${token}, tx reverted: ${hash}`
|
|
260
|
+
`failed to allowed credit manager ${cm.creditManager.name} to spend ${symbol} (${token}), tx reverted: ${hash}`
|
|
247
261
|
);
|
|
248
262
|
} else {
|
|
249
263
|
this.#logger?.debug(
|
|
250
|
-
`allowed credit manager ${cm.creditManager.name} to spend ${token}, tx: ${hash}`
|
|
264
|
+
`allowed credit manager ${cm.creditManager.name} to spend ${symbol} (${token}), tx: ${hash}`
|
|
251
265
|
);
|
|
252
266
|
}
|
|
253
267
|
} catch (e) {
|
|
254
268
|
this.#logger?.error(
|
|
255
|
-
`failed to allowed credit manager ${cm.creditManager.name} to spend ${token}: ${e}`
|
|
269
|
+
`failed to allowed credit manager ${cm.creditManager.name} to spend ${symbol} (${token}): ${e}`
|
|
256
270
|
);
|
|
257
271
|
}
|
|
258
272
|
}
|