@hypurrquant/defi-cli 1.0.5 → 1.0.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.
- package/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/dist/main.js +15 -5
- package/dist/main.js.map +1 -1
- package/dist/mcp-server.js +7 -5
- package/dist/mcp-server.js.map +1 -1
- package/package.json +1 -1
- package/skills/defi-cli/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5735,7 +5735,7 @@ var init_dist2 = __esm({
|
|
|
5735
5735
|
total_borrow: 0n
|
|
5736
5736
|
};
|
|
5737
5737
|
}
|
|
5738
|
-
const [supplyRate, borrowRate,
|
|
5738
|
+
const [supplyRate, borrowRate, totalSupplyVtoken, totalBorrows, exchangeRate] = await Promise.all([
|
|
5739
5739
|
client.readContract({ address: vtoken, abi: CTOKEN_ABI, functionName: "supplyRatePerBlock" }).catch((e) => {
|
|
5740
5740
|
throw DefiError.rpcError(`[${this.protocolName}] supplyRatePerBlock failed: ${e}`);
|
|
5741
5741
|
}),
|
|
@@ -5743,22 +5743,24 @@ var init_dist2 = __esm({
|
|
|
5743
5743
|
throw DefiError.rpcError(`[${this.protocolName}] borrowRatePerBlock failed: ${e}`);
|
|
5744
5744
|
}),
|
|
5745
5745
|
client.readContract({ address: vtoken, abi: CTOKEN_ABI, functionName: "totalSupply" }).catch(() => 0n),
|
|
5746
|
-
client.readContract({ address: vtoken, abi: CTOKEN_ABI, functionName: "totalBorrows" }).catch(() => 0n)
|
|
5746
|
+
client.readContract({ address: vtoken, abi: CTOKEN_ABI, functionName: "totalBorrows" }).catch(() => 0n),
|
|
5747
|
+
client.readContract({ address: vtoken, abi: CTOKEN_ABI, functionName: "exchangeRateStored" }).catch(() => 0n)
|
|
5747
5748
|
]);
|
|
5748
5749
|
const supplyPerBlock = Number(supplyRate) / 1e18;
|
|
5749
5750
|
const borrowPerBlock = Number(borrowRate) / 1e18;
|
|
5750
5751
|
const supplyApy = supplyPerBlock * BSC_BLOCKS_PER_YEAR * 100;
|
|
5751
5752
|
const borrowApy = borrowPerBlock * BSC_BLOCKS_PER_YEAR * 100;
|
|
5752
|
-
const
|
|
5753
|
+
const totalSupplyUnderlying = exchangeRate > 0n ? totalSupplyVtoken * exchangeRate / 10n ** 18n : totalSupplyVtoken;
|
|
5754
|
+
const supplyF = Number(totalSupplyUnderlying);
|
|
5753
5755
|
const borrowF = Number(totalBorrows);
|
|
5754
|
-
const utilization = supplyF > 0 ? borrowF / supplyF * 100 : 0;
|
|
5756
|
+
const utilization = supplyF > 0 ? Math.round(borrowF / supplyF * 1e4) / 100 : 0;
|
|
5755
5757
|
return {
|
|
5756
5758
|
protocol: this.protocolName,
|
|
5757
5759
|
asset,
|
|
5758
5760
|
supply_apy: supplyApy,
|
|
5759
5761
|
borrow_variable_apy: borrowApy,
|
|
5760
5762
|
utilization,
|
|
5761
|
-
total_supply:
|
|
5763
|
+
total_supply: totalSupplyUnderlying,
|
|
5762
5764
|
total_borrow: totalBorrows
|
|
5763
5765
|
};
|
|
5764
5766
|
}
|
|
@@ -11092,6 +11094,14 @@ function registerBridge(parent, getOpts) {
|
|
|
11092
11094
|
}
|
|
11093
11095
|
const amountUsdc = Number(BigInt(opts.amount)) / 1e6;
|
|
11094
11096
|
const { fee, maxFeeSubunits } = await getCctpFeeEstimate(srcDomain, dstDomain, amountUsdc);
|
|
11097
|
+
if (BigInt(opts.amount) <= maxFeeSubunits) {
|
|
11098
|
+
printOutput({
|
|
11099
|
+
error: `CCTP: amount ${opts.amount} (${amountUsdc} USDC) is below the minimum bridge fee of ${maxFeeSubunits} (${fee} USDC). Increase --amount.`,
|
|
11100
|
+
minimum_amount_wei: maxFeeSubunits.toString(),
|
|
11101
|
+
minimum_amount_usdc: fee
|
|
11102
|
+
}, getOpts());
|
|
11103
|
+
return;
|
|
11104
|
+
}
|
|
11095
11105
|
const recipientPadded = `0x${"0".repeat(24)}${recipient.replace("0x", "").toLowerCase()}`;
|
|
11096
11106
|
const { encodeFunctionData: encodeFunctionData30, parseAbi: parseAbi34 } = await import("viem");
|
|
11097
11107
|
const tokenMessengerAbi = parseAbi34([
|