Skip to content

Commit

Permalink
refactor(staking): import bytesToBech32Bytes from toolkit
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev committed Sep 27, 2023
1 parent abb7a57 commit 07726f7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
14 changes: 1 addition & 13 deletions omnichain/staking/contracts/Staking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,6 @@ contract Staking is ERC20, zContract {
_;
}

function bytesToBech32Bytes(
bytes calldata data,
uint256 offset
) internal pure returns (bytes memory) {
bytes memory bech32Bytes = new bytes(42);
for (uint i = 0; i < 42; i++) {
bech32Bytes[i] = data[i + offset];
}

return bech32Bytes;
}

function onCrossChainCall(
zContext calldata context,
address zrc20,
Expand Down Expand Up @@ -140,7 +128,7 @@ contract Staking is ERC20, zContract {
) internal {
bytes memory withdrawAddress;
if (chainID == BITCOIN) {
withdrawAddress = bytesToBech32Bytes(message, 1);
withdrawAddress = BytesHelperLib.bytesToBech32Bytes(message, 1);
} else {
withdrawAddress = origin;
}
Expand Down
4 changes: 2 additions & 2 deletions omnichain/staking/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@types/node": ">=12.0.0",
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.9",
"@zetachain/toolkit": "^2.2.2",
"@zetachain/toolkit": "^2.2.4",
"axios": "^1.3.6",
"chai": "^4.2.0",
"dotenv": "^16.0.3",
Expand All @@ -48,4 +48,4 @@
"typechain": "^8.1.0",
"typescript": ">=4.5.0"
}
}
}
8 changes: 4 additions & 4 deletions omnichain/staking/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1756,10 +1756,10 @@
resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-2.1.0.tgz#775b4eee7c85d115232dece121cbfc798fde6b63"
integrity sha512-xmG6p8DizIk0h7Tr8Lt6UMG0ejrfRrPx0qH9ze3enwblo7W+eGP12oQ7djanYu50B0pNhh9z7xy/IYxKa9wD0Q==

"@zetachain/toolkit@^2.2.2":
version "2.2.2"
resolved "https://registry.yarnpkg.com/@zetachain/toolkit/-/toolkit-2.2.2.tgz#17f5957bdff6e3e508a8bdd06e4d7228de8bb888"
integrity sha512-C42kje55PEIIX3cQ9m36w4w+mL5CyFx0P/F3PdXsrOtub3hNLi0Es1j0hFqlAtUtBnyfLCE772a97j0ubyWFjQ==
"@zetachain/toolkit@^2.2.4":
version "2.2.4"
resolved "https://registry.yarnpkg.com/@zetachain/toolkit/-/toolkit-2.2.4.tgz#4c80d160fdac1ebe9058c4f626934056476982f7"
integrity sha512-njh+owCjXAMe3PVvgm/5zIjErUqx87M/SciJXolAHYnbnKm85/gVwyguQu3mpHFQ5sIYBU2YN/W7HoMn6kVG1g==
dependencies:
"@inquirer/prompts" "^2.1.1"
"@inquirer/select" "1.1.3"
Expand Down

0 comments on commit 07726f7

Please sign in to comment.