2022-10-11 12:34:32 +00:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
2023-01-13 18:12:18 +00:00
|
|
|
libcommon "github.com/ledgerwatch/erigon-lib/common"
|
|
|
|
|
2022-10-11 12:34:32 +00:00
|
|
|
"github.com/ledgerwatch/erigon/cmd/devnet/models"
|
|
|
|
"github.com/ledgerwatch/erigon/cmd/devnet/requests"
|
2023-05-20 20:57:32 +00:00
|
|
|
"github.com/ledgerwatch/log/v3"
|
2022-10-11 12:34:32 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2022-10-31 10:46:49 +00:00
|
|
|
addr = "0x71562b71999873DB5b286dF957af199Ec94617F7"
|
2022-10-11 12:34:32 +00:00
|
|
|
)
|
|
|
|
|
2023-05-20 20:57:32 +00:00
|
|
|
func callGetBalance(addr string, blockNum models.BlockNumber, checkBal uint64, logger log.Logger) {
|
2023-05-22 07:46:50 +00:00
|
|
|
logger.Info("Getting balance", "addeess", addr)
|
2023-01-13 18:12:18 +00:00
|
|
|
address := libcommon.HexToAddress(addr)
|
2023-05-20 20:57:32 +00:00
|
|
|
bal, err := requests.GetBalance(models.ReqId, address, blockNum, logger)
|
2022-10-11 12:34:32 +00:00
|
|
|
if err != nil {
|
2023-05-22 07:46:50 +00:00
|
|
|
logger.Error("FAILURE", "error", err)
|
2022-10-11 12:34:32 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if checkBal > 0 && checkBal != bal {
|
2023-05-22 07:46:50 +00:00
|
|
|
logger.Error("FAILURE => Balance mismatch", "expected", checkBal, "got", bal)
|
2022-10-11 12:34:32 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-05-22 07:46:50 +00:00
|
|
|
logger.Info("SUCCESS", "balance", bal)
|
2022-10-11 12:34:32 +00:00
|
|
|
}
|