dione/ethclient/stake.go
2021-08-25 22:10:56 +03:00

32 lines
649 B
Go

package ethclient
import (
"math/big"
"github.com/ethereum/go-ethereum/common"
)
const (
MinMinerStake = 1000
)
// GetTotalStake for getting total stake in DioneStaking contract
func (c *ethereumClient) GetTotalStake() (*big.Int, error) {
totalStake, err := c.dioneStaking.TotalStake()
if err != nil {
return nil, err
}
return totalStake, nil
}
// GetMinerStake for getting specified miner stake in DioneStaking contract
func (c *ethereumClient) GetMinerStake(minerAddress common.Address) (*big.Int, error) {
minerStake, err := c.dioneStaking.MinerStake(minerAddress)
if err != nil {
return nil, err
}
return minerStake, nil
}