Commit 2215c14
authored
refactor(coins): use 20 bytes for trade referral decoding (#1349)
## Description
Updated the `getTradeReferral` function in `CoinRewardsV4.sol` to check for a minimum hook data length of 20 bytes instead of 32 bytes when decoding the referral address.
## Motivation and Context
The function was checking for a minimum of 32 bytes, but an Ethereum address is only 20 bytes. This change makes the function more efficient by allowing it to decode valid addresses from smaller hook data payloads.
## Does this change the ABI/API?
- [ ] This changes the ABI/API
## What tests did you add/modify to account for these changes
Tested the function with hook data of various lengths to ensure it correctly decodes addresses when the data is at least 20 bytes and returns address(0) for smaller payloads.
## Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New module / feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
## Checklist:
- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] I added a changeset to account for this change
## Reviewer Checklist:
- [ ] My review includes a symposis of the changes and potential issues
- [ ] The code style is enforced
- [ ] There are no risky / concerning changes / additions to the PR1 parent 55950cc commit 2215c14
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
0 commit comments