RGB-WG / rgb-schemata

Standard RGB schemata and schema compiler
Apache License 2.0
29 stars 20 forks source link

example rgb20 can't compile #30

Closed Matrix-Zhang closed 3 months ago

Matrix-Zhang commented 6 months ago
error[E0432]: unresolved import `rgbstd::interface::ContractClass`
 --> examples/rgb20.rs:9:25
  |
9 | use rgbstd::interface::{ContractClass, FilterIncludeAll, FungibleAllocation, Rgb20};
  |                         ^^^^^^^^^^^^^
  |                         |
  |                         no `ContractClass` in `interface`
  |                         help: a similar name exists in the module: `ContractIface`

error[E0599]: no function or associated item named `iface` found for struct `Rgb20` in the current scope
  --> examples/rgb20.rs:54:31
   |
54 |     stock.import_iface(Rgb20::iface()).unwrap();
   |                               ^^^^^ function or associated item not found in `Rgb20`
   |
   = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
   |
1  + use rgbstd::interface::IfaceClass;
   |

error[E0599]: no function or associated item named `schema` found for struct `NonInflatableAsset` in the current scope
   --> examples/rgb20.rs:55:45
    |
55  |     stock.import_schema(NonInflatableAsset::schema()).unwrap();
    |                                             ^^^^^^ function or associated item not found in `NonInflatableAsset`
    |
note: if you're trying to build a new `NonInflatableAsset` consider using one of the following associated functions:
      NonInflatableAsset::testnet
      NonInflatableAsset::testnet_det
   --> /Users/matrix/Codes/github/rgb-schemata/src/nia.rs:161:5
    |
161 | /     pub fn testnet(
162 | |         ticker: &str,
163 | |         name: &str,
164 | |         details: Option<&str>,
165 | |         precision: Precision,
166 | |     ) -> Result<Self, InvalidIdent> {
    | |___________________________________^
...
171 | /     pub fn testnet_det<C: IssuerClass>(
172 | |         ticker: &str,
173 | |         name: &str,
174 | |         details: Option<&str>,
...   |
177 | |         asset_tag: AssetTag,
178 | |     ) -> Result<Self, InvalidIdent> {
    | |___________________________________^
    = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
1   + use rgbstd::interface::IssuerClass;
    |

error[E0599]: no function or associated item named `main_iface_impl` found for struct `NonInflatableAsset` in the current scope
   --> examples/rgb20.rs:56:49
    |
56  |     stock.import_iface_impl(NonInflatableAsset::main_iface_impl()).unwrap();
    |                                                 ^^^^^^^^^^^^^^^ function or associated item not found in `NonInflatableAsset`
    |
note: if you're trying to build a new `NonInflatableAsset` consider using one of the following associated functions:
      NonInflatableAsset::testnet
      NonInflatableAsset::testnet_det
   --> /Users/matrix/Codes/github/rgb-schemata/src/nia.rs:161:5
    |
161 | /     pub fn testnet(
162 | |         ticker: &str,
163 | |         name: &str,
164 | |         details: Option<&str>,
165 | |         precision: Precision,
166 | |     ) -> Result<Self, InvalidIdent> {
    | |___________________________________^
...
171 | /     pub fn testnet_det<C: IssuerClass>(
172 | |         ticker: &str,
173 | |         name: &str,
174 | |         details: Option<&str>,
...   |
177 | |         asset_tag: AssetTag,
178 | |     ) -> Result<Self, InvalidIdent> {
    | |___________________________________^

error[E0599]: no function or associated item named `iface` found for struct `Rgb20` in the current scope
  --> examples/rgb20.rs:61:64
   |
61 |     let contract = stock.contract_iface_id(contract_id, Rgb20::iface().iface_id()).unwrap();
   |                                                                ^^^^^ function or associated item not found in `Rgb20`
   |
   = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
   |
1  + use rgbstd::interface::IfaceClass;
   |

Some errors have detailed explanations: E0432, E0599.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `rgb-schemata` (example "rgb20") due to 5 previous errors
dr-orlovsky commented 6 months ago

https://github.com/RGB-WG/rgb/issues/133#issuecomment-1949337656