@hypurrquant/defi-cli 0.3.1 → 0.3.3
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 +37 -8
- package/dist/index.js.map +1 -1
- package/dist/main.js +37 -8
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
- package/config/protocols/lending/euler.toml +0 -20
- package/config/protocols/lending/hyperyield_hyperevm.toml +0 -14
- package/config/protocols/lending/primefi_hyperevm.toml +0 -13
- package/config/protocols/lending/purrlend_hyperevm.toml +0 -14
package/dist/main.js
CHANGED
|
@@ -7716,9 +7716,7 @@ function resolveAsset(registry, chain, asset) {
|
|
|
7716
7716
|
return registry.resolveToken(chain, asset).address;
|
|
7717
7717
|
}
|
|
7718
7718
|
async function collectLendingRates(registry, chainName, rpc, assetAddr) {
|
|
7719
|
-
const protos = registry.getProtocolsForChain(chainName).filter(
|
|
7720
|
-
(p) => p.category === ProtocolCategory.Lending && (p.interface === "aave_v3" || p.interface === "aave_v3_isolated")
|
|
7721
|
-
);
|
|
7719
|
+
const protos = registry.getProtocolsForChain(chainName).filter((p) => p.category === ProtocolCategory.Lending);
|
|
7722
7720
|
const results = [];
|
|
7723
7721
|
let first = true;
|
|
7724
7722
|
for (const proto of protos) {
|
|
@@ -7806,7 +7804,7 @@ async function runYieldScan(registry, asset, output) {
|
|
|
7806
7804
|
} catch {
|
|
7807
7805
|
return [];
|
|
7808
7806
|
}
|
|
7809
|
-
const protos = registry.getProtocolsForChain(chainName).filter((p) => p.category === ProtocolCategory.Lending
|
|
7807
|
+
const protos = registry.getProtocolsForChain(chainName).filter((p) => p.category === ProtocolCategory.Lending);
|
|
7810
7808
|
if (protos.length === 0) return [];
|
|
7811
7809
|
const rpc = chain.effectiveRpcUrl();
|
|
7812
7810
|
const rates = [];
|
|
@@ -7889,7 +7887,7 @@ async function scanRatesForExecute(registry, asset) {
|
|
|
7889
7887
|
} catch {
|
|
7890
7888
|
return [];
|
|
7891
7889
|
}
|
|
7892
|
-
const protos = registry.getProtocolsForChain(chainName).filter((p) => p.category === ProtocolCategory.Lending
|
|
7890
|
+
const protos = registry.getProtocolsForChain(chainName).filter((p) => p.category === ProtocolCategory.Lending);
|
|
7893
7891
|
if (protos.length === 0) return [];
|
|
7894
7892
|
const rpc = chain.effectiveRpcUrl();
|
|
7895
7893
|
const rates = [];
|
|
@@ -7921,7 +7919,38 @@ async function scanRatesForExecute(registry, asset) {
|
|
|
7921
7919
|
}
|
|
7922
7920
|
function registerYield(parent, getOpts, makeExecutor2) {
|
|
7923
7921
|
const yieldCmd = parent.command("yield").description("Yield operations: compare, scan, optimize, execute");
|
|
7924
|
-
yieldCmd.
|
|
7922
|
+
yieldCmd.option("--asset <token>", "Token symbol or address", "USDC").action(async (opts) => {
|
|
7923
|
+
try {
|
|
7924
|
+
const registry = Registry.loadEmbedded();
|
|
7925
|
+
const asset = opts.asset;
|
|
7926
|
+
const allRates = [];
|
|
7927
|
+
for (const [chainKey] of registry.chains) {
|
|
7928
|
+
try {
|
|
7929
|
+
const chain = registry.getChain(chainKey);
|
|
7930
|
+
const rpc = chain.effectiveRpcUrl();
|
|
7931
|
+
let assetAddr;
|
|
7932
|
+
try {
|
|
7933
|
+
assetAddr = resolveAsset(registry, chainKey, asset);
|
|
7934
|
+
} catch {
|
|
7935
|
+
continue;
|
|
7936
|
+
}
|
|
7937
|
+
const rates = await collectLendingRates(registry, chainKey, rpc, assetAddr);
|
|
7938
|
+
for (const r of rates) {
|
|
7939
|
+
if (r.supply_apy > 0) {
|
|
7940
|
+
allRates.push({ chain: chain.name, protocol: r.protocol, supply_apy: r.supply_apy, borrow_variable_apy: r.borrow_variable_apy });
|
|
7941
|
+
}
|
|
7942
|
+
}
|
|
7943
|
+
} catch {
|
|
7944
|
+
}
|
|
7945
|
+
}
|
|
7946
|
+
allRates.sort((a, b) => b.supply_apy - a.supply_apy);
|
|
7947
|
+
const best = allRates[0] ? `${allRates[0].protocol} on ${allRates[0].chain}` : null;
|
|
7948
|
+
printOutput({ asset, chains_scanned: registry.chains.size, rates: allRates, best_supply: best }, getOpts());
|
|
7949
|
+
} catch (err) {
|
|
7950
|
+
printOutput({ error: String(err) }, getOpts());
|
|
7951
|
+
}
|
|
7952
|
+
});
|
|
7953
|
+
yieldCmd.command("compare").description("Compare lending rates across protocols for an asset").option("--asset <token>", "Token symbol or address", "USDC").action(async (opts) => {
|
|
7925
7954
|
try {
|
|
7926
7955
|
const registry = Registry.loadEmbedded();
|
|
7927
7956
|
const chainName = (parent.opts().chain ?? "hyperevm").toLowerCase();
|
|
@@ -8097,7 +8126,7 @@ function registerYield(parent, getOpts, makeExecutor2) {
|
|
|
8097
8126
|
return;
|
|
8098
8127
|
}
|
|
8099
8128
|
} else {
|
|
8100
|
-
const candidates = registry.getProtocolsForChain(chainName).filter((p) => p.category === ProtocolCategory.Lending
|
|
8129
|
+
const candidates = registry.getProtocolsForChain(chainName).filter((p) => p.category === ProtocolCategory.Lending);
|
|
8101
8130
|
if (candidates.length === 0) {
|
|
8102
8131
|
printOutput({ error: `No aave_v3 lending protocol found on ${chainName}` }, getOpts());
|
|
8103
8132
|
process.exit(1);
|
|
@@ -10968,7 +10997,7 @@ var BANNER = `
|
|
|
10968
10997
|
\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551
|
|
10969
10998
|
\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D
|
|
10970
10999
|
|
|
10971
|
-
2 chains \xB7
|
|
11000
|
+
2 chains \xB7 21 protocols \xB7 by HypurrQuant
|
|
10972
11001
|
|
|
10973
11002
|
Scan exploits, swap tokens, bridge assets, track whales,
|
|
10974
11003
|
compare yields \u2014 all from your terminal.
|