@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/index.js
CHANGED
|
@@ -7712,9 +7712,7 @@ function resolveAsset(registry, chain, asset) {
|
|
|
7712
7712
|
return registry.resolveToken(chain, asset).address;
|
|
7713
7713
|
}
|
|
7714
7714
|
async function collectLendingRates(registry, chainName, rpc, assetAddr) {
|
|
7715
|
-
const protos = registry.getProtocolsForChain(chainName).filter(
|
|
7716
|
-
(p) => p.category === ProtocolCategory.Lending && (p.interface === "aave_v3" || p.interface === "aave_v3_isolated")
|
|
7717
|
-
);
|
|
7715
|
+
const protos = registry.getProtocolsForChain(chainName).filter((p) => p.category === ProtocolCategory.Lending);
|
|
7718
7716
|
const results = [];
|
|
7719
7717
|
let first = true;
|
|
7720
7718
|
for (const proto of protos) {
|
|
@@ -7802,7 +7800,7 @@ async function runYieldScan(registry, asset, output) {
|
|
|
7802
7800
|
} catch {
|
|
7803
7801
|
return [];
|
|
7804
7802
|
}
|
|
7805
|
-
const protos = registry.getProtocolsForChain(chainName).filter((p) => p.category === ProtocolCategory.Lending
|
|
7803
|
+
const protos = registry.getProtocolsForChain(chainName).filter((p) => p.category === ProtocolCategory.Lending);
|
|
7806
7804
|
if (protos.length === 0) return [];
|
|
7807
7805
|
const rpc = chain.effectiveRpcUrl();
|
|
7808
7806
|
const rates = [];
|
|
@@ -7885,7 +7883,7 @@ async function scanRatesForExecute(registry, asset) {
|
|
|
7885
7883
|
} catch {
|
|
7886
7884
|
return [];
|
|
7887
7885
|
}
|
|
7888
|
-
const protos = registry.getProtocolsForChain(chainName).filter((p) => p.category === ProtocolCategory.Lending
|
|
7886
|
+
const protos = registry.getProtocolsForChain(chainName).filter((p) => p.category === ProtocolCategory.Lending);
|
|
7889
7887
|
if (protos.length === 0) return [];
|
|
7890
7888
|
const rpc = chain.effectiveRpcUrl();
|
|
7891
7889
|
const rates = [];
|
|
@@ -7917,7 +7915,38 @@ async function scanRatesForExecute(registry, asset) {
|
|
|
7917
7915
|
}
|
|
7918
7916
|
function registerYield(parent, getOpts, makeExecutor2) {
|
|
7919
7917
|
const yieldCmd = parent.command("yield").description("Yield operations: compare, scan, optimize, execute");
|
|
7920
|
-
yieldCmd.
|
|
7918
|
+
yieldCmd.option("--asset <token>", "Token symbol or address", "USDC").action(async (opts) => {
|
|
7919
|
+
try {
|
|
7920
|
+
const registry = Registry.loadEmbedded();
|
|
7921
|
+
const asset = opts.asset;
|
|
7922
|
+
const allRates = [];
|
|
7923
|
+
for (const [chainKey] of registry.chains) {
|
|
7924
|
+
try {
|
|
7925
|
+
const chain = registry.getChain(chainKey);
|
|
7926
|
+
const rpc = chain.effectiveRpcUrl();
|
|
7927
|
+
let assetAddr;
|
|
7928
|
+
try {
|
|
7929
|
+
assetAddr = resolveAsset(registry, chainKey, asset);
|
|
7930
|
+
} catch {
|
|
7931
|
+
continue;
|
|
7932
|
+
}
|
|
7933
|
+
const rates = await collectLendingRates(registry, chainKey, rpc, assetAddr);
|
|
7934
|
+
for (const r of rates) {
|
|
7935
|
+
if (r.supply_apy > 0) {
|
|
7936
|
+
allRates.push({ chain: chain.name, protocol: r.protocol, supply_apy: r.supply_apy, borrow_variable_apy: r.borrow_variable_apy });
|
|
7937
|
+
}
|
|
7938
|
+
}
|
|
7939
|
+
} catch {
|
|
7940
|
+
}
|
|
7941
|
+
}
|
|
7942
|
+
allRates.sort((a, b) => b.supply_apy - a.supply_apy);
|
|
7943
|
+
const best = allRates[0] ? `${allRates[0].protocol} on ${allRates[0].chain}` : null;
|
|
7944
|
+
printOutput({ asset, chains_scanned: registry.chains.size, rates: allRates, best_supply: best }, getOpts());
|
|
7945
|
+
} catch (err) {
|
|
7946
|
+
printOutput({ error: String(err) }, getOpts());
|
|
7947
|
+
}
|
|
7948
|
+
});
|
|
7949
|
+
yieldCmd.command("compare").description("Compare lending rates across protocols for an asset").option("--asset <token>", "Token symbol or address", "USDC").action(async (opts) => {
|
|
7921
7950
|
try {
|
|
7922
7951
|
const registry = Registry.loadEmbedded();
|
|
7923
7952
|
const chainName = (parent.opts().chain ?? "hyperevm").toLowerCase();
|
|
@@ -8093,7 +8122,7 @@ function registerYield(parent, getOpts, makeExecutor2) {
|
|
|
8093
8122
|
return;
|
|
8094
8123
|
}
|
|
8095
8124
|
} else {
|
|
8096
|
-
const candidates = registry.getProtocolsForChain(chainName).filter((p) => p.category === ProtocolCategory.Lending
|
|
8125
|
+
const candidates = registry.getProtocolsForChain(chainName).filter((p) => p.category === ProtocolCategory.Lending);
|
|
8097
8126
|
if (candidates.length === 0) {
|
|
8098
8127
|
printOutput({ error: `No aave_v3 lending protocol found on ${chainName}` }, getOpts());
|
|
8099
8128
|
process.exit(1);
|
|
@@ -10964,7 +10993,7 @@ var BANNER = `
|
|
|
10964
10993
|
\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
|
|
10965
10994
|
\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
|
|
10966
10995
|
|
|
10967
|
-
2 chains \xB7
|
|
10996
|
+
2 chains \xB7 21 protocols \xB7 by HypurrQuant
|
|
10968
10997
|
|
|
10969
10998
|
Scan exploits, swap tokens, bridge assets, track whales,
|
|
10970
10999
|
compare yields \u2014 all from your terminal.
|