|
|
@ -17,7 +17,6 @@ import ( |
|
|
|
"github.com/harmony-one/harmony/crypto/hash" |
|
|
|
"github.com/harmony-one/harmony/crypto/hash" |
|
|
|
"github.com/harmony-one/harmony/internal/params" |
|
|
|
"github.com/harmony-one/harmony/internal/params" |
|
|
|
pkgworker "github.com/harmony-one/harmony/node/worker" |
|
|
|
pkgworker "github.com/harmony-one/harmony/node/worker" |
|
|
|
staking "github.com/harmony-one/harmony/staking/types" |
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
const ( |
|
|
|
const ( |
|
|
@ -126,7 +125,7 @@ func fundFaucetContract(chain *core.BlockChain) { |
|
|
|
amount := 720000 |
|
|
|
amount := 720000 |
|
|
|
tx, _ := types.SignTx(types.NewTransaction(nonce+uint64(4), StakingAddress, 0, big.NewInt(int64(amount)), params.TxGas, nil, nil), types.HomesteadSigner{}, FaucetPriKey) |
|
|
|
tx, _ := types.SignTx(types.NewTransaction(nonce+uint64(4), StakingAddress, 0, big.NewInt(int64(amount)), params.TxGas, nil, nil), types.HomesteadSigner{}, FaucetPriKey) |
|
|
|
txs = append(txs, tx) |
|
|
|
txs = append(txs, tx) |
|
|
|
err := contractworker.CommitTransactions(txs, staking.StakingTransactions{}, testUserAddress) |
|
|
|
err := contractworker.CommitTransactions(txs, testUserAddress) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
fmt.Println(err) |
|
|
|
fmt.Println(err) |
|
|
|
} |
|
|
|
} |
|
|
@ -164,7 +163,7 @@ func callFaucetContractToFundAnAddress(chain *core.BlockChain) { |
|
|
|
callEnc = append(callEnc, paddedAddress...) |
|
|
|
callEnc = append(callEnc, paddedAddress...) |
|
|
|
callfaucettx, _ := types.SignTx(types.NewTransaction(nonce+uint64(5), faucetContractAddress, 0, big.NewInt(0), params.TxGasContractCreation*10, nil, callEnc), types.HomesteadSigner{}, FaucetPriKey) |
|
|
|
callfaucettx, _ := types.SignTx(types.NewTransaction(nonce+uint64(5), faucetContractAddress, 0, big.NewInt(0), params.TxGasContractCreation*10, nil, callEnc), types.HomesteadSigner{}, FaucetPriKey) |
|
|
|
|
|
|
|
|
|
|
|
err = contractworker.CommitTransactions(types.Transactions{callfaucettx}, staking.StakingTransactions{}, testUserAddress) |
|
|
|
err = contractworker.CommitTransactions(types.Transactions{callfaucettx}, testUserAddress) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
fmt.Println(err) |
|
|
|
fmt.Println(err) |
|
|
|
} |
|
|
|
} |
|
|
@ -242,7 +241,7 @@ func playStaking(chain *core.BlockChain) { |
|
|
|
tx, _ := types.SignTx(types.NewTransaction(0, stakeContractAddress, 0, big.NewInt(int64(stake)), params.TxGas*5, nil, callEncl), types.HomesteadSigner{}, allRandomUserKey[i]) |
|
|
|
tx, _ := types.SignTx(types.NewTransaction(0, stakeContractAddress, 0, big.NewInt(int64(stake)), params.TxGas*5, nil, callEncl), types.HomesteadSigner{}, allRandomUserKey[i]) |
|
|
|
stakingtxns = append(stakingtxns, tx) |
|
|
|
stakingtxns = append(stakingtxns, tx) |
|
|
|
} |
|
|
|
} |
|
|
|
err = contractworker.CommitTransactions(stakingtxns, staking.StakingTransactions{}, common.Address{}) |
|
|
|
err = contractworker.CommitTransactions(stakingtxns, common.Address{}) |
|
|
|
|
|
|
|
|
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
fmt.Println(err) |
|
|
|
fmt.Println(err) |
|
|
@ -300,7 +299,7 @@ func playWithdrawStaking(chain *core.BlockChain) { |
|
|
|
withdrawstakingtxns = append(withdrawstakingtxns, tx) |
|
|
|
withdrawstakingtxns = append(withdrawstakingtxns, tx) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
err = contractworker.CommitTransactions(withdrawstakingtxns, staking.StakingTransactions{}, common.Address{}) |
|
|
|
err = contractworker.CommitTransactions(withdrawstakingtxns, common.Address{}) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
fmt.Println("error:") |
|
|
|
fmt.Println("error:") |
|
|
|
fmt.Println(err) |
|
|
|
fmt.Println(err) |
|
|
|