/
simulation.ts
72 lines (64 loc) 路 2.05 KB
/
simulation.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { CustomError, Integer } from "../common";
export class SimulationError extends CustomError {
error_code: string;
static NO_LOG = "no_log";
static TENDERLY_RESPONSE_ERROR = "tenderly_response_error";
static PARTIAL_REVERT = "partial_revert";
static INVALID_TYPE = "invalid_type";
constructor(message: string, error_code: string) {
super(message, "simulation");
this.error_code = error_code;
}
}
export class ZapError extends CustomError {
error_code: string;
static ZAP_IN_APPROVAL_STATE = "zap_in_approval_state";
static ZAP_IN_APPROVAL = "zap_in_approval";
static ZAP_OUT_APPROVAL_STATE = "zap_out_approval_state";
static ZAP_OUT_APPROVAL = "zap_out_approval";
static ZAP_IN = "zap_in";
static ZAP_OUT = "zap_out";
constructor(message: string, error_code: string) {
super(message, "zap");
this.error_code = error_code;
}
}
export class EthersError extends CustomError {
error_code: string;
static FAIL_TOKEN_FETCH = "fail_token_fetch";
static NO_DECIMALS = "no_decimals";
static NO_PRICE_PER_SHARE = "no_price_per_share";
static POPULATING_TRANSACTION = "populating_transaction";
constructor(message: string, error_code: string) {
super(message, "ethers");
this.error_code = error_code;
}
}
export class TenderlyError extends CustomError {
error_code: string;
static SIMULATION_CALL = "simulation_call";
static CREATE_FORK = "create_fork";
constructor(message: string, error_code: string) {
super(message, "tenderly");
this.error_code = error_code;
}
}
export class PriceFetchingError extends CustomError {
error_code: string;
static FETCHING_PRICE_ORACLE = "fetching_price_oracle";
static FETCHING_PRICE_PICKLE = "fetching_price_pickle";
constructor(message: string, error_code: string) {
super(message, "price_fetching");
this.error_code = error_code;
}
}
export interface SimulationOptions {
slippage?: number;
root?: string;
forkId?: string;
gasPrice?: Integer;
maxFeePerGas?: Integer;
maxPriorityFeePerGas?: Integer;
gasLimit?: Integer;
save?: boolean;
}