Skip to content

Commit

Permalink
Fix bytes32 to bigint conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
tuler committed Sep 1, 2023
1 parent 1c8d9ef commit 9796d6e
Show file tree
Hide file tree
Showing 3 changed files with 238 additions and 233 deletions.
5 changes: 5 additions & 0 deletions .changeset/neat-scissors-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@deroll/wallet": patch
---

fix bytes32 to bigint conversion
4 changes: 2 additions & 2 deletions packages/wallet/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export type ERC20Deposit = {
*/
export const parseEtherDeposit = (payload: Payload): EtherDeposit => {
const sender = slice(payload, 0, 20); // 20 bytes for address
const value = hexToBigInt(slice(payload, 20, 52)); // 32 bytes for uint256
const value = hexToBigInt(slice(payload, 20, 52), { size: 32 }); // 32 bytes for uint256
return { sender, value };
};

Expand All @@ -55,7 +55,7 @@ export const parseERC20Deposit = (payload: Payload): ERC20Deposit => {
const success = hexToBool(slice(payload, 0, 1)); // 1 byte for boolean
const token = slice(payload, 1, 21); // 20 bytes for address
const sender = slice(payload, 21, 41); // 20 bytes for address
const amount = hexToBigInt(slice(payload, 41, 73)); // 32 bytes for uint256
const amount = hexToBigInt(slice(payload, 41, 73), { size: 32 }); // 32 bytes for uint256
return { success, token, sender, amount };
};

Expand Down
Loading

0 comments on commit 9796d6e

Please sign in to comment.