Commit baf36d8e authored by luxq's avatar luxq

fix metrics bug

parent 5860be39
......@@ -227,7 +227,7 @@ func HandlerAccountSwap(acc *types.Account, env types.Env, idx uint) {
if log.Topics[0] == pancake.TransferTopic {
token, _ := erc20.NewTokenContract(common.HexToAddress(cfg.Pair.Token), client)
event, _ := token.ParseTransfer(*log)
if event.To == acc.Addr {
if event.To == acc.Addr || event.To == common.HexToAddress(acc.Recipient) {
val, _ := new(big.Float).SetInt(event.Value).Float64()
val = val / 1e18
WriteLog(fmt.Sprintf("[%s] receive %f token", acc.Address, val))
......@@ -236,6 +236,7 @@ func HandlerAccountSwap(acc *types.Account, env types.Env, idx uint) {
if event.From == acc.Addr {
val, _ := new(big.Float).SetInt(event.Value).Float64()
val = val / 1e18
WriteLog(fmt.Sprintf("[%s] cost %f token", acc.Address, val))
IncrCostToken(val)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment