mirror of
https://github.com/grassrootseconomics/cic-go.git
synced 2024-12-12 12:56:10 +01:00
fix: pointer param for provider
This commit is contained in:
parent
7eba3182ed
commit
a3052d9e21
@ -10,9 +10,9 @@ type BatchBalance struct {
|
|||||||
batchContract common.Address
|
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{
|
return &BatchBalance{
|
||||||
provider: &rpcProvider,
|
provider: rpcProvider,
|
||||||
batchContract: batchContract,
|
batchContract: batchContract,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ func TestBatchBalance_Connect(t *testing.T) {
|
|||||||
t.Errorf("Creating an rpc instance failed = %v", err)
|
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) {
|
t.Run(name, func(t *testing.T) {
|
||||||
if err := batchBalance.provider.EthClient.Close(); (err != nil) != wantErr {
|
if err := batchBalance.provider.EthClient.Close(); (err != nil) != wantErr {
|
||||||
|
@ -40,7 +40,7 @@ func TestBatchBalance_TokensBalance(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Creating an rpc instance failed = %v", err)
|
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 {
|
if err != nil {
|
||||||
t.Fatalf("NewBatchBalance error = %v", err)
|
t.Fatalf("NewBatchBalance error = %v", err)
|
||||||
|
@ -10,9 +10,9 @@ type CicNet struct {
|
|||||||
tokenIndex common.Address
|
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{
|
return &CicNet{
|
||||||
provider: &rpcProvider,
|
provider: rpcProvider,
|
||||||
tokenIndex: tokenIndex,
|
tokenIndex: tokenIndex,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ func TestCicNet_Connect(t *testing.T) {
|
|||||||
t.Errorf("Creating an rpc instance failed = %v", err)
|
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) {
|
t.Run(name, func(t *testing.T) {
|
||||||
if err := cicnet.provider.EthClient.Close(); (err != nil) != wantErr {
|
if err := cicnet.provider.EthClient.Close(); (err != nil) != wantErr {
|
||||||
|
@ -50,7 +50,7 @@ func TestCicNet_DemurrageToken_DemurrageTokeInfo(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Creating an rpc instance failed = %v", err)
|
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 {
|
if err != nil {
|
||||||
t.Fatalf("NewCicNet error = %v", err)
|
t.Fatalf("NewCicNet error = %v", err)
|
||||||
@ -119,7 +119,7 @@ func TestCicNet_DemurrageToken_BaseBalanceOf(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Creating an rpc instance failed = %v", err)
|
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 {
|
for _, testcase := range tests {
|
||||||
tt := testcase
|
tt := testcase
|
||||||
@ -161,7 +161,7 @@ func TestCicNet_DemurrageToken_ChangePeriod(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Creating an rpc instance failed = %v", err)
|
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)
|
nonce, err := cicnet.LastNonce(context.Background(), fromAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -226,7 +226,7 @@ func TestCicNet_DemurrageToken_ApplyDemurrageLimited(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Creating an rpc instance failed = %v", err)
|
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)
|
nonce, err := cicnet.LastNonce(context.Background(), fromAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -43,7 +43,7 @@ func TestCicNet_ERC20Token_ERC20TokenInfo(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Creating an rpc instance failed = %v", err)
|
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 {
|
if err != nil {
|
||||||
t.Fatalf("NewCicNet error = %v", err)
|
t.Fatalf("NewCicNet error = %v", err)
|
||||||
@ -102,7 +102,7 @@ func TestCicNet_ERC20Token_BalanceOf(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Creating an rpc instance failed = %v", err)
|
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 {
|
for _, testcase := range tests {
|
||||||
tt := testcase
|
tt := testcase
|
||||||
|
@ -17,7 +17,7 @@ func TestCicNet_TokenIndex_EntryCount(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Creating an rpc instance failed = %v", err)
|
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 {
|
if err != nil {
|
||||||
t.Fatalf("NewCicNet error = %v", err)
|
t.Fatalf("NewCicNet error = %v", err)
|
||||||
@ -69,7 +69,7 @@ func TestCicNet_TokenIndex_AddressAtIndex(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Creating an rpc instance failed = %v", err)
|
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 {
|
if err != nil {
|
||||||
t.Fatalf("NewCicNet error = %v", err)
|
t.Fatalf("NewCicNet error = %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user