This repository has been archived by the owner on Oct 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 795
MultiAbigen
does not create rust structs for solidity structs
#947
Labels
bug
Something isn't working
Comments
thanks for this repro! |
3 tasks
@mattsse thanks for the quick fix. This works for the repro but I'm still seeing the problem when I try it on a more complex project. Will post here if I have another repro. |
Having a nested struct still triggers the problem here pragma solidity >=0.8.0;
contract Greeter {
struct Inner {
bool a;
}
struct Stuff {
Inner inner;
}
function greet(Stuff calldata stuff) public view returns (Stuff memory) {
return stuff;
}
} Gives pub fn greet(
&self,
stuff: ((bool,),),
) -> ethers::contract::builders::ContractCall<M, ((bool,),)> { Full generated binings: #![allow(clippy::all)]
//! This module contains abigen! generated bindings for solidity contracts.
//! This is autogenerated code.
//! Do not manually edit these files.
//! This file may be overwritten by the codegen system at any time.
pub use greeter_mod::*;
#[allow(clippy::too_many_arguments)]
mod greeter_mod {
#![allow(clippy::enum_variant_names)]
#![allow(dead_code)]
#![allow(clippy::type_complexity)]
#![allow(unused_imports)]
use ethers::contract::{
builders::{ContractCall, Event},
Contract, Lazy,
};
use ethers::core::{
abi::{Abi, Detokenize, InvalidOutputType, Token, Tokenizable},
types::*,
};
use ethers::providers::Middleware;
#[doc = "Greeter was auto-generated with ethers-rs Abigen. More information at: https://github.com/gakonst/ethers-rs"]
use std::sync::Arc;
pub static GREETER_ABI: ethers::contract::Lazy<ethers::core::abi::Abi> =
ethers::contract::Lazy::new(|| {
serde_json :: from_str ("[{\"type\":\"function\",\"name\":\"greet\",\"inputs\":[{\"internalType\":\"struct Greeter.Stuff\",\"name\":\"stuff\",\"type\":\"tuple\",\"components\":[{\"type\":\"tuple\",\"components\":[{\"type\":\"bool\"}]}]}],\"outputs\":[{\"internalType\":\"struct Greeter.Stuff\",\"name\":\"\",\"type\":\"tuple\",\"components\":[{\"type\":\"tuple\",\"components\":[{\"type\":\"bool\"}]}]}],\"stateMutability\":\"view\"}]") . expect ("invalid abi")
});
#[derive(Clone)]
pub struct Greeter<M>(ethers::contract::Contract<M>);
impl<M> std::ops::Deref for Greeter<M> {
type Target = ethers::contract::Contract<M>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl<M: ethers::providers::Middleware> std::fmt::Debug for Greeter<M> {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_tuple(stringify!(Greeter))
.field(&self.address())
.finish()
}
}
impl<'a, M: ethers::providers::Middleware> Greeter<M> {
#[doc = r" Creates a new contract instance with the specified `ethers`"]
#[doc = r" client at the given `Address`. The contract derefs to a `ethers::Contract`"]
#[doc = r" object"]
pub fn new<T: Into<ethers::core::types::Address>>(
address: T,
client: ::std::sync::Arc<M>,
) -> Self {
let contract =
ethers::contract::Contract::new(address.into(), GREETER_ABI.clone(), client);
Self(contract)
}
#[doc = "Calls the contract's `greet` (0x8ed3bc56) function"]
pub fn greet(
&self,
stuff: ((bool,),),
) -> ethers::contract::builders::ContractCall<M, ((bool,),)> {
self.0
.method_hash([142, 211, 188, 86], (stuff,))
.expect("method not found (this should never happen)")
}
}
#[doc = "Container type for all input parameters for the `greet`function with signature `greet(((bool)))` and selector `[142, 211, 188, 86]`"]
#[derive(
Clone,
Debug,
Default,
Eq,
PartialEq,
ethers :: contract :: EthCall,
ethers :: contract :: EthDisplay,
)]
#[ethcall(name = "greet", abi = "greet(((bool)))")]
pub struct GreetCall {
pub stuff: ((bool,),),
}
} |
3 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Version
Platform
Linux bix 5.10.101 #1-NixOS SMP Wed Feb 16 11:54:31 UTC 2022 x86_64 GNU/Linux
Description
Generating bindings for contract
with the
build.rs
script:I expect to have a
Stuff
struct in the rust code. The generated filesrc/bindings/mod.rs
does not contain that. For exampleGreeter.greet
takesstuff: (bool,),
as argument.The text was updated successfully, but these errors were encountered: