Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Solidity ABI encode functions and utils #279

Merged
merged 6 commits into from
Mar 12, 2024
Merged

feat: Solidity ABI encode functions and utils #279

merged 6 commits into from
Mar 12, 2024

Conversation

b-j-roberts
Copy link
Contributor

@b-j-roberts b-j-roberts commented Feb 22, 2024

Added various traits/utils for supporting Solidity-like ABI encode functions. This includes the traits :

  • SolAbiEncodeTrait : providing equivalents for Solidity abi.encode and abi.encodePacked
  • SolAbiEncodeSelectorTrait : for Solidity abi.encodeWithSelector
  • SolAbiDecodeTrait : for Solidity abi.decode
  • SolBytesTrait : Providing utilities for easy conversion of types into Solidity-like bytes1, bytes2, ..., bytes32 types

Also added some helpers for alexandria_bytes::Bytes, such as :

  • Bytes <-> Cairo's ByteArray & bytes31 function options
  • Debug & Display traits for Bytes, to allow printing Bytes as a hex string

Pull Request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build-related changes
  • Documentation content changes
  • Other (please describe):

Issue Number: #274

Does this introduce a breaking change?

  • Yes
  • No

@b-j-roberts b-j-roberts marked this pull request as ready for review February 22, 2024 17:43
@b-j-roberts b-j-roberts requested a review from 0xLucqs as a code owner February 22, 2024 17:43
src/bytes/src/bytes.cairo Outdated Show resolved Hide resolved
src/bytes/src/bytes.cairo Show resolved Hide resolved
src/bytes/src/bytes.cairo Outdated Show resolved Hide resolved
src/bytes/src/bytes.cairo Show resolved Hide resolved
src/bytes/src/utils.cairo Outdated Show resolved Hide resolved
src/bytes/src/utils.cairo Outdated Show resolved Hide resolved
src/encoding/src/sol_abi/decode.cairo Outdated Show resolved Hide resolved
@b-j-roberts b-j-roberts requested a review from 0xLucqs February 26, 2024 16:53
src/bytes/src/utils.cairo Outdated Show resolved Hide resolved
src/bytes/src/utils.cairo Outdated Show resolved Hide resolved
src/bytes/src/utils.cairo Outdated Show resolved Hide resolved
@0xLucqs 0xLucqs merged commit c1a604e into main Mar 12, 2024
6 checks passed
@0xLucqs 0xLucqs deleted the feat/sol-abi branch March 12, 2024 13:56
@github-actions github-actions bot locked and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants