2020-11-13 15:36:01 +00:00
|
|
|
package ethclient
|
|
|
|
|
|
|
|
import (
|
2021-06-08 21:30:23 +00:00
|
|
|
"math/big"
|
|
|
|
|
2020-11-13 15:36:01 +00:00
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
)
|
|
|
|
|
2020-11-27 16:16:08 +00:00
|
|
|
const (
|
|
|
|
MinMinerStake = 1000
|
|
|
|
)
|
|
|
|
|
2021-06-08 21:30:23 +00:00
|
|
|
// GetTotalStake for getting total stake in DioneStaking contract
|
|
|
|
func (c *EthereumClient) GetTotalStake() (*big.Int, error) {
|
2020-11-13 15:36:01 +00:00
|
|
|
totalStake, err := c.dioneStaking.TotalStake()
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2021-06-08 21:30:23 +00:00
|
|
|
return totalStake, nil
|
2020-11-13 15:36:01 +00:00
|
|
|
}
|
|
|
|
|
2021-06-08 21:30:23 +00:00
|
|
|
// GetMinerStake for getting specified miner stake in DioneStaking contract
|
|
|
|
func (c *EthereumClient) GetMinerStake(minerAddress common.Address) (*big.Int, error) {
|
2020-11-13 15:36:01 +00:00
|
|
|
minerStake, err := c.dioneStaking.MinerStake(minerAddress)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2021-06-08 21:30:23 +00:00
|
|
|
return minerStake, nil
|
2020-11-13 15:36:01 +00:00
|
|
|
}
|