Skip to content

Commit 68bdd42

Browse files
committed
feat: check version is less than 300
1 parent 7f29aa8 commit 68bdd42

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

models/contract_register/on_log.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package contract_register
22

33
import (
44
"github.com/Gearbox-protocol/sdk-go/core"
5+
"github.com/Gearbox-protocol/sdk-go/log"
56
"github.com/ethereum/go-ethereum/common"
67
"github.com/ethereum/go-ethereum/core/types"
78

@@ -11,6 +12,16 @@ import (
1112

1213
func (mdl *ContractRegister) OnLog(txLog types.Log) {
1314
blockNum := int64(txLog.BlockNumber)
15+
if core.GetChainId(mdl.Client) != 1337 && (core.Topic("NewPoolAdded(address)") == txLog.Topics[0] ||
16+
core.Topic("NewCreditManagerAdded(address)") == txLog.Topics[0]) {
17+
18+
address := common.HexToAddress(txLog.Topics[1].Hex())
19+
version := core.FetchVersionOptimized(address, 0, mdl.Client)
20+
log.Info(version)
21+
if version.MoreThanEq(core.NewVersion(300)) {
22+
return
23+
}
24+
}
1425
switch txLog.Topics[0] {
1526
case core.Topic("NewPoolAdded(address)"):
1627
address := common.HexToAddress(txLog.Topics[1].Hex()).Hex()

0 commit comments

Comments
 (0)