-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathconstants.ts
More file actions
152 lines (126 loc) · 4.15 KB
/
constants.ts
File metadata and controls
152 lines (126 loc) · 4.15 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import { ContractConfig, RoundConfig, TickSize } from './types';
export const POLYMARKET_PROVIDER_ID = 'polymarket';
export const POLYMARKET_TERMS_URL = 'https://polymarket.com/tos';
export const DEFAULT_CLOB_BASE_URL = 'https://clob.polymarket.com';
export const LEGACY_V2_CLOB_BASE_URL = 'https://clob-v2.polymarket.com';
/**
* Default slippage for market orders.
*/
export const SLIPPAGE_BUY = 0.03; // 3%
export const SLIPPAGE_SELL = 0.05; // 5%
// BUY is floored at maxAmountSpent + tickSize. SELL has no floor — user accepts up to 99% less USDC.
export const SLIPPAGE_BEST_AVAILABLE = 0.99; // 99%
export const ORDER_RATE_LIMIT_MS = 5000;
export const MIN_COLLATERAL_BALANCE_FOR_CLAIM = 0.5;
export const POLYGON_MAINNET_CHAIN_ID = 137;
export const POLYGON_MAINNET_CAIP_CHAIN_ID =
`eip155:${POLYGON_MAINNET_CHAIN_ID}` as const;
export const COLLATERAL_TOKEN_DECIMALS = 6;
export const CONDITIONAL_TOKEN_DECIMALS = 6;
export const HASH_ZERO_BYTES32 =
'0x0000000000000000000000000000000000000000000000000000000000000000';
export const EIP712Domain = [
{ name: 'name', type: 'string' },
{ name: 'version', type: 'string' },
{ name: 'chainId', type: 'uint256' },
];
export const ClobAuthDomain = {
ClobAuth: [
{ name: 'address', type: 'address' },
{ name: 'timestamp', type: 'string' },
{ name: 'nonce', type: 'uint256' },
{ name: 'message', type: 'string' },
],
};
export const MSG_TO_SIGN =
'This message attests that I control the given wallet';
export const ROUNDING_CONFIG: Record<TickSize, RoundConfig> = {
'0.1': {
price: 1,
size: 2,
amount: 3,
},
'0.01': {
price: 2,
size: 2,
amount: 4,
},
'0.001': {
price: 3,
size: 2,
amount: 5,
},
'0.0001': {
price: 4,
size: 2,
amount: 6,
},
};
/**
* Gas limit for the Safe execTransaction call used during withdrawals.
* The actual execution uses ~93k gas; includes a 30% buffer.
*/
export const SAFE_EXEC_GAS_LIMIT = 121000;
export const MATIC_CONTRACTS: ContractConfig = {
exchange: '0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E',
negRiskAdapter: '0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296',
negRiskExchange: '0xC5d563A36AE78145C45a50134d48A1215220f80a',
collateral: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174',
conditionalTokens: '0x4D97DCd97eC945f40cF65F87097ACe5EA0476045',
};
export const MATIC_CONTRACTS_V2: ContractConfig = {
exchange: '0xE111180000d2663C0091e4f400237545B87B996B',
negRiskAdapter: '0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296',
negRiskExchange: '0xe2222d279d744050d28e00520010520000310F59',
collateral: '0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB',
conditionalTokens: '0x4D97DCd97eC945f40cF65F87097ACe5EA0476045',
};
export const USDC_E_ADDRESS = MATIC_CONTRACTS.collateral;
export const COLLATERAL_ONRAMP_ADDRESS =
'0x93070a847efEf7F70739046A929D47a521F5B8ee';
export const COLLATERAL_OFFRAMP_ADDRESS =
'0x2957922Eb93258b93368531d39fAcCA3B4dC5854';
export const CTF_COLLATERAL_ADAPTER_ADDRESS =
'0xAdA100Db00Ca00073811820692005400218FcE1f';
export const NEG_RISK_CTF_COLLATERAL_ADAPTER_ADDRESS =
'0xadA2005600Dec949baf300f4C6120000bDB6eAab';
export const POLYGON_USDC_CAIP_ASSET_ID =
`${POLYGON_MAINNET_CAIP_CHAIN_ID}/erc20:${MATIC_CONTRACTS.collateral}` as const;
export const SPORTS_MARKET_TYPE_TO_GROUP: Record<string, string> = {
first_half_moneyline: 'first-half',
first_half_spreads: 'first-half',
first_half_totals: 'first-half',
team_totals: 'team-totals',
anytime_touchdowns: 'touchdowns',
first_touchdowns: 'touchdowns',
rushing_yards: 'rushing',
receiving_yards: 'receiving',
points: 'points',
assists: 'assists',
rebounds: 'rebounds',
soccer_anytime_goalscorer: 'goalscorers',
soccer_exact_score: 'exact-score',
soccer_halftime_result: 'halftime',
total_corners: 'corners',
};
export const GROUP_ORDER: string[] = [
'game-lines',
'first-half',
'team-totals',
'touchdowns',
'rushing',
'receiving',
'points',
'assists',
'rebounds',
'goalscorers',
'exact-score',
'halftime',
'corners',
];
export const DEFAULT_GROUP_KEY = 'game-lines';
export const SPORTS_MARKET_TYPE_PRIORITIES: Record<string, number> = {
moneyline: 0,
spreads: 1,
totals: 2,
};