Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cargo test failed on newly generated forge bind #5

Closed
0xqd opened this issue Aug 11, 2022 · 1 comment
Closed

Cargo test failed on newly generated forge bind #5

0xqd opened this issue Aug 11, 2022 · 1 comment

Comments

@0xqd
Copy link

0xqd commented Aug 11, 2022

I got this error message after using forge bind to generate new bindings:

   Compiling bindings v0.0.1 (/home/nxqd/dev/00_projects/defidog.d/defidog-sol/bindings)
error[E0433]: failed to resolve: could not find `__serde_json` in `utils`
  --> bindings/src/my_contract.rs:21:34
   |
21 |             ethers::core::utils::__serde_json::from_str("[]").expect("invalid abi")
   |                                  ^^^^^^^^^^^^ could not find `__serde_json` in `utils`

error[E0433]: failed to resolve: could not find `ContractDeployer` in `contract`
  --> bindings/src/my_contract.rs:93:46
   |
93 |             let deployer = ethers::contract::ContractDeployer::new(deployer);
   |                                              ^^^^^^^^^^^^^^^^ could not find `ContractDeployer` in `contract`

error[E0412]: cannot find type `ContractDeployer` in module `ethers::contract::builders`
  --> bindings/src/my_contract.rs:84:41
   |
84 |             ethers::contract::builders::ContractDeployer<M, Self>,
   |                                         ^^^^^^^^^^^^^^^^ not found in `ethers::contract::builders`

error[E0277]: the trait bound `ethers::prelude::Bytes: FromStr` is not satisfied
    --> bindings/src/my_contract.rs:26:204
     |
26   | ...a3ee64736f6c634300080a0033" . parse () . expect ("invalid bytecode")
     |                                  ^^^^^ the trait `FromStr` is not implemented for `ethers::prelude::Bytes`
     |
     = help: the following other types implement trait `FromStr`:
               Bloom
               BytecodeOutputSelection
               ContractOutputSelection
               DeployedBytecodeOutputSelection
               ERCNFT
               ERCNFTType
               EvmOutputSelection
               EvmVersion
             and 123 others
note: required by a bound in `core::str::<impl str>::parse`

error[E0599]: the method `clone` exists for struct `ethers::contract::Contract<M>`, but its trait bounds were not satisfied
   --> bindings/src/my_contract.rs:31:31
    |
31  |             MyContract(self.0.clone())
    |                               ^^^^^ method cannot be called on `ethers::contract::Contract<M>` due to unsatisfied trait bounds
    |
   ::: /home/nxqd/.cargo/git/checkouts/ethers-rs-c3a7c0a0ae0fe6be/19d2fd1/ethers-contract/src/contract.rs:154:1
    |
154 | pub struct Contract<M> {
    | ---------------------- doesn't satisfy `ethers::contract::Contract<M>: Clone`
    |
    = note: the following trait bounds were not satisfied:
            `M: Clone`
            which is required by `ethers::contract::Contract<M>: Clone`
help: one of the expressions' fields has a method of the same name
    |
31  |             MyContract(self.0.base_contract.clone())
    |                               ++++++++++++++
help: one of the expressions' fields has a method of the same name
    |
31  |             MyContract(self.0.address.clone())
# environment
forge -V
forge 0.2.0 (6cd6618 2022-08-11T00:03:54.64793456Z)
@0xqd
Copy link
Author

0xqd commented Aug 11, 2022

cargo update -p ethers gets rid of the bug by updating to latest ethers.

@0xqd 0xqd closed this as completed Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant