Skip to content

Commit

Permalink
feat: check version is less than 300
Browse files Browse the repository at this point in the history
  • Loading branch information
5lliot committed Dec 16, 2023
1 parent 7f29aa8 commit 68bdd42
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions models/contract_register/on_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package contract_register

import (
"github.com/Gearbox-protocol/sdk-go/core"
"github.com/Gearbox-protocol/sdk-go/log"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"

Expand All @@ -11,6 +12,16 @@ import (

func (mdl *ContractRegister) OnLog(txLog types.Log) {
blockNum := int64(txLog.BlockNumber)
if core.GetChainId(mdl.Client) != 1337 && (core.Topic("NewPoolAdded(address)") == txLog.Topics[0] ||
core.Topic("NewCreditManagerAdded(address)") == txLog.Topics[0]) {

address := common.HexToAddress(txLog.Topics[1].Hex())
version := core.FetchVersionOptimized(address, 0, mdl.Client)
log.Info(version)
if version.MoreThanEq(core.NewVersion(300)) {
return
}
}
switch txLog.Topics[0] {
case core.Topic("NewPoolAdded(address)"):
address := common.HexToAddress(txLog.Topics[1].Hex()).Hex()
Expand Down

0 comments on commit 68bdd42

Please sign in to comment.