ERC725Alliance / erc725.js

Package to interact with ERC725 smart contracts
Apache License 2.0
38 stars 29 forks source link

feat: add support for encoding `bytes1` to `bytes32` + fix incorrect encoding `uintN` #427

Closed CJ42 closed 5 months ago

CJ42 commented 5 months ago

What kind of change does this PR introduce (bug fix, feature, docs update, ...)?

⭐ Feature 🐛 Bug Fix

What is the current behaviour (you can also link to an open issue here)?

Bug

When encoding uintN in tuples and the valueContent is Number, these are always encoded to a uint256 as a 32 bytes long value because of the following line in the code:

https://github.com/ERC725Alliance/erc725.js/blob/06d872baa75fb3bfaac3e51c541e727eb76646e7/src/lib/encoder.ts#L675-L690

Missing Feature

Additionally, there is only support for few bytesN types, like bytes2, bytes4, bytes8, etc...

What is the new behaviour (if this is a feature change)?

This the padding for the encoding of uintN and bytesN + add support for multiple bytesN