gemstation / gemforge

Command-line tool for building, deploying and upgrading Diamond Standard contracts on EVM chains.
https://gemforge.xyz
MIT License
17 stars 4 forks source link

fix: use method signature to allow using functional polymorphism #40

Closed bmateus closed 3 months ago

bmateus commented 3 months ago

issue discussed here

hiddentao commented 3 months ago

Thanks for the submission!

Just tested this against the https://github.com/gemstation/contracts-foundry repo and got test failures. I think the code might need a bit of tweaking.

hiddentao commented 3 months ago

The issue is that functions which take structs as parameters won't have the correct selectors generated. Doing so would require deconstructing the struct and nested structs and then doing something like:

struct InnerStruct {
    uint256 x;
    bool y;
}

struct OuterStruct {
    uint256 a;
    address b;
    InnerStruct c;
}

function complexFunction(OuterStruct memory param) public {
}

// selector => complexFunction((uint256,address,(uint256,bool)))

Getting this working requires much larger parsing work, not to mention finding where structs are located. So for now I propose doing the following:

hiddentao commented 3 months ago

Merged in #42

bmateus commented 3 months ago

thanks!