Skip to content

Commit

Permalink
Feature/dec sequencer (#261)
Browse files Browse the repository at this point in the history
* support for new Fee model
  • Loading branch information
r0wdy1 authored Mar 29, 2024
1 parent 16c11b1 commit d523ba5
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 40 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"wagmi": "^0.12.1",
"web-vitals": "^1.0.1",
"webpack": "^5.70.0",
"zkbob-client-js": "5.5.0"
"zkbob-client-js": "6.0.0-beta4"
},
"scripts": {
"start": "react-app-rewired start",
Expand Down
43 changes: 24 additions & 19 deletions src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,25 +107,25 @@ const config = {
},
},
dev: {
defaultPool: 'USDC-goerli',
defaultPool: 'zkbob_sepolia',
pools: {
// 'BOB-sepolia': {
// chainId: 11155111,
// poolAddress: '0x3bd088C19960A8B5d72E4e01847791BD0DD1C9E6',
// tokenAddress: '0x2C74B18e2f84B78ac67428d0c7a9898515f0c46f',
// relayerUrls: ['https://relayer.thgkjlr.website/'],
// delegatedProverUrls: ['https://prover-staging.thgkjlr.website/'],
// coldStorageConfigPath: 'https://r2-staging.zkbob.com/coldstorage/coldstorage.cfg',
// kycUrls: {
// status: 'https://api-stage.knowyourcat.id/v1/%s/categories?category=BABTokenBOB',
// homepage: 'https://stage.knowyourcat.id/address/%s/BABTokenBOB',
// },
// tokenSymbol: 'BOB',
// tokenDecimals: 18,
// feeDecimals: 2,
// depositScheme: 'permit',
// addressPrefix: 'zkbob_sepolia',
// },
'zkbob_sepolia': {
chainId: 11155111,
poolAddress: '0x77f3D9Fb578a0F2B300347fb3Cd302dFd7eedf93',
tokenAddress: '0x2C74B18e2f84B78ac67428d0c7a9898515f0c46f',
proxyUrls: ['https://sepolia-decentralized-relayer.thgkjlr.website'],
delegatedProverUrls: ['https://prover-staging.thgkjlr.website/'],
coldStorageConfigPath: 'https://r2-staging.zkbob.com/coldstorage/coldstorage.cfg',
kycUrls: {
status: 'https://api-stage.knowyourcat.id/v1/%s/categories?category=BABTokenBOB',
homepage: 'https://stage.knowyourcat.id/address/%s/BABTokenBOB',
},
tokenSymbol: 'BOB',
tokenDecimals: 18,
feeDecimals: 2,
depositScheme: 'permit',
addressPrefix: 'zkbob_sepolia',
},
'BOB2USDC-goerli': {
chainId: 5,
poolAddress: '0x49661694a71B3Dab9F25E86D5df2809B170c56E6',
Expand Down Expand Up @@ -219,7 +219,7 @@ const config = {
},
chains: {
'11155111': {
rpcUrls: ['https://sepolia.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161'],
rpcUrls: ['https://sepolia.infura.io/v3/9a94d181b23846209f01161dcd0f9ad6'],
},
'5': {
rpcUrls: ['https://goerli.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161']
Expand All @@ -242,6 +242,11 @@ const config = {
prefix: 'zkbob_nile_g',
name: 'USDT on Nile testnet (MPC guard contracts)',
},
{
poolId: 16776969,
prefix: 'zkbob_sepolia',
name: 'Bob Pool on Sepolia with decentralized relayer',
},
],
}
};
Expand Down
12 changes: 6 additions & 6 deletions src/contexts/ZkAccountContext/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ export const ZkAccountContextProvider = ({ children }) => {
if (!zkClient) return;
let version = null;
try {
const data = await zkClient.getRelayerVersion();
version = data.ref;
// const data = await zkClient.getRelayerVersion();
version = "TODO";
} catch (error) {
console.error(error);
Sentry.captureException(error, { tags: { method: 'ZkAccountContext.loadRelayerVersion' } });
Expand Down Expand Up @@ -437,19 +437,19 @@ export const ZkAccountContextProvider = ({ children }) => {
}
if (!zkAccount) {
let atomicTxFee = await zkClient.atomicTxFee(txType);
atomicTxFee = await fromShieldedAmount(atomicTxFee);
atomicTxFee = await fromShieldedAmount(atomicTxFee.total);
return { fee: atomicTxFee, numberOfTxs: 1, insufficientFunds: false, directDepositFee };
}
const shieldedAmounts = await Promise.all(amounts.map(async amount => await toShieldedAmount(amount)));
const shieldedAmountToConvert = await toShieldedAmount(amountToConvert);
const {
total,
fee,
txCnt,
insufficientFunds,
relayerFee,
} = await zkClient.feeEstimate(shieldedAmounts, txType, shieldedAmountToConvert, false);
} = await zkClient.feeEstimate(shieldedAmounts, txType, shieldedAmountToConvert, false);
return {
fee: await fromShieldedAmount(total),
fee: await fromShieldedAmount(fee.total),
numberOfTxs: txCnt,
insufficientFunds,
relayerFee,
Expand Down
28 changes: 14 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12783,15 +12783,15 @@ levn@^0.4.1:
prelude-ls "^1.2.1"
type-check "~0.4.0"

libzkbob-rs-wasm-web-mt@1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/libzkbob-rs-wasm-web-mt/-/libzkbob-rs-wasm-web-mt-1.5.0.tgz#6a88fe3fdfcd0fe856fd791fa0976bdde2fea34b"
integrity sha512-2uwwE5mm32ITMvYgW3uPsPXLrPVutnpYB003wzDzMbPfF2EBjP1kh+sQwPUDmEl+ic4OSTXU/q3sdkWWmhUhRQ==
libzkbob-rs-wasm-web-mt@1.7.0-beta4:
version "1.7.0-beta4"
resolved "https://registry.yarnpkg.com/libzkbob-rs-wasm-web-mt/-/libzkbob-rs-wasm-web-mt-1.7.0-beta4.tgz#c279a405a5f8658429d0e991b4a1631ac6e3f37c"
integrity sha512-e1QO1hbxI0ED4rr6xME1wqTsPS/pZPMAlfvgXHGddQGWk3e1ICqVTzBNTW0TgnbzlY4AdrX3YH37OjaqdC/Qig==

libzkbob-rs-wasm-web@1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/libzkbob-rs-wasm-web/-/libzkbob-rs-wasm-web-1.5.0.tgz#41c2b0a51a9283a96457bd5439cfeed27f866913"
integrity sha512-QlnFMNzqjFakkIDrST4kmOdr+OikMZVZoOi2B73F/kb/3elcPSA5vAjYM/AdmB3+Ojty4ZrQW1GnsFWJrebF5w==
libzkbob-rs-wasm-web@1.7.0-beta4:
version "1.7.0-beta4"
resolved "https://registry.yarnpkg.com/libzkbob-rs-wasm-web/-/libzkbob-rs-wasm-web-1.7.0-beta4.tgz#6e4fbd62fc41db593a16a769c6bea25674bbc5b0"
integrity sha512-dD17xhMEfT6OIzvW30wVAOyCYchRU8mSXPW5O7pemDqEiZOJpRT5CrMQAKsLP+rzcVznw24CziyNzJyTrxORIQ==

[email protected]:
version "3.1.1"
Expand Down Expand Up @@ -19015,10 +19015,10 @@ yocto-queue@^0.1.0:
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==

zkbob-client-js@5.4.1-beta:
version "5.4.1-beta"
resolved "https://registry.yarnpkg.com/zkbob-client-js/-/zkbob-client-js-5.4.1-beta.tgz#b7e9eee2e37835ed96ddedd69c5e7391f1ebae28"
integrity sha512-+shx8Adt9qsPQMuBQMXW891okxOeQmHcqqpc+VONhk26xgTCtGP076Zuh2Yw0loCavjBH6OG0GdSvgWI0m7YEA==
zkbob-client-js@6.0.0-beta4:
version "6.0.0-beta4"
resolved "https://registry.yarnpkg.com/zkbob-client-js/-/zkbob-client-js-6.0.0-beta4.tgz#ff8bdedab45c35a6e5624563ab5582d231f6ed68"
integrity sha512-HMmiPrIG5FnU0W27pQTLszHuMpa8K8M2Vtj+5U6XhKeTltQgZIhaefM8B5UrEQ0jpaIE9gvkigJCKjfHFeAUlw==
dependencies:
"@ethereumjs/util" "^8.0.2"
"@graphprotocol/client-cli" "3.0.0"
Expand All @@ -19031,8 +19031,8 @@ [email protected]:
graphql "16.7.1"
hdwallet-babyjub "^0.0.2"
idb "^7.0.0"
libzkbob-rs-wasm-web "1.5.0"
libzkbob-rs-wasm-web-mt "1.5.0"
libzkbob-rs-wasm-web "1.7.0-beta4"
libzkbob-rs-wasm-web-mt "1.7.0-beta4"
promise-retry "^2.0.1"
promise-throttle "^1.1.2"
regenerator-runtime "^0.13.9"
Expand Down

0 comments on commit d523ba5

Please sign in to comment.