Skip to content

Commit e4f458b

Browse files
kbizikavCopilot
andauthored
feat: use the graph for event sync (#55)
* feat: use the graph instead of rpc for fetching events * fix: fix sync test * chore: delete gas server * fix: replace get account with get transaction count for compatibility reason * chore: delte last deposit block number because it's not used anymore * chore: fix clippy * chore: add derive test * chore: delete unused network & bump version * chore: update deps version * chore: more logs * chore: fix typo & minor test change * feat: add insufficient balance handler * chore: increase transaction timeout * chore: print tx success status * feat: github cache * feat: print balance of withdrawal * feat: abr diplay of withdrawal * feat: notify balance update in insufficient_balance_instruction * chore: fix typos * fix: reject all indices * chore: increase cooldown for less rpc requests * feat: add health check for graph client * Update src/cli/accounts_status.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/cli/configure.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * chore: replace graphql url for base sepolia/mainnet * fix: fix compile error for windows * chore: delete unused deps --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 989aff1 commit e4f458b

72 files changed

Lines changed: 4133 additions & 3892 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 1691 additions & 2314 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,15 @@ edition = "2021"
88
[dependencies]
99
anyhow = "1.0.88"
1010
bincode = "1.3.3"
11-
plonky2 = { git="https://github.com/InternetMaximalism/polygon-plonky2.git", branch="intmax2-dev"}
12-
intmax2-zkp = {git ="https://github.com/InternetMaximalism/intmax2-zkp", branch = "dev"}
13-
mining_circuit_v1 ={git ="https://github.com/InternetMaximalism/intmax2-mining.git"}
11+
plonky2 = { git = "https://github.com/InternetMaximalism/polygon-plonky2.git", branch = "intmax2-dev" }
12+
intmax2-zkp = { git = "https://github.com/InternetMaximalism/intmax2-zkp", branch = "dev" }
13+
mining_circuit_v1 = { git = "https://github.com/InternetMaximalism/intmax2-mining.git" }
1414
num-bigint = "0.4.6"
15-
serde = {version="1.0.210", features = ["derive"]}
15+
serde = { version = "1.0.210", features = ["derive"] }
1616
serde_json = "1.0.128"
1717
config = "0.13"
1818
reqwest = { version = "0.11", features = ["json"] }
19-
ethers = "2.0"
2019
tokio = { version = "1", features = ["full"] }
21-
rpassword = "5.0"
2220
aes-gcm = "0.9"
2321
sha3 = "0.10.0"
2422
dialoguer = "0.11.0"
@@ -28,7 +26,6 @@ simplelog = "0.12.2"
2826
log = "0.4.22"
2927
chrono = "0.4.38"
3028
regex = "1.10.6"
31-
dir = "0.1.2"
3229
dirs = "5.0.1"
3330
clap = { version = "4.5.18", features = ["derive"] }
3431
dotenv = "0.15.0"
@@ -38,6 +35,15 @@ strum = "0.26.3"
3835
strum_macros = "0.26.4"
3936
openssl = { version = "0.10", features = ["vendored"] }
4037
openssl-sys = { version = "0.9", features = ["vendored"] }
41-
self_update = {version="0.41.0", features=["archive-zip", "compression-zip-deflate"]}
38+
self_update = { version = "0.41.0", features = [
39+
"archive-zip",
40+
"compression-zip-deflate",
41+
] }
4242
rand_chacha = "0.3.1"
43+
alloy = { version = "1.0.1", features = ["rand"] }
44+
futures = "0.3.31"
45+
serde_with = "3.12.0"
46+
tower = "0.5.2"
47+
serde_qs = "0.15.0"
48+
env_logger = "0.11.8"
4349

abi/ERC20.json

Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
[
2+
{
3+
"constant": true,
4+
"inputs": [],
5+
"name": "name",
6+
"outputs": [
7+
{
8+
"name": "",
9+
"type": "string"
10+
}
11+
],
12+
"payable": false,
13+
"stateMutability": "view",
14+
"type": "function"
15+
},
16+
{
17+
"constant": false,
18+
"inputs": [
19+
{
20+
"name": "_spender",
21+
"type": "address"
22+
},
23+
{
24+
"name": "_value",
25+
"type": "uint256"
26+
}
27+
],
28+
"name": "approve",
29+
"outputs": [
30+
{
31+
"name": "",
32+
"type": "bool"
33+
}
34+
],
35+
"payable": false,
36+
"stateMutability": "nonpayable",
37+
"type": "function"
38+
},
39+
{
40+
"constant": true,
41+
"inputs": [],
42+
"name": "totalSupply",
43+
"outputs": [
44+
{
45+
"name": "",
46+
"type": "uint256"
47+
}
48+
],
49+
"payable": false,
50+
"stateMutability": "view",
51+
"type": "function"
52+
},
53+
{
54+
"constant": false,
55+
"inputs": [
56+
{
57+
"name": "_from",
58+
"type": "address"
59+
},
60+
{
61+
"name": "_to",
62+
"type": "address"
63+
},
64+
{
65+
"name": "_value",
66+
"type": "uint256"
67+
}
68+
],
69+
"name": "transferFrom",
70+
"outputs": [
71+
{
72+
"name": "",
73+
"type": "bool"
74+
}
75+
],
76+
"payable": false,
77+
"stateMutability": "nonpayable",
78+
"type": "function"
79+
},
80+
{
81+
"constant": true,
82+
"inputs": [],
83+
"name": "decimals",
84+
"outputs": [
85+
{
86+
"name": "",
87+
"type": "uint8"
88+
}
89+
],
90+
"payable": false,
91+
"stateMutability": "view",
92+
"type": "function"
93+
},
94+
{
95+
"constant": true,
96+
"inputs": [
97+
{
98+
"name": "_owner",
99+
"type": "address"
100+
}
101+
],
102+
"name": "balanceOf",
103+
"outputs": [
104+
{
105+
"name": "balance",
106+
"type": "uint256"
107+
}
108+
],
109+
"payable": false,
110+
"stateMutability": "view",
111+
"type": "function"
112+
},
113+
{
114+
"constant": true,
115+
"inputs": [],
116+
"name": "symbol",
117+
"outputs": [
118+
{
119+
"name": "",
120+
"type": "string"
121+
}
122+
],
123+
"payable": false,
124+
"stateMutability": "view",
125+
"type": "function"
126+
},
127+
{
128+
"constant": false,
129+
"inputs": [
130+
{
131+
"name": "_to",
132+
"type": "address"
133+
},
134+
{
135+
"name": "_value",
136+
"type": "uint256"
137+
}
138+
],
139+
"name": "transfer",
140+
"outputs": [
141+
{
142+
"name": "",
143+
"type": "bool"
144+
}
145+
],
146+
"payable": false,
147+
"stateMutability": "nonpayable",
148+
"type": "function"
149+
},
150+
{
151+
"constant": true,
152+
"inputs": [
153+
{
154+
"name": "_owner",
155+
"type": "address"
156+
},
157+
{
158+
"name": "_spender",
159+
"type": "address"
160+
}
161+
],
162+
"name": "allowance",
163+
"outputs": [
164+
{
165+
"name": "",
166+
"type": "uint256"
167+
}
168+
],
169+
"payable": false,
170+
"stateMutability": "view",
171+
"type": "function"
172+
},
173+
{
174+
"payable": true,
175+
"stateMutability": "payable",
176+
"type": "fallback"
177+
},
178+
{
179+
"anonymous": false,
180+
"inputs": [
181+
{
182+
"indexed": true,
183+
"name": "owner",
184+
"type": "address"
185+
},
186+
{
187+
"indexed": true,
188+
"name": "spender",
189+
"type": "address"
190+
},
191+
{
192+
"indexed": false,
193+
"name": "value",
194+
"type": "uint256"
195+
}
196+
],
197+
"name": "Approval",
198+
"type": "event"
199+
},
200+
{
201+
"anonymous": false,
202+
"inputs": [
203+
{
204+
"indexed": true,
205+
"name": "from",
206+
"type": "address"
207+
},
208+
{
209+
"indexed": true,
210+
"name": "to",
211+
"type": "address"
212+
},
213+
{
214+
"indexed": false,
215+
"name": "value",
216+
"type": "uint256"
217+
}
218+
],
219+
"name": "Transfer",
220+
"type": "event"
221+
}
222+
]

config/config.base-sepolia.toml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
availability_server_url = "https://base-sepolia.v1.mining-gateway.intmax.xyz/v1/availability"
33
withdrawal_gnark_prover_url = "https://base-sepolia.v1.mining-gateway.intmax.xyz/v1/gnark-withdraw-circuit"
44
claim_gnark_prover_url = "https://base-sepolia.v1.mining-gateway.intmax.xyz/v1/gnark-claim-circuit"
5-
withdrawal_server_url="https://base-sepolia.v1.mining-gateway.intmax.xyz/v1/withdrawal"
6-
circulation_server_url="https://base-sepolia.v1.mining-gateway.intmax.xyz/v1/mining"
7-
gas_server_url="https://base-sepolia.v1.mining-gateway.intmax.xyz/v1/mining/gas-fee/estimate"
8-
tree_data_repository="InternetMaximalism/intmax2-v1-mining-mock"
9-
tree_data_directory="base-sepolia-data"
10-
tree_data_branch="main"
5+
withdrawal_server_url = "https://base-sepolia.v1.mining-gateway.intmax.xyz/v1/withdrawal"
6+
circulation_server_url = "https://base-sepolia.v1.mining-gateway.intmax.xyz/v1/mining"
7+
tree_data_repository = "InternetMaximalism/intmax2-v1-mining-mock"
8+
tree_data_directory = "base-sepolia-data"
9+
tree_data_branch = "main"
1110
sync_tree_data_interval_in_sec = 3600
1211
gnark_get_proof_cooldown_in_sec = 60
1312

1413
[blockchain]
1514
chain_id = 84532
15+
graph_url = "https://base-sepolia.graph.intmax.xyz/subgraphs/name/stage-int1"
16+
graph_health_check_timeout_in_sec = 60
1617
int1_address = "0x5dfa05aAdbE75a92f6153508950533fC1bed98BE"
1718
minter_address = "0xeF9CBc6F2f602AF19b0fEc2cc4F217177730858E"
1819
token_address = "0x2699CD7f883DecC464171a7A92f4CcC4eF220fa2"
@@ -22,12 +23,12 @@ single_claim_gas = 600000
2223

2324
[service]
2425
repository_url = "https://github.com/InternetMaximalism/intmax2-mining-cli"
25-
mining_min_cooldown_in_sec = 20
26-
mining_max_cooldown_in_sec = 200
27-
loop_cooldown_in_sec = 10
28-
high_gas_retry_inverval_in_sec = 10
26+
mining_min_cooldown_in_sec = 20
27+
mining_max_cooldown_in_sec = 200
28+
loop_cooldown_in_sec = 60
29+
high_gas_retry_interval_in_sec = 30
2930

3031
[env]
31-
default_max_gas_price ="100"
32-
default_mining_times="5"
33-
default_mining_unit="0.1"
32+
default_max_gas_price = "100"
33+
default_mining_times = "5"
34+
default_mining_unit = "0.1"

config/config.base.toml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
availability_server_url = "https://v1.base-prod.mining-gateway.intmax.xyz/v1/availability"
33
withdrawal_gnark_prover_url = "https://v1.base-prod.mining-gateway.intmax.xyz/v1/gnark-withdraw-circuit"
44
claim_gnark_prover_url = "https://v1.base-prod.mining-gateway.intmax.xyz/v1/gnark-claim-circuit"
5-
withdrawal_server_url="https://v1.base-prod.mining-gateway.intmax.xyz/v1/withdrawal"
6-
circulation_server_url="https://v1.base-prod.mining-gateway.intmax.xyz/v1/mining"
7-
gas_server_url="https://v1.base-prod.mining-gateway.intmax.xyz/v1/mining/gas-fee/estimate"
8-
tree_data_repository="InternetMaximalism/intmax2-mining"
9-
tree_data_directory="base-data"
10-
tree_data_branch="main"
5+
withdrawal_server_url = "https://v1.base-prod.mining-gateway.intmax.xyz/v1/withdrawal"
6+
circulation_server_url = "https://v1.base-prod.mining-gateway.intmax.xyz/v1/mining"
7+
tree_data_repository = "InternetMaximalism/intmax2-mining"
8+
tree_data_directory = "base-data"
9+
tree_data_branch = "main"
1110
sync_tree_data_interval_in_sec = 3600
1211
gnark_get_proof_cooldown_in_sec = 60
1312

1413
[blockchain]
1514
chain_id = 8453
15+
graph_url = "https://v1.base-prod.graph.intmax.xyz/subgraphs/name/prod-int1"
16+
graph_health_check_timeout_in_sec = 60
1617
int1_address = "0x195F9b5F42435bB71E9765E66a9bdFE40d44A895"
1718
minter_address = "0x1f5a5Eb6C3894351425BD51ea2AE1ef3FEC93976"
1819
token_address = "0xf95117e3a5B7968703CeD3B66A9CbE0Bc9e1D8bf"
@@ -22,12 +23,12 @@ single_claim_gas = 600000
2223

2324
[service]
2425
repository_url = "https://github.com/InternetMaximalism/intmax2-mining-cli"
25-
mining_min_cooldown_in_sec = 3600 # 1 hour
26-
mining_max_cooldown_in_sec = 21600 # 6 hours
27-
loop_cooldown_in_sec = 10
28-
high_gas_retry_inverval_in_sec = 10
26+
mining_min_cooldown_in_sec = 3600 # 1 hour
27+
mining_max_cooldown_in_sec = 21600 # 6 hours
28+
loop_cooldown_in_sec = 60
29+
high_gas_retry_interval_in_sec = 30
2930

3031
[env]
31-
default_max_gas_price ="10"
32-
default_mining_times="10"
33-
default_mining_unit="0.1"
32+
default_max_gas_price = "10"
33+
default_mining_times = "10"
34+
default_mining_unit = "0.1"

0 commit comments

Comments
 (0)