ethereum/fe

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

g-r-a-n-t opened this issue · 0 comments

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 #856:

IO types

  • MemoryBuffer, MemoryBufferWriter, MemoryBufferReader
  • CalldataReader

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

  • AbiEncode, AbiDecode

ABI impls

  • all primitive types
  • Array types (u8 array as bytes)
  • tuple types up to a given length
  • String

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:

  • function selection and dispatching