ethereum / fe

Emerging smart contract language for the Ethereum blockchain.
https://fe-lang.org
Other
1.61k stars 187 forks source link

Implement `std::abi` and use in Fe v2 to provide Contract ABI support #900

Open g-r-a-n-t opened 1 year ago

g-r-a-n-t commented 1 year ago

std::abi

The Fe standard library should provide an implementation of the Ethereum Contract ABI and this implementation should be used in Fe v2 to replace the existing dispatcher codegen.

Here is a rough outline of what's being worked on in https://github.com/ethereum/fe/pull/856:

IO types

Note: we should probably be using io::{Read, Write} traits, but limitations in the current trait implementation make this difficult. In v2 we can refactor this.

ABI traits

ABI impls

Contract ABI support in Fe v2

On the Fe v2 branch, we need to add Contract ABI support using the __call__ function and the std::abi implementation.

The compiler will be responsible for generating the following functional components of the Contract ABI: