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

chore: update protocol contracts to v8 #159

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"@uniswap/v2-periphery": "^1.1.0-beta.0",
"@zetachain/faucet-cli": "^4.0.1",
"@zetachain/networks": "^8.0.0",
"@zetachain/protocol-contracts": "7.0.0",
"@zetachain/protocol-contracts": "8.0.0-rc1",
"axios": "^1.4.0",
"bech32": "^2.0.0",
"bip39": "^3.1.0",
Expand Down
9 changes: 7 additions & 2 deletions packages/client/src/getFees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@

import { ZetaChainClient } from "./client";

const fetchZEVMFees = async function (

Check warning on line 8 in packages/client/src/getFees.ts

View workflow job for this annotation

GitHub Actions / build

Prefer using arrow functions over plain functions
zrc20: any,
rpcUrl: string,
foreignCoins: any
) {
const provider = new ethers.providers.StaticJsonRpcProvider(rpcUrl);
const contract = new ethers.Contract(zrc20.address, ZRC20.abi, provider);
const [, withdrawGasFee] = await contract.withdrawGasFee();
let withdrawGasFee;
try {
[, withdrawGasFee] = await contract.withdrawGasFee();
} catch (e) {
return;
}
const gasFee = ethers.BigNumber.from(withdrawGasFee);
const protocolFee = ethers.BigNumber.from(await contract.PROTOCOL_FLAT_FEE());
const gasToken = foreignCoins.find((c: any) => {
Expand Down Expand Up @@ -90,7 +95,7 @@
try {
const rpcUrl = this.getEndpoint("evm", `zeta_${this.network}`);
const fee = await fetchZEVMFees(zrc20, rpcUrl, foreignCoins);
fees.omnichain.push(fee);
if (fee) fees.omnichain.push(fee);
} catch (err) {
console.log(err);
}
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1767,10 +1767,10 @@
dependencies:
dotenv "^16.1.4"

"@zetachain/protocol-contracts@7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-7.0.0.tgz#20eb6c62d805d7470408ccdff0e3614684bca174"
integrity sha512-8JTNFZxVZYmDtAXJIEr+tkakuML12X42Fya4bJ1NkfWiVMkcSej92BSTl/35qYtHdjY7vXy9uMrfXEqfw5rsPw==
"@zetachain/protocol-contracts@8.0.0-rc1":
version "8.0.0-rc1"
resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-8.0.0-rc1.tgz#34df589c1b56df77f2695b37bd8a4b79df1787b1"
integrity sha512-VpgbQtVUxy4XYFb0P9UN9nQZkhQ+fr3Bg7A5SqZJCH3fi8QELSn6qaVSwATn+mXdnSMD2uXWSnyy/ANXFqedmw==

abbrev@1:
version "1.1.1"
Expand Down
Loading