feat: identify eth deposits - #405
Conversation
dohaki
left a comment
There was a problem hiding this comment.
Left a few questions and remarks
| import { BigNumber, Event } from "ethers"; | ||
|
|
||
| export interface WethDepositEvent extends Event { | ||
| args: [string, BigNumber] & { | ||
| dst: string; | ||
| wad: BigNumber; | ||
| }; | ||
| } | ||
|
|
||
| export interface WethDepositEventOptimism extends Event { | ||
| args: [string, BigNumber] & { | ||
| dst: string; | ||
| wad: BigNumber; | ||
| }; | ||
| } | ||
|
|
||
| export interface WethDepositEventLinea extends Event { | ||
| args: [string, BigNumber] & { | ||
| dst: string; | ||
| wad: BigNumber; | ||
| }; | ||
| } | ||
|
|
||
| export interface WethDepositEventBase extends Event { | ||
| args: [string, BigNumber] & { | ||
| dst: string; | ||
| wad: BigNumber; | ||
| }; | ||
| } | ||
|
|
||
| export interface WethTransfetEventArbitrum extends Event { | ||
| args: [string, string, BigNumber] & { | ||
| from: string; | ||
| to: string; | ||
| value: BigNumber; | ||
| }; | ||
| } |
There was a problem hiding this comment.
Any reason why we need duplicated events for different chains? AFAICT only on Arbitrum the respective event is different. But can't we just reuse the Deposit event signature for every other chain? This would also decrease the number of else if cases in the code
| }; | ||
| } | ||
|
|
||
| export interface WethTransfetEventArbitrum extends Event { |
There was a problem hiding this comment.
| export interface WethTransfetEventArbitrum extends Event { | |
| export interface WethTransferEventArbitrum extends Event { |
There was a problem hiding this comment.
I don't think we need a different ABI file for every chain if they are the same, no?
There was a problem hiding this comment.
Unfortunately the ABIs are not the same and I didn't want to spend time putting together a common ABI file
There was a problem hiding this comment.
Hmm okay, got you.. Maybe we could also just reduce the ABI to the minimal interfaces with need / care about, i.e.
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "dst",
"type": "address"
},
{
"indexed": false,
"name": "wad",
"type": "uint256"
}
],
"name": "Deposit",
"type": "event"
},
| return ( | ||
| e.logIndex < depositEvent.logIndex && | ||
| typedEvent.args.value.eq(depositEvent.args.inputAmount) && | ||
| spokePoolAddresses.includes(typedEvent.args.to) | ||
| ); |
There was a problem hiding this comment.
Don't we need to also add the check
typedEvent.args.from === ZERO_ADDRESS
? So that we don't consider a normal WETH transfer but rather a "deposit", i.e. mint.
There was a problem hiding this comment.
spokePoolAddresses.includes(typedEvent.args.to) checks if the recipient of WETH is the SpokePool contract. Do you think it's necessary to also check from address? I cannot see a case when someone sends WETH intentionally to the SpokePool followed by a deposit
There was a problem hiding this comment.
Yea, you are right. Should be very unlikely
e653e79 to
32954f0
Compare
No description provided.