-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: tvl by chain #39
Conversation
ZKS-76 TVL by chainId
Create a Batch contract to query token balances from specific chainId using the method Use same token list as for L1 TVL breakdown. BridgeHub address: 0x303a465B659cBB0ab36eE643eA362c509EEb5213 SharedBridge address: 0xD7f9f54194C633F36CCD5F3da84ad4a1c38cB2cB AC:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good ser, just some comments
*/ | ||
private async fetchTokenBalancesByChain(chainId: number, addresses: Address[]) { | ||
const chainIdBn = BigInt(chainId); | ||
const balances = await this.evmProviderService.multicall({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also use multicall
to fetchTokenBalances of the SharedBridge ??? I mean, watching this now, makes me wonder that we are adding some overhead by using a batching contract for just iterating over multiple calls and having no computation on it.
Let me know if you agree and i will added to tech debt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I thought it too jaja, sure add it to tech debt ser 🫡
>( | ||
args: MulticallParameters<contracts, allowFailure>, | ||
): Promise<MulticallReturnType<contracts, allowFailure>> { | ||
if (!this.chain.contracts?.multicall3?.address) throw new MulticallNotFound(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch here
@@ -269,4 +269,91 @@ describe("EvmProviderService", () => { | |||
expect(returnValue).toEqual(arrayAbiFixture.args[0]); | |||
}); | |||
}); | |||
describe("multicall", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets also add a test for the happy path
}); | ||
}); | ||
|
||
describe("EvmProviderService (with mocked chain)", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may we just mock the chain instead of splitting the tests into 2 describes ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah you're right, in spanish criollo: "flashie"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to go for me after addressing @0xkenj1's comments ✅
// This is the address given to native ETH on L2 chains. | ||
// See: https://github.com/matter-labs/era-contracts/blob/8a70bbbc48125f5bde6189b4e3c6a3ee79631678/l1-contracts/contracts/common/Config.sol#L105 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
🤖 Linear
Closes ZKS-76
Description
Retrieve TVL by Chain ID of Shared Bridge from static token list:
tvl(chainId: number)
method implementedadded
multicall
method to EvmProviderServiceuses multicall for fetching token balances
uses Pricing Service for fetching prices