@gearbox-protocol/sdk 8.27.12 → 8.27.13
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.
|
@@ -23,6 +23,7 @@ __export(networks_exports, {
|
|
|
23
23
|
RAMP_DURATION_BY_NETWORK: () => RAMP_DURATION_BY_NETWORK
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(networks_exports);
|
|
26
|
+
var import_chain = require("../chain/index.js");
|
|
26
27
|
var import_mappers = require("../utils/mappers.js");
|
|
27
28
|
const ADDRESS_PROVIDER_BLOCK = {
|
|
28
29
|
Mainnet: 18433056n,
|
|
@@ -51,27 +52,19 @@ const ADDRESS_PROVIDER_BLOCK = {
|
|
|
51
52
|
Lisk: 18934260n
|
|
52
53
|
// arbitrary not deployed yet
|
|
53
54
|
};
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
Berachain: 1.9,
|
|
66
|
-
Avalanche: 1.7,
|
|
67
|
-
BNB: 3,
|
|
68
|
-
WorldChain: 2,
|
|
69
|
-
Etherlink: 1,
|
|
70
|
-
Hemi: 12,
|
|
71
|
-
Lisk: 2
|
|
72
|
-
};
|
|
55
|
+
const BLOCK_DURATION_LOCAL = {};
|
|
56
|
+
const BLOCK_DURATION = Object.values(import_chain.chains).reduce(
|
|
57
|
+
(acc, chain) => {
|
|
58
|
+
const blockTime = chain.blockTime || BLOCK_DURATION_LOCAL[chain.network] || 0;
|
|
59
|
+
if (blockTime === 0)
|
|
60
|
+
console.error(`Block time for ${chain.name} is unknown`);
|
|
61
|
+
acc[chain.network] = blockTime / 1e3;
|
|
62
|
+
return acc;
|
|
63
|
+
},
|
|
64
|
+
{}
|
|
65
|
+
);
|
|
73
66
|
const RAMP_TIME = 30 * 24 * 60 * 60 * 1.2;
|
|
74
|
-
const RAMP_DURATION_BY_NETWORK = import_mappers.TypedObjectUtils.entries(
|
|
67
|
+
const RAMP_DURATION_BY_NETWORK = import_mappers.TypedObjectUtils.entries(BLOCK_DURATION).reduce(
|
|
75
68
|
(acc, [n, duration]) => {
|
|
76
69
|
acc[n] = BigInt(Math.floor(RAMP_TIME / duration));
|
|
77
70
|
return acc;
|
|
@@ -79,7 +72,7 @@ const RAMP_DURATION_BY_NETWORK = import_mappers.TypedObjectUtils.entries(BLOCK_D
|
|
|
79
72
|
{}
|
|
80
73
|
);
|
|
81
74
|
const WEEK = 7 * 24 * 60 * 60;
|
|
82
|
-
const BLOCKS_PER_WEEK_BY_NETWORK = import_mappers.TypedObjectUtils.entries(
|
|
75
|
+
const BLOCKS_PER_WEEK_BY_NETWORK = import_mappers.TypedObjectUtils.entries(BLOCK_DURATION).reduce(
|
|
83
76
|
(acc, [n, duration]) => {
|
|
84
77
|
acc[n] = BigInt(Math.floor(WEEK / duration));
|
|
85
78
|
return acc;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { chains as CHAINS } from "../chain/index.js";
|
|
1
2
|
import { TypedObjectUtils } from "../utils/mappers.js";
|
|
2
3
|
const ADDRESS_PROVIDER_BLOCK = {
|
|
3
4
|
Mainnet: 18433056n,
|
|
@@ -26,27 +27,19 @@ const ADDRESS_PROVIDER_BLOCK = {
|
|
|
26
27
|
Lisk: 18934260n
|
|
27
28
|
// arbitrary not deployed yet
|
|
28
29
|
};
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
Berachain: 1.9,
|
|
41
|
-
Avalanche: 1.7,
|
|
42
|
-
BNB: 3,
|
|
43
|
-
WorldChain: 2,
|
|
44
|
-
Etherlink: 1,
|
|
45
|
-
Hemi: 12,
|
|
46
|
-
Lisk: 2
|
|
47
|
-
};
|
|
30
|
+
const BLOCK_DURATION_LOCAL = {};
|
|
31
|
+
const BLOCK_DURATION = Object.values(CHAINS).reduce(
|
|
32
|
+
(acc, chain) => {
|
|
33
|
+
const blockTime = chain.blockTime || BLOCK_DURATION_LOCAL[chain.network] || 0;
|
|
34
|
+
if (blockTime === 0)
|
|
35
|
+
console.error(`Block time for ${chain.name} is unknown`);
|
|
36
|
+
acc[chain.network] = blockTime / 1e3;
|
|
37
|
+
return acc;
|
|
38
|
+
},
|
|
39
|
+
{}
|
|
40
|
+
);
|
|
48
41
|
const RAMP_TIME = 30 * 24 * 60 * 60 * 1.2;
|
|
49
|
-
const RAMP_DURATION_BY_NETWORK = TypedObjectUtils.entries(
|
|
42
|
+
const RAMP_DURATION_BY_NETWORK = TypedObjectUtils.entries(BLOCK_DURATION).reduce(
|
|
50
43
|
(acc, [n, duration]) => {
|
|
51
44
|
acc[n] = BigInt(Math.floor(RAMP_TIME / duration));
|
|
52
45
|
return acc;
|
|
@@ -54,7 +47,7 @@ const RAMP_DURATION_BY_NETWORK = TypedObjectUtils.entries(BLOCK_DURATION_BY_NETW
|
|
|
54
47
|
{}
|
|
55
48
|
);
|
|
56
49
|
const WEEK = 7 * 24 * 60 * 60;
|
|
57
|
-
const BLOCKS_PER_WEEK_BY_NETWORK = TypedObjectUtils.entries(
|
|
50
|
+
const BLOCKS_PER_WEEK_BY_NETWORK = TypedObjectUtils.entries(BLOCK_DURATION).reduce(
|
|
58
51
|
(acc, [n, duration]) => {
|
|
59
52
|
acc[n] = BigInt(Math.floor(WEEK / duration));
|
|
60
53
|
return acc;
|