near / cargo-near

Cargo extension for building Rust smart contracts on NEAR
Apache License 2.0
33 stars 16 forks source link

feat(source-scan): exports, needed for factory `build.rs` #164

Closed dj8yfo closed 2 months ago

dj8yfo commented 3 months ago

tested this against modified near-examples repo/tree/main: Obtained 3 contracts by deploying : 1st & 2nd:

cd factory
cargo near deploy repro-fct-11.testnet
near contract call-function as-transaction repro-fct-11.testnet create_factory_subaccount_and_deploy json-args '{ "name": "donation-product", "beneficiary": "donatello2.testnet"}' prepaid-gas '300.0 Tgas' attached-deposit '1.7 NEAR' sign-as donatello2.testnet network-config testnet sign-with-keychain send

=> repro-fct-11.testnet and donation-product.repro-fct-11.testnet 3rd:

cd product-donation
cargo near deploy repro-fct-product-11.testnet

=> repro-fct-product-11.testnet

2nd and 3rd have identical code hashes and contract source metadata:

 repro-fct-11.testnet - 7eFN2zuvy1DLSQoYV5ksMjzaoXpJw6ppS7f3rtRiF4uz  
 donation-product.repro-fct-11.testnet - CvRsj8e7xSyumyLeKsQjn8r19TAd6WV5ohUw3DzKoM3A 
 repro-fct-product-11.testnet - CvRsj8e7xSyumyLeKsQjn8r19TAd6WV5ohUw3DzKoM3A  

section https://github.com/dj8yfo/factory-rust/blob/main/product-donation/Cargo.toml#L10-L14 was needed to deploy product-donation subfolder as a standalone contract (to check that metadata is same while cargo near verify is not implemented)


Screenshot_20240522_175228 Screenshot_20240522_175329

dj8yfo commented 3 months ago
near contract call-function as-read-only repro-fct-11.testnet contract_source_metadata json-args {} network-config testnet now
{
  "build_info": {
    "build_command": [
      "cargo",
      "near",
      "build",
      "--no-default-features",
      "--features",
      "near-sdk/expensive-debug"
    ],
    "build_environment": "dj8yfo/sourcescan:0.x.x-dev-cargo-near-factory-2@sha256:a1341785c2cd7e048f72750b168d6ef1a6c256b7c63034b98f16ba1c178d2ce0",
    "contract_path": "factory",
    "source_code_snapshot": "git+https://github.com/dj8yfo/factory-rust.git?rev=aeb5b4c22cf3a99524d6e549de5caadeb6dff9b0"
  },
  "link": "https://github.com/dj8yfo/factory-rust/tree/aeb5b4c22cf3a99524d6e549de5caadeb6dff9b0",
  "standards": [
    {
      "standard": "nep330",
      "version": "1.2.0"
    }
  ],
  "version": "0.1.0"
}
near contract call-function as-read-only donation-product.repro-fct-11.testnet contract_source_metadata json-args {} network-config testnet now
{
  "build_info": {
    "build_command": [
      "cargo",
      "near",
      "build"
    ],
    "build_environment": "dj8yfo/sourcescan:0.x.x-dev-cargo-near-factory-2@sha256:a1341785c2cd7e048f72750b168d6ef1a6c256b7c63034b98f16ba1c178d2ce0",
    "contract_path": "product-donation",
    "source_code_snapshot": "git+https://github.com/dj8yfo/factory-rust.git?rev=aeb5b4c22cf3a99524d6e549de5caadeb6dff9b0"
  },
  "link": "https://github.com/dj8yfo/factory-rust/tree/aeb5b4c22cf3a99524d6e549de5caadeb6dff9b0",
  "standards": [
    {
      "standard": "nep330",
      "version": "1.2.0"
    }
  ],
  "version": "0.1.0"
}
near contract call-function as-read-only repro-fct-product-11.testnet contract_source_metadata json-args {} network-config testnet now
{
  "build_info": {
    "build_command": [
      "cargo",
      "near",
      "build"
    ],
    "build_environment": "dj8yfo/sourcescan:0.x.x-dev-cargo-near-factory-2@sha256:a1341785c2cd7e048f72750b168d6ef1a6c256b7c63034b98f16ba1c178d2ce0",
    "contract_path": "product-donation",
    "source_code_snapshot": "git+https://github.com/dj8yfo/factory-rust.git?rev=aeb5b4c22cf3a99524d6e549de5caadeb6dff9b0"
  },
  "link": "https://github.com/dj8yfo/factory-rust/tree/aeb5b4c22cf3a99524d6e549de5caadeb6dff9b0",
  "standards": [
    {
      "standard": "nep330",
      "version": "1.2.0"
    }
  ],
  "version": "0.1.0"
}
dj8yfo commented 2 months ago

closing this as being included in its entirety into #166 and is destined to have the same resolution as #166