fix: pointer param for provider

This commit is contained in:
Mohamed Sohail 2022-05-18 13:41:55 +03:00
parent 7eba3182ed
commit a3052d9e21
Signed by: kamikazechaser
GPG Key ID: 7DD45520C01CD85D
8 changed files with 15 additions and 15 deletions

View File

@ -10,9 +10,9 @@ type BatchBalance struct {
batchContract common.Address
}
func NewBatchBalance(rpcProvider provider.Provider, batchContract common.Address) (*BatchBalance, error) {
func NewBatchBalance(rpcProvider *provider.Provider, batchContract common.Address) (*BatchBalance, error) {
return &BatchBalance{
provider: &rpcProvider,
provider: rpcProvider,
batchContract: batchContract,
}, nil
}

View File

@ -27,7 +27,7 @@ func TestBatchBalance_Connect(t *testing.T) {
t.Errorf("Creating an rpc instance failed = %v", err)
}
batchBalance, _ := NewBatchBalance(*newProvider, w3.A(conf.batchContract))
batchBalance, _ := NewBatchBalance(newProvider, w3.A(conf.batchContract))
t.Run(name, func(t *testing.T) {
if err := batchBalance.provider.EthClient.Close(); (err != nil) != wantErr {

View File

@ -40,7 +40,7 @@ func TestBatchBalance_TokensBalance(t *testing.T) {
if err != nil {
t.Errorf("Creating an rpc instance failed = %v", err)
}
batchBalance, err := NewBatchBalance(*newProvider, w3.A(conf.batchContract))
batchBalance, err := NewBatchBalance(newProvider, w3.A(conf.batchContract))
if err != nil {
t.Fatalf("NewBatchBalance error = %v", err)

View File

@ -10,9 +10,9 @@ type CicNet struct {
tokenIndex common.Address
}
func NewCicNet(rpcProvider provider.Provider, tokenIndex common.Address) (*CicNet, error) {
func NewCicNet(rpcProvider *provider.Provider, tokenIndex common.Address) (*CicNet, error) {
return &CicNet{
provider: &rpcProvider,
provider: rpcProvider,
tokenIndex: tokenIndex,
}, nil
}

View File

@ -29,7 +29,7 @@ func TestCicNet_Connect(t *testing.T) {
t.Errorf("Creating an rpc instance failed = %v", err)
}
cicnet, _ := NewCicNet(*newProvider, w3.A(conf.tokenIndex))
cicnet, _ := NewCicNet(newProvider, w3.A(conf.tokenIndex))
t.Run(name, func(t *testing.T) {
if err := cicnet.provider.EthClient.Close(); (err != nil) != wantErr {

View File

@ -50,7 +50,7 @@ func TestCicNet_DemurrageToken_DemurrageTokeInfo(t *testing.T) {
if err != nil {
t.Errorf("Creating an rpc instance failed = %v", err)
}
cicnet, err := NewCicNet(*newProvider, w3.A(conf.tokenIndex))
cicnet, err := NewCicNet(newProvider, w3.A(conf.tokenIndex))
if err != nil {
t.Fatalf("NewCicNet error = %v", err)
@ -119,7 +119,7 @@ func TestCicNet_DemurrageToken_BaseBalanceOf(t *testing.T) {
if err != nil {
t.Errorf("Creating an rpc instance failed = %v", err)
}
cicnet, err := NewCicNet(*newProvider, w3.A(conf.tokenIndex))
cicnet, err := NewCicNet(newProvider, w3.A(conf.tokenIndex))
for _, testcase := range tests {
tt := testcase
@ -161,7 +161,7 @@ func TestCicNet_DemurrageToken_ChangePeriod(t *testing.T) {
if err != nil {
t.Errorf("Creating an rpc instance failed = %v", err)
}
cicnet, err := NewCicNet(*newProvider, w3.A(conf.tokenIndex))
cicnet, err := NewCicNet(newProvider, w3.A(conf.tokenIndex))
nonce, err := cicnet.LastNonce(context.Background(), fromAddress)
if err != nil {
@ -226,7 +226,7 @@ func TestCicNet_DemurrageToken_ApplyDemurrageLimited(t *testing.T) {
if err != nil {
t.Errorf("Creating an rpc instance failed = %v", err)
}
cicnet, err := NewCicNet(*newProvider, w3.A(conf.tokenIndex))
cicnet, err := NewCicNet(newProvider, w3.A(conf.tokenIndex))
nonce, err := cicnet.LastNonce(context.Background(), fromAddress)
if err != nil {

View File

@ -43,7 +43,7 @@ func TestCicNet_ERC20Token_ERC20TokenInfo(t *testing.T) {
if err != nil {
t.Errorf("Creating an rpc instance failed = %v", err)
}
cicnet, err := NewCicNet(*newProvider, w3.A(conf.tokenIndex))
cicnet, err := NewCicNet(newProvider, w3.A(conf.tokenIndex))
if err != nil {
t.Fatalf("NewCicNet error = %v", err)
@ -102,7 +102,7 @@ func TestCicNet_ERC20Token_BalanceOf(t *testing.T) {
if err != nil {
t.Errorf("Creating an rpc instance failed = %v", err)
}
cicnet, err := NewCicNet(*newProvider, w3.A(conf.tokenIndex))
cicnet, err := NewCicNet(newProvider, w3.A(conf.tokenIndex))
for _, testcase := range tests {
tt := testcase

View File

@ -17,7 +17,7 @@ func TestCicNet_TokenIndex_EntryCount(t *testing.T) {
if err != nil {
t.Errorf("Creating an rpc instance failed = %v", err)
}
cicnet, err := NewCicNet(*newProvider, w3.A(conf.tokenIndex))
cicnet, err := NewCicNet(newProvider, w3.A(conf.tokenIndex))
if err != nil {
t.Fatalf("NewCicNet error = %v", err)
@ -69,7 +69,7 @@ func TestCicNet_TokenIndex_AddressAtIndex(t *testing.T) {
if err != nil {
t.Errorf("Creating an rpc instance failed = %v", err)
}
cicnet, err := NewCicNet(*newProvider, w3.A(conf.tokenIndex))
cicnet, err := NewCicNet(newProvider, w3.A(conf.tokenIndex))
if err != nil {
t.Fatalf("NewCicNet error = %v", err)