From 904c8d4d9afccbcc1ab446d99d2d7dc438b7e0fa Mon Sep 17 00:00:00 2001 From: ben Date: Mon, 19 Aug 2024 20:39:32 +0800 Subject: [PATCH] feat: check for deposit event --- adapters/projects/izumi/transfer_event.go | 12 +++++++++++- cmd/lp.go | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/adapters/projects/izumi/transfer_event.go b/adapters/projects/izumi/transfer_event.go index c81b280..53b50b7 100644 --- a/adapters/projects/izumi/transfer_event.go +++ b/adapters/projects/izumi/transfer_event.go @@ -19,6 +19,7 @@ import ( var ( logTransferSigHash = crypto.Keccak256Hash([]byte("Transfer(address,address,uint256)")) + logDepositSigHash = crypto.Keccak256Hash([]byte("Deposit(address,uint256,uint256)")) ) // TransferIndexer is an implementation of LogsIndexer for ERC20 transfer logs. @@ -68,7 +69,16 @@ func (indexer *TransferIndexer) ProcessLog(ctx context.Context, chainID *big.Int if !exists { return nil, nil } - from := common.BytesToAddress(vLog.Topics[1].Bytes()[12:]) + txReceipt, err := client.TransactionReceipt(ctx, vLog.TxHash) + if err != nil { + return nil, err + } + from := adapters.ZeroAddress + for _, log := range txReceipt.Logs { + if log.Topics[0].Hex() == logDepositSigHash.Hex() { + from = common.BytesToAddress(log.Topics[1].Bytes()[12:]) + } + } tokenID := vLog.Topics[3].Big() // Fetch the block details diff --git a/cmd/lp.go b/cmd/lp.go index effca23..83ffe97 100644 --- a/cmd/lp.go +++ b/cmd/lp.go @@ -22,7 +22,8 @@ func processRitsuLPIndexer(client *ethclient.Client, blockNumber int64) error { func processIziLPIndexer(client *ethclient.Client, blockNumber int64) error { whitelist := map[string]struct{}{ - common.HexToAddress("0x88867BF3bB3321d8c7Da71a8eAb70680037068E4").Hex(): {}, + common.HexToAddress("0xE2380f4Cc37027B4bF23bBb3b6c092470dB4975f").Hex(): {}, + common.HexToAddress("0x5264F77F8af8550cDa8e81Fee0360c0De6b52432").Hex(): {}, } tokens := []common.Address{ common.HexToAddress("0x33531bDBFE34fa6Fd5963D0423f7699775AacaaF"),