Skip to content

Add composition example in playground - #22

Draft
czepluch wants to merge 3 commits into
new-syntaxfrom
composition-example
Draft

Add composition example in playground#22
czepluch wants to merge 3 commits into
new-syntaxfrom
composition-example

Conversation

@czepluch

Copy link
Copy Markdown
Collaborator

Adds a composition example: three deployable vaults sharing one engine module.
Sender context (direct call, or recovered from a secp256k1 signature) and fee policy (flat, basis points, or two policies stacked) are traits with per-type impls, composed by a generic settle function. With exactly one impl per trait and type there is nothing to disambiguate: no override(...) lists, no super chains, no linearization.

Motivation: 0x-settler's MainnetSettlerIntent, a mainnet contract whose entire body is eleven return super.f(...) overrides disambiguating an inheritance diamond, under the in-source comment "Solidity inheritance is stupid". This example doesn't cover everything 0x-settler does. It just shows how a comparable structure can be built without inheritance, so the diamond problem can't come up in the first place.

All three contracts are runtime-tested on both backends, including deployment with a constructor argument and on-chain recovery of a real signature.

@czepluch
czepluch force-pushed the composition-example branch from 87e3b6f to fc55512 Compare August 24, 2026 20:29
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

Successfully merging this pull request may close these issues.

1 participant