curvance 3.7.4 → 4.0.0
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/chains/monad-mainnet.json +1 -26
- package/dist/classes/Api.d.ts.map +1 -1
- package/dist/classes/Api.js +3 -2
- package/dist/classes/Api.js.map +1 -1
- package/dist/classes/CToken.d.ts +1 -0
- package/dist/classes/CToken.d.ts.map +1 -1
- package/dist/classes/CToken.js +38 -28
- package/dist/classes/CToken.js.map +1 -1
- package/dist/classes/DexAggregators/Kuru.d.ts +2 -2
- package/dist/classes/DexAggregators/Kuru.d.ts.map +1 -1
- package/dist/classes/DexAggregators/Kuru.js +35 -12
- package/dist/classes/DexAggregators/Kuru.js.map +1 -1
- package/dist/classes/DexAggregators/KyberSwap.d.ts.map +1 -1
- package/dist/classes/DexAggregators/KyberSwap.js +7 -4
- package/dist/classes/DexAggregators/KyberSwap.js.map +1 -1
- package/dist/classes/Market.d.ts +1 -1
- package/dist/classes/Market.d.ts.map +1 -1
- package/dist/classes/Market.js +21 -13
- package/dist/classes/Market.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/integrations/merkl.d.ts.map +1 -1
- package/dist/integrations/merkl.js +4 -3
- package/dist/integrations/merkl.js.map +1 -1
- package/dist/retry-provider.d.ts.map +1 -1
- package/dist/retry-provider.js +6 -8
- package/dist/retry-provider.js.map +1 -1
- package/dist/setup.d.ts.map +1 -1
- package/dist/setup.js +3 -0
- package/dist/setup.js.map +1 -1
- package/dist/validation.d.ts +45 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +128 -0
- package/dist/validation.js.map +1 -0
- package/package.json +9 -9
- package/dist/chains/arb-sepolia.json +0 -44
- package/dist/classes/DexAggregators/KuruMainnet.d.ts +0 -1
- package/dist/classes/DexAggregators/KuruMainnet.d.ts.map +0 -1
- package/dist/classes/DexAggregators/KuruMainnet.js +0 -228
- package/dist/classes/DexAggregators/KuruMainnet.js.map +0 -1
- package/dist/classes/Kuru.d.ts +0 -59
- package/dist/classes/Kuru.d.ts.map +0 -1
- package/dist/classes/Kuru.js +0 -167
- package/dist/classes/Kuru.js.map +0 -1
- package/dist/classes/KuruMainnet.d.ts +0 -59
- package/dist/classes/KuruMainnet.d.ts.map +0 -1
- package/dist/classes/KuruMainnet.js +0 -167
- package/dist/classes/KuruMainnet.js.map +0 -1
- package/dist/snapshot.d.ts +0 -53
- package/dist/snapshot.d.ts.map +0 -1
- package/dist/snapshot.js +0 -103
- package/dist/snapshot.js.map +0 -1
package/dist/setup.js
CHANGED
|
@@ -9,11 +9,14 @@ const OracleManager_1 = require("./classes/OracleManager");
|
|
|
9
9
|
const retry_provider_1 = require("./retry-provider");
|
|
10
10
|
const chains_1 = require("./chains");
|
|
11
11
|
const Api_1 = require("./classes/Api");
|
|
12
|
+
const validation_1 = require("./validation");
|
|
12
13
|
exports.all_markets = [];
|
|
13
14
|
async function setupChain(chain, provider = null, approval_protection = false, api_url = "https://api.curvance.com") {
|
|
14
15
|
if (!(chain in chains_1.chain_config)) {
|
|
15
16
|
throw new Error("Chain does not have a corresponding config");
|
|
16
17
|
}
|
|
18
|
+
// Validate api_url scheme before any network calls
|
|
19
|
+
(0, validation_1.validateApiUrl)(api_url);
|
|
17
20
|
if (provider == null) {
|
|
18
21
|
provider = chains_1.chain_config[chain].provider;
|
|
19
22
|
}
|
package/dist/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":";;;AAoBA,gCAwCC;AA5DD,uCAAiE;AACjE,6CAA0C;AAE1C,6DAA0D;AAC1D,2DAAwD;AACxD,qDAA2D;AAC3D,qCAAwC;AACxC,uCAAoC;AACpC,6C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AC,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,oBAAY,CAAC,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IAEzG,OAAO;QACH,OAAO,EAAE,mBAAW;QACpB,MAAM;QACN,MAAM,EAAE,qBAAY,CAAC,KAAK,CAAC,CAAC,MAAM;QAClC,gBAAgB,EAAE,UAAU,CAAC,QAAQ,CAAC,IAAI,IAAI;KACjD,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { address } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Parse a string from an untrusted source (API response) into BigInt.
|
|
4
|
+
* Throws a descriptive error instead of raw SyntaxError on invalid input.
|
|
5
|
+
*
|
|
6
|
+
* @param value - Value to convert (string, number, bigint)
|
|
7
|
+
* @param context - Human-readable label for error messages (e.g. "KyberSwap amountOut")
|
|
8
|
+
*/
|
|
9
|
+
export declare function safeBigInt(value: unknown, context: string): bigint;
|
|
10
|
+
/**
|
|
11
|
+
* Validate and checksum an address from an untrusted source.
|
|
12
|
+
* The SDK `address` type is compile-time only — this adds runtime enforcement.
|
|
13
|
+
*
|
|
14
|
+
* @param raw - Address string to validate
|
|
15
|
+
* @param context - Human-readable label for error messages
|
|
16
|
+
*/
|
|
17
|
+
export declare function validateAddress(raw: string, context: string): address;
|
|
18
|
+
/**
|
|
19
|
+
* Validate that a router address from a DEX API matches the expected address.
|
|
20
|
+
*
|
|
21
|
+
* @param actual - Router address returned by the API
|
|
22
|
+
* @param expected - Known router address from SDK config
|
|
23
|
+
* @param aggregatorName - Name of the DEX aggregator for error messages
|
|
24
|
+
*/
|
|
25
|
+
export declare function validateRouterAddress(actual: string, expected: string, aggregatorName: string): address;
|
|
26
|
+
/**
|
|
27
|
+
* Wrapper around fetch() that adds a timeout via AbortController.
|
|
28
|
+
* If the caller already provided a signal, the timeout races against it.
|
|
29
|
+
*
|
|
30
|
+
* @param url - Request URL
|
|
31
|
+
* @param options - Standard RequestInit options
|
|
32
|
+
* @param timeoutMs - Timeout in milliseconds (default 15s)
|
|
33
|
+
*/
|
|
34
|
+
export declare function fetchWithTimeout(url: string, options?: RequestInit, timeoutMs?: number): Promise<Response>;
|
|
35
|
+
/**
|
|
36
|
+
* Validate that an API URL uses HTTPS and is well-formed.
|
|
37
|
+
* Prevents SSRF when api_url is consumer-provided.
|
|
38
|
+
*/
|
|
39
|
+
export declare function validateApiUrl(url: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Validate that slippage is within valid BPS range [0, 10000].
|
|
42
|
+
* Prevents negative min_out calculations when slippage > 100%.
|
|
43
|
+
*/
|
|
44
|
+
export declare function validateSlippageBps(slippage: bigint, context: string): bigint;
|
|
45
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAYlE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAYrE;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACjC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,GACvB,OAAO,CAQT;AAMD;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CAClC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,WAAgB,EACzB,SAAS,GAAE,MAA2B,GACvC,OAAO,CAAC,QAAQ,CAAC,CAsBnB;AAID;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAiBlD;AAMD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAK7E"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.safeBigInt = safeBigInt;
|
|
4
|
+
exports.validateAddress = validateAddress;
|
|
5
|
+
exports.validateRouterAddress = validateRouterAddress;
|
|
6
|
+
exports.fetchWithTimeout = fetchWithTimeout;
|
|
7
|
+
exports.validateApiUrl = validateApiUrl;
|
|
8
|
+
exports.validateSlippageBps = validateSlippageBps;
|
|
9
|
+
const ethers_1 = require("ethers");
|
|
10
|
+
/**
|
|
11
|
+
* Parse a string from an untrusted source (API response) into BigInt.
|
|
12
|
+
* Throws a descriptive error instead of raw SyntaxError on invalid input.
|
|
13
|
+
*
|
|
14
|
+
* @param value - Value to convert (string, number, bigint)
|
|
15
|
+
* @param context - Human-readable label for error messages (e.g. "KyberSwap amountOut")
|
|
16
|
+
*/
|
|
17
|
+
function safeBigInt(value, context) {
|
|
18
|
+
if (typeof value === 'bigint')
|
|
19
|
+
return value;
|
|
20
|
+
const str = String(value ?? '');
|
|
21
|
+
// BigInt() accepts integer strings only — reject floats, hex, empty, etc. early
|
|
22
|
+
// to give a useful error instead of generic SyntaxError
|
|
23
|
+
if (!/^-?\d+$/.test(str)) {
|
|
24
|
+
throw new Error(`Invalid numeric value from ${context}: "${str.slice(0, 50)}"`);
|
|
25
|
+
}
|
|
26
|
+
return BigInt(str);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Validate and checksum an address from an untrusted source.
|
|
30
|
+
* The SDK `address` type is compile-time only — this adds runtime enforcement.
|
|
31
|
+
*
|
|
32
|
+
* @param raw - Address string to validate
|
|
33
|
+
* @param context - Human-readable label for error messages
|
|
34
|
+
*/
|
|
35
|
+
function validateAddress(raw, context) {
|
|
36
|
+
if (!raw || typeof raw !== 'string') {
|
|
37
|
+
throw new Error(`Missing address from ${context}`);
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
// ethers v6 getAddress: validates format, length, checksum.
|
|
41
|
+
// Returns checksummed EIP-55 address.
|
|
42
|
+
return (0, ethers_1.getAddress)(raw);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
throw new Error(`Invalid address from ${context}: "${raw.slice(0, 50)}"`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Validate that a router address from a DEX API matches the expected address.
|
|
50
|
+
*
|
|
51
|
+
* @param actual - Router address returned by the API
|
|
52
|
+
* @param expected - Known router address from SDK config
|
|
53
|
+
* @param aggregatorName - Name of the DEX aggregator for error messages
|
|
54
|
+
*/
|
|
55
|
+
function validateRouterAddress(actual, expected, aggregatorName) {
|
|
56
|
+
const validated = validateAddress(actual, `${aggregatorName} router`);
|
|
57
|
+
if (validated.toLowerCase() !== expected.toLowerCase()) {
|
|
58
|
+
throw new Error(`${aggregatorName} returned unexpected router address: ${actual} (expected ${expected})`);
|
|
59
|
+
}
|
|
60
|
+
return validated;
|
|
61
|
+
}
|
|
62
|
+
// ── Fetch with timeout ──────────────────────────────────────────────
|
|
63
|
+
const DEFAULT_TIMEOUT_MS = 15_000;
|
|
64
|
+
/**
|
|
65
|
+
* Wrapper around fetch() that adds a timeout via AbortController.
|
|
66
|
+
* If the caller already provided a signal, the timeout races against it.
|
|
67
|
+
*
|
|
68
|
+
* @param url - Request URL
|
|
69
|
+
* @param options - Standard RequestInit options
|
|
70
|
+
* @param timeoutMs - Timeout in milliseconds (default 15s)
|
|
71
|
+
*/
|
|
72
|
+
async function fetchWithTimeout(url, options = {}, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
73
|
+
const controller = new AbortController();
|
|
74
|
+
const id = setTimeout(() => controller.abort(), timeoutMs);
|
|
75
|
+
// If the caller provided their own signal, listen for its abort too
|
|
76
|
+
const externalSignal = options.signal;
|
|
77
|
+
if (externalSignal) {
|
|
78
|
+
if (externalSignal.aborted) {
|
|
79
|
+
controller.abort();
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
externalSignal.addEventListener('abort', () => controller.abort(), { once: true });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
return await fetch(url, {
|
|
87
|
+
...options,
|
|
88
|
+
signal: controller.signal
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
clearTimeout(id);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// ── URL validation ──────────────────────────────────────────────────
|
|
96
|
+
/**
|
|
97
|
+
* Validate that an API URL uses HTTPS and is well-formed.
|
|
98
|
+
* Prevents SSRF when api_url is consumer-provided.
|
|
99
|
+
*/
|
|
100
|
+
function validateApiUrl(url) {
|
|
101
|
+
if (!url || typeof url !== 'string') {
|
|
102
|
+
throw new Error('api_url must be a non-empty string');
|
|
103
|
+
}
|
|
104
|
+
let parsed;
|
|
105
|
+
try {
|
|
106
|
+
parsed = new URL(url);
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
throw new Error(`Invalid api_url: "${url.slice(0, 100)}"`);
|
|
110
|
+
}
|
|
111
|
+
if (parsed.protocol !== 'https:') {
|
|
112
|
+
throw new Error(`api_url must use HTTPS, got ${parsed.protocol} in "${url.slice(0, 100)}"`);
|
|
113
|
+
}
|
|
114
|
+
return url;
|
|
115
|
+
}
|
|
116
|
+
// ── Slippage validation ─────────────────────────────────────────────
|
|
117
|
+
const MAX_SLIPPAGE_BPS = 10000n; // 100%
|
|
118
|
+
/**
|
|
119
|
+
* Validate that slippage is within valid BPS range [0, 10000].
|
|
120
|
+
* Prevents negative min_out calculations when slippage > 100%.
|
|
121
|
+
*/
|
|
122
|
+
function validateSlippageBps(slippage, context) {
|
|
123
|
+
if (slippage < 0n || slippage > MAX_SLIPPAGE_BPS) {
|
|
124
|
+
throw new Error(`Slippage out of range (0-10000 BPS) in ${context}: ${slippage}`);
|
|
125
|
+
}
|
|
126
|
+
return slippage;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":";;AAUA,gCAYC;AASD,0CAYC;AASD,sDAYC;AAcD,4CA0BC;AAQD,wCAiBC;AAUD,kDAKC;AAhJD,mCAAoC;AAGpC;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,KAAc,EAAE,OAAe;IACtD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE5C,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAEhC,gFAAgF;IAChF,wDAAwD;IACxD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,8BAA8B,OAAO,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;IACpF,CAAC;IAED,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,eAAe,CAAC,GAAW,EAAE,OAAe;IACxD,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,IAAI,CAAC;QACD,4DAA4D;QAC5D,sCAAsC;QACtC,OAAO,IAAA,mBAAU,EAAC,GAAG,CAAY,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACL,MAAM,IAAI,KAAK,CAAC,wBAAwB,OAAO,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;IAC9E,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,qBAAqB,CACjC,MA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,CAAC,GAAW;IACtC,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IAC1D,CAAC;IAED,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACD,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACL,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/D,CAAC;IAED,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,+BAA+B,MAAM,CAAC,QAAQ,QAAQ,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAChG,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC;AAED,uEAAuE;AAEvE,MAAM,gBAAgB,GAAG,MAAM,CAAC,CAAC,OAAO;AAExC;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,QAAgB,EAAE,OAAe;IACjE,IAAI,QAAQ,GAAG,EAAE,IAAI,QAAQ,GAAG,gBAAgB,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,0CAA0C,OAAO,KAAK,QAAQ,EAAE,CAAC,CAAC;IACtF,CAAC;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "curvance",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"scripts": {
|
|
26
26
|
"up": "npm run build && npm publish",
|
|
27
27
|
"fetch": "ts-node fetch-deployment.ts",
|
|
28
|
-
"build": "tsc",
|
|
28
|
+
"build": "node node_modules/typescript/bin/tsc",
|
|
29
29
|
"test": "node --test --test-concurrency=1 --require ts-node/register tests/*.test.ts",
|
|
30
30
|
"test:replay": "ts-node tests/replay.test.ts",
|
|
31
31
|
"test:leverage": "ts-node tests/leverage.test.ts",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"test:optimizer": "ts-node tests/optimizer.test.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@redstone-finance/sdk": "
|
|
40
|
-
"decimal.js": "
|
|
41
|
-
"ethers": "
|
|
39
|
+
"@redstone-finance/sdk": "0.9.0",
|
|
40
|
+
"decimal.js": "10.6.0",
|
|
41
|
+
"ethers": "6.16.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@types/node": "
|
|
45
|
-
"dotenv": "
|
|
46
|
-
"ts-node": "
|
|
47
|
-
"typescript": "
|
|
44
|
+
"@types/node": "24.12.2",
|
|
45
|
+
"dotenv": "17.4.1",
|
|
46
|
+
"ts-node": "10.9.2",
|
|
47
|
+
"typescript": "5.9.3"
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"CentralRegistry": "0xC7B36473cb7F4BC0b2F47376623615Da4e6fE57D",
|
|
3
|
-
"OracleManager": "0x440d0CC7ACC38DDA1E0E2E1DDa226EB44A72d4eE",
|
|
4
|
-
"adaptors": {
|
|
5
|
-
"ChainlinkAdaptor": "0x38c37f57a3b5c26B344671FdF3C3162BaCDA7bBa",
|
|
6
|
-
"RedstoneClassicAdaptor": "0x6a0bf34856F6B9cb42867aC0a6b9Dc9e49a0b2Ba",
|
|
7
|
-
"RedstoneCoreAdaptor": "0xD44861cF7ff4eCEe3d227a0e67E2e60244456E27"
|
|
8
|
-
},
|
|
9
|
-
"calldataCheckers": {
|
|
10
|
-
"RedstoneAdaptorMulticallChecker": "0x81607179829EFA9735E7413090Db247cFb6231E1"
|
|
11
|
-
},
|
|
12
|
-
"zappers": {
|
|
13
|
-
"nativeVaultZapper": "0xbDa98B38aFc8433a07bf291787A10c7470E3fA06",
|
|
14
|
-
"vaultZapper": "0x24cE639C53a1A0eCB0d5209fc8F548ceBbfF534A",
|
|
15
|
-
"simpleZapper": "0xCD602E77913114fd29CA5da0898c49996d504B13"
|
|
16
|
-
},
|
|
17
|
-
"MockOracle": "0x7f2b026da1e31109b7049DeeCb5aa852a1f2a728",
|
|
18
|
-
"USDC": "0xFAf10acC86Dd587B1a75B832FCeB01B2fe3379Db",
|
|
19
|
-
"AUSD": "0x2220a895C3B943838F606C67B488fec9FE9ADa4b",
|
|
20
|
-
"BTC": "0x955Cd836061481131b35Ac114ef96e17f9D1D402",
|
|
21
|
-
"ETH": "0xa0EF95Df879E7958281404B44f2065A72cF4A8FA",
|
|
22
|
-
"Faucet": "0xa47b3c31aeB952E60332869F7ED6F44D14890375",
|
|
23
|
-
"markets": {
|
|
24
|
-
"Stable Market": {
|
|
25
|
-
"address": "0x8fe35902B67D81c94CF81fd9a96558e8349215F5",
|
|
26
|
-
"USDC-DynamicIRM": "0x2a5d40ccbD99cf6aC202A32725e2E1680bd3B2A0",
|
|
27
|
-
"tokens": {
|
|
28
|
-
"USDC": "0x4Fd99EFd43d66F0eF854Ca58Ec0c9b9950514aF3",
|
|
29
|
-
"AUSD": "0xC9cfa1ABf23F672a0a75eC567cE13619d0062CAD"
|
|
30
|
-
},
|
|
31
|
-
"AUSD-DynamicIRM": "0xa8CAc481f9f8D690609f4A1EF1C32d58cFC687F0"
|
|
32
|
-
},
|
|
33
|
-
"Volatile Market": {
|
|
34
|
-
"address": "0x405793BfAC1A82F056fdE8A71580FCeDa68Ef8d6",
|
|
35
|
-
"BTC-DynamicIRM": "0xA6D76582F0cBaaBB512edCeB138c106185C8f0c6",
|
|
36
|
-
"tokens": {
|
|
37
|
-
"BTC": "0xe98D2e7EB66e504e26Dbc208601cb04F31652AA5",
|
|
38
|
-
"ETH": "0x79049726F807407eEa9eFc49DEa4010332Aa6d7f"
|
|
39
|
-
},
|
|
40
|
-
"ETH-DynamicIRM": "0xFae2a261D376acDCcf5fe6D63944650209f22C2C"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"ProtocolReader": "0xC57e4e42278CA815C5717eFA84a536f30Ee49637"
|
|
44
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=KuruMainnet.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"KuruMainnet.d.ts","sourceRoot":"","sources":["../../../src/classes/DexAggregators/KuruMainnet.ts"],"names":[],"mappings":""}
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// import Decimal from "decimal.js";
|
|
3
|
-
// import { address, curvance_provider, TokenInput } from "../../types";
|
|
4
|
-
// import { ERC20 } from "../ERC20";
|
|
5
|
-
// import { toBigInt, toDecimal, validateProviderAsSigner, WAD } from "../../helpers";
|
|
6
|
-
// import { ZapToken } from "../CToken";
|
|
7
|
-
// import { Swap } from "../Zapper";
|
|
8
|
-
// interface KuruJWTResponse {
|
|
9
|
-
// token: string;
|
|
10
|
-
// expires_at: number;
|
|
11
|
-
// rate_limit: {
|
|
12
|
-
// rps: number;
|
|
13
|
-
// burst: number;
|
|
14
|
-
// }
|
|
15
|
-
// }
|
|
16
|
-
// interface KuruQuoteResponse {
|
|
17
|
-
// type: string;
|
|
18
|
-
// status: string;
|
|
19
|
-
// output: string;
|
|
20
|
-
// minOut: string;
|
|
21
|
-
// transaction: {
|
|
22
|
-
// calldata: string;
|
|
23
|
-
// value: string;
|
|
24
|
-
// to: string;
|
|
25
|
-
// };
|
|
26
|
-
// gasPrices: {
|
|
27
|
-
// slow: string;
|
|
28
|
-
// standard: string;
|
|
29
|
-
// fast: string;
|
|
30
|
-
// rapid: string;
|
|
31
|
-
// extreme: string;
|
|
32
|
-
// };
|
|
33
|
-
// }
|
|
34
|
-
// const cached_jwt = new Map<string, KuruJWTResponse>();
|
|
35
|
-
// const cached_requests = new Map<string, number[]>();
|
|
36
|
-
// export default class KuruMainnet {
|
|
37
|
-
// static api = "https://ws.kuru.io/api"
|
|
38
|
-
// static router = "0xb3e6778480b2E488385E8205eA05E20060B813cb" as address; // KuruFlowEntrypoint
|
|
39
|
-
// jwt: string | null = null;
|
|
40
|
-
// rps = 1;
|
|
41
|
-
// dao = "0x0Acb7eF4D8733C719d60e0992B489b629bc55C02" as address;
|
|
42
|
-
// async loadJWT(wallet: string) {
|
|
43
|
-
// if(cached_jwt.has(wallet)) {
|
|
44
|
-
// const cached = cached_jwt.get(wallet)!;
|
|
45
|
-
// const currentTime = KuruMainnet.getCurrentTime();
|
|
46
|
-
// if(cached.expires_at > currentTime) {
|
|
47
|
-
// this.jwt = cached.token;
|
|
48
|
-
// this.rps = cached.rate_limit.rps;
|
|
49
|
-
// return;
|
|
50
|
-
// } else {
|
|
51
|
-
// cached_jwt.delete(wallet);
|
|
52
|
-
// }
|
|
53
|
-
// }
|
|
54
|
-
// const resp = await fetch(`${KuruMainnet.api}/generate-token`, {
|
|
55
|
-
// method: "POST",
|
|
56
|
-
// headers: {
|
|
57
|
-
// "Content-Type": "application/json",
|
|
58
|
-
// },
|
|
59
|
-
// body: JSON.stringify({
|
|
60
|
-
// user_address: wallet,
|
|
61
|
-
// }),
|
|
62
|
-
// keepalive: true
|
|
63
|
-
// });
|
|
64
|
-
// if(!resp.ok) {
|
|
65
|
-
// throw new Error(`Failed to fetch JWT: ${resp.status} ${resp.statusText}`);
|
|
66
|
-
// }
|
|
67
|
-
// const data = await resp.json() as KuruJWTResponse;
|
|
68
|
-
// this.jwt = data.token;
|
|
69
|
-
// this.rps = data.rate_limit.rps;
|
|
70
|
-
// cached_jwt.set(wallet, data);
|
|
71
|
-
// }
|
|
72
|
-
// async rateLimitSleep(wallet: string) {
|
|
73
|
-
// const now = KuruMainnet.getCurrentTime();
|
|
74
|
-
// const requests = cached_requests.get(wallet) || [];
|
|
75
|
-
// const windowStart = now - 2;
|
|
76
|
-
// const recentRequests = requests.filter(timestamp => timestamp > windowStart);
|
|
77
|
-
// if(recentRequests.length >= this.rps) {
|
|
78
|
-
// const earliestRequest = Math.min(...recentRequests);
|
|
79
|
-
// const sleepTime = (earliestRequest + 2) - now;
|
|
80
|
-
// await new Promise(resolve => setTimeout(resolve, sleepTime * 2000));
|
|
81
|
-
// }
|
|
82
|
-
// }
|
|
83
|
-
// static async getAvailableTokens(provider: curvance_provider, query: string | null = null) {
|
|
84
|
-
// const signer = validateProviderAsSigner(provider);
|
|
85
|
-
// const userAddress = signer.address;
|
|
86
|
-
// let endpoint = `https://api.kuru.io/api/v2/tokens/search?limit=20&userAddress=${userAddress}`;
|
|
87
|
-
// if(query) {
|
|
88
|
-
// endpoint += `&q=${encodeURIComponent(query)}`;
|
|
89
|
-
// }
|
|
90
|
-
// const resp = await fetch(endpoint, {
|
|
91
|
-
// method: "GET",
|
|
92
|
-
// headers: {
|
|
93
|
-
// "Content-Type": "application/json",
|
|
94
|
-
// }
|
|
95
|
-
// });
|
|
96
|
-
// if(!resp.ok) {
|
|
97
|
-
// throw new Error(`Failed to fetch available tokens: ${resp.status} ${resp.statusText}`);
|
|
98
|
-
// }
|
|
99
|
-
// const list = await resp.json() as {
|
|
100
|
-
// success: boolean;
|
|
101
|
-
// code: number;
|
|
102
|
-
// timestamp: number;
|
|
103
|
-
// data: {
|
|
104
|
-
// data: Array<{
|
|
105
|
-
// address: string;
|
|
106
|
-
// decimals: number;
|
|
107
|
-
// name: string;
|
|
108
|
-
// ticker: string;
|
|
109
|
-
// imageurl: string,
|
|
110
|
-
// twitter: string,
|
|
111
|
-
// website: string,
|
|
112
|
-
// is_verified: boolean,
|
|
113
|
-
// contract_renounced: boolean,
|
|
114
|
-
// is_erc20: boolean,
|
|
115
|
-
// is_mintable: boolean,
|
|
116
|
-
// is_strict: boolean,
|
|
117
|
-
// balance: string,
|
|
118
|
-
// last_price: string,
|
|
119
|
-
// quote_asset: string,
|
|
120
|
-
// market_address: string,
|
|
121
|
-
// total_supply: string,
|
|
122
|
-
// burned_supply: string
|
|
123
|
-
// }>
|
|
124
|
-
// }
|
|
125
|
-
// };
|
|
126
|
-
// let tokens: ZapToken[] = [];
|
|
127
|
-
// for(const token of list.data.data) {
|
|
128
|
-
// const erc20 = new ERC20(
|
|
129
|
-
// provider,
|
|
130
|
-
// token.address as address,
|
|
131
|
-
// {
|
|
132
|
-
// address: token.address as address,
|
|
133
|
-
// name: token.name,
|
|
134
|
-
// symbol: token.ticker,
|
|
135
|
-
// decimals: BigInt(token.decimals ?? 18),
|
|
136
|
-
// totalSupply: BigInt(token.total_supply ?? 0),
|
|
137
|
-
// balance: BigInt(token.balance ?? 0),
|
|
138
|
-
// image: token.imageurl,
|
|
139
|
-
// price: Decimal(token.last_price).div(WAD)
|
|
140
|
-
// },
|
|
141
|
-
// );
|
|
142
|
-
// tokens.push({
|
|
143
|
-
// interface: erc20,
|
|
144
|
-
// type: 'simple',
|
|
145
|
-
// quote: async(tokenIn: string, tokenOut: string, amount: TokenInput, slippageTolerance: bigint | null = null) => {
|
|
146
|
-
// const raw_amount = toBigInt(amount, 18n);
|
|
147
|
-
// const data = await KuruMainnet.quote(signer.address, tokenIn, tokenOut, raw_amount.toString(), slippageTolerance);
|
|
148
|
-
// return {
|
|
149
|
-
// output: toDecimal(BigInt(data.output ?? 0), BigInt(token.decimals ?? 18)),
|
|
150
|
-
// minOut: toDecimal(BigInt(data.minOut ?? 0), BigInt(token.decimals ?? 18)),
|
|
151
|
-
// max_slippage: data.max_slippage
|
|
152
|
-
// };
|
|
153
|
-
// }
|
|
154
|
-
// });
|
|
155
|
-
// }
|
|
156
|
-
// return tokens;
|
|
157
|
-
// }
|
|
158
|
-
// // Get current time in seconds
|
|
159
|
-
// static getCurrentTime() {
|
|
160
|
-
// return Math.floor(Date.now() / 1000);
|
|
161
|
-
// }
|
|
162
|
-
// static async quoteAction(wallet: string, tokenIn: string, tokenOut: string, amount: string, slippageTolerance: bigint | null = null) {
|
|
163
|
-
// const quote = await KuruMainnet.quote(wallet, tokenIn, tokenOut, amount, slippageTolerance);
|
|
164
|
-
// const action = {
|
|
165
|
-
// inputToken: tokenIn,
|
|
166
|
-
// inputAmount: BigInt(amount),
|
|
167
|
-
// outputToken: tokenOut,
|
|
168
|
-
// target: quote.transaction.to,
|
|
169
|
-
// slippage: slippageTolerance ?? 0n,
|
|
170
|
-
// call: `0x${quote.transaction.calldata}`
|
|
171
|
-
// } as Swap;
|
|
172
|
-
// return { action, quote };
|
|
173
|
-
// }
|
|
174
|
-
// static async quoteMin(wallet: string, tokenIn: string, tokenOut: string, amount: string, slippageTolerance: bigint | null = null) {
|
|
175
|
-
// const quote = await KuruMainnet.quote(wallet, tokenIn, tokenOut, amount, slippageTolerance);
|
|
176
|
-
// return quote.minOut;
|
|
177
|
-
// }
|
|
178
|
-
// static async quote(wallet: string, tokenIn: string, tokenOut: string, amount: string, slippageTolerance: bigint | null = null) {
|
|
179
|
-
// const kuru = new this();
|
|
180
|
-
// await kuru.loadJWT(wallet);
|
|
181
|
-
// await kuru.rateLimitSleep(wallet);
|
|
182
|
-
// const payload: {
|
|
183
|
-
// userAddress: string;
|
|
184
|
-
// tokenIn: string;
|
|
185
|
-
// tokenOut: string;
|
|
186
|
-
// amount: string;
|
|
187
|
-
// referrerAddress?: string;
|
|
188
|
-
// referrerFeeBps?: number;
|
|
189
|
-
// slippage_tolerance?: number;
|
|
190
|
-
// autoSlippage?: boolean;
|
|
191
|
-
// } = {
|
|
192
|
-
// userAddress: wallet,
|
|
193
|
-
// tokenIn: tokenIn,
|
|
194
|
-
// tokenOut: tokenOut,
|
|
195
|
-
// amount: amount,
|
|
196
|
-
// referrerAddress: kuru.dao,
|
|
197
|
-
// referrerFeeBps: 10,
|
|
198
|
-
// };
|
|
199
|
-
// if(!slippageTolerance) {
|
|
200
|
-
// payload.autoSlippage = true;
|
|
201
|
-
// } else {
|
|
202
|
-
// payload.slippage_tolerance = Number(slippageTolerance);
|
|
203
|
-
// }
|
|
204
|
-
// cached_requests.set(wallet, (cached_requests.get(wallet) || []).concat(KuruMainnet.getCurrentTime()));
|
|
205
|
-
// const resp = await fetch(`${KuruMainnet.api}/quote`, {
|
|
206
|
-
// method: "POST",
|
|
207
|
-
// headers: {
|
|
208
|
-
// "Content-Type": "application/json",
|
|
209
|
-
// "Authorization": `Bearer ${kuru.jwt}`
|
|
210
|
-
// },
|
|
211
|
-
// body: JSON.stringify(payload),
|
|
212
|
-
// });
|
|
213
|
-
// if(!resp.ok) {
|
|
214
|
-
// throw new Error(`Failed to fetch quote: ${resp.status} ${resp.statusText}`);
|
|
215
|
-
// }
|
|
216
|
-
// const data = await resp.json() as KuruQuoteResponse;
|
|
217
|
-
// return {
|
|
218
|
-
// ...data,
|
|
219
|
-
// max_slippage: KuruMainnet.getSlippage(BigInt(data.output ?? 0), BigInt(data.minOut ?? 0))
|
|
220
|
-
// };
|
|
221
|
-
// }
|
|
222
|
-
// static getSlippage(output: bigint, min_output: bigint) {
|
|
223
|
-
// const diff = output - min_output;
|
|
224
|
-
// const decimal = Decimal(diff).div(output).mul(100);
|
|
225
|
-
// return decimal ?? Decimal(100);
|
|
226
|
-
// }
|
|
227
|
-
// }
|
|
228
|
-
//# sourceMappingURL=KuruMainnet.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"KuruMainnet.js","sourceRoot":"","sources":["../../../src/classes/DexAggregators/KuruMainnet.ts"],"names":[],"mappings":";AAAA,oCAAoC;AACpC,wEAAwE;AACxE,oCAAoC;AACpC,sFAAsF;AACtF,wCAAwC;AACxC,oCAAoC;AAEpC,8BAA8B;AAC9B,qBAAqB;AACrB,0BAA0B;AAC1B,oBAAoB;AACpB,uBAAuB;AACvB,yBAAyB;AACzB,QAAQ;AACR,IAAI;AAEJ,gCAAgC;AAChC,oBAAoB;AACp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,wCAAwC;AACxC,uCAAuC;AACvC,2CAA2C;AAC3C,sCAAsC;AACtC,gBAAgB;AAChB,mCAAmC;AACnC,gCAAgC;AAChC,kCAAkC;AAClC,8BAA8B;AAC9B,yCAAyC;AACzC,kCAAkC;AAClC,aAAa;AAEb,mCAAmC;AACnC,2CAA2C;AAC3C,mBAAmB;AACnB,sEAAsE;AACtE,YAAY;AAEZ,iHAAiH;AACjH,iEAAiE;AACjE,8BAA8B;AAC9B,yBAAyB;AACzB,sDAAsD;AACtD,wDAAwD;AACxD,iBAAiB;AACjB,6CAA6C;AAC7C,cAAc;AAEd,yBAAyB;AACzB,2FAA2F;AAC3F,YAAY;AAEZ,+DAA+D;AAE/D,mBAAmB;AACnB,uBAAuB;AACvB,wGAAwG;AACxG,aAAa;AACb,QAAQ;AAER,+DAA+D;AAC/D,4CAA4C;AAC5C,8DAA8D;AAC9D,0CAA0C;AAC1C,QAAQ;AACR,IAAI"}
|
package/dist/classes/Kuru.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import Decimal from "decimal.js";
|
|
2
|
-
import { address, curvance_provider } from "../types";
|
|
3
|
-
import { ZapToken } from "./CToken";
|
|
4
|
-
import { Swap } from "./Zapper";
|
|
5
|
-
export default class Kuru {
|
|
6
|
-
api: string;
|
|
7
|
-
static router: address;
|
|
8
|
-
jwt: string | null;
|
|
9
|
-
rps: number;
|
|
10
|
-
dao: address;
|
|
11
|
-
loadJWT(wallet: string): Promise<void>;
|
|
12
|
-
rateLimitSleep(wallet: string): Promise<void>;
|
|
13
|
-
static getAvailableTokens(provider: curvance_provider, query?: string | null): Promise<ZapToken[]>;
|
|
14
|
-
static getCurrentTime(): number;
|
|
15
|
-
static quoteAction(wallet: string, tokenIn: string, tokenOut: string, amount: string, slippageTolerance?: bigint | null): Promise<{
|
|
16
|
-
action: Swap;
|
|
17
|
-
quote: {
|
|
18
|
-
max_slippage: Decimal;
|
|
19
|
-
type: string;
|
|
20
|
-
status: string;
|
|
21
|
-
output: string;
|
|
22
|
-
minOut: string;
|
|
23
|
-
transaction: {
|
|
24
|
-
calldata: string;
|
|
25
|
-
value: string;
|
|
26
|
-
to: string;
|
|
27
|
-
};
|
|
28
|
-
gasPrices: {
|
|
29
|
-
slow: string;
|
|
30
|
-
standard: string;
|
|
31
|
-
fast: string;
|
|
32
|
-
rapid: string;
|
|
33
|
-
extreme: string;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
}>;
|
|
37
|
-
static quoteMin(wallet: string, tokenIn: string, tokenOut: string, amount: string, slippageTolerance?: bigint | null): Promise<string>;
|
|
38
|
-
static quote(wallet: string, tokenIn: string, tokenOut: string, amount: string, slippageTolerance?: bigint | null): Promise<{
|
|
39
|
-
max_slippage: Decimal;
|
|
40
|
-
type: string;
|
|
41
|
-
status: string;
|
|
42
|
-
output: string;
|
|
43
|
-
minOut: string;
|
|
44
|
-
transaction: {
|
|
45
|
-
calldata: string;
|
|
46
|
-
value: string;
|
|
47
|
-
to: string;
|
|
48
|
-
};
|
|
49
|
-
gasPrices: {
|
|
50
|
-
slow: string;
|
|
51
|
-
standard: string;
|
|
52
|
-
fast: string;
|
|
53
|
-
rapid: string;
|
|
54
|
-
extreme: string;
|
|
55
|
-
};
|
|
56
|
-
}>;
|
|
57
|
-
static getSlippage(output: bigint, min_output: bigint): Decimal;
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=Kuru.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Kuru.d.ts","sourceRoot":"","sources":["../../src/classes/Kuru.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAc,MAAM,UAAU,CAAC;AAGlE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAiChC,MAAM,CAAC,OAAO,OAAO,IAAI;IAC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