mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-20 00:30:52 +00:00
848a46efe7
Former-commit-id: 4d8862ce8ddb66c4abae746cafbf8c7f5588982b [formerly 837f54daae9575bc08a9ac32bf5cf1c86aa800f3] Former-commit-id: 43d7b466ac5ca717499d4d0f0391f009800086a6
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package proposer
|
|
|
|
import (
|
|
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
|
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
|
|
"github.com/ethereum/go-ethereum/core"
|
|
"github.com/ethereum/go-ethereum/crypto"
|
|
"github.com/ethereum/go-ethereum/sharding/contracts"
|
|
"math/big"
|
|
"testing"
|
|
)
|
|
|
|
var (
|
|
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
|
addr = crypto.PubkeyToAddress(key.PublicKey)
|
|
accountBalance = big.NewInt(1001000000000000000000)
|
|
)
|
|
|
|
type mockClient struct {
|
|
smc *contracts.SMC
|
|
t *testing.T
|
|
}
|
|
|
|
func (m *mockClient) SMCCaller() *contracts.SMCCaller {
|
|
return &m.smc.SMCCaller
|
|
}
|
|
|
|
func (m *mockClient) SMCTransactor() *contracts.SMCTransactor {
|
|
return &m.smc.SMCTransactor
|
|
}
|
|
|
|
func transactOpts() *bind.TransactOpts {
|
|
return bind.NewKeyedTransactor(key)
|
|
}
|
|
|
|
func setup() (*backends.SimulatedBackend, *contracts.SMC) {
|
|
backend := backends.NewSimulatedBackend(core.GenesisAlloc{addr: {Balance: accountBalance}})
|
|
_, _, smc, _ := contracts.DeploySMC(transactOpts(), backend)
|
|
backend.Commit()
|
|
return backend, smc
|
|
}
|