-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathsolvbtc_test.go
More file actions
36 lines (33 loc) · 909 Bytes
/
Copy pathsolvbtc_test.go
File metadata and controls
36 lines (33 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package protocols
import (
"testing"
"github.com/ethereum/go-ethereum/common"
"github.com/rs/zerolog"
"github.com/shopspring/decimal"
)
func TestSolv_ZeroReadPassThrough(t *testing.T) {
t.Parallel()
want, _ := decimal.NewFromString("65100.25")
s := &SolvLPPriceProvider{
address: common.HexToAddress("0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"),
logger: zerolog.Nop(),
config: &SolvConfig{Asset: "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", LPTDecimals: 18},
priceMap: map[string]Price{
"0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb": {Decimals: 18, Price: want},
},
}
reads, err := s.PriceReads()
if err != nil {
t.Fatalf("PriceReads: %v", err)
}
if len(reads) != 0 {
t.Fatalf("want 0 reads, got %d", len(reads))
}
got, err := s.ComputePrice(nil)
if err != nil {
t.Fatalf("ComputePrice: %v", err)
}
if !got.Equal(want) {
t.Errorf("got %s, want %s", got, want)
}
}