@@ -27,7 +27,8 @@ pub async fn legacy_init() -> Result<()> {
27
27
"Hardhat JavaScript (Solidity & Vyper)" ,
28
28
"Hardhat TypeScript (Solidity & Vyper)" ,
29
29
"Rust" ,
30
- "Blendedapp 🔄" ,
30
+ "Blendedapp Hardhat 🔄" ,
31
+ "Blendedapp Foundry 🔄" ,
31
32
"Exit" ,
32
33
] ;
33
34
let selection = Select :: new ( )
@@ -41,8 +42,9 @@ pub async fn legacy_init() -> Result<()> {
41
42
0 => spin_js ( use_erc20) ?,
42
43
1 => spin_ts ( use_erc20) ?,
43
44
2 => spin_rust ( ) ?,
44
- 3 => spin_blended_app ( ) ?,
45
- 4 => {
45
+ 3 => spin_blended_app_hardhat ( ) ?,
46
+ 4 => spin_blended_app_foundry ( ) ?,
47
+ 5 => {
46
48
println ! ( "Exiting program." ) ;
47
49
return Ok ( ( ) ) ; // Exit the program gracefully
48
50
}
@@ -243,8 +245,8 @@ fn spin_ts(use_erc20: bool) -> Result<()> {
243
245
Ok ( ( ) )
244
246
}
245
247
246
- fn spin_blended_app ( ) -> Result < ( ) > {
247
- println ! ( "Creating blended app ..." ) ;
248
+ fn spin_blended_app_hardhat ( ) -> Result < ( ) > {
249
+ println ! ( "Creating blended app with Hardhat ..." ) ;
248
250
249
251
// Embed the files in the binary using `include_str!`
250
252
const HARDHAT_CONFIG : & str = include_str ! ( concat!(
@@ -328,7 +330,120 @@ fn spin_blended_app() -> Result<()> {
328
330
create_file_with_content ( ".env" , ENV ) ?;
329
331
create_file_with_content ( ".gitignore" , GIT_IGNORE ) ?;
330
332
331
- println ! ( "Blended app created successfully!" ) ;
333
+ println ! ( "Blended app with Hardhat created successfully!" ) ;
332
334
333
335
Ok ( ( ) )
334
336
}
337
+
338
+ fn spin_blended_app_foundry ( ) -> Result < ( ) > {
339
+ println ! ( "Creating blended app with Foundry..." ) ;
340
+
341
+ // Embed the files in the binary using `include_str!`
342
+ const JAVASCRIPT_GIT_IGNORE : & str = include_str ! ( concat!(
343
+ env!( "CARGO_MANIFEST_DIR" ) ,
344
+ "/templates/blendedAppFoundry/javascript/.gitignore"
345
+ ) ) ;
346
+ const JAVASCRIPT_PACKAGE_JSON : & str = include_str ! ( concat!(
347
+ env!( "CARGO_MANIFEST_DIR" ) ,
348
+ "/templates/blendedAppFoundry/javascript/package.json"
349
+ ) ) ;
350
+ const JAVASCRIPT_SOLIDITY : & str = include_str ! ( concat!(
351
+ env!( "CARGO_MANIFEST_DIR" ) ,
352
+ "/templates/blendedAppFoundry/javascript/solidity.js"
353
+ ) ) ;
354
+ const JAVASCRIPT_RUST : & str = include_str ! ( concat!(
355
+ env!( "CARGO_MANIFEST_DIR" ) ,
356
+ "/templates/blendedAppFoundry/javascript/rust.js"
357
+ ) ) ;
358
+
359
+ const RUST_GIT_IGNORE : & str = include_str ! ( concat!(
360
+ env!( "CARGO_MANIFEST_DIR" ) ,
361
+ "/templates/blendedAppFoundry/rust/.gitignore"
362
+ ) ) ;
363
+ const RUST_CARGO_TOML : & str = include_str ! ( concat!(
364
+ env!( "CARGO_MANIFEST_DIR" ) ,
365
+ "/templates/blendedAppFoundry/rust/Cargo.toml"
366
+ ) ) ;
367
+ const RUST_MAKEFILE : & str = include_str ! ( concat!(
368
+ env!( "CARGO_MANIFEST_DIR" ) ,
369
+ "/templates/blendedAppFoundry/rust/Makefile"
370
+ ) ) ;
371
+ const RUST_LIB_RS : & str = include_str ! ( concat!(
372
+ env!( "CARGO_MANIFEST_DIR" ) ,
373
+ "/templates/blendedAppFoundry/rust/lib.rs"
374
+ ) ) ;
375
+ const RUST_TOOLCHAIN : & str = include_str ! ( concat!(
376
+ env!( "CARGO_MANIFEST_DIR" ) ,
377
+ "/templates/blendedAppFoundry/rust/rust-toolchain"
378
+ ) ) ;
379
+
380
+ const SOLIDITY_GIT_IGNORE : & str = include_str ! ( concat!(
381
+ env!( "CARGO_MANIFEST_DIR" ) ,
382
+ "/templates/blendedAppFoundry/solidity/.gitignore"
383
+ ) ) ;
384
+ const SOLIDITY_README : & str = include_str ! ( concat!(
385
+ env!( "CARGO_MANIFEST_DIR" ) ,
386
+ "/templates/blendedAppFoundry/solidity/README.md"
387
+ ) ) ;
388
+ const SOLIDITY_FOUNDRY_TOML : & str = include_str ! ( concat!(
389
+ env!( "CARGO_MANIFEST_DIR" ) ,
390
+ "/templates/blendedAppFoundry/solidity/foundry.toml"
391
+ ) ) ;
392
+
393
+ const SOLIDITY_GIT_WORKFLOW_TEST : & str = include_str ! ( concat!(
394
+ env!( "CARGO_MANIFEST_DIR" ) ,
395
+ "/templates/blendedAppFoundry/solidity/.github/workflows/test.yml"
396
+ ) ) ;
397
+ const SOLIDITY_SOURCE_CONTRACT : & str = include_str ! ( concat!(
398
+ env!( "CARGO_MANIFEST_DIR" ) ,
399
+ "/templates/blendedAppFoundry/solidity/src/FluentSdkRustTypesTest.sol"
400
+ ) ) ;
401
+ const SOLIDITY_SOURCE_CONSTRUCTOR : & str = include_str ! ( concat!(
402
+ env!( "CARGO_MANIFEST_DIR" ) ,
403
+ "/templates/blendedAppFoundry/solidity/src/deployConstructor/FluentSdkRustTypesTest.txt"
404
+ ) ) ;
405
+ const SOLIDITY_TEST_CONTRACT : & str = include_str ! ( concat!(
406
+ env!( "CARGO_MANIFEST_DIR" ) ,
407
+ "/templates/blendedAppFoundry/solidity/test/FluentSdkRustTypesTest.t.sol"
408
+ ) ) ;
409
+
410
+ const README : & str = include_str ! ( concat!(
411
+ env!( "CARGO_MANIFEST_DIR" ) ,
412
+ "/templates/blendedAppFoundry/README.md"
413
+ ) ) ;
414
+ const GIT_MODULES : & str = include_str ! ( concat!(
415
+ env!( "CARGO_MANIFEST_DIR" ) ,
416
+ "/templates/blendedAppFoundry/.gitmodules"
417
+ ) ) ;
418
+
419
+ // Create necessary directories and write files
420
+ create_directories ( "javascript" ) ?;
421
+ create_directories ( "rust" ) ?;
422
+ create_directories ( "solidity" ) ?;
423
+
424
+ create_file_with_content ( "javascript/.gitignore" , JAVASCRIPT_GIT_IGNORE ) ?;
425
+ create_file_with_content ( "javascript/package.json" , JAVASCRIPT_PACKAGE_JSON ) ?;
426
+ create_file_with_content ( "javascript/solidity.js" , JAVASCRIPT_SOLIDITY ) ?;
427
+ create_file_with_content ( "javascript/rust.js" , JAVASCRIPT_RUST ) ?;
428
+
429
+ create_file_with_content ( "rust/.gitignore" , RUST_GIT_IGNORE ) ?;
430
+ create_file_with_content ( "rust/Cargo.toml" , RUST_CARGO_TOML ) ?;
431
+ create_file_with_content ( "rust/Makefile" , RUST_MAKEFILE ) ?;
432
+ create_file_with_content ( "rust/lib.rs" , RUST_LIB_RS ) ?;
433
+ create_file_with_content ( "rust/rust-toolchain" , RUST_TOOLCHAIN ) ?;
434
+
435
+ create_file_with_content ( "solidity/.gitignore" , SOLIDITY_GIT_IGNORE ) ?;
436
+ create_file_with_content ( "solidity/README.md" , SOLIDITY_README ) ?;
437
+ create_file_with_content ( "solidity/foundry.toml" , SOLIDITY_FOUNDRY_TOML ) ?;
438
+ create_file_with_content ( "solidity/.github/workflows/test.yml" , SOLIDITY_GIT_WORKFLOW_TEST ) ?;
439
+ create_file_with_content ( "solidity/src/FluentSdkRustTypesTest.sol" , SOLIDITY_SOURCE_CONTRACT ) ?;
440
+ create_file_with_content ( "solidity/src/deployConstructor/FluentSdkRustTypesTest.txt" , SOLIDITY_SOURCE_CONSTRUCTOR ) ?;
441
+ create_file_with_content ( "solidity/test/FluentSdkRustTypesTest.t.sol" , SOLIDITY_TEST_CONTRACT ) ?;
442
+
443
+ create_file_with_content ( "README.md" , README ) ?;
444
+ create_file_with_content ( ".gitmodules" , GIT_MODULES ) ?;
445
+
446
+ println ! ( "Blended app with Foundry created successfully!" ) ;
447
+
448
+ Ok ( ( ) )
449
+ }
0 commit comments