update smart contract, hard-code first 3-masternodes

This commit is contained in:
MestryOmkar 2018-09-25 11:43:29 +05:30
parent 76153eea4a
commit c69251ddd2
2 changed files with 8 additions and 9 deletions

View file

@ -27,8 +27,8 @@ func NewValidator(transactOpts *bind.TransactOpts, contractAddr common.Address,
}, nil
}
func DeployValidator(transactOpts *bind.TransactOpts, contractBackend bind.ContractBackend, candidates []common.Address, caps []*big.Int) (common.Address, *Validator, error) {
validatorAddr, _, _, err := contract.DeployXDCValidator(transactOpts, contractBackend, candidates, caps, big.NewInt(50000), big.NewInt(99), big.NewInt(100))
func DeployValidator(transactOpts *bind.TransactOpts, contractBackend bind.ContractBackend) (common.Address, *Validator, error) {
validatorAddr, _, _, err := contract.DeployXDCValidator(transactOpts, contractBackend, big.NewInt(50000), big.NewInt(99), big.NewInt(100))
if err != nil {
return validatorAddr, nil, err
}

View file

@ -1,32 +1,31 @@
package validator
import (
import (
"math/big"
"testing"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/crypto"
)
var (
var (
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
addr = crypto.PubkeyToAddress(key.PublicKey)
)
func TestValidator(t *testing.T) {
func TestValidator(t *testing.T) {
contractBackend := backends.NewSimulatedBackend(core.GenesisAlloc{addr: {Balance: big.NewInt(1000000000)}})
transactOpts := bind.NewKeyedTransactor(key)
_, validator, err := DeployValidator(transactOpts, contractBackend, []common.Address{addr}, []*big.Int{big.NewInt(0)})
_, validator, err := DeployValidator(transactOpts, contractBackend)
if err != nil {
t.Fatalf("can't deploy root registry: %v", err)
}
contractBackend.Commit()
candidates, err := validator.GetCandidates()
candidates, err := validator.GetCandidates()
if err != nil {
t.Fatalf("can't get candidates: %v", err)
}