1+ use std:: ffi:: OsString ;
12use std:: path:: PathBuf ;
23
3- use alloy:: primitives:: { Address , B256 , U256 } ;
4-
4+ use alloy:: primitives:: { Address , B256 , U256 , Uint } ;
55use crate :: types:: errors:: CliError ;
66
77#[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
@@ -152,28 +152,25 @@ impl ChainSet {
152152 }
153153}
154154
155- // ── Salt Parsing ───────────────────────────────────────────
156-
157155fn parse_salt ( input : & str ) -> Result < B256 , CliError > {
158156 // Try hex first (with or without 0x prefix)
159157 if let Ok ( val) = input. parse :: < B256 > ( ) {
160158 return Ok ( val) ;
161159 }
162160
163161 // Try decimal uint256 → B256
164- let num = U256 :: from_str_radix ( input, 10 )
162+ let num: Uint < 256 , 4 > = U256 :: from_str_radix ( input, 10 )
165163 . map_err ( |e| CliError :: InvalidSalt ( format ! ( "not valid hex or uint256: {e}" ) ) ) ?;
166164 Ok ( B256 :: from ( num. to_be_bytes :: < 32 > ( ) ) )
167165}
168166
169- // ── CLI Args ────────────────────────────────────────────
170-
171167pub struct CliArgs {
172168 pub contract_path : Option < PathBuf > ,
173169 pub chains : Vec < Chain > ,
174170 pub salt : Option < B256 > ,
175171 pub contract_name : Option < String > ,
176172 pub address : Option < Address > ,
173+ pub verify : bool ,
177174}
178175
179176pub fn parse_args ( ) -> Result < CliArgs , CliError > {
@@ -183,6 +180,7 @@ pub fn parse_args() -> Result<CliArgs, CliError> {
183180 let mut salt: Option < B256 > = None ;
184181 let mut contract_name: Option < String > = None ;
185182 let mut address: Option < Address > = None ;
183+ let mut verify: bool = false ;
186184 let mut chains: Vec < Chain > = Vec :: with_capacity ( Chain :: COUNT ) ;
187185 let mut seen: ChainSet = ChainSet :: new ( ) ;
188186 let mut parser: lexopt:: Parser = lexopt:: Parser :: from_env ( ) ;
@@ -197,7 +195,7 @@ pub fn parse_args() -> Result<CliArgs, CliError> {
197195 std:: process:: exit ( 0 ) ;
198196 }
199197 Long ( "salt" ) => {
200- let val = parser
198+ let val: std :: ffi :: OsString = parser
201199 . value ( )
202200 . map_err ( |e| CliError :: ParseError ( e. to_string ( ) ) ) ?;
203201 let val_str = val
@@ -206,7 +204,7 @@ pub fn parse_args() -> Result<CliArgs, CliError> {
206204 salt = Some ( parse_salt ( val_str) ?) ;
207205 }
208206 Long ( "contract-name" ) => {
209- let val = parser
207+ let val: OsString = parser
210208 . value ( )
211209 . map_err ( |e| CliError :: ParseError ( e. to_string ( ) ) ) ?;
212210 let val_str = val
@@ -216,8 +214,11 @@ pub fn parse_args() -> Result<CliArgs, CliError> {
216214 } ) ?;
217215 contract_name = Some ( val_str. to_string ( ) ) ;
218216 }
217+ Long ( "verify" ) => {
218+ verify = true ;
219+ }
219220 Long ( "address" ) => {
220- let val = parser
221+ let val: OsString = parser
221222 . value ( )
222223 . map_err ( |e| CliError :: ParseError ( e. to_string ( ) ) ) ?;
223224 let val_str = val
@@ -260,6 +261,7 @@ pub fn parse_args() -> Result<CliArgs, CliError> {
260261 salt,
261262 contract_name,
262263 address,
264+ verify,
263265 } )
264266}
265267
@@ -270,6 +272,7 @@ fn print_usage() {
270272 eprintln ! ( " --salt <value> CREATE2 salt (hex bytes32 or decimal uint256)" ) ;
271273 eprintln ! ( " --contract-name <name> Contract name (e.g. ERC20)" ) ;
272274 eprintln ! ( " --address <hex> Contract address (hex, with or without 0x)" ) ;
275+ eprintln ! ( " --verify Enable contract verification" ) ;
273276 eprintln ! ( ) ;
274277 eprintln ! ( "Mainnets:" ) ;
275278 for chain in & Chain :: ALL {
0 commit comments