Skip to content

Conversation

@Turupawn
Copy link
Contributor

@Turupawn Turupawn commented May 5, 2025

This PR adds generic libraries centered around the Map structure and other types needed to implement it. Only additions are done, no code was removed.

Changes:

  1. casting.fe: Added interfaces for casting, both upcast and downcast between two types.
  2. codec.fe: Defines traits and implementations for encoding and decoding data to and from a buffer, using a cursor to read and write.
  3. default.fe: Included the u256 default value of 0
  4. map.fe: Added a generic MapStorage centered on the set and entry entry interface. Uses a customazible Hasher under the hood. This is wrapped by the Map type. Also supports generic arithmetic operations.
  5. operators.fe: Basic arithmetic traits that can be used for method overloading in the future.

Still TODO/not covered by this PR:

  • Casting imlementation is still TODO
  • Through this PR I use a lot of u256 which is not ideal. Waiting for the implementation of higher kind types in the future to improve it
  • The operators added on operators.fe should implement method overloading when the feature is added on fe.

This is currently being tested by the following two repos:

  • fe-evm a fe library for the ethereum virtual machine
  • fe-cookbook, fe examples. It currently has an ERC20 and ERC721 contracts

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