Commit 87c67ff3 authored by duanjinfei's avatar duanjinfei

add print log

parent 89a562b1
...@@ -1148,6 +1148,7 @@ func PrReOneErc20TranCase1(txCount int, testAccArr *tool.AccArrFormat, contractM ...@@ -1148,6 +1148,7 @@ func PrReOneErc20TranCase1(txCount int, testAccArr *tool.AccArrFormat, contractM
log.Error("Get erc20 balanceOf error:", err.Error()) log.Error("Get erc20 balanceOf error:", err.Error())
return nil, nil return nil, nil
} }
log.Infof("ERC20 Before to addr:%s,toBal:%s", toAddr.Hex(), toBal.String())
beforeAddrErc20Bal[toAddr] = toBal beforeAddrErc20Bal[toAddr] = toBal
for i := 0; i < txCount; i++ { for i := 0; i < txCount; i++ {
fromBal, err := erc20Contract.BalanceOf(&bind.CallOpts{}, testAccArr.FromAddr[i]) fromBal, err := erc20Contract.BalanceOf(&bind.CallOpts{}, testAccArr.FromAddr[i])
...@@ -1155,6 +1156,7 @@ func PrReOneErc20TranCase1(txCount int, testAccArr *tool.AccArrFormat, contractM ...@@ -1155,6 +1156,7 @@ func PrReOneErc20TranCase1(txCount int, testAccArr *tool.AccArrFormat, contractM
log.Error("Get erc20 balanceOf error:", err.Error()) log.Error("Get erc20 balanceOf error:", err.Error())
return nil, nil return nil, nil
} }
log.Infof("ERC20 Before from addr:%s,fromBal:%s", testAccArr.FromAddr[i].Hex(), fromBal.String())
beforeAddrErc20Bal[testAccArr.FromAddr[i]] = fromBal beforeAddrErc20Bal[testAccArr.FromAddr[i]] = fromBal
oneErc20Trade.ToAddr = []common.Address{testAccArr.ToAddr[i]} oneErc20Trade.ToAddr = []common.Address{testAccArr.ToAddr[i]}
auth, err := bind.NewKeyedTransactorWithChainID(testAccArr.FromPrv[i], tool.Cfg.ChainId) auth, err := bind.NewKeyedTransactorWithChainID(testAccArr.FromPrv[i], tool.Cfg.ChainId)
...@@ -1170,7 +1172,7 @@ func PrReOneErc20TranCase1(txCount int, testAccArr *tool.AccArrFormat, contractM ...@@ -1170,7 +1172,7 @@ func PrReOneErc20TranCase1(txCount int, testAccArr *tool.AccArrFormat, contractM
if err != nil { if err != nil {
return nil, nil return nil, nil
} }
log.Info("Erc20OneTransferTx tx:", tx.Hash().Hex()) log.Info("Erc20OneTransferFromTx tx:", tx.Hash().Hex())
resTxArr = append(resTxArr, tx) resTxArr = append(resTxArr, tx)
} }
verify := func() bool { verify := func() bool {
...@@ -1183,12 +1185,14 @@ func PrReOneErc20TranCase1(txCount int, testAccArr *tool.AccArrFormat, contractM ...@@ -1183,12 +1185,14 @@ func PrReOneErc20TranCase1(txCount int, testAccArr *tool.AccArrFormat, contractM
if to.Sub(to, beforeAddrErc20Bal[toAddr]).Cmp(new(big.Int).Mul(big.NewInt(int64(txCount)), amount)) != 0 { if to.Sub(to, beforeAddrErc20Bal[toAddr]).Cmp(new(big.Int).Mul(big.NewInt(int64(txCount)), amount)) != 0 {
res = false res = false
} }
log.Infof("ERC20 After to addr:%s,toBal:%s", toAddr.Hex(), to.String())
for i := 0; i < txCount; i++ { for i := 0; i < txCount; i++ {
from, err := erc20Contract.BalanceOf(&bind.CallOpts{}, testAccArr.FromAddr[i]) from, err := erc20Contract.BalanceOf(&bind.CallOpts{}, testAccArr.FromAddr[i])
if err != nil { if err != nil {
log.Error("Get erc20 balanceOf error:", err.Error()) log.Error("Get erc20 balanceOf error:", err.Error())
res = false res = false
} }
log.Infof("ERC20 After from addr:%s,fromBal:%s", testAccArr.FromAddr[i].Hex(), from.String())
if beforeAddrErc20Bal[testAccArr.FromAddr[i]].Sub(beforeAddrErc20Bal[testAccArr.FromAddr[i]], from).Cmp(amount) != 1 { if beforeAddrErc20Bal[testAccArr.FromAddr[i]].Sub(beforeAddrErc20Bal[testAccArr.FromAddr[i]], from).Cmp(amount) != 1 {
res = false res = false
} }
......
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