DXgovernance / davi-monorepo

https://davi-monorepo-davi.vercel.app
8 stars 12 forks source link

Rich contracts V2 - Calldata type #319

Open rossneilson opened 1 year ago

rossneilson commented 1 year ago

A frequent pattern of smart contracts is having calldata of another function passed via a parameter. This presents an issue for us as we want to provide a nice view for users not random byte code.

Example: https://github.com/ImpeccableHQ/stackly/blob/development/packages/contracts/src/OrderFactory.sol#L25

To enable this we'll add a new type in rich contracts for calldata as a parameter. Since the calldata represents a function call we can simply nest a reference to that function inside of the rich contract.

In the ui for this field we'll then just show the fields from the nested call alongside the main functions params.

We can then try to reuse existing logic inside action builder to encode as its doing the same job just one layer down.

rossneilson commented 1 year ago

We also have to properly decode the nested call so we can reference and use the values in action summaries