solady icon indicating copy to clipboard operation
solady copied to clipboard

✨ Weiroll

Open zerosnacks opened this issue 10 months ago • 4 comments

Weiroll is really neat but https://github.com/weiroll/weiroll is unmaintained and outdated

I think it would be great if Solady would ship with a (custom) version of Weiroll or a new novel approach to the same problem of stateful operation chaining / on-chain scripting

The most recent and maintained Weiroll versions are:

  • Enso Build's Weiroll: https://github.com/EnsoBuild/enso-weiroll/tree/2e61525fde086300a8b243e8fc1fd32bf0316335 (this commit is MIT licensed, later was changed to GPL-3.0)
  • Dialectic's (?) Weiroll: https://github.com/dantop114/weiroll-foundry/tree/main (MIT) (has good documentation)

There have been a few audits:

  • ABDK audit: https://github.com/abdk-consulting/audits/blob/main/weiroll/ABDK_Weiroll_Weiroll_v_1_0.pdf
  • ChainSecurity audit: https://cdn.prod.website-files.com/65d35b01a4034b72499019e8/6643d27d218ac576e3345fa3_Enso-Weiroll-smart-contract-audit-by-ChainSecurity_compressed.pdf

There are accompanying planners:

  • Rust planner: https://github.com/Meph1587/weiroll-rs/tree/main
  • JavaScript planner: https://weiroll.github.io/weiroll.js/

Additional resources:

  • https://github.com/oguimbal/HyVM
  • https://github.com/0xdewy/weiroll-huff

zerosnacks avatar Jan 22 '25 16:01 zerosnacks

What a nerdsnipe.

I need to work on Ithaca and Solady EOF, so to any adventurous person reading this, drop a comment if you wanna take this on.

Vectorized avatar Jan 22 '25 20:01 Vectorized

What are some use cases you're excited by @zerosnacks?

gakonst avatar Jan 31 '25 22:01 gakonst

I see the potential of weiroll for smart accounts. @gakonst

Vectorized avatar Feb 02 '25 10:02 Vectorized

Me too!

Some ways Weiroll is being used currently:

  • Rapid development of yield farming automation (harvest, compound, rebalancing, etc..) without the deployment of individual strategy contracts
  • Programmatic complex DeFi interactions (shortcuts) (https://www.enso.build/), used in the context of agents
  • Permissionless reward distribution based on complex conditions (recipes) (https://docs.royco.org/for-incentive-providers/create-an-iam#creating-a-recipe-iam)
  • Uniswap's Universal Router design was inspired by it but opted for their own fixed instruction set (commands)

It is basically a more expressive multicall where you can pass results from the previous call into the next and apply additional conditional checks (slippage, profitability, minimum amount, etc..). It can also handle callbacks (e.g. for flashloans) through the use of subplans.

That said, the current Weiroll implementation is quite convoluted, not well documented outside of the specification, does not have a high-level reference implementation and was written in the context of Ethereum L1. The delegatecall also has additional security implications and was disabled in Enso's implementation.

zerosnacks avatar Feb 03 '25 16:02 zerosnacks

found this by accident. im working on a weiroll sdk and a survey of who uses it. if time allows, i want to support all versions. there are indeed at least three different implementations.

so far im somewhat there, it's coming into shape but needs much more work to be robust. Image

banteg avatar Mar 04 '25 04:03 banteg