@1delta/margin-fetcher 5.0.31 → 5.0.32
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 +94 -56
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -63972,6 +63972,10 @@ function parseMarket2(m, chainId, prices, tokenList, apiAssets, decimalsOnChain,
|
|
|
63972
63972
|
apiAssets,
|
|
63973
63973
|
decimalsOnChain
|
|
63974
63974
|
);
|
|
63975
|
+
const apiName = typeof m.name === "string" && m.name ? m.name : void 0;
|
|
63976
|
+
const assetSymbol = assetMeta.symbol ?? apiName;
|
|
63977
|
+
const assetName = assetMeta.name ?? apiName;
|
|
63978
|
+
const assetLogoURI = assetMeta.logoURI ?? (typeof m.icon === "string" && m.icon ? m.icon : void 0);
|
|
63975
63979
|
const decimals = ptMeta.decimals;
|
|
63976
63980
|
if (decimals === void 0) return null;
|
|
63977
63981
|
const assetDecimals = assetMeta.decimals ?? decimals;
|
|
@@ -64021,13 +64025,13 @@ function parseMarket2(m, chainId, prices, tokenList, apiAssets, decimalsOnChain,
|
|
|
64021
64025
|
// everything else downstream reads); synthesize a minimal one from
|
|
64022
64026
|
// Pendle's metadata otherwise, so `stampVaultClassification` still has a
|
|
64023
64027
|
// symbol to read for the stable/volatile call.
|
|
64024
|
-
asset: tokenList[underlying.address] ?? (
|
|
64028
|
+
asset: tokenList[underlying.address] ?? (assetSymbol || assetMeta.decimals !== void 0 ? {
|
|
64025
64029
|
chainId,
|
|
64026
64030
|
address: underlying.address,
|
|
64027
|
-
symbol:
|
|
64028
|
-
name:
|
|
64031
|
+
symbol: assetSymbol,
|
|
64032
|
+
name: assetName,
|
|
64029
64033
|
decimals: assetDecimals,
|
|
64030
|
-
logoURI:
|
|
64034
|
+
logoURI: assetLogoURI
|
|
64031
64035
|
} : void 0),
|
|
64032
64036
|
priceUsd,
|
|
64033
64037
|
ptPriceUsd,
|
|
@@ -68780,15 +68784,25 @@ var liquityAdapter = {
|
|
|
68780
68784
|
description: "Charged when the Stability Pool is empty and the debt is redistributed across the branch\u2019s other troves. Materially worse than the Stability-Pool path."
|
|
68781
68785
|
} : null
|
|
68782
68786
|
].filter(Boolean);
|
|
68787
|
+
const isCollateralRow = input.collateralActive !== false;
|
|
68783
68788
|
return {
|
|
68784
|
-
supply: {
|
|
68789
|
+
supply: isCollateralRow ? {
|
|
68790
|
+
role: "collateral",
|
|
68791
|
+
availability: { opensWith: "both-legs" },
|
|
68792
|
+
counterparty: { kind: "cdp", solvency: "overcollateralized" }
|
|
68793
|
+
} : {
|
|
68785
68794
|
// The Stability Pool is an earn position, never collateral.
|
|
68786
68795
|
role: "yield",
|
|
68787
68796
|
exit: { mode: "instant", settlement: "sync", partialAllowed: true },
|
|
68797
|
+
availability: { opensWith: "standalone" },
|
|
68788
68798
|
counterparty: { kind: "cdp", solvency: "overcollateralized" },
|
|
68789
68799
|
principal: { protected: false, risks: ["bad-debt"] }
|
|
68790
68800
|
},
|
|
68791
68801
|
borrow: {
|
|
68802
|
+
// `openTrove` takes collateral, debt AND the interest rate together, so
|
|
68803
|
+
// a bare borrow has no trove to draw against. Reaches the debt row
|
|
68804
|
+
// only — the collateral row has no borrow side to refine.
|
|
68805
|
+
availability: { opensWith: "both-legs" },
|
|
68792
68806
|
rate: {
|
|
68793
68807
|
kind: "user-set",
|
|
68794
68808
|
isLocked: false,
|
|
@@ -68881,59 +68895,75 @@ var riverAdapter = {
|
|
|
68881
68895
|
id: "river",
|
|
68882
68896
|
matches: isRiver,
|
|
68883
68897
|
profileId: () => "river.cdp@v1",
|
|
68884
|
-
build: () =>
|
|
68885
|
-
|
|
68886
|
-
|
|
68887
|
-
|
|
68888
|
-
|
|
68889
|
-
|
|
68890
|
-
|
|
68891
|
-
|
|
68892
|
-
|
|
68893
|
-
|
|
68894
|
-
|
|
68895
|
-
|
|
68896
|
-
|
|
68897
|
-
|
|
68898
|
-
|
|
68898
|
+
build: (input) => {
|
|
68899
|
+
const isCollateralRow = input.collateralActive !== false;
|
|
68900
|
+
return {
|
|
68901
|
+
supply: isCollateralRow ? {
|
|
68902
|
+
role: "collateral",
|
|
68903
|
+
// The trove is the position; collateral cannot exist without
|
|
68904
|
+
// `minNetDebt` of debt behind it, so this side never opens alone.
|
|
68905
|
+
availability: { opensWith: "both-legs" },
|
|
68906
|
+
counterparty: { kind: "cdp", solvency: "overcollateralized" }
|
|
68907
|
+
} : {
|
|
68908
|
+
// The Stability Pool: an earn position, never collateral, and
|
|
68909
|
+
// openable on its own — `provideToSP` needs no trove.
|
|
68910
|
+
role: "yield",
|
|
68911
|
+
exit: { mode: "instant", settlement: "sync", partialAllowed: true },
|
|
68912
|
+
availability: { opensWith: "standalone" },
|
|
68913
|
+
counterparty: { kind: "cdp", solvency: "overcollateralized" },
|
|
68914
|
+
principal: { protected: false, risks: ["bad-debt"] }
|
|
68899
68915
|
},
|
|
68900
|
-
|
|
68901
|
-
|
|
68902
|
-
|
|
68903
|
-
|
|
68904
|
-
|
|
68905
|
-
|
|
68906
|
-
|
|
68907
|
-
|
|
68908
|
-
|
|
68909
|
-
|
|
68910
|
-
|
|
68911
|
-
|
|
68912
|
-
|
|
68913
|
-
|
|
68914
|
-
|
|
68915
|
-
|
|
68916
|
-
|
|
68917
|
-
|
|
68918
|
-
|
|
68919
|
-
|
|
68920
|
-
|
|
68921
|
-
|
|
68922
|
-
|
|
68923
|
-
|
|
68924
|
-
|
|
68925
|
-
|
|
68926
|
-
|
|
68927
|
-
|
|
68916
|
+
borrow: {
|
|
68917
|
+
// Opening a trove takes collateral AND debt in one call, so a bare
|
|
68918
|
+
// borrow has no position to draw against. Only reaches the debt row —
|
|
68919
|
+
// the collateral row has no borrow side for the patch to refine.
|
|
68920
|
+
availability: { opensWith: "both-legs" },
|
|
68921
|
+
rate: { kind: "zero-interest", isLocked: true, compounding: "none" },
|
|
68922
|
+
debtShape: "accruing",
|
|
68923
|
+
exit: {
|
|
68924
|
+
earlyRepay: "free",
|
|
68925
|
+
atMaturityCost: "accrued",
|
|
68926
|
+
lateBehaviour: "none",
|
|
68927
|
+
partialAllowed: true
|
|
68928
|
+
},
|
|
68929
|
+
liquidation: {
|
|
68930
|
+
trigger: "price",
|
|
68931
|
+
seizure: "proportional",
|
|
68932
|
+
redeemable: true,
|
|
68933
|
+
redemption: {
|
|
68934
|
+
// Not governance and not a liquidation: any holder of the stable can
|
|
68935
|
+
// trigger it, without permission and without targeting anyone.
|
|
68936
|
+
trigger: "permissionless-arbitrage",
|
|
68937
|
+
// Permissionless does NOT mean constant: it only pays the redeemer
|
|
68938
|
+
// while the stable trades under target, which is what makes it a peg
|
|
68939
|
+
// defence rather than a standing claim on collateral.
|
|
68940
|
+
driver: "below-peg",
|
|
68941
|
+
// COLLATERAL-RATIO ordered, V1-style — NOT rate-ordered.
|
|
68942
|
+
//
|
|
68943
|
+
// This said `lowest-rate-first`, copied from the Liquity V2 shape,
|
|
68944
|
+
// and it was wrong twice over: River is Prisma/V1 lineage, which
|
|
68945
|
+
// redeems against the LOWEST-COLLATERALISED troves first, and River
|
|
68946
|
+
// charges no interest at all (`rate.kind: 'zero-interest'` above), so
|
|
68947
|
+
// the accompanying "raise your rate" advice pointed at a control that
|
|
68948
|
+
// does not exist on this protocol. A borrower following it would have
|
|
68949
|
+
// done nothing while sitting first in the real queue.
|
|
68950
|
+
order: "lowest-collateral-ratio",
|
|
68951
|
+
// Deliberately ABSENT rather than `usd-neutral`. The V1 mechanism
|
|
68952
|
+
// sends collateral above the redeemed debt to a surplus balance that
|
|
68953
|
+
// the borrower must CLAIM, so whether they end up whole depends on an
|
|
68954
|
+
// action they may not know to take — see `defence`.
|
|
68955
|
+
defence: "Add collateral or repay to raise your collateral ratio and move behind other troves in the queue. If you are redeemed, claim the leftover collateral from the surplus balance \u2014 it is not returned automatically."
|
|
68956
|
+
}
|
|
68957
|
+
},
|
|
68958
|
+
counterparty: { kind: "cdp", solvency: "overcollateralized" }
|
|
68928
68959
|
},
|
|
68929
|
-
|
|
68930
|
-
|
|
68931
|
-
|
|
68932
|
-
|
|
68933
|
-
|
|
68934
|
-
|
|
68935
|
-
|
|
68936
|
-
})
|
|
68960
|
+
constraints: {
|
|
68961
|
+
// River troves are ADDRESS-keyed — there is no id to discover.
|
|
68962
|
+
positionModel: "account",
|
|
68963
|
+
positionIdMeaning: "Troves are keyed by owner address; there is no id."
|
|
68964
|
+
}
|
|
68965
|
+
};
|
|
68966
|
+
}
|
|
68937
68967
|
};
|
|
68938
68968
|
var inverseAdapter = {
|
|
68939
68969
|
id: "inverse",
|
|
@@ -69041,8 +69071,16 @@ var llamaLendAdapter = {
|
|
|
69041
69071
|
const ll = input.market?.llamalend ?? {};
|
|
69042
69072
|
const bandLtv = ll.bandLtv && typeof ll.bandLtv === "object" ? ll.bandLtv : void 0;
|
|
69043
69073
|
const hardDiscount = typeof ll.liquidationDiscount === "number" ? ll.liquidationDiscount : void 0;
|
|
69074
|
+
const isCollateralRow = input.collateralActive !== false;
|
|
69044
69075
|
return {
|
|
69076
|
+
supply: {
|
|
69077
|
+
availability: {
|
|
69078
|
+
opensWith: isCollateralRow ? "both-legs" : "standalone"
|
|
69079
|
+
}
|
|
69080
|
+
},
|
|
69045
69081
|
borrow: {
|
|
69082
|
+
// `create_loan(collateral, debt, N)` — both legs plus the band count.
|
|
69083
|
+
availability: { opensWith: "both-legs" },
|
|
69046
69084
|
debtShape: "accruing",
|
|
69047
69085
|
liquidation: {
|
|
69048
69086
|
model: "soft-band",
|