@gblin-protocol/mcp-server 0.3.2 → 0.4.1
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/AGENTS.md +10 -8
- package/README.md +194 -381
- package/dist/abi.d.ts +541 -74
- package/dist/abi.d.ts.map +1 -1
- package/dist/abi.js +56 -25
- package/dist/abi.js.map +1 -1
- package/dist/auction.d.ts +81 -0
- package/dist/auction.d.ts.map +1 -0
- package/dist/auction.js +161 -0
- package/dist/auction.js.map +1 -0
- package/dist/client.d.ts +12 -12
- package/dist/config.d.ts +6 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +17 -9
- package/dist/config.js.map +1 -1
- package/dist/helpers.d.ts +3 -7
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +34 -34
- package/dist/helpers.js.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/init.js +2 -2
- package/dist/paywall.d.ts.map +1 -1
- package/dist/paywall.js +1 -2
- package/dist/paywall.js.map +1 -1
- package/dist/receipts.d.ts +8 -0
- package/dist/receipts.d.ts.map +1 -1
- package/dist/receipts.js +5 -6
- package/dist/receipts.js.map +1 -1
- package/dist/tools.d.ts +28 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +186 -150
- package/dist/tools.js.map +1 -1
- package/llms.txt +56 -40
- package/package.json +1 -1
- package/dist/keeper.d.ts +0 -51
- package/dist/keeper.d.ts.map +0 -1
- package/dist/keeper.js +0 -251
- package/dist/keeper.js.map +0 -1
package/dist/abi.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abi.d.ts","sourceRoot":"","sources":["../src/abi.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"abi.d.ts","sourceRoot":"","sources":["../src/abi.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;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,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMpB,CAAC"}
|
package/dist/abi.js
CHANGED
|
@@ -1,41 +1,71 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GBLIN MCP — Contract ABIs
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* The basket() return signature exactly matches the Asset struct field order.
|
|
4
|
+
* Surfaces of the vault in service, its Lens and its Zap on Base mainnet, taken from the verified sources.
|
|
6
5
|
*/
|
|
7
6
|
import { parseAbi } from "viem";
|
|
8
7
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* IMPORTANT — basket() returns the Asset struct in declaration order:
|
|
12
|
-
* (token, oracle, poolFee, isStable, baseWeight, dynamicWeight, peakPrice, lastPeakUpdate)
|
|
13
|
-
*
|
|
14
|
-
* Common mistake: assuming a 5-field tuple. This caused real production bugs
|
|
15
|
-
* during the V4 audit cycle. Do not "simplify" this ABI.
|
|
8
|
+
* GBLIN vault — the surface these tools read and encode calls for.
|
|
9
|
+
* The vault exposes little directly; quotes, configuration, basket rows and auction state come from the Lens.
|
|
16
10
|
*/
|
|
17
11
|
export const GBLIN_ABI = parseAbi([
|
|
18
|
-
// Quotes (view, gas-free)
|
|
19
|
-
"function quoteBuyGBLIN(uint256 ethAmount) view returns (uint256 gblinOut, uint256 founderFee, uint256 stabFee)",
|
|
20
|
-
"function quoteSellGBLIN(uint256 gblinAmount) view returns (uint256 ethOut)",
|
|
21
|
-
// Basket — full struct, 8 fields, do not truncate
|
|
22
|
-
"function basket(uint256 index) view returns (address token, address oracle, uint24 poolFee, bool isStable, uint256 baseWeight, uint256 dynamicWeight, uint256 peakPrice, uint256 lastPeakUpdate)",
|
|
23
12
|
// ERC-20 surface
|
|
24
13
|
"function balanceOf(address account) view returns (uint256)",
|
|
25
14
|
"function totalSupply() view returns (uint256)",
|
|
26
15
|
"function decimals() view returns (uint8)",
|
|
27
|
-
|
|
28
|
-
"function
|
|
29
|
-
//
|
|
16
|
+
"function allowance(address owner, address spender) view returns (uint256)",
|
|
17
|
+
"function approve(address spender, uint256 amount) returns (bool)",
|
|
18
|
+
// Valuation and state
|
|
19
|
+
"function totalEthValue(uint256 excludeWeth) view returns (uint256 total)",
|
|
20
|
+
"function navPerShare(uint256 excludeWeth) view returns (uint256)",
|
|
21
|
+
"function isNavReliable() view returns (bool)",
|
|
22
|
+
"function auctionPremiumBps() view returns (int256)",
|
|
23
|
+
"function currentDriftEth() view returns (uint256)",
|
|
24
|
+
// Ownership
|
|
30
25
|
"function owner() view returns (address)",
|
|
31
|
-
"function
|
|
32
|
-
"function
|
|
33
|
-
//
|
|
34
|
-
"function
|
|
35
|
-
"function
|
|
36
|
-
"function
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
"function pendingOwner() view returns (address)",
|
|
27
|
+
"function acceptOwnership()",
|
|
28
|
+
// Payments by signature (EIP-3009)
|
|
29
|
+
"function authorizationState(address authorizer, bytes32 nonce) view returns (bool)",
|
|
30
|
+
"function transferWithAuthorization(address from, address to, uint256 value, uint256 validAfter, uint256 validBefore, bytes32 nonce, uint8 v, bytes32 r, bytes32 s)",
|
|
31
|
+
"function receiveWithAuthorization(address from, address to, uint256 value, uint256 validAfter, uint256 validBefore, bytes32 nonce, uint8 v, bytes32 r, bytes32 s)",
|
|
32
|
+
"function cancelAuthorization(address authorizer, bytes32 nonce, uint8 v, bytes32 r, bytes32 s)",
|
|
33
|
+
// Mutating — only used to build calldata (never executed by this server)
|
|
34
|
+
"function buyGBLIN(uint256 minOut) payable",
|
|
35
|
+
"function buyGBLINWithWeth(uint256 amount, uint256 minOut, address receiver)",
|
|
36
|
+
"function buyGBLINInKind(address token, uint256 amountIn, uint256 minOut)",
|
|
37
|
+
"function sellGBLIN(uint256 gblinAmount)",
|
|
38
|
+
"function claimPending(address token)",
|
|
39
|
+
"function bid(uint256 index, bool vaultBuysAsset, uint256 amountIn, uint256 minOut, bytes data) returns (uint256 amountInUsed, uint256 amountOut)",
|
|
40
|
+
]);
|
|
41
|
+
/**
|
|
42
|
+
* GBLIN Lens — read-only views beside the vault. Every call takes the vault as its first argument.
|
|
43
|
+
*/
|
|
44
|
+
export const LENS_ABI = parseAbi([
|
|
45
|
+
"function basketLength(address vault) view returns (uint256)",
|
|
46
|
+
"function asset(address vault, uint256 i) view returns (address token, address oracle, bool isStable, bool delisted, uint256 baseWeight, uint256 dynamicWeight, bool shielded, bool abandoned)",
|
|
47
|
+
"function auction(address vault, uint256 i) view returns (bool open, int256 premiumBps, bool vaultBuysAsset, uint256 gapEth)",
|
|
48
|
+
"function auctionOpenedAt(address vault) view returns (uint256)",
|
|
49
|
+
"function quoteBuy(address vault, uint256 ethValue) view returns (uint256 out, uint256 protocolFee, uint256 stabilityFee)",
|
|
50
|
+
"function quoteSell(address vault, uint256 gblinAmount) view returns (uint256)",
|
|
51
|
+
"function configFees(address vault) view returns (uint256 protocolFee, uint256 stabilityFee, uint256 minDeposit, uint256 oracleAge, uint256 oracleAgeTrade, uint256 sellCooldown, uint256 basketCap)",
|
|
52
|
+
"function configAuction(address vault) view returns (uint256 driftBand, uint256 driftClose, uint256 auctionStart, uint256 auctionCap, uint256 auctionRamp, uint256 volUpdateInterval, uint256 listingDelay, uint256 inKindFee, uint256 inKindTax)",
|
|
53
|
+
"function managementFeeBps(address vault) view returns (uint256)",
|
|
54
|
+
"function lastManagementFeeAccrual(address vault) view returns (uint256)",
|
|
55
|
+
"function lastDepositTime(address vault, address holder) view returns (uint256)",
|
|
56
|
+
"function pendingWithdrawal(address vault, address holder, address token) view returns (uint256)",
|
|
57
|
+
"function feeRecipient(address vault) view returns (address)",
|
|
58
|
+
"function pendingOwner(address vault) view returns (address)",
|
|
59
|
+
"function wethOracle(address vault) view returns (address)",
|
|
60
|
+
"function sequencerFeed(address vault) view returns (address)",
|
|
61
|
+
"function fill(address vault) view returns (address agent, bool open)",
|
|
62
|
+
]);
|
|
63
|
+
/**
|
|
64
|
+
* GBLIN Zap — the only contract that swaps. Mints with any token; exits to ETH all or nothing.
|
|
65
|
+
*/
|
|
66
|
+
export const ZAP_ABI = parseAbi([
|
|
67
|
+
"function buyGBLINWithToken(address tokenIn, uint256 amountIn, uint256 minWethOut, uint256 minOut, bytes venueData, address receiver) returns (uint256 out)",
|
|
68
|
+
"function sellGBLINForEth(uint256 shares, uint256 minEthOut, bytes[] venueData, address receiver) returns (uint256 ethOut)",
|
|
39
69
|
]);
|
|
40
70
|
/**
|
|
41
71
|
* GblinTimelockController — OpenZeppelin TimelockController v5 surface.
|
|
@@ -73,6 +103,7 @@ export const CHAINLINK_AGGREGATOR_ABI = parseAbi([
|
|
|
73
103
|
export const ERC20_ABI = parseAbi([
|
|
74
104
|
"function balanceOf(address account) view returns (uint256)",
|
|
75
105
|
"function decimals() view returns (uint8)",
|
|
106
|
+
"function symbol() view returns (string)",
|
|
76
107
|
"function approve(address spender, uint256 amount) returns (bool)",
|
|
77
108
|
"function allowance(address owner, address spender) view returns (uint256)",
|
|
78
109
|
]);
|
package/dist/abi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abi.js","sourceRoot":"","sources":["../src/abi.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"abi.js","sourceRoot":"","sources":["../src/abi.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEhC;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC;IAChC,iBAAiB;IACjB,4DAA4D;IAC5D,+CAA+C;IAC/C,0CAA0C;IAC1C,2EAA2E;IAC3E,kEAAkE;IAElE,sBAAsB;IACtB,0EAA0E;IAC1E,kEAAkE;IAClE,8CAA8C;IAC9C,oDAAoD;IACpD,mDAAmD;IAEnD,YAAY;IACZ,yCAAyC;IACzC,gDAAgD;IAChD,4BAA4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AC,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GBLIN MCP — Auction state
|
|
3
|
+
*
|
|
4
|
+
* The vault does not rebalance itself and pays nobody to do it. When a basket row drifts past the
|
|
5
|
+
* opening band it holds a Dutch auction: whoever trades with the vault toward its target weights is
|
|
6
|
+
* the counterparty, at the oracle price adjusted by a premium that rises over time. The input is
|
|
7
|
+
* reduced to what closes the gap, so a bid never pushes a row past its target. Nothing is paid out of
|
|
8
|
+
* the vault for calling it: the premium is the whole reward.
|
|
9
|
+
*
|
|
10
|
+
* Everything here is read-only. The calldata returned is plain ABI-encoded bytes for the bidder to
|
|
11
|
+
* review and broadcast from its own wallet.
|
|
12
|
+
*/
|
|
13
|
+
import type { Address } from "viem";
|
|
14
|
+
export interface AuctionCurve {
|
|
15
|
+
/** Discount at the opening, in bps of the oracle price (the vault asks this much less). */
|
|
16
|
+
startBps: bigint;
|
|
17
|
+
/** Premium the curve rises to, in bps of the oracle price. */
|
|
18
|
+
capBps: bigint;
|
|
19
|
+
/** Seconds from the opening discount to the cap. The cap then holds for another ramp before the curve starts again. */
|
|
20
|
+
rampSeconds: bigint;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Premium over the oracle price, in bps, `elapsedSeconds` after the auction opened. Mirrors the
|
|
24
|
+
* vault's `auctionPremiumBps`: `-start` at the opening, rising linearly to `cap` over one ramp,
|
|
25
|
+
* holding at `cap` for a second ramp, then starting again from `-start`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function premiumBpsAt(elapsedSeconds: bigint, curve: AuctionCurve): bigint;
|
|
28
|
+
/** Converts an amount of ETH value into units of an asset at the two oracle prices. */
|
|
29
|
+
export declare function ethToAssetUnits(ethWei: bigint, assetPrice: bigint, wethPrice: bigint, decimals: number): bigint;
|
|
30
|
+
export interface AuctionRow {
|
|
31
|
+
index: number;
|
|
32
|
+
token: Address;
|
|
33
|
+
symbol: string;
|
|
34
|
+
baseWeightPct: number;
|
|
35
|
+
dynamicWeightPct: number;
|
|
36
|
+
shielded: boolean;
|
|
37
|
+
/** True when the vault buys this asset and pays WETH: the bidder hands over the asset. */
|
|
38
|
+
vaultBuysAsset: boolean;
|
|
39
|
+
gapEth: string;
|
|
40
|
+
/** Token the bidder hands to the vault, and the amount that closes the gap, in that token's units. */
|
|
41
|
+
inputToken: Address;
|
|
42
|
+
inputSymbol: string;
|
|
43
|
+
inputAmount: string;
|
|
44
|
+
inputAmountRaw: string;
|
|
45
|
+
/** Unsigned calldata: an approval of the input token to the vault, then the bid. `minOut` is zero because
|
|
46
|
+
* the price is the oracle's adjusted by the premium, fixed for the block: there is no pool to be sandwiched on. */
|
|
47
|
+
calldata: {
|
|
48
|
+
approve: {
|
|
49
|
+
target: Address;
|
|
50
|
+
data: `0x${string}`;
|
|
51
|
+
};
|
|
52
|
+
bid: {
|
|
53
|
+
target: Address;
|
|
54
|
+
data: `0x${string}`;
|
|
55
|
+
};
|
|
56
|
+
} | null;
|
|
57
|
+
}
|
|
58
|
+
export interface AuctionState {
|
|
59
|
+
vault: Address;
|
|
60
|
+
lens: Address;
|
|
61
|
+
navReliable: boolean;
|
|
62
|
+
auctionOpen: boolean;
|
|
63
|
+
premiumBps: number;
|
|
64
|
+
curve: {
|
|
65
|
+
startBps: number;
|
|
66
|
+
capBps: number;
|
|
67
|
+
rampSeconds: number;
|
|
68
|
+
opensAboveBps: number;
|
|
69
|
+
closesAtOrBelowBps: number;
|
|
70
|
+
};
|
|
71
|
+
openedAt: number | null;
|
|
72
|
+
worstGapEth: string;
|
|
73
|
+
totalValueEth: string;
|
|
74
|
+
rows: AuctionRow[];
|
|
75
|
+
/** The row with the largest gap, when the auction is open and the vault can price itself. */
|
|
76
|
+
best: AuctionRow | null;
|
|
77
|
+
howToBid: string;
|
|
78
|
+
note: string;
|
|
79
|
+
}
|
|
80
|
+
export declare function getAuctionState(): Promise<AuctionState>;
|
|
81
|
+
//# sourceMappingURL=auction.d.ts.map
|
|
@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E,CAAA;KAAE,GAAG,IAAI,CAAC;CACvH;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAA;KAAE,CAAC;IACpH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,6FAA6F;IAC7F,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAcD,wBAAsB,eAAe,IAAI,OAAO,CAAC,YAAY,CAAC,CAiH7D"}
|
package/dist/auction.js
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GBLIN MCP — Auction state
|
|
3
|
+
*
|
|
4
|
+
* The vault does not rebalance itself and pays nobody to do it. When a basket row drifts past the
|
|
5
|
+
* opening band it holds a Dutch auction: whoever trades with the vault toward its target weights is
|
|
6
|
+
* the counterparty, at the oracle price adjusted by a premium that rises over time. The input is
|
|
7
|
+
* reduced to what closes the gap, so a bid never pushes a row past its target. Nothing is paid out of
|
|
8
|
+
* the vault for calling it: the premium is the whole reward.
|
|
9
|
+
*
|
|
10
|
+
* Everything here is read-only. The calldata returned is plain ABI-encoded bytes for the bidder to
|
|
11
|
+
* review and broadcast from its own wallet.
|
|
12
|
+
*/
|
|
13
|
+
import { encodeFunctionData, formatEther, formatUnits } from "viem";
|
|
14
|
+
import { CHAINLINK_AGGREGATOR_ABI, ERC20_ABI, GBLIN_ABI, LENS_ABI } from "./abi.js";
|
|
15
|
+
import { client, getOnChainTimestamp } from "./client.js";
|
|
16
|
+
import { GBLIN_LENS, GBLIN_VAULT, ORACLE_STALENESS_SECONDS, WETH } from "./config.js";
|
|
17
|
+
/**
|
|
18
|
+
* Premium over the oracle price, in bps, `elapsedSeconds` after the auction opened. Mirrors the
|
|
19
|
+
* vault's `auctionPremiumBps`: `-start` at the opening, rising linearly to `cap` over one ramp,
|
|
20
|
+
* holding at `cap` for a second ramp, then starting again from `-start`.
|
|
21
|
+
*/
|
|
22
|
+
export function premiumBpsAt(elapsedSeconds, curve) {
|
|
23
|
+
const start = -curve.startBps;
|
|
24
|
+
if (curve.rampSeconds === 0n)
|
|
25
|
+
return start;
|
|
26
|
+
let t = elapsedSeconds % (2n * curve.rampSeconds);
|
|
27
|
+
if (t > curve.rampSeconds)
|
|
28
|
+
t = curve.rampSeconds;
|
|
29
|
+
return start + ((curve.capBps - start) * t) / curve.rampSeconds;
|
|
30
|
+
}
|
|
31
|
+
/** Converts an amount of ETH value into units of an asset at the two oracle prices. */
|
|
32
|
+
export function ethToAssetUnits(ethWei, assetPrice, wethPrice, decimals) {
|
|
33
|
+
if (assetPrice === 0n || wethPrice === 0n)
|
|
34
|
+
return 0n;
|
|
35
|
+
let units = (ethWei * wethPrice) / assetPrice;
|
|
36
|
+
if (decimals < 18)
|
|
37
|
+
units = units / 10n ** BigInt(18 - decimals);
|
|
38
|
+
else if (decimals > 18)
|
|
39
|
+
units = units * 10n ** BigInt(decimals - 18);
|
|
40
|
+
return units;
|
|
41
|
+
}
|
|
42
|
+
async function oraclePrice(oracle, now) {
|
|
43
|
+
try {
|
|
44
|
+
const d = await client.readContract({ address: oracle, abi: CHAINLINK_AGGREGATOR_ABI, functionName: "latestRoundData" });
|
|
45
|
+
const answer = d[1];
|
|
46
|
+
const updatedAt = Number(d[3]);
|
|
47
|
+
if (answer <= 0n || now - updatedAt > ORACLE_STALENESS_SECONDS)
|
|
48
|
+
return 0n;
|
|
49
|
+
return answer;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return 0n;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export async function getAuctionState() {
|
|
56
|
+
const [navReliable, premiumRaw, driftRaw, totalValue, rowCountRaw, openedAtRaw, cfg, wethOracle, blockTs] = await Promise.all([
|
|
57
|
+
client.readContract({ address: GBLIN_VAULT, abi: GBLIN_ABI, functionName: "isNavReliable" }),
|
|
58
|
+
client.readContract({ address: GBLIN_VAULT, abi: GBLIN_ABI, functionName: "auctionPremiumBps" }),
|
|
59
|
+
client.readContract({ address: GBLIN_VAULT, abi: GBLIN_ABI, functionName: "currentDriftEth" }),
|
|
60
|
+
client.readContract({ address: GBLIN_VAULT, abi: GBLIN_ABI, functionName: "totalEthValue", args: [0n] }),
|
|
61
|
+
client.readContract({ address: GBLIN_LENS, abi: LENS_ABI, functionName: "basketLength", args: [GBLIN_VAULT] }),
|
|
62
|
+
client.readContract({ address: GBLIN_LENS, abi: LENS_ABI, functionName: "auctionOpenedAt", args: [GBLIN_VAULT] }),
|
|
63
|
+
client.readContract({ address: GBLIN_LENS, abi: LENS_ABI, functionName: "configAuction", args: [GBLIN_VAULT] }),
|
|
64
|
+
client.readContract({ address: GBLIN_LENS, abi: LENS_ABI, functionName: "wethOracle", args: [GBLIN_VAULT] }),
|
|
65
|
+
getOnChainTimestamp(),
|
|
66
|
+
]);
|
|
67
|
+
const now = Number(blockTs);
|
|
68
|
+
const wethPrice = await oraclePrice(wethOracle, now);
|
|
69
|
+
const auctionOpen = openedAtRaw !== 0n;
|
|
70
|
+
const rows = [];
|
|
71
|
+
for (let i = 0; i < Number(rowCountRaw); i++) {
|
|
72
|
+
const [row, state] = await Promise.all([
|
|
73
|
+
client.readContract({ address: GBLIN_LENS, abi: LENS_ABI, functionName: "asset", args: [GBLIN_VAULT, BigInt(i)] }),
|
|
74
|
+
client.readContract({ address: GBLIN_LENS, abi: LENS_ABI, functionName: "auction", args: [GBLIN_VAULT, BigInt(i)] }),
|
|
75
|
+
]);
|
|
76
|
+
const token = row[0];
|
|
77
|
+
if (row[7])
|
|
78
|
+
continue; // abandoned rows cannot be bid on
|
|
79
|
+
const [symbol, decimals] = await Promise.all([
|
|
80
|
+
client.readContract({ address: token, abi: ERC20_ABI, functionName: "symbol" }).catch(() => `row ${i}`),
|
|
81
|
+
client.readContract({ address: token, abi: ERC20_ABI, functionName: "decimals" }).catch(() => 18),
|
|
82
|
+
]);
|
|
83
|
+
const vaultBuysAsset = state[2];
|
|
84
|
+
const gapEth = state[3];
|
|
85
|
+
const isWeth = token.toLowerCase() === WETH.toLowerCase();
|
|
86
|
+
// The bidder is the counterparty: when the vault buys the asset the bidder hands it over and receives
|
|
87
|
+
// WETH; when the vault sells it the bidder hands over WETH. Sizing at the gap is enough — the vault
|
|
88
|
+
// trims any excess to what closes it.
|
|
89
|
+
let inputToken = WETH;
|
|
90
|
+
let inputSymbol = "WETH";
|
|
91
|
+
let inputAmountRaw = gapEth;
|
|
92
|
+
let inputDecimals = 18;
|
|
93
|
+
if (vaultBuysAsset && !isWeth) {
|
|
94
|
+
const assetPrice = await oraclePrice(row[1], now);
|
|
95
|
+
inputToken = token;
|
|
96
|
+
inputSymbol = String(symbol);
|
|
97
|
+
inputDecimals = Number(decimals);
|
|
98
|
+
inputAmountRaw = ethToAssetUnits(gapEth, assetPrice, wethPrice, inputDecimals);
|
|
99
|
+
}
|
|
100
|
+
const biddable = auctionOpen && navReliable && !isWeth && gapEth > 0n && inputAmountRaw > 0n;
|
|
101
|
+
const calldata = biddable
|
|
102
|
+
? {
|
|
103
|
+
approve: {
|
|
104
|
+
target: inputToken,
|
|
105
|
+
data: encodeFunctionData({ abi: ERC20_ABI, functionName: "approve", args: [GBLIN_VAULT, inputAmountRaw] }),
|
|
106
|
+
},
|
|
107
|
+
bid: {
|
|
108
|
+
target: GBLIN_VAULT,
|
|
109
|
+
data: encodeFunctionData({
|
|
110
|
+
abi: GBLIN_ABI,
|
|
111
|
+
functionName: "bid",
|
|
112
|
+
args: [BigInt(i), vaultBuysAsset, inputAmountRaw, 0n, "0x"],
|
|
113
|
+
}),
|
|
114
|
+
},
|
|
115
|
+
}
|
|
116
|
+
: null;
|
|
117
|
+
rows.push({
|
|
118
|
+
index: i,
|
|
119
|
+
token,
|
|
120
|
+
symbol: String(symbol),
|
|
121
|
+
baseWeightPct: Number(row[4]) / 100,
|
|
122
|
+
dynamicWeightPct: Number(row[5]) / 100,
|
|
123
|
+
shielded: row[6],
|
|
124
|
+
vaultBuysAsset,
|
|
125
|
+
gapEth: formatEther(gapEth),
|
|
126
|
+
inputToken,
|
|
127
|
+
inputSymbol,
|
|
128
|
+
inputAmount: formatUnits(inputAmountRaw, inputDecimals),
|
|
129
|
+
inputAmountRaw: inputAmountRaw.toString(),
|
|
130
|
+
calldata,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
const best = rows
|
|
134
|
+
.filter((r) => r.calldata !== null)
|
|
135
|
+
.sort((a, b) => Number(b.gapEth) - Number(a.gapEth))[0] ?? null;
|
|
136
|
+
return {
|
|
137
|
+
vault: GBLIN_VAULT,
|
|
138
|
+
lens: GBLIN_LENS,
|
|
139
|
+
navReliable,
|
|
140
|
+
auctionOpen,
|
|
141
|
+
premiumBps: Number(premiumRaw),
|
|
142
|
+
curve: {
|
|
143
|
+
startBps: Number(cfg[2]),
|
|
144
|
+
capBps: Number(cfg[3]),
|
|
145
|
+
rampSeconds: Number(cfg[4]),
|
|
146
|
+
opensAboveBps: Number(cfg[0]),
|
|
147
|
+
closesAtOrBelowBps: Number(cfg[1]),
|
|
148
|
+
},
|
|
149
|
+
openedAt: auctionOpen ? Number(openedAtRaw) : null,
|
|
150
|
+
worstGapEth: formatEther(driftRaw),
|
|
151
|
+
totalValueEth: formatEther(totalValue),
|
|
152
|
+
rows,
|
|
153
|
+
best,
|
|
154
|
+
howToBid: "Approve the input token to the vault, then call bid(index, vaultBuysAsset, amountIn, minOut, data) from your own wallet. " +
|
|
155
|
+
"You hand over the input token and receive the other side at the oracle price adjusted by the current premium. " +
|
|
156
|
+
"The input is reduced to what closes the gap; a bid that would change nothing reverts.",
|
|
157
|
+
note: "Nothing is paid out of the vault for bidding: the premium is the reward. The premium starts at a discount, rises to the cap " +
|
|
158
|
+
"over one ramp, holds for another and starts again; bid when it covers your own cost.",
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=auction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auction.js","sourceRoot":"","sources":["../src/auction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAGpE,OAAO,EAAE,wBAAwB,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,wBAAwB,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAatF;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,cAAsB,EAAE,KAAmB;IACtE,MAAM,KAAK,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC9B,IAAI,KAAK,CAAC,WAAW,KAAK,EAAE;QAAE,OAAO,KAAK,CAAC;IAC3C,IAAI,CAAC,GAAG,cAAc,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC;IAClD,IAAI,CAAC,GAAG,KAAK,CAAC,WAAW;QAAE,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC;IACjD,OAAO,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC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AM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACtB,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAC3B,aAAa,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAC7B,kBAAkB,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACnC;QACD,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI;QAClD,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC;QAClC,aAAa,EAAE,WAAW,CAAC,UAAU,CAAC;QACtC,IAAI;QACJ,IAAI;QACJ,QAAQ,EACN,2HAA2H;YAC3H,gHAAgH;YAChH,uFAAuF;QACzF,IAAI,EACF,8HAA8H;YAC9H,sFAAsF;KACzF,CAAC;AACJ,CAAC"}
|
package/dist/client.d.ts
CHANGED
|
@@ -2006,6 +2006,7 @@ export declare const client: {
|
|
|
2006
2006
|
withdrawals?: import("viem").Withdrawal[] | undefined | undefined | undefined;
|
|
2007
2007
|
withdrawalsRoot?: `0x${string}` | undefined | undefined;
|
|
2008
2008
|
transactions: includeTransactions extends true ? ({
|
|
2009
|
+
r: import("viem").Hex;
|
|
2009
2010
|
s: import("viem").Hex;
|
|
2010
2011
|
yParity: number;
|
|
2011
2012
|
blockTimestamp?: bigint | undefined | undefined;
|
|
@@ -2014,7 +2015,6 @@ export declare const client: {
|
|
|
2014
2015
|
hash: import("viem").Hash;
|
|
2015
2016
|
input: import("viem").Hex;
|
|
2016
2017
|
nonce: number;
|
|
2017
|
-
r: import("viem").Hex;
|
|
2018
2018
|
to: import("viem").Address | null;
|
|
2019
2019
|
typeHex: import("viem").Hex | null;
|
|
2020
2020
|
v: bigint;
|
|
@@ -2031,6 +2031,7 @@ export declare const client: {
|
|
|
2031
2031
|
blockNumber: (blockTag extends "pending" ? true : false) extends infer T_1 ? T_1 extends (blockTag extends "pending" ? true : false) ? T_1 extends true ? null : bigint : never : never;
|
|
2032
2032
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_2 ? T_2 extends (blockTag extends "pending" ? true : false) ? T_2 extends true ? null : number : never : never;
|
|
2033
2033
|
} | {
|
|
2034
|
+
r: import("viem").Hex;
|
|
2034
2035
|
s: import("viem").Hex;
|
|
2035
2036
|
yParity?: undefined | undefined | undefined;
|
|
2036
2037
|
blockTimestamp?: bigint | undefined | undefined;
|
|
@@ -2039,7 +2040,6 @@ export declare const client: {
|
|
|
2039
2040
|
hash: import("viem").Hash;
|
|
2040
2041
|
input: import("viem").Hex;
|
|
2041
2042
|
nonce: number;
|
|
2042
|
-
r: import("viem").Hex;
|
|
2043
2043
|
to: import("viem").Address | null;
|
|
2044
2044
|
typeHex: import("viem").Hex | null;
|
|
2045
2045
|
v: bigint;
|
|
@@ -2060,6 +2060,7 @@ export declare const client: {
|
|
|
2060
2060
|
blockNumber: (blockTag extends "pending" ? true : false) extends infer T_4 ? T_4 extends (blockTag extends "pending" ? true : false) ? T_4 extends true ? null : bigint : never : never;
|
|
2061
2061
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_5 ? T_5 extends (blockTag extends "pending" ? true : false) ? T_5 extends true ? null : number : never : never;
|
|
2062
2062
|
} | {
|
|
2063
|
+
r: import("viem").Hex;
|
|
2063
2064
|
s: import("viem").Hex;
|
|
2064
2065
|
yParity: number;
|
|
2065
2066
|
blockTimestamp?: bigint | undefined | undefined;
|
|
@@ -2068,7 +2069,6 @@ export declare const client: {
|
|
|
2068
2069
|
hash: import("viem").Hash;
|
|
2069
2070
|
input: import("viem").Hex;
|
|
2070
2071
|
nonce: number;
|
|
2071
|
-
r: import("viem").Hex;
|
|
2072
2072
|
to: import("viem").Address | null;
|
|
2073
2073
|
typeHex: import("viem").Hex | null;
|
|
2074
2074
|
v: bigint;
|
|
@@ -2089,6 +2089,7 @@ export declare const client: {
|
|
|
2089
2089
|
blockNumber: (blockTag extends "pending" ? true : false) extends infer T_7 ? T_7 extends (blockTag extends "pending" ? true : false) ? T_7 extends true ? null : bigint : never : never;
|
|
2090
2090
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_8 ? T_8 extends (blockTag extends "pending" ? true : false) ? T_8 extends true ? null : number : never : never;
|
|
2091
2091
|
} | {
|
|
2092
|
+
r: import("viem").Hex;
|
|
2092
2093
|
s: import("viem").Hex;
|
|
2093
2094
|
yParity: number;
|
|
2094
2095
|
blockTimestamp?: bigint | undefined | undefined;
|
|
@@ -2097,7 +2098,6 @@ export declare const client: {
|
|
|
2097
2098
|
hash: import("viem").Hash;
|
|
2098
2099
|
input: import("viem").Hex;
|
|
2099
2100
|
nonce: number;
|
|
2100
|
-
r: import("viem").Hex;
|
|
2101
2101
|
to: import("viem").Address | null;
|
|
2102
2102
|
typeHex: import("viem").Hex | null;
|
|
2103
2103
|
v: bigint;
|
|
@@ -2118,6 +2118,7 @@ export declare const client: {
|
|
|
2118
2118
|
blockNumber: (blockTag extends "pending" ? true : false) extends infer T_10 ? T_10 extends (blockTag extends "pending" ? true : false) ? T_10 extends true ? null : bigint : never : never;
|
|
2119
2119
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_11 ? T_11 extends (blockTag extends "pending" ? true : false) ? T_11 extends true ? null : number : never : never;
|
|
2120
2120
|
} | {
|
|
2121
|
+
r: import("viem").Hex;
|
|
2121
2122
|
s: import("viem").Hex;
|
|
2122
2123
|
yParity: number;
|
|
2123
2124
|
blockTimestamp?: bigint | undefined | undefined;
|
|
@@ -2126,7 +2127,6 @@ export declare const client: {
|
|
|
2126
2127
|
hash: import("viem").Hash;
|
|
2127
2128
|
input: import("viem").Hex;
|
|
2128
2129
|
nonce: number;
|
|
2129
|
-
r: import("viem").Hex;
|
|
2130
2130
|
to: import("viem").Address | null;
|
|
2131
2131
|
typeHex: import("viem").Hex | null;
|
|
2132
2132
|
v: bigint;
|
|
@@ -2147,6 +2147,7 @@ export declare const client: {
|
|
|
2147
2147
|
blockNumber: (blockTag extends "pending" ? true : false) extends infer T_13 ? T_13 extends (blockTag extends "pending" ? true : false) ? T_13 extends true ? null : bigint : never : never;
|
|
2148
2148
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_14 ? T_14 extends (blockTag extends "pending" ? true : false) ? T_14 extends true ? null : number : never : never;
|
|
2149
2149
|
} | {
|
|
2150
|
+
r: import("viem").Hex;
|
|
2150
2151
|
s: import("viem").Hex;
|
|
2151
2152
|
yParity: number;
|
|
2152
2153
|
blockTimestamp?: bigint | undefined | undefined;
|
|
@@ -2155,7 +2156,6 @@ export declare const client: {
|
|
|
2155
2156
|
hash: import("viem").Hash;
|
|
2156
2157
|
input: import("viem").Hex;
|
|
2157
2158
|
nonce: number;
|
|
2158
|
-
r: import("viem").Hex;
|
|
2159
2159
|
to: import("viem").Address | null;
|
|
2160
2160
|
typeHex: import("viem").Hex | null;
|
|
2161
2161
|
v: bigint;
|
|
@@ -2525,6 +2525,7 @@ export declare const client: {
|
|
|
2525
2525
|
} | undefined) => Promise<import("viem").EstimateMaxPriorityFeePerGasReturnType>;
|
|
2526
2526
|
getStorageAt: (args: import("viem").GetStorageAtParameters) => Promise<import("viem").GetStorageAtReturnType>;
|
|
2527
2527
|
getTransaction: <blockTag extends import("viem").BlockTag = "latest">(args: import("viem").GetTransactionParameters<blockTag>) => Promise<{
|
|
2528
|
+
r: import("viem").Hex;
|
|
2528
2529
|
s: import("viem").Hex;
|
|
2529
2530
|
yParity: number;
|
|
2530
2531
|
blockTimestamp?: bigint | undefined | undefined;
|
|
@@ -2533,7 +2534,6 @@ export declare const client: {
|
|
|
2533
2534
|
hash: import("viem").Hash;
|
|
2534
2535
|
input: import("viem").Hex;
|
|
2535
2536
|
nonce: number;
|
|
2536
|
-
r: import("viem").Hex;
|
|
2537
2537
|
to: import("viem").Address | null;
|
|
2538
2538
|
typeHex: import("viem").Hex | null;
|
|
2539
2539
|
v: bigint;
|
|
@@ -2550,6 +2550,7 @@ export declare const client: {
|
|
|
2550
2550
|
blockNumber: (blockTag extends "pending" ? true : false) extends infer T_1 ? T_1 extends (blockTag extends "pending" ? true : false) ? T_1 extends true ? null : bigint : never : never;
|
|
2551
2551
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_2 ? T_2 extends (blockTag extends "pending" ? true : false) ? T_2 extends true ? null : number : never : never;
|
|
2552
2552
|
} | {
|
|
2553
|
+
r: import("viem").Hex;
|
|
2553
2554
|
s: import("viem").Hex;
|
|
2554
2555
|
yParity?: undefined | undefined | undefined;
|
|
2555
2556
|
blockTimestamp?: bigint | undefined | undefined;
|
|
@@ -2558,7 +2559,6 @@ export declare const client: {
|
|
|
2558
2559
|
hash: import("viem").Hash;
|
|
2559
2560
|
input: import("viem").Hex;
|
|
2560
2561
|
nonce: number;
|
|
2561
|
-
r: import("viem").Hex;
|
|
2562
2562
|
to: import("viem").Address | null;
|
|
2563
2563
|
typeHex: import("viem").Hex | null;
|
|
2564
2564
|
v: bigint;
|
|
@@ -2579,6 +2579,7 @@ export declare const client: {
|
|
|
2579
2579
|
blockNumber: (blockTag extends "pending" ? true : false) extends infer T_4 ? T_4 extends (blockTag extends "pending" ? true : false) ? T_4 extends true ? null : bigint : never : never;
|
|
2580
2580
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_5 ? T_5 extends (blockTag extends "pending" ? true : false) ? T_5 extends true ? null : number : never : never;
|
|
2581
2581
|
} | {
|
|
2582
|
+
r: import("viem").Hex;
|
|
2582
2583
|
s: import("viem").Hex;
|
|
2583
2584
|
yParity: number;
|
|
2584
2585
|
blockTimestamp?: bigint | undefined | undefined;
|
|
@@ -2587,7 +2588,6 @@ export declare const client: {
|
|
|
2587
2588
|
hash: import("viem").Hash;
|
|
2588
2589
|
input: import("viem").Hex;
|
|
2589
2590
|
nonce: number;
|
|
2590
|
-
r: import("viem").Hex;
|
|
2591
2591
|
to: import("viem").Address | null;
|
|
2592
2592
|
typeHex: import("viem").Hex | null;
|
|
2593
2593
|
v: bigint;
|
|
@@ -2608,6 +2608,7 @@ export declare const client: {
|
|
|
2608
2608
|
blockNumber: (blockTag extends "pending" ? true : false) extends infer T_7 ? T_7 extends (blockTag extends "pending" ? true : false) ? T_7 extends true ? null : bigint : never : never;
|
|
2609
2609
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_8 ? T_8 extends (blockTag extends "pending" ? true : false) ? T_8 extends true ? null : number : never : never;
|
|
2610
2610
|
} | {
|
|
2611
|
+
r: import("viem").Hex;
|
|
2611
2612
|
s: import("viem").Hex;
|
|
2612
2613
|
yParity: number;
|
|
2613
2614
|
blockTimestamp?: bigint | undefined | undefined;
|
|
@@ -2616,7 +2617,6 @@ export declare const client: {
|
|
|
2616
2617
|
hash: import("viem").Hash;
|
|
2617
2618
|
input: import("viem").Hex;
|
|
2618
2619
|
nonce: number;
|
|
2619
|
-
r: import("viem").Hex;
|
|
2620
2620
|
to: import("viem").Address | null;
|
|
2621
2621
|
typeHex: import("viem").Hex | null;
|
|
2622
2622
|
v: bigint;
|
|
@@ -2637,6 +2637,7 @@ export declare const client: {
|
|
|
2637
2637
|
blockNumber: (blockTag extends "pending" ? true : false) extends infer T_10 ? T_10 extends (blockTag extends "pending" ? true : false) ? T_10 extends true ? null : bigint : never : never;
|
|
2638
2638
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_11 ? T_11 extends (blockTag extends "pending" ? true : false) ? T_11 extends true ? null : number : never : never;
|
|
2639
2639
|
} | {
|
|
2640
|
+
r: import("viem").Hex;
|
|
2640
2641
|
s: import("viem").Hex;
|
|
2641
2642
|
yParity: number;
|
|
2642
2643
|
blockTimestamp?: bigint | undefined | undefined;
|
|
@@ -2645,7 +2646,6 @@ export declare const client: {
|
|
|
2645
2646
|
hash: import("viem").Hash;
|
|
2646
2647
|
input: import("viem").Hex;
|
|
2647
2648
|
nonce: number;
|
|
2648
|
-
r: import("viem").Hex;
|
|
2649
2649
|
to: import("viem").Address | null;
|
|
2650
2650
|
typeHex: import("viem").Hex | null;
|
|
2651
2651
|
v: bigint;
|
|
@@ -2666,6 +2666,7 @@ export declare const client: {
|
|
|
2666
2666
|
blockNumber: (blockTag extends "pending" ? true : false) extends infer T_13 ? T_13 extends (blockTag extends "pending" ? true : false) ? T_13 extends true ? null : bigint : never : never;
|
|
2667
2667
|
transactionIndex: (blockTag extends "pending" ? true : false) extends infer T_14 ? T_14 extends (blockTag extends "pending" ? true : false) ? T_14 extends true ? null : number : never : never;
|
|
2668
2668
|
} | {
|
|
2669
|
+
r: import("viem").Hex;
|
|
2669
2670
|
s: import("viem").Hex;
|
|
2670
2671
|
yParity: number;
|
|
2671
2672
|
blockTimestamp?: bigint | undefined | undefined;
|
|
@@ -2674,7 +2675,6 @@ export declare const client: {
|
|
|
2674
2675
|
hash: import("viem").Hash;
|
|
2675
2676
|
input: import("viem").Hex;
|
|
2676
2677
|
nonce: number;
|
|
2677
|
-
r: import("viem").Hex;
|
|
2678
2678
|
to: import("viem").Address | null;
|
|
2679
2679
|
typeHex: import("viem").Hex | null;
|
|
2680
2680
|
v: bigint;
|
package/dist/config.d.ts
CHANGED
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
* GBLIN MCP — Network Configuration
|
|
3
3
|
*
|
|
4
4
|
* All addresses, constants, and tunable parameters.
|
|
5
|
-
*
|
|
5
|
+
* Addresses and constants of the vault in service on Base mainnet, taken from the verified sources.
|
|
6
6
|
*/
|
|
7
7
|
import type { Address } from "viem";
|
|
8
8
|
export declare const PACKAGE_VERSION: string;
|
|
9
9
|
export declare const BASE_CHAIN_ID = 8453;
|
|
10
10
|
export declare const DEFAULT_RPC_URL = "https://base-rpc.publicnode.com";
|
|
11
11
|
export declare const RPC_URL: string;
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const GBLIN_VAULT: Address;
|
|
13
|
+
export declare const GBLIN_LENS: Address;
|
|
14
|
+
export declare const GBLIN_ZAP: Address;
|
|
15
|
+
export declare const GBLIN_PREVIOUS: Address;
|
|
13
16
|
export declare const USDC: Address;
|
|
14
17
|
export declare const WETH: Address;
|
|
15
18
|
export declare const GBLIN_TIMELOCK: Address;
|
|
@@ -18,8 +21,7 @@ export declare const EXPECTED_MIN_DELAY_SECONDS = 172800n;
|
|
|
18
21
|
export declare const ETH_USD_FEED: Address;
|
|
19
22
|
export declare const GBLIN_ATTESTOR: Address;
|
|
20
23
|
export declare const WETH_USDC_POOL_FEE = 500;
|
|
21
|
-
export declare const
|
|
22
|
-
export declare const COOLDOWN_SECONDS = 120;
|
|
24
|
+
export declare const COOLDOWN_SECONDS_FALLBACK = 20;
|
|
23
25
|
export declare const ORACLE_STALENESS_SECONDS = 86400;
|
|
24
26
|
export declare const SLIPPAGE_NORMAL_BPS = 250n;
|
|
25
27
|
export declare const SLIPPAGE_CRASH_SHIELD_BPS = 400n;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAMpC,eAAO,MAAM,eAAe,QAAc,CAAC;AAG3C,eAAO,MAAM,aAAa,OAAO,CAAC;AAGlC,eAAO,MAAM,eAAe,oCAAoC,CAAC;AAiBjE,eAAO,MAAM,OAAO,QAC4C,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAMpC,eAAO,MAAM,eAAe,QAAc,CAAC;AAG3C,eAAO,MAAM,aAAa,OAAO,CAAC;AAGlC,eAAO,MAAM,eAAe,oCAAoC,CAAC;AAiBjE,eAAO,MAAM,OAAO,QAC4C,CAAC;AAIjE,eAAO,MAAM,WAAW,EAAE,OAAsD,CAAC;AAEjF,eAAO,MAAM,UAAU,EAAE,OAAsD,CAAC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