Skip to content

Commit

Permalink
get address parser
Browse files Browse the repository at this point in the history
  • Loading branch information
ngocthanh1389 committed Oct 3, 2024
1 parent bd151cd commit 29af997
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/tradelogs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func run(c *cli.Context) error {
kyberswaprfq.MustNewParser(),
hashflowv3.MustNewParser(),
oneinchv6.MustNewParser(traceCalls),
uniswapxv1.MustNewParser(traceCalls),
// uniswapxv1.MustNewParser(traceCalls),
uniswapx.MustNewParser(traceCalls),
bebop.MustNewParser(traceCalls),
zxrfqv3.MustNewParserWithDeployer(traceCalls, ethClients[0], common.HexToAddress(parser.Deployer0xV3)),
Expand Down
4 changes: 4 additions & 0 deletions pkg/parser/bebop/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,3 +432,7 @@ func getAggregateOrderInfo(order AggregateOrder) *big.Int {
}
return quoteTakerAmount
}

func (p *Parser) Address() string {
return parser.AddrBebop
}
4 changes: 4 additions & 0 deletions pkg/parser/hashflow_v3/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,7 @@ func (p *Parser) LogFromExchange(log ethereumTypes.Log) bool {
return len(log.Topics) > 0 &&
strings.EqualFold(log.Topics[0].String(), p.eventHash)
}

func (p *Parser) Address() string {
return ""
}
4 changes: 4 additions & 0 deletions pkg/parser/kyberswap/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,7 @@ func (p *Parser) LogFromExchange(log ethereumTypes.Log) bool {
len(log.Topics) > 0 &&
strings.EqualFold(log.Topics[0].String(), p.eventHash)
}

func (p *Parser) Address() string {
return parser.AddrKyberswap
}
4 changes: 4 additions & 0 deletions pkg/parser/kyberswap_rfq/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,7 @@ func (p *Parser) LogFromExchange(log ethereumTypes.Log) bool {
len(log.Topics) > 0 &&
strings.EqualFold(log.Topics[0].String(), p.eventHash)
}

func (p *Parser) Address() string {
return parser.AddrKyberswapRFQ
}
4 changes: 4 additions & 0 deletions pkg/parser/oneinchv6/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,7 @@ func (p *Parser) LogFromExchange(log ethereumTypes.Log) bool {
len(log.Topics) > 0 &&
strings.EqualFold(log.Topics[0].String(), p.eventHash)
}

func (p *Parser) Address() string {
return parser.Addr1InchV6
}
4 changes: 4 additions & 0 deletions pkg/parser/pancakeswap/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,7 @@ func (p *Parser) LogFromExchange(log ethereumTypes.Log) bool {
len(log.Topics) > 0 &&
strings.EqualFold(log.Topics[0].String(), p.eventHash)
}

func (p *Parser) Address() string {
return parser.AddrPancakewap
}
4 changes: 4 additions & 0 deletions pkg/parser/paraswap/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,7 @@ func (p *Parser) LogFromExchange(log ethereumTypes.Log) bool {
len(log.Topics) > 0 &&
strings.EqualFold(log.Topics[0].String(), p.eventHash)
}

func (p *Parser) Address() string {
return parser.AddrParaswap
}
1 change: 1 addition & 0 deletions pkg/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ type Parser interface {
UseTraceCall() bool
ParseWithCallFrame(callFrame types.CallFrame, log ethereumTypes.Log, blockTime uint64) (storage.TradeLog, error)
LogFromExchange(log ethereumTypes.Log) bool
Address() string
}
4 changes: 4 additions & 0 deletions pkg/parser/uniswapx/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,3 +344,7 @@ func (p *Parser) LogFromExchange(log ethereumTypes.Log) bool {
len(log.Topics) > 0 &&
strings.EqualFold(log.Topics[0].String(), p.eventHash)
}

func (p *Parser) Address() string {
return parser.AddrUniswapX
}
4 changes: 4 additions & 0 deletions pkg/parser/zxotc/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,7 @@ func (p *Parser) LogFromExchange(log ethereumTypes.Log) bool {
len(log.Topics) > 0 &&
strings.EqualFold(log.Topics[0].String(), p.eventHash)
}

func (p *Parser) Address() string {
return parser.Addr0x
}
4 changes: 4 additions & 0 deletions pkg/parser/zxrfqv3/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,3 +356,7 @@ func (p *Parser) LogFromExchange(log ethereumTypes.Log) bool {
return p.contractABIs.containAddress(log.Address) &&
len(log.Topics) == 0
}

func (p *Parser) Address() string {
return ""
}

0 comments on commit 29af997

Please sign in to comment.