diff --git a/near-sdk-macros/src/core_impl/contract_metadata/mod.rs b/near-sdk-macros/src/core_impl/contract_metadata/mod.rs index b2d51588e..91b2c0503 100644 --- a/near-sdk-macros/src/core_impl/contract_metadata/mod.rs +++ b/near-sdk-macros/src/core_impl/contract_metadata/mod.rs @@ -56,13 +56,17 @@ struct Standard { impl ContractMetadata { fn populate(mut self) -> Self { if self.link.is_none() { - let field_val = std::env::var("NEP330_LINK").unwrap_or(String::from("")); + let field_val = std::env::var("NEP330_LINK") + .or(std::env::var("CARGO_PKG_REPOSITORY")) + .unwrap_or(String::from("")); if !field_val.is_empty() { self.link = Some(field_val); } } if self.version.is_none() { - let field_val = std::env::var("NEP330_VERSION").unwrap_or(String::from("")); + let field_val = std::env::var("NEP330_VERSION") + .or(std::env::var("CARGO_PKG_VERSION")) + .unwrap_or(String::from("")); if !field_val.is_empty() { self.version = Some(field_val); }