11package pool_v2
22
33import (
4+ "fmt"
45 "math/big"
56
67 "github.com/Gearbox-protocol/sdk-go/core"
@@ -48,7 +49,8 @@ func (mdl *Poolv2) OnLog(txLog types.Log) {
4849 AmountBI : (* core .BigInt )(addLiquidityEvent .Amount ),
4950 Amount : utils .GetFloat64Decimal (addLiquidityEvent .Amount , mdl .Repo .GetToken (mdl .State .UnderlyingToken ).Decimals ),
5051 })
51- pool_common .CheckIfAmountMoreThan1Mil (mdl .Client , mdl .Repo , mdl .State , addLiquidityEvent .Amount , blockNum , txLog .TxHash .Hex (), "deposit" )
52+ pool_common .CheckIfAmountMoreThan1Mil (mdl .Client , mdl .Repo , mdl .State , addLiquidityEvent .Amount , blockNum , txLog .TxHash .Hex (),
53+ fmt .Sprintf ("%s deposit" , mdl .Repo .GetToken (mdl .State .UnderlyingToken ).Symbol ))
5254 mdl .updateBorrowRate (blockNum )
5355 case core .Topic ("RemoveLiquidity(address,address,uint256)" ):
5456 removeLiquidityEvent , err := mdl .contractETH .ParseRemoveLiquidity (txLog )
@@ -67,7 +69,8 @@ func (mdl *Poolv2) OnLog(txLog types.Log) {
6769 Receiver : removeLiquidityEvent .To .Hex (),
6870 AmountBI : (* core .BigInt )(removeLiquidityEvent .Amount ),
6971 })
70- pool_common .CheckIfAmountMoreThan1Mil (mdl .Client , mdl .Repo , mdl .State , removeLiquidityEvent .Amount , blockNum , txLog .TxHash .Hex (), "withdrawn" )
72+ pool_common .CheckIfAmountMoreThan1Mil (mdl .Client , mdl .Repo , mdl .State , removeLiquidityEvent .Amount , blockNum , txLog .TxHash .Hex (),
73+ fmt .Sprintf ("%s withdrawal" , mdl .Repo .GetToken (mdl .State .UnderlyingToken ).Symbol ))
7174
7275 mdl .updateBorrowRate (blockNum )
7376 case core .Topic ("Borrow(address,address,uint256)" ):
@@ -175,19 +178,3 @@ func (mdl *Poolv2) OnLog(txLog types.Log) {
175178 mdl .gatewayHandler .CheckWithdrawETH (txLog .TxHash .Hex (), blockNum , int64 (ind ), mdl .Address , to )
176179 }
177180}
178-
179- func (mdl Poolv2 ) checkIfAmountMoreThan1Mil (amount * big.Int , blockNum int64 , txHash string , operation string ) {
180- token := mdl .State .UnderlyingToken
181- priceInUSD := mdl .Repo .GetPrice (token )
182- if priceInUSD == nil {
183- return
184- }
185- value := utils .GetFloat64Decimal (new (big.Int ).Mul (priceInUSD , amount ), mdl .Repo .GetToken (token ).Decimals + 8 )
186- if value > 1_000_000 {
187- urls := log .NetworkUIUrl (core .GetChainId (mdl .Client ))
188- mdl .Repo .RecentMsgf (log.RiskHeader {
189- BlockNumber : blockNum ,
190- EventCode : "AMQP" ,
191- }, "Pool %s in %s is more than 1Million USD, calculated value is %f" , operation , urls .ExplorerHashUrl (txHash ), value )
192- }
193- }
0 commit comments