@gearbox-protocol/sdk 3.0.0-vfour.45 → 3.0.0-vfour.47
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 +94 -3
- package/dist/cjs/dev/index.d.ts +9 -3
- package/dist/cjs/sdk/index.cjs +410 -729
- package/dist/cjs/sdk/index.d.ts +1553 -1831
- package/dist/esm/dev/index.d.mts +9 -3
- package/dist/esm/dev/index.mjs +94 -4
- package/dist/esm/sdk/index.d.mts +1553 -1831
- package/dist/esm/sdk/index.mjs +412 -715
- package/package.json +1 -1
package/dist/cjs/dev/index.cjs
CHANGED
|
@@ -1475,7 +1475,7 @@ var iCreditManagerV3Abi = [
|
|
|
1475
1475
|
// src/dev/setLTs.ts
|
|
1476
1476
|
async function setLTs(sdk, cm, newLTs, logger) {
|
|
1477
1477
|
const aclAddr = await sdk.provider.publicClient.readContract({
|
|
1478
|
-
address: cm.creditConfigurator
|
|
1478
|
+
address: cm.creditConfigurator,
|
|
1479
1479
|
abi: iaclTraitAbi,
|
|
1480
1480
|
functionName: "acl"
|
|
1481
1481
|
});
|
|
@@ -1498,14 +1498,14 @@ async function setLTs(sdk, cm, newLTs, logger) {
|
|
|
1498
1498
|
for (const [t, lt] of Object.entries(newLTs)) {
|
|
1499
1499
|
await anvil.writeContract({
|
|
1500
1500
|
chain: anvil.chain,
|
|
1501
|
-
address: cm.creditConfigurator
|
|
1501
|
+
address: cm.creditConfigurator,
|
|
1502
1502
|
account: configuratorAddr,
|
|
1503
1503
|
abi: iCreditConfiguratorV3Abi,
|
|
1504
1504
|
functionName: "setLiquidationThreshold",
|
|
1505
1505
|
args: [t, lt]
|
|
1506
1506
|
});
|
|
1507
1507
|
const newLT = await anvil.readContract({
|
|
1508
|
-
address: cm.
|
|
1508
|
+
address: cm.address,
|
|
1509
1509
|
abi: iCreditManagerV3Abi,
|
|
1510
1510
|
functionName: "liquidationThresholds",
|
|
1511
1511
|
args: [t]
|
|
@@ -1518,10 +1518,101 @@ async function setLTs(sdk, cm, newLTs, logger) {
|
|
|
1518
1518
|
address: configuratorAddr
|
|
1519
1519
|
});
|
|
1520
1520
|
}
|
|
1521
|
+
async function setLTZero(sdk$1, cm, logger) {
|
|
1522
|
+
const aclAddr = await sdk$1.provider.publicClient.readContract({
|
|
1523
|
+
address: cm.creditConfigurator,
|
|
1524
|
+
abi: iaclTraitAbi,
|
|
1525
|
+
functionName: "acl"
|
|
1526
|
+
});
|
|
1527
|
+
const configuratorAddr = await sdk$1.provider.publicClient.readContract({
|
|
1528
|
+
address: aclAddr,
|
|
1529
|
+
abi: iaclAbi,
|
|
1530
|
+
functionName: "owner"
|
|
1531
|
+
});
|
|
1532
|
+
const anvil = createAnvilClient({
|
|
1533
|
+
transport: sdk$1.provider.transport,
|
|
1534
|
+
chain: sdk$1.provider.chain
|
|
1535
|
+
});
|
|
1536
|
+
await anvil.impersonateAccount({
|
|
1537
|
+
address: configuratorAddr
|
|
1538
|
+
});
|
|
1539
|
+
await anvil.setBalance({
|
|
1540
|
+
address: configuratorAddr,
|
|
1541
|
+
value: viem.parseEther("100")
|
|
1542
|
+
});
|
|
1543
|
+
let hash = await anvil.writeContract({
|
|
1544
|
+
chain: anvil.chain,
|
|
1545
|
+
address: cm.creditConfigurator,
|
|
1546
|
+
account: configuratorAddr,
|
|
1547
|
+
abi: iCreditConfiguratorV3Abi,
|
|
1548
|
+
functionName: "setFees",
|
|
1549
|
+
args: [
|
|
1550
|
+
cm.feeInterest,
|
|
1551
|
+
cm.liquidationDiscount - 1,
|
|
1552
|
+
Number(sdk.PERCENTAGE_FACTOR) - cm.liquidationDiscount,
|
|
1553
|
+
cm.feeLiquidationExpired,
|
|
1554
|
+
cm.liquidationDiscountExpired
|
|
1555
|
+
]
|
|
1556
|
+
});
|
|
1557
|
+
await anvil.waitForTransactionReceipt({ hash });
|
|
1558
|
+
logger?.debug(`[${cm.name}] setFees part 2`);
|
|
1559
|
+
hash = await anvil.writeContract({
|
|
1560
|
+
chain: anvil.chain,
|
|
1561
|
+
address: cm.creditConfigurator,
|
|
1562
|
+
account: configuratorAddr,
|
|
1563
|
+
abi: iCreditConfiguratorV3Abi,
|
|
1564
|
+
functionName: "setFees",
|
|
1565
|
+
args: [
|
|
1566
|
+
cm.feeInterest,
|
|
1567
|
+
cm.feeLiquidation,
|
|
1568
|
+
Number(sdk.PERCENTAGE_FACTOR) - cm.liquidationDiscount,
|
|
1569
|
+
cm.feeLiquidationExpired,
|
|
1570
|
+
cm.liquidationDiscountExpired
|
|
1571
|
+
]
|
|
1572
|
+
});
|
|
1573
|
+
await anvil.waitForTransactionReceipt({ hash });
|
|
1574
|
+
logger?.debug(`[${cm.name}] setFees done`);
|
|
1575
|
+
await anvil.impersonateAccount({
|
|
1576
|
+
address: cm.creditConfigurator
|
|
1577
|
+
});
|
|
1578
|
+
await anvil.setBalance({
|
|
1579
|
+
address: cm.creditConfigurator,
|
|
1580
|
+
value: viem.parseEther("100")
|
|
1581
|
+
});
|
|
1582
|
+
logger?.debug(
|
|
1583
|
+
`[${cm.name}] impresonating creditConfigurator ${cm.creditConfigurator}`
|
|
1584
|
+
);
|
|
1585
|
+
logger?.debug(`[${cm.name}] setting liquidation threshold`);
|
|
1586
|
+
hash = await anvil.writeContract({
|
|
1587
|
+
chain: anvil.chain,
|
|
1588
|
+
address: cm.address,
|
|
1589
|
+
account: cm.creditConfigurator,
|
|
1590
|
+
abi: iCreditManagerV3Abi,
|
|
1591
|
+
functionName: "setCollateralTokenData",
|
|
1592
|
+
args: [cm.underlying, 1, 1, Number(2n ** 40n - 1n), 0]
|
|
1593
|
+
});
|
|
1594
|
+
await anvil.waitForTransactionReceipt({ hash });
|
|
1595
|
+
logger?.debug(`[${cm.name}] setting configurator ${cm.creditConfigurator}`);
|
|
1596
|
+
hash = await anvil.writeContract({
|
|
1597
|
+
chain: anvil.chain,
|
|
1598
|
+
address: cm.address,
|
|
1599
|
+
account: cm.creditConfigurator,
|
|
1600
|
+
abi: iCreditManagerV3Abi,
|
|
1601
|
+
functionName: "setCreditConfigurator",
|
|
1602
|
+
args: [cm.creditConfigurator]
|
|
1603
|
+
});
|
|
1604
|
+
await anvil.waitForTransactionReceipt({ hash });
|
|
1605
|
+
logger?.debug(`[${cm.name}] done`);
|
|
1606
|
+
await anvil.stopImpersonatingAccount({
|
|
1607
|
+
address: cm.creditConfigurator
|
|
1608
|
+
});
|
|
1609
|
+
await anvil.stopImpersonatingAccount({ address: configuratorAddr });
|
|
1610
|
+
}
|
|
1521
1611
|
|
|
1522
1612
|
exports.anvilNodeInfo = anvilNodeInfo;
|
|
1523
1613
|
exports.calcLiquidatableLTs = calcLiquidatableLTs;
|
|
1524
1614
|
exports.createAnvilClient = createAnvilClient;
|
|
1525
1615
|
exports.evmMineDetailed = evmMineDetailed;
|
|
1526
1616
|
exports.isAnvil = isAnvil;
|
|
1617
|
+
exports.setLTZero = setLTZero;
|
|
1527
1618
|
exports.setLTs = setLTs;
|
package/dist/cjs/dev/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, TestRpcSchema, Hex, Block, Prettify, Client, Transport, Chain, TestActions, PublicClient, WalletClient } from 'viem';
|
|
2
|
-
import { GearboxSDK, CreditAccountData, ILogger,
|
|
2
|
+
import { GearboxSDK, CreditAccountData, ILogger, CreditManagerState } from '../sdk';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Given credit accounts, calculates new liquidation thresholds that needs to be set to drop account health factor a bit to make it eligible for partial liquidation
|
|
@@ -81,6 +81,12 @@ declare function evmMineDetailed(client: Client<any, any, any, AnvilRPCSchema, a
|
|
|
81
81
|
* @param cm
|
|
82
82
|
* @param newLTs
|
|
83
83
|
*/
|
|
84
|
-
declare function setLTs(sdk: GearboxSDK, cm:
|
|
84
|
+
declare function setLTs(sdk: GearboxSDK, cm: CreditManagerState & {
|
|
85
|
+
address: Address;
|
|
86
|
+
}, newLTs: Record<Address, number>, logger?: ILogger): Promise<void>;
|
|
85
87
|
|
|
86
|
-
|
|
88
|
+
declare function setLTZero(sdk: GearboxSDK, cm: CreditManagerState & {
|
|
89
|
+
address: Address;
|
|
90
|
+
}, logger?: ILogger): Promise<void>;
|
|
91
|
+
|
|
92
|
+
export { type AnvilActions, type AnvilClient, type AnvilClientConfig, type AnvilNodeInfo, type AnvilRPCSchema, anvilNodeInfo, calcLiquidatableLTs, createAnvilClient, evmMineDetailed, isAnvil, setLTZero, setLTs };
|