@venusprotocol/venus-periphery 1.2.0-dev.6 → 1.2.0-dev.7

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.
@@ -33,6 +33,7 @@ const dotenv = __importStar(require("dotenv"));
33
33
  require("hardhat-dependency-compiler");
34
34
  require("hardhat-deploy");
35
35
  require("hardhat-gas-reporter");
36
+ const task_names_1 = require("hardhat/builtin-tasks/task-names");
36
37
  const config_1 = require("hardhat/config");
37
38
  require("solidity-coverage");
38
39
  require("solidity-docgen");
@@ -80,6 +81,18 @@ const getRpcUrl = (networkName) => {
80
81
  }
81
82
  }
82
83
  });
84
+ // Override the built-in test task to accept --fork <network>, which sets
85
+ // FORKED_NETWORK so simulateSafeEBrakeTx.ts (and other fork tests) can pick
86
+ // up the correct archive node URL without needing a separate env var.
87
+ (0, config_1.task)(task_names_1.TASK_TEST)
88
+ .addOptionalParam("fork", "Fork a live network by name (e.g. bsctestnet, bscmainnet)")
89
+ .setAction(async (args, _hre, runSuper) => {
90
+ if (args.fork) {
91
+ process.env.FORKED_NETWORK = args.fork;
92
+ process.env.HARDHAT_FORK_NETWORK = args.fork;
93
+ }
94
+ return runSuper(args);
95
+ });
83
96
  // This is a sample Hardhat task. To learn how to create your own go to
84
97
  // https://hardhat.org/guides/create-task.html
85
98
  (0, config_1.task)("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
@@ -152,6 +165,26 @@ const config = {
152
165
  blockNumber: process.env.HARDHAT_FORK_NUMBER ? parseInt(process.env.HARDHAT_FORK_NUMBER) : undefined,
153
166
  }
154
167
  : undefined,
168
+ // Hardhat only knows chain 1 (Ethereum mainnet) by default. All other chains
169
+ // used in Venus Protocol fork tests must declare their hardfork history here so
170
+ // that hardhat_reset with a specific blockNumber doesn't throw
171
+ // "No known hardfork for execution on historical block N in chain with id X".
172
+ // cancun: 0 → treat every block on these chains as post-Cancun,
173
+ // which is consistent with evmVersion: "cancun" in the Solidity compiler settings.
174
+ chains: {
175
+ 56: { hardforkHistory: { cancun: 0 } },
176
+ 97: { hardforkHistory: { cancun: 0 } },
177
+ 204: { hardforkHistory: { cancun: 0 } },
178
+ 5611: { hardforkHistory: { cancun: 0 } },
179
+ 10: { hardforkHistory: { cancun: 0 } },
180
+ 11155420: { hardforkHistory: { cancun: 0 } },
181
+ 42161: { hardforkHistory: { cancun: 0 } },
182
+ 421614: { hardforkHistory: { cancun: 0 } },
183
+ 8453: { hardforkHistory: { cancun: 0 } },
184
+ 84532: { hardforkHistory: { cancun: 0 } },
185
+ 130: { hardforkHistory: { cancun: 0 } },
186
+ 1301: { hardforkHistory: { cancun: 0 } }, // Unichain Sepolia
187
+ },
155
188
  },
156
189
  development: {
157
190
  url: "http://127.0.0.1:8545/",
@@ -0,0 +1,92 @@
1
+ export declare function retry<T = any>(fn: () => Promise<T>, retries?: number, delayMs?: number): Promise<T>;
2
+ export declare const ALLOWED_PAUSE_ACTIONS: Record<string, number>;
3
+ export declare const buildSafeBatch: (safeAddress: string, transactions: {
4
+ to: string;
5
+ value: string;
6
+ data: string;
7
+ }[], chainId: number, blockNumber: number) => object;
8
+ type EBrakeOperation = "pause_actions" | "decrease_cf" | "decrease_cf_pool" | "set_borrow_caps" | "set_supply_caps" | "pause_flash_loan" | "revoke_flash_loan" | "disable_pool_borrow";
9
+ export interface EBrakeCommand {
10
+ signature: string;
11
+ params: any[];
12
+ }
13
+ export interface EBrakeStep {
14
+ operation: EBrakeOperation;
15
+ marketAddresses: string[];
16
+ symbols: Map<string, string>;
17
+ pauseActions?: number[];
18
+ newCFs?: Map<string, string>;
19
+ newCFsByPool?: Map<string, Map<number, string>>;
20
+ poolIdsByMarket?: Map<string, number[]>;
21
+ newCaps?: Map<string, string>;
22
+ revokeAccounts?: string[];
23
+ }
24
+ export interface EBrakeBatchInput {
25
+ eBrakeAddress: string;
26
+ comptrollerAddress: string;
27
+ isIsolatedPool: boolean;
28
+ network: string;
29
+ chainId: number;
30
+ safeAddress: string;
31
+ blockNumber: number;
32
+ steps: EBrakeStep[];
33
+ }
34
+ export interface ExportResult {
35
+ txBuilderFile: string;
36
+ metadataFile: string;
37
+ txCount: number;
38
+ safeAddress: string;
39
+ }
40
+ export declare const parseUint256String: (raw: string) => string | null;
41
+ export declare const getEBrakeAddress: (networkName: string) => Promise<string>;
42
+ export declare const parsePoolIdList: (answer: string, available: number[]) => number[] | null;
43
+ export type PerMarketFileResult = {
44
+ kind: "ok";
45
+ values: Map<string, string>;
46
+ ignored: string[];
47
+ } | {
48
+ kind: "notObject";
49
+ } | {
50
+ kind: "invalidValue";
51
+ key: string;
52
+ rawValue: unknown;
53
+ } | {
54
+ kind: "missing";
55
+ missingSymbols: string[];
56
+ ignored: string[];
57
+ };
58
+ export declare const parsePerMarketValuesJson: (raw: unknown, markets: string[], symbols: Map<string, string>) => PerMarketFileResult;
59
+ export type PerPoolFileResult = {
60
+ kind: "ok";
61
+ values: Map<string, Map<number, string>>;
62
+ ignoredKeys: string[];
63
+ ignoredPools: Array<{
64
+ key: string;
65
+ poolIdKey: string;
66
+ }>;
67
+ } | {
68
+ kind: "notObject";
69
+ } | {
70
+ kind: "innerNotObject";
71
+ key: string;
72
+ } | {
73
+ kind: "invalidValue";
74
+ key: string;
75
+ poolId: number;
76
+ rawValue: unknown;
77
+ } | {
78
+ kind: "missing";
79
+ missing: string[];
80
+ ignoredKeys: string[];
81
+ ignoredPools: Array<{
82
+ key: string;
83
+ poolIdKey: string;
84
+ }>;
85
+ };
86
+ export declare const parsePerPoolValuesJson: (raw: unknown, markets: string[], symbols: Map<string, string>, poolIdsByMarket: Map<string, number[]>) => PerPoolFileResult;
87
+ export declare const gatherInput: () => Promise<EBrakeBatchInput>;
88
+ export declare const generateCommands: (batch: EBrakeBatchInput) => EBrakeCommand[];
89
+ export declare const exportJson: (commands: EBrakeCommand[], batch: EBrakeBatchInput, safeAddress: string) => Promise<ExportResult | null>;
90
+ export declare const orchestrate: (batch: EBrakeBatchInput) => Promise<ExportResult | null>;
91
+ export declare const main: () => Promise<void>;
92
+ export {};