@@ -13,10 +13,10 @@ use std::io::Write;
1313use std:: path:: { Path , PathBuf } ;
1414use toml_edit:: { Array , ArrayOfTables , DocumentMut , Item , Table , Value , value} ;
1515
16+ const OZ_VERSION : Version = Version :: new ( 1 , 0 , 0 ) ;
17+
1618static TEMPLATES_DIR : Dir = include_dir ! ( "snforge_templates" ) ;
1719
18- const DEFAULT_ASSERT_MACROS : Version = Version :: new ( 0 , 1 , 0 ) ;
19- const MINIMAL_SCARB_FOR_CORRESPONDING_ASSERT_MACROS : Version = Version :: new ( 2 , 8 , 0 ) ;
2020const SCARB_WITHOUT_CAIRO_TEST_TEMPLATE : Version = Version :: new ( 2 , 13 , 0 ) ;
2121
2222struct Dependency {
@@ -134,7 +134,7 @@ impl TryFrom<&Template> for TemplateManifestConfig {
134134 } ,
135135 Dependency {
136136 name: "openzeppelin_token" . to_string( ) ,
137- version: get_oz_version ( ) ? . to_string( ) ,
137+ version: OZ_VERSION . to_string( ) ,
138138 dev: false ,
139139 } ,
140140 ] ,
@@ -256,12 +256,7 @@ fn set_cairo_edition(document: &mut DocumentMut, cairo_edition: &str) {
256256}
257257
258258fn add_assert_macros ( document : & mut DocumentMut ) -> Result < ( ) > {
259- let versions = scarb_version ( ) ?;
260- let version = if versions. scarb < MINIMAL_SCARB_FOR_CORRESPONDING_ASSERT_MACROS {
261- DEFAULT_ASSERT_MACROS
262- } else {
263- versions. cairo
264- } ;
259+ let version = scarb_version ( ) ?. cairo ;
265260
266261 document
267262 . entry ( "dev-dependencies" )
@@ -464,16 +459,3 @@ fn get_template_dir(template: &Template) -> Result<Dir<'_>> {
464459 . ok_or_else ( || anyhow ! ( "Directory {dir_name} not found" ) )
465460 . cloned ( )
466461}
467-
468- fn get_oz_version ( ) -> Result < Version > {
469- let scarb_version = scarb_version ( ) ?. scarb ;
470-
471- let oz_version = match scarb_version {
472- ver if ver >= Version :: new ( 2 , 9 , 4 ) => Version :: new ( 1 , 0 , 0 ) ,
473- ver if ver >= Version :: new ( 2 , 9 , 1 ) => Version :: new ( 0 , 20 , 0 ) ,
474- ver if ver >= Version :: new ( 2 , 8 , 4 ) => Version :: new ( 0 , 19 , 0 ) ,
475- _ => bail ! ( "Minimal Scarb version to create a new project with ERC-20 template is 2.8.4" ) ,
476- } ;
477-
478- Ok ( oz_version)
479- }
0 commit comments