diff --git a/common/client/mock_rpc_test.go b/common/client/mock_rpc_test.go index c378b9384e4..8f171302a2a 100644 --- a/common/client/mock_rpc_test.go +++ b/common/client/mock_rpc_test.go @@ -5,7 +5,7 @@ package client import ( big "math/big" - assets "github.com/smartcontractkit/chainlink/v2/core/assets" + assets "github.com/smartcontractkit/chainlink-relay/pkg/assets" context "context" diff --git a/common/client/multi_node.go b/common/client/multi_node.go index c268cfb23cd..df91c61a9d8 100644 --- a/common/client/multi_node.go +++ b/common/client/multi_node.go @@ -11,12 +11,12 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink-relay/pkg/services" + "github.com/smartcontractkit/chainlink/v2/common/config" feetypes "github.com/smartcontractkit/chainlink/v2/common/fee/types" "github.com/smartcontractkit/chainlink/v2/common/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" - "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/utils" ) diff --git a/common/client/multi_node_test.go b/common/client/multi_node_test.go index 1fddbc3be3c..3621d6d862d 100644 --- a/common/client/multi_node_test.go +++ b/common/client/multi_node_test.go @@ -14,8 +14,8 @@ import ( "github.com/smartcontractkit/chainlink-relay/pkg/utils/tests" + "github.com/smartcontractkit/chainlink/v2/common/config" "github.com/smartcontractkit/chainlink/v2/common/types" - "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/utils" ) diff --git a/common/client/types.go b/common/client/types.go index 0e52f1db72c..ef9f94dafea 100644 --- a/common/client/types.go +++ b/common/client/types.go @@ -4,9 +4,9 @@ import ( "context" "math/big" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" feetypes "github.com/smartcontractkit/chainlink/v2/common/fee/types" "github.com/smartcontractkit/chainlink/v2/common/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/utils" ) diff --git a/core/config/chaintype.go b/common/config/chaintype.go similarity index 100% rename from core/config/chaintype.go rename to common/config/chaintype.go diff --git a/core/assets/currencies.go b/core/assets/currencies.go deleted file mode 100644 index 1201f0be35c..00000000000 --- a/core/assets/currencies.go +++ /dev/null @@ -1,301 +0,0 @@ -package assets - -import ( - "database/sql/driver" - "fmt" - "math/big" - "strings" - - "github.com/smartcontractkit/chainlink/v2/core/utils" - - "github.com/ethereum/go-ethereum/common" - "github.com/pkg/errors" - "github.com/shopspring/decimal" -) - -var ErrNoQuotesForCurrency = errors.New("cannot unmarshal json.Number into currency") - -// getDenominator returns 10**precision. -func getDenominator(precision int) *big.Int { - x := big.NewInt(10) - return new(big.Int).Exp(x, big.NewInt(int64(precision)), nil) -} - -func format(i *big.Int, precision int) string { - r := big.NewRat(1, 1).SetFrac(i, getDenominator(precision)) - return fmt.Sprintf("%v", r.FloatString(precision)) -} - -// Link contains a field to represent the smallest units of LINK -type Link big.Int - -// NewLinkFromJuels returns a new struct to represent LINK from it's smallest unit -func NewLinkFromJuels(w int64) *Link { - return (*Link)(big.NewInt(w)) -} - -// String returns Link formatted as a string. -func (l *Link) String() string { - if l == nil { - return "0" - } - return fmt.Sprintf("%v", (*big.Int)(l)) -} - -// Link returns Link formatted as a string, in LINK units -func (l *Link) Link() string { - if l == nil { - return "0" - } - return format((*big.Int)(l), 18) -} - -// SetInt64 delegates to *big.Int.SetInt64 -func (l *Link) SetInt64(w int64) *Link { - return (*Link)((*big.Int)(l).SetInt64(w)) -} - -// ToInt returns the Link value as a *big.Int. -func (l *Link) ToInt() *big.Int { - return (*big.Int)(l) -} - -// ToHash returns a 32 byte representation of this value -func (l *Link) ToHash() common.Hash { - return common.BigToHash((*big.Int)(l)) -} - -// Set delegates to *big.Int.Set -func (l *Link) Set(x *Link) *Link { - il := (*big.Int)(l) - ix := (*big.Int)(x) - - w := il.Set(ix) - return (*Link)(w) -} - -// SetString delegates to *big.Int.SetString -func (l *Link) SetString(s string, base int) (*Link, bool) { - w, ok := (*big.Int)(l).SetString(s, base) - return (*Link)(w), ok -} - -// Cmp defers to big.Int Cmp -func (l *Link) Cmp(y *Link) int { - return (*big.Int)(l).Cmp((*big.Int)(y)) -} - -// Add defers to big.Int Add -func (l *Link) Add(x, y *Link) *Link { - il := (*big.Int)(l) - ix := (*big.Int)(x) - iy := (*big.Int)(y) - - return (*Link)(il.Add(ix, iy)) -} - -// Text defers to big.Int Text -func (l *Link) Text(base int) string { - return (*big.Int)(l).Text(base) -} - -var linkFmtThreshold = (*Link)(new(big.Int).Exp(big.NewInt(10), big.NewInt(12), nil)) - -// MarshalText implements the encoding.TextMarshaler interface. -func (l *Link) MarshalText() ([]byte, error) { - if l.Cmp(linkFmtThreshold) >= 0 { - return []byte(fmt.Sprintf("%s link", decimal.NewFromBigInt(l.ToInt(), -18))), nil - } - return (*big.Int)(l).MarshalText() -} - -// MarshalJSON implements the json.Marshaler interface. -func (l Link) MarshalJSON() ([]byte, error) { - value, err := l.MarshalText() - if err != nil { - return nil, err - } - return []byte(fmt.Sprintf(`"%s"`, value)), nil -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -func (l *Link) UnmarshalJSON(data []byte) error { - if utils.IsQuoted(data) { - return l.UnmarshalText(utils.RemoveQuotes(data)) - } - return ErrNoQuotesForCurrency -} - -// UnmarshalText implements the encoding.TextUnmarshaler interface. -func (l *Link) UnmarshalText(text []byte) error { - s := string(text) - if strings.HasSuffix(s, "link") { - s = strings.TrimSuffix(s, "link") - s = strings.TrimSuffix(s, " ") - d, err := decimal.NewFromString(s) - if err != nil { - return errors.Wrapf(err, "assets: cannot unmarshal %q into a *assets.Link", text) - } - d = d.Mul(decimal.New(1, 18)) - if !d.IsInteger() { - err := errors.New("maximum precision is juels") - return errors.Wrapf(err, "assets: cannot unmarshal %q into a *assets.Link", text) - } - l.Set((*Link)(d.Rat().Num())) - return nil - } - if strings.HasSuffix(s, "juels") { - s = strings.TrimSuffix(s, "juels") - s = strings.TrimSuffix(s, " ") - } - if _, ok := l.SetString(s, 10); !ok { - return errors.Errorf("assets: cannot unmarshal %q into a *assets.Link", text) - } - return nil -} - -// IsZero returns true when the value is 0 and false otherwise -func (l *Link) IsZero() bool { - zero := big.NewInt(0) - return (*big.Int)(l).Cmp(zero) == 0 -} - -// Symbol returns LINK -func (*Link) Symbol() string { - return "LINK" -} - -// Value returns the Link value for serialization to database. -func (l Link) Value() (driver.Value, error) { - b := (big.Int)(l) - return b.String(), nil -} - -// Scan reads the database value and returns an instance. -func (l *Link) Scan(value interface{}) error { - switch v := value.(type) { - case string: - decoded, ok := l.SetString(v, 10) - if !ok { - return fmt.Errorf("unable to set string %v of %T to base 10 big.Int for Link", value, value) - } - *l = *decoded - case []uint8: - // The SQL library returns numeric() types as []uint8 of the string representation - decoded, ok := l.SetString(string(v), 10) - if !ok { - return fmt.Errorf("unable to set string %v of %T to base 10 big.Int for Link", value, value) - } - *l = *decoded - case int64: - return fmt.Errorf("unable to convert %v of %T to Link, is the sql type set to varchar?", value, value) - default: - return fmt.Errorf("unable to convert %v of %T to Link", value, value) - } - - return nil -} - -// Eth contains a field to represent the smallest units of ETH -type Eth big.Int - -// NewEth returns a new struct to represent ETH from it's smallest unit (wei) -func NewEth(w int64) *Eth { - return (*Eth)(big.NewInt(w)) -} - -// NewEthValue returns a new struct to represent ETH from it's smallest unit (wei) -func NewEthValue(w int64) Eth { - eth := NewEth(w) - return *eth -} - -// NewEthValueS returns a new struct to represent ETH from a string value of Eth (not wei) -// the underlying value is still wei -func NewEthValueS(s string) (Eth, error) { - e, err := decimal.NewFromString(s) - if err != nil { - return Eth{}, err - } - w := e.Mul(decimal.RequireFromString("10").Pow(decimal.RequireFromString("18"))) - return *(*Eth)(w.BigInt()), nil -} - -// Cmp delegates to *big.Int.Cmp -func (e *Eth) Cmp(y *Eth) int { - return e.ToInt().Cmp(y.ToInt()) -} - -func (e *Eth) String() string { - if e == nil { - return "" - } - return format(e.ToInt(), 18) -} - -// SetInt64 delegates to *big.Int.SetInt64 -func (e *Eth) SetInt64(w int64) *Eth { - return (*Eth)(e.ToInt().SetInt64(w)) -} - -// SetString delegates to *big.Int.SetString -func (e *Eth) SetString(s string, base int) (*Eth, bool) { - w, ok := e.ToInt().SetString(s, base) - return (*Eth)(w), ok -} - -// MarshalJSON implements the json.Marshaler interface. -func (e Eth) MarshalJSON() ([]byte, error) { - value, err := e.MarshalText() - if err != nil { - return nil, err - } - return []byte(fmt.Sprintf(`"%s"`, value)), nil -} - -// MarshalText implements the encoding.TextMarshaler interface. -func (e *Eth) MarshalText() ([]byte, error) { - return e.ToInt().MarshalText() -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -func (e *Eth) UnmarshalJSON(data []byte) error { - if utils.IsQuoted(data) { - return e.UnmarshalText(utils.RemoveQuotes(data)) - } - return ErrNoQuotesForCurrency -} - -// UnmarshalText implements the encoding.TextUnmarshaler interface. -func (e *Eth) UnmarshalText(text []byte) error { - if _, ok := e.SetString(string(text), 10); !ok { - return fmt.Errorf("assets: cannot unmarshal %q into a *assets.Eth", text) - } - return nil -} - -// IsZero returns true when the value is 0 and false otherwise -func (e *Eth) IsZero() bool { - zero := big.NewInt(0) - return e.ToInt().Cmp(zero) == 0 -} - -// Symbol returns ETH -func (*Eth) Symbol() string { - return "ETH" -} - -// ToInt returns the Eth value as a *big.Int. -func (e *Eth) ToInt() *big.Int { - return (*big.Int)(e) -} - -// Scan reads the database value and returns an instance. -func (e *Eth) Scan(value interface{}) error { - return (*utils.Big)(e).Scan(value) -} - -// Value returns the Eth value for serialization to database. -func (e Eth) Value() (driver.Value, error) { - return (utils.Big)(e).Value() -} diff --git a/core/assets/currencies_test.go b/core/assets/currencies_test.go deleted file mode 100644 index 5f2a00223f5..00000000000 --- a/core/assets/currencies_test.go +++ /dev/null @@ -1,357 +0,0 @@ -package assets_test - -import ( - "encoding/json" - "math/big" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/ethereum/go-ethereum/common" - - "github.com/smartcontractkit/chainlink/v2/core/assets" -) - -func TestAssets_NewLinkAndString(t *testing.T) { - t.Parallel() - - link := assets.NewLinkFromJuels(0) - - assert.Equal(t, "0", link.String()) - - link.SetInt64(1) - assert.Equal(t, "1", link.String()) - - link.SetString("900000000000000000", 10) - assert.Equal(t, "900000000000000000", link.String()) - - link.SetString("115792089237316195423570985008687907853269984665640564039457584007913129639935", 10) - assert.Equal(t, "115792089237316195423570985008687907853269984665640564039457584007913129639935", link.String()) - - var nilLink *assets.Link - assert.Equal(t, "0", nilLink.String()) -} - -func TestAssets_NewLinkAndLink(t *testing.T) { - t.Parallel() - - link := assets.NewLinkFromJuels(0) - - assert.Equal(t, "0.000000000000000000", link.Link()) - - link.SetInt64(1) - assert.Equal(t, "0.000000000000000001", link.Link()) - - link.SetString("900000000000000000", 10) - assert.Equal(t, "0.900000000000000000", link.Link()) - - link.SetString("115792089237316195423570985008687907853269984665640564039457584007913129639935", 10) - assert.Equal(t, "115792089237316195423570985008687907853269984665640564039457.584007913129639935", link.Link()) - - link.SetString("115792089237316195423570985008687907853269984665640564039457584007913129639936", 10) - assert.Equal(t, "115792089237316195423570985008687907853269984665640564039457.584007913129639936", link.Link()) - - var nilLink *assets.Link - assert.Equal(t, "0", nilLink.Link()) -} - -func TestAssets_Link_MarshalJson(t *testing.T) { - t.Parallel() - - link := assets.NewLinkFromJuels(1) - - b, err := json.Marshal(link) - assert.NoError(t, err) - assert.Equal(t, []byte(`"1"`), b) -} - -func TestAssets_Link_UnmarshalJsonOk(t *testing.T) { - t.Parallel() - - link := assets.Link{} - - err := json.Unmarshal([]byte(`"1"`), &link) - assert.NoError(t, err) - assert.Equal(t, "0.000000000000000001", link.Link()) -} - -func TestAssets_Link_UnmarshalJsonError(t *testing.T) { - t.Parallel() - - link := assets.Link{} - - err := json.Unmarshal([]byte(`"x"`), &link) - assert.EqualError(t, err, "assets: cannot unmarshal \"x\" into a *assets.Link") - - err = json.Unmarshal([]byte(`1`), &link) - assert.Equal(t, assets.ErrNoQuotesForCurrency, err) -} - -func TestAssets_NewEthAndString(t *testing.T) { - t.Parallel() - - eth := assets.NewEth(0) - - assert.Equal(t, "0.000000000000000000", eth.String()) - - eth.SetInt64(1) - assert.Equal(t, "0.000000000000000001", eth.String()) - - eth.SetString("900000000000000000", 10) - assert.Equal(t, "0.900000000000000000", eth.String()) - - eth.SetString("115792089237316195423570985008687907853269984665640564039457584007913129639935", 10) - assert.Equal(t, "115792089237316195423570985008687907853269984665640564039457.584007913129639935", eth.String()) - - eth.SetString("115792089237316195423570985008687907853269984665640564039457584007913129639936", 10) - assert.Equal(t, "115792089237316195423570985008687907853269984665640564039457.584007913129639936", eth.String()) -} - -func TestAssets_Eth_IsZero(t *testing.T) { - t.Parallel() - - zeroEth := assets.NewEth(0) - assert.True(t, zeroEth.IsZero()) - - oneLink := assets.NewEth(1) - assert.False(t, oneLink.IsZero()) -} - -func TestAssets_Eth_MarshalJson(t *testing.T) { - t.Parallel() - - eth := assets.NewEth(1) - - b, err := json.Marshal(eth) - assert.NoError(t, err) - assert.Equal(t, []byte(`"1"`), b) -} - -func TestAssets_Eth_UnmarshalJsonOk(t *testing.T) { - t.Parallel() - - eth := assets.Eth{} - - err := json.Unmarshal([]byte(`"1"`), ð) - assert.NoError(t, err) - assert.Equal(t, "0.000000000000000001", eth.String()) -} - -func TestAssets_Eth_UnmarshalJsonError(t *testing.T) { - t.Parallel() - - eth := assets.Eth{} - - err := json.Unmarshal([]byte(`"x"`), ð) - assert.EqualError(t, err, "assets: cannot unmarshal \"x\" into a *assets.Eth") - - err = json.Unmarshal([]byte(`1`), ð) - assert.Equal(t, assets.ErrNoQuotesForCurrency, err) -} - -func TestAssets_LinkToInt(t *testing.T) { - t.Parallel() - - link := assets.NewLinkFromJuels(0) - assert.Equal(t, big.NewInt(0), link.ToInt()) - - link = assets.NewLinkFromJuels(123) - assert.Equal(t, big.NewInt(123), link.ToInt()) -} - -func TestAssets_LinkToHash(t *testing.T) { - t.Parallel() - - link := assets.NewLinkFromJuels(123) - expected := common.BigToHash((*big.Int)(link)) - assert.Equal(t, expected, link.ToHash()) -} - -func TestAssets_LinkSetLink(t *testing.T) { - t.Parallel() - - link1 := assets.NewLinkFromJuels(123) - link2 := assets.NewLinkFromJuels(321) - link3 := link1.Set(link2) - assert.Equal(t, link3, link2) -} - -func TestAssets_LinkCmpLink(t *testing.T) { - t.Parallel() - - link1 := assets.NewLinkFromJuels(123) - link2 := assets.NewLinkFromJuels(321) - assert.NotZero(t, link1.Cmp(link2)) - - link3 := assets.NewLinkFromJuels(321) - assert.Zero(t, link3.Cmp(link2)) -} - -func TestAssets_LinkAddLink(t *testing.T) { - t.Parallel() - - link1 := assets.NewLinkFromJuels(123) - link2 := assets.NewLinkFromJuels(321) - sum := assets.NewLinkFromJuels(123 + 321) - assert.Equal(t, sum, link1.Add(link1, link2)) -} - -func TestAssets_LinkText(t *testing.T) { - t.Parallel() - - link := assets.NewLinkFromJuels(123) - assert.Equal(t, "123", link.Text(10)) - assert.Equal(t, "7b", link.Text(16)) -} - -func TestAssets_LinkIsZero(t *testing.T) { - t.Parallel() - - link := assets.NewLinkFromJuels(123) - assert.False(t, link.IsZero()) - - link = assets.NewLinkFromJuels(0) - assert.True(t, link.IsZero()) -} - -func TestAssets_LinkSymbol(t *testing.T) { - t.Parallel() - - link := assets.NewLinkFromJuels(123) - assert.Equal(t, "LINK", link.Symbol()) -} - -func TestAssets_LinkScanValue(t *testing.T) { - t.Parallel() - - link := assets.NewLinkFromJuels(123) - v, err := link.Value() - assert.NoError(t, err) - - link2 := assets.NewLinkFromJuels(0) - err = link2.Scan(v) - assert.NoError(t, err) - assert.Equal(t, link2, link) - - err = link2.Scan("123") - assert.NoError(t, err) - assert.Equal(t, link2, link) - - err = link2.Scan([]uint8{'1', '2', '3'}) - assert.NoError(t, err) - assert.Equal(t, link2, link) - - assert.ErrorContains(t, link2.Scan([]uint8{'x'}), "unable to set string") - assert.ErrorContains(t, link2.Scan("123.56"), "unable to set string") - assert.ErrorContains(t, link2.Scan(1.5), "unable to convert") - assert.ErrorContains(t, link2.Scan(int64(123)), "unable to convert") -} - -func TestAssets_NewEth(t *testing.T) { - t.Parallel() - - ethRef := assets.NewEth(123) - ethVal := assets.NewEthValue(123) - ethStr, err := assets.NewEthValueS(ethRef.String()) - assert.NoError(t, err) - assert.Equal(t, *ethRef, ethVal) - assert.Equal(t, *ethRef, ethStr) -} - -func TestAssets_EthSymbol(t *testing.T) { - t.Parallel() - - eth := assets.NewEth(123) - assert.Equal(t, "ETH", eth.Symbol()) -} - -func TestAssets_EthScanValue(t *testing.T) { - t.Parallel() - - eth := assets.NewEth(123) - v, err := eth.Value() - assert.NoError(t, err) - - eth2 := assets.NewEth(0) - err = eth2.Scan(v) - assert.NoError(t, err) - - assert.Equal(t, eth, eth2) -} - -func TestAssets_EthCmpEth(t *testing.T) { - t.Parallel() - - eth1 := assets.NewEth(123) - eth2 := assets.NewEth(321) - assert.NotZero(t, eth1.Cmp(eth2)) - - eth3 := assets.NewEth(321) - assert.Zero(t, eth3.Cmp(eth2)) -} - -func TestLink(t *testing.T) { - for _, tt := range []struct { - input string - exp string - }{ - {"0", "0"}, - {"1", "1"}, - {"1 juels", "1"}, - {"100000000000", "100000000000"}, - {"0.0000001 link", "100000000000"}, - {"1000000000000", "0.000001 link"}, - {"100000000000000", "0.0001 link"}, - {"0.0001 link", "0.0001 link"}, - {"10000000000000000", "0.01 link"}, - {"0.01 link", "0.01 link"}, - {"100000000000000000", "0.1 link"}, - {"0.1 link", "0.1 link"}, - {"1.0 link", "1 link"}, - {"1000000000000000000", "1 link"}, - {"1000000000000000000 juels", "1 link"}, - {"1100000000000000000", "1.1 link"}, - {"1.1link", "1.1 link"}, - {"1.1 link", "1.1 link"}, - } { - t.Run(tt.input, func(t *testing.T) { - var l assets.Link - err := l.UnmarshalText([]byte(tt.input)) - require.NoError(t, err) - b, err := l.MarshalText() - require.NoError(t, err) - assert.Equal(t, tt.exp, string(b)) - }) - } -} - -func FuzzLink(f *testing.F) { - f.Add("1") - f.Add("1 link") - f.Add("1.1link") - f.Add("2.3") - f.Add("2.3 link") - f.Add("00005 link") - f.Add("0.0005link") - f.Add("1100000000000000000000000000000") - f.Add("1100000000000000000000000000000 juels") - f.Fuzz(func(t *testing.T, v string) { - if len(v) > 1_000 { - t.Skip() - } - var l assets.Link - err := l.UnmarshalText([]byte(v)) - if err != nil { - t.Skip() - } - - b, err := l.MarshalText() - require.NoErrorf(t, err, "failed to marshal %v after unmarshaling from %q", l, v) - - var l2 assets.Link - err = l2.UnmarshalText(b) - require.NoErrorf(t, err, "failed to unmarshal %s after marshaling from %v", string(b), l) - require.Equal(t, l, l2, "unequal values after marshal/unmarshal") - }) -} diff --git a/core/bridges/bridge_type.go b/core/bridges/bridge_type.go index 9b3a8570ca2..9031541f22b 100644 --- a/core/bridges/bridge_type.go +++ b/core/bridges/bridge_type.go @@ -10,7 +10,7 @@ import ( "strings" "time" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/store/models" "github.com/smartcontractkit/chainlink/v2/core/utils" ) diff --git a/core/bridges/bridge_type_test.go b/core/bridges/bridge_type_test.go index 8c4a7cbace0..c04aba5c2c7 100644 --- a/core/bridges/bridge_type_test.go +++ b/core/bridges/bridge_type_test.go @@ -11,7 +11,7 @@ import ( "github.com/ethereum/go-ethereum/common/math" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/store/models" diff --git a/core/chains/evm/assets/assets.go b/core/chains/evm/assets/assets.go new file mode 100644 index 00000000000..c6c81b5ab48 --- /dev/null +++ b/core/chains/evm/assets/assets.go @@ -0,0 +1,117 @@ +package assets + +import ( + "database/sql/driver" + "fmt" + "math/big" + + "github.com/smartcontractkit/chainlink-relay/pkg/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/utils/bytes" + "github.com/smartcontractkit/chainlink/v2/core/utils" + + "github.com/shopspring/decimal" +) + +// Eth contains a field to represent the smallest units of ETH +type Eth big.Int + +// NewEth returns a new struct to represent ETH from it's smallest unit (wei) +func NewEth(w int64) *Eth { + return (*Eth)(big.NewInt(w)) +} + +// NewEthValue returns a new struct to represent ETH from it's smallest unit (wei) +func NewEthValue(w int64) Eth { + eth := NewEth(w) + return *eth +} + +// NewEthValueS returns a new struct to represent ETH from a string value of Eth (not wei) +// the underlying value is still wei +func NewEthValueS(s string) (Eth, error) { + e, err := decimal.NewFromString(s) + if err != nil { + return Eth{}, err + } + w := e.Mul(decimal.RequireFromString("10").Pow(decimal.RequireFromString("18"))) + return *(*Eth)(w.BigInt()), nil +} + +// Cmp delegates to *big.Int.Cmp +func (e *Eth) Cmp(y *Eth) int { + return e.ToInt().Cmp(y.ToInt()) +} + +func (e *Eth) String() string { + if e == nil { + return "" + } + return assets.Format(e.ToInt(), 18) +} + +// SetInt64 delegates to *big.Int.SetInt64 +func (e *Eth) SetInt64(w int64) *Eth { + return (*Eth)(e.ToInt().SetInt64(w)) +} + +// SetString delegates to *big.Int.SetString +func (e *Eth) SetString(s string, base int) (*Eth, bool) { + w, ok := e.ToInt().SetString(s, base) + return (*Eth)(w), ok +} + +// MarshalJSON implements the json.Marshaler interface. +func (e Eth) MarshalJSON() ([]byte, error) { + value, err := e.MarshalText() + if err != nil { + return nil, err + } + return []byte(fmt.Sprintf(`"%s"`, value)), nil +} + +// MarshalText implements the encoding.TextMarshaler interface. +func (e *Eth) MarshalText() ([]byte, error) { + return e.ToInt().MarshalText() +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (e *Eth) UnmarshalJSON(data []byte) error { + if bytes.HasQuotes(data) { + return e.UnmarshalText(bytes.TrimQuotes(data)) + } + return assets.ErrNoQuotesForCurrency +} + +// UnmarshalText implements the encoding.TextUnmarshaler interface. +func (e *Eth) UnmarshalText(text []byte) error { + if _, ok := e.SetString(string(text), 10); !ok { + return fmt.Errorf("assets: cannot unmarshal %q into a *assets.Eth", text) + } + return nil +} + +// IsZero returns true when the value is 0 and false otherwise +func (e *Eth) IsZero() bool { + zero := big.NewInt(0) + return e.ToInt().Cmp(zero) == 0 +} + +// Symbol returns ETH +func (*Eth) Symbol() string { + return "ETH" +} + +// ToInt returns the Eth value as a *big.Int. +func (e *Eth) ToInt() *big.Int { + return (*big.Int)(e) +} + +// Scan reads the database value and returns an instance. +func (e *Eth) Scan(value interface{}) error { + return (*utils.Big)(e).Scan(value) +} + +// Value returns the Eth value for serialization to database. +func (e Eth) Value() (driver.Value, error) { + return (utils.Big)(e).Value() +} diff --git a/core/chains/evm/assets/assets_test.go b/core/chains/evm/assets/assets_test.go new file mode 100644 index 00000000000..9496554f116 --- /dev/null +++ b/core/chains/evm/assets/assets_test.go @@ -0,0 +1,116 @@ +package assets_test + +import ( + "encoding/json" + "testing" + + "github.com/stretchr/testify/assert" + + relayassets "github.com/smartcontractkit/chainlink-relay/pkg/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" +) + +func TestAssets_NewEthAndString(t *testing.T) { + t.Parallel() + + eth := assets.NewEth(0) + + assert.Equal(t, "0.000000000000000000", eth.String()) + + eth.SetInt64(1) + assert.Equal(t, "0.000000000000000001", eth.String()) + + eth.SetString("900000000000000000", 10) + assert.Equal(t, "0.900000000000000000", eth.String()) + + eth.SetString("115792089237316195423570985008687907853269984665640564039457584007913129639935", 10) + assert.Equal(t, "115792089237316195423570985008687907853269984665640564039457.584007913129639935", eth.String()) + + eth.SetString("115792089237316195423570985008687907853269984665640564039457584007913129639936", 10) + assert.Equal(t, "115792089237316195423570985008687907853269984665640564039457.584007913129639936", eth.String()) +} + +func TestAssets_Eth_IsZero(t *testing.T) { + t.Parallel() + + zeroEth := assets.NewEth(0) + assert.True(t, zeroEth.IsZero()) + + oneLink := assets.NewEth(1) + assert.False(t, oneLink.IsZero()) +} + +func TestAssets_Eth_MarshalJson(t *testing.T) { + t.Parallel() + + eth := assets.NewEth(1) + + b, err := json.Marshal(eth) + assert.NoError(t, err) + assert.Equal(t, []byte(`"1"`), b) +} + +func TestAssets_Eth_UnmarshalJsonOk(t *testing.T) { + t.Parallel() + + eth := assets.Eth{} + + err := json.Unmarshal([]byte(`"1"`), ð) + assert.NoError(t, err) + assert.Equal(t, "0.000000000000000001", eth.String()) +} + +func TestAssets_Eth_UnmarshalJsonError(t *testing.T) { + t.Parallel() + + eth := assets.Eth{} + + err := json.Unmarshal([]byte(`"x"`), ð) + assert.EqualError(t, err, "assets: cannot unmarshal \"x\" into a *assets.Eth") + + err = json.Unmarshal([]byte(`1`), ð) + assert.Equal(t, relayassets.ErrNoQuotesForCurrency, err) +} + +func TestAssets_NewEth(t *testing.T) { + t.Parallel() + + ethRef := assets.NewEth(123) + ethVal := assets.NewEthValue(123) + ethStr, err := assets.NewEthValueS(ethRef.String()) + assert.NoError(t, err) + assert.Equal(t, *ethRef, ethVal) + assert.Equal(t, *ethRef, ethStr) +} + +func TestAssets_EthSymbol(t *testing.T) { + t.Parallel() + + eth := assets.NewEth(123) + assert.Equal(t, "ETH", eth.Symbol()) +} + +func TestAssets_EthScanValue(t *testing.T) { + t.Parallel() + + eth := assets.NewEth(123) + v, err := eth.Value() + assert.NoError(t, err) + + eth2 := assets.NewEth(0) + err = eth2.Scan(v) + assert.NoError(t, err) + + assert.Equal(t, eth, eth2) +} + +func TestAssets_EthCmpEth(t *testing.T) { + t.Parallel() + + eth1 := assets.NewEth(123) + eth2 := assets.NewEth(321) + assert.NotZero(t, eth1.Cmp(eth2)) + + eth3 := assets.NewEth(321) + assert.Zero(t, eth3.Cmp(eth2)) +} diff --git a/core/assets/units.go b/core/chains/evm/assets/units.go similarity index 100% rename from core/assets/units.go rename to core/chains/evm/assets/units.go diff --git a/core/assets/units_test.go b/core/chains/evm/assets/units_test.go similarity index 93% rename from core/assets/units_test.go rename to core/chains/evm/assets/units_test.go index 7b23072033d..37eb1393257 100644 --- a/core/assets/units_test.go +++ b/core/chains/evm/assets/units_test.go @@ -7,7 +7,7 @@ import ( "github.com/ethereum/go-ethereum/params" "github.com/stretchr/testify/assert" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" ) func TestAssets_Units(t *testing.T) { diff --git a/core/assets/wei.go b/core/chains/evm/assets/wei.go similarity index 100% rename from core/assets/wei.go rename to core/chains/evm/assets/wei.go diff --git a/core/assets/wei_test.go b/core/chains/evm/assets/wei_test.go similarity index 100% rename from core/assets/wei_test.go rename to core/chains/evm/assets/wei_test.go diff --git a/core/chains/evm/chain.go b/core/chains/evm/chain.go index b5896393d3c..f21bf2525a0 100644 --- a/core/chains/evm/chain.go +++ b/core/chains/evm/chain.go @@ -17,6 +17,7 @@ import ( "github.com/smartcontractkit/chainlink-relay/pkg/services" "github.com/smartcontractkit/chainlink-relay/pkg/types" + commonconfig "github.com/smartcontractkit/chainlink/v2/common/config" "github.com/smartcontractkit/chainlink/v2/core/chains" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" @@ -473,7 +474,7 @@ func (c *chain) Logger() logger.Logger { return c.logger } func (c *chain) BalanceMonitor() monitor.BalanceMonitor { return c.balanceMonitor } func (c *chain) GasEstimator() gas.EvmFeeEstimator { return c.gasEstimator } -func newEthClientFromChain(cfg evmconfig.NodePool, noNewHeadsThreshold time.Duration, lggr logger.Logger, chainID *big.Int, chainType config.ChainType, nodes []*toml.Node) (evmclient.Client, error) { +func newEthClientFromChain(cfg evmconfig.NodePool, noNewHeadsThreshold time.Duration, lggr logger.Logger, chainID *big.Int, chainType commonconfig.ChainType, nodes []*toml.Node) (evmclient.Client, error) { var primaries []evmclient.Node var sendonlys []evmclient.SendOnlyNode for i, node := range nodes { diff --git a/core/chains/evm/client/chain_client.go b/core/chains/evm/client/chain_client.go index 4c5108745c5..79a91dfc057 100644 --- a/core/chains/evm/client/chain_client.go +++ b/core/chains/evm/client/chain_client.go @@ -10,10 +10,11 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/rpc" + relayassets "github.com/smartcontractkit/chainlink-relay/pkg/assets" commonclient "github.com/smartcontractkit/chainlink/v2/common/client" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/common/config" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" - "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/logger" ) @@ -182,7 +183,7 @@ func (c *chainClient) IsL2() bool { return c.multiNode.IsL2() } -func (c *chainClient) LINKBalance(ctx context.Context, address common.Address, linkAddress common.Address) (*assets.Link, error) { +func (c *chainClient) LINKBalance(ctx context.Context, address common.Address, linkAddress common.Address) (*relayassets.Link, error) { return c.multiNode.LINKBalance(ctx, address, linkAddress) } diff --git a/core/chains/evm/client/client.go b/core/chains/evm/client/client.go index fb8a39f3798..988a7404c9b 100644 --- a/core/chains/evm/client/client.go +++ b/core/chains/evm/client/client.go @@ -6,11 +6,11 @@ import ( "strings" "time" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" commonclient "github.com/smartcontractkit/chainlink/v2/common/client" + "github.com/smartcontractkit/chainlink/v2/common/config" htrktypes "github.com/smartcontractkit/chainlink/v2/common/headtracker/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" - "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/utils" diff --git a/core/chains/evm/client/helpers_test.go b/core/chains/evm/client/helpers_test.go index 2820ba992c3..b1d477b1a29 100644 --- a/core/chains/evm/client/helpers_test.go +++ b/core/chains/evm/client/helpers_test.go @@ -10,9 +10,9 @@ import ( "github.com/pkg/errors" commonclient "github.com/smartcontractkit/chainlink/v2/common/client" + commonconfig "github.com/smartcontractkit/chainlink/v2/common/config" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" - commonconfig "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/utils" ) diff --git a/core/chains/evm/client/mocks/client.go b/core/chains/evm/client/mocks/client.go index 7617a7c05f9..f1ff5fab456 100644 --- a/core/chains/evm/client/mocks/client.go +++ b/core/chains/evm/client/mocks/client.go @@ -5,7 +5,7 @@ package mocks import ( big "math/big" - assets "github.com/smartcontractkit/chainlink/v2/core/assets" + assets "github.com/smartcontractkit/chainlink-relay/pkg/assets" common "github.com/ethereum/go-ethereum/common" diff --git a/core/chains/evm/client/null_client.go b/core/chains/evm/client/null_client.go index 286f62b3b8b..45876d9259c 100644 --- a/core/chains/evm/client/null_client.go +++ b/core/chains/evm/client/null_client.go @@ -9,8 +9,8 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/rpc" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" commonclient "github.com/smartcontractkit/chainlink/v2/common/client" - "github.com/smartcontractkit/chainlink/v2/core/assets" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/logger" ) diff --git a/core/chains/evm/client/pool.go b/core/chains/evm/client/pool.go index 2d679ab3d73..473ab6d1eb0 100644 --- a/core/chains/evm/client/pool.go +++ b/core/chains/evm/client/pool.go @@ -17,8 +17,8 @@ import ( "github.com/smartcontractkit/chainlink-relay/pkg/services" + "github.com/smartcontractkit/chainlink/v2/common/config" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" - "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/utils" ) diff --git a/core/chains/evm/client/rpc_client.go b/core/chains/evm/client/rpc_client.go index 04b9fad1fcd..f952c04d5bb 100644 --- a/core/chains/evm/client/rpc_client.go +++ b/core/chains/evm/client/rpc_client.go @@ -17,9 +17,10 @@ import ( "github.com/google/uuid" "github.com/pkg/errors" + relayassets "github.com/smartcontractkit/chainlink-relay/pkg/assets" commonclient "github.com/smartcontractkit/chainlink/v2/common/client" commontypes "github.com/smartcontractkit/chainlink/v2/common/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/utils" @@ -868,12 +869,12 @@ func (r *rpcClient) TokenBalance(ctx context.Context, address common.Address, co } // LINKBalance returns the balance of LINK at the given address -func (r *rpcClient) LINKBalance(ctx context.Context, address common.Address, linkAddress common.Address) (*assets.Link, error) { +func (r *rpcClient) LINKBalance(ctx context.Context, address common.Address, linkAddress common.Address) (*relayassets.Link, error) { balance, err := r.TokenBalance(ctx, address, linkAddress) if err != nil { - return assets.NewLinkFromJuels(0), err + return relayassets.NewLinkFromJuels(0), err } - return (*assets.Link)(balance), nil + return (*relayassets.Link)(balance), nil } func (r *rpcClient) FilterEvents(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error) { diff --git a/core/chains/evm/client/send_only_node_test.go b/core/chains/evm/client/send_only_node_test.go index b37ee142533..876ae9bc4da 100644 --- a/core/chains/evm/client/send_only_node_test.go +++ b/core/chains/evm/client/send_only_node_test.go @@ -19,7 +19,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client/mocks" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/logger" diff --git a/core/chains/evm/client/simulated_backend_client.go b/core/chains/evm/client/simulated_backend_client.go index f4ad6a65a1a..33ecc3d0d5f 100644 --- a/core/chains/evm/client/simulated_backend_client.go +++ b/core/chains/evm/client/simulated_backend_client.go @@ -18,8 +18,8 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/rpc" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" commonclient "github.com/smartcontractkit/chainlink/v2/common/client" - "github.com/smartcontractkit/chainlink/v2/core/assets" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/utils" diff --git a/core/chains/evm/config/chain_scoped.go b/core/chains/evm/config/chain_scoped.go index 7971a18d4db..6030991179b 100644 --- a/core/chains/evm/config/chain_scoped.go +++ b/core/chains/evm/config/chain_scoped.go @@ -9,13 +9,14 @@ import ( ocr "github.com/smartcontractkit/libocr/offchainreporting" ocrtypes "github.com/smartcontractkit/libocr/offchainreporting/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" + commonconfig "github.com/smartcontractkit/chainlink/v2/common/config" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" - gencfg "github.com/smartcontractkit/chainlink/v2/core/config" + "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/logger" ) -func NewTOMLChainScopedConfig(appCfg gencfg.AppConfig, tomlConfig *toml.EVMConfig, lggr logger.Logger) *ChainScoped { +func NewTOMLChainScopedConfig(appCfg config.AppConfig, tomlConfig *toml.EVMConfig, lggr logger.Logger) *ChainScoped { return &ChainScoped{ AppConfig: appCfg, evmConfig: &evmConfig{c: tomlConfig}, @@ -24,7 +25,7 @@ func NewTOMLChainScopedConfig(appCfg gencfg.AppConfig, tomlConfig *toml.EVMConfi // ChainScoped implements config.ChainScopedConfig with a gencfg.BasicConfig and EVMConfig. type ChainScoped struct { - gencfg.AppConfig + config.AppConfig lggr logger.Logger evmConfig *evmConfig @@ -140,11 +141,11 @@ func (e *evmConfig) BlockEmissionIdleWarningThreshold() time.Duration { return e.c.NoNewHeadsThreshold.Duration() } -func (e *evmConfig) ChainType() gencfg.ChainType { +func (e *evmConfig) ChainType() commonconfig.ChainType { if e.c.ChainType == nil { return "" } - return gencfg.ChainType(*e.c.ChainType) + return commonconfig.ChainType(*e.c.ChainType) } func (e *evmConfig) ChainID() *big.Int { diff --git a/core/chains/evm/config/chain_scoped_gas_estimator.go b/core/chains/evm/config/chain_scoped_gas_estimator.go index cc28ce75f03..0c52cf0a468 100644 --- a/core/chains/evm/config/chain_scoped_gas_estimator.go +++ b/core/chains/evm/config/chain_scoped_gas_estimator.go @@ -3,7 +3,7 @@ package config import ( gethcommon "github.com/ethereum/go-ethereum/common" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" ) diff --git a/core/chains/evm/config/config.go b/core/chains/evm/config/config.go index f8ec030969e..ec90797d7fa 100644 --- a/core/chains/evm/config/config.go +++ b/core/chains/evm/config/config.go @@ -6,7 +6,9 @@ import ( gethcommon "github.com/ethereum/go-ethereum/common" - "github.com/smartcontractkit/chainlink/v2/core/assets" + relayassets "github.com/smartcontractkit/chainlink-relay/pkg/assets" + commonconfig "github.com/smartcontractkit/chainlink/v2/common/config" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/config" ) @@ -24,7 +26,7 @@ type EVM interface { BlockBackfillSkip() bool BlockEmissionIdleWarningThreshold() time.Duration ChainID() *big.Int - ChainType() config.ChainType + ChainType() commonconfig.ChainType FinalityDepth() uint32 FinalityTagEnabled() bool FlagsContractAddress() string @@ -32,7 +34,7 @@ type EVM interface { LogBackfillBatchSize() uint32 LogKeepBlocksDepth() uint32 LogPollInterval() time.Duration - MinContractPayment() *assets.Link + MinContractPayment() *relayassets.Link MinIncomingConfirmations() uint32 NonceAutoSync() bool OperatorFactoryAddress() string diff --git a/core/chains/evm/config/config_test.go b/core/chains/evm/config/config_test.go index 0a3fc5f41e6..d34d1eae63e 100644 --- a/core/chains/evm/config/config_test.go +++ b/core/chains/evm/config/config_test.go @@ -11,7 +11,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + commonconfig "github.com/smartcontractkit/chainlink/v2/common/config" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" @@ -402,7 +403,7 @@ func Test_chainScopedConfig_Validate(t *testing.T) { t.Run("arbitrum-estimator", func(t *testing.T) { t.Run("custom", func(t *testing.T) { cfg := configWithChains(t, 0, &toml.Chain{ - ChainType: ptr(string(config.ChainArbitrum)), + ChainType: ptr(string(commonconfig.ChainArbitrum)), GasEstimator: toml.GasEstimator{ Mode: ptr("BlockHistory"), }, @@ -433,7 +434,7 @@ func Test_chainScopedConfig_Validate(t *testing.T) { t.Run("optimism-estimator", func(t *testing.T) { t.Run("custom", func(t *testing.T) { cfg := configWithChains(t, 0, &toml.Chain{ - ChainType: ptr(string(config.ChainOptimismBedrock)), + ChainType: ptr(string(commonconfig.ChainOptimismBedrock)), GasEstimator: toml.GasEstimator{ Mode: ptr("BlockHistory"), }, diff --git a/core/chains/evm/config/mocks/gas_estimator.go b/core/chains/evm/config/mocks/gas_estimator.go index 8cb54132f58..6260b3cd501 100644 --- a/core/chains/evm/config/mocks/gas_estimator.go +++ b/core/chains/evm/config/mocks/gas_estimator.go @@ -4,7 +4,7 @@ package mocks import ( common "github.com/ethereum/go-ethereum/common" - assets "github.com/smartcontractkit/chainlink/v2/core/assets" + assets "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" config "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" diff --git a/core/chains/evm/config/toml/config.go b/core/chains/evm/config/toml/config.go index cf2cde460e5..ae0fb41c5ea 100644 --- a/core/chains/evm/config/toml/config.go +++ b/core/chains/evm/config/toml/config.go @@ -12,12 +12,13 @@ import ( "go.uber.org/multierr" "gopkg.in/guregu/null.v4" + relayassets "github.com/smartcontractkit/chainlink-relay/pkg/assets" relaytypes "github.com/smartcontractkit/chainlink-relay/pkg/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/common/config" "github.com/smartcontractkit/chainlink/v2/core/chains" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" - "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/relay" "github.com/smartcontractkit/chainlink/v2/core/store/models" @@ -354,7 +355,7 @@ type Chain struct { LogPollInterval *models.Duration LogKeepBlocksDepth *uint32 MinIncomingConfirmations *uint32 - MinContractPayment *assets.Link + MinContractPayment *relayassets.Link NonceAutoSync *bool NoNewHeadsThreshold *models.Duration OperatorFactoryAddress *ethkey.EIP55Address diff --git a/core/chains/evm/config/toml/defaults.go b/core/chains/evm/config/toml/defaults.go index 68513383585..d362e9ac3dc 100644 --- a/core/chains/evm/config/toml/defaults.go +++ b/core/chains/evm/config/toml/defaults.go @@ -8,7 +8,7 @@ import ( "slices" "strings" - "github.com/smartcontractkit/chainlink/v2/core/config" + "github.com/smartcontractkit/chainlink/v2/common/config" "github.com/smartcontractkit/chainlink/v2/core/utils" configutils "github.com/smartcontractkit/chainlink/v2/core/utils/config" ) diff --git a/core/chains/evm/gas/arbitrum_estimator.go b/core/chains/evm/gas/arbitrum_estimator.go index 78d93243bbe..860126a5888 100644 --- a/core/chains/evm/gas/arbitrum_estimator.go +++ b/core/chains/evm/gas/arbitrum_estimator.go @@ -16,7 +16,7 @@ import ( "github.com/smartcontractkit/chainlink-relay/pkg/services" feetypes "github.com/smartcontractkit/chainlink/v2/common/fee/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/utils" diff --git a/core/chains/evm/gas/arbitrum_estimator_test.go b/core/chains/evm/gas/arbitrum_estimator_test.go index a226368edf2..894b531dc97 100644 --- a/core/chains/evm/gas/arbitrum_estimator_test.go +++ b/core/chains/evm/gas/arbitrum_estimator_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas/mocks" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" diff --git a/core/chains/evm/gas/block_history_estimator.go b/core/chains/evm/gas/block_history_estimator.go index 80ae19f109f..eb35cd27511 100644 --- a/core/chains/evm/gas/block_history_estimator.go +++ b/core/chains/evm/gas/block_history_estimator.go @@ -16,12 +16,12 @@ import ( "github.com/prometheus/client_golang/prometheus/promauto" "github.com/smartcontractkit/chainlink-relay/pkg/services" + "github.com/smartcontractkit/chainlink/v2/common/config" commonfee "github.com/smartcontractkit/chainlink/v2/common/fee" feetypes "github.com/smartcontractkit/chainlink/v2/common/fee/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" - "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/utils" "github.com/smartcontractkit/chainlink/v2/core/utils/mathutil" diff --git a/core/chains/evm/gas/block_history_estimator_test.go b/core/chains/evm/gas/block_history_estimator_test.go index c8b193c4435..2747ea067d6 100644 --- a/core/chains/evm/gas/block_history_estimator_test.go +++ b/core/chains/evm/gas/block_history_estimator_test.go @@ -18,12 +18,12 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/zap/zapcore" + "github.com/smartcontractkit/chainlink/v2/common/config" commonfee "github.com/smartcontractkit/chainlink/v2/common/fee" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" - "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest" diff --git a/core/chains/evm/gas/chain_specific.go b/core/chains/evm/gas/chain_specific.go index 4f0d2e6b2f8..c989cd0aa98 100644 --- a/core/chains/evm/gas/chain_specific.go +++ b/core/chains/evm/gas/chain_specific.go @@ -1,9 +1,9 @@ package gas import ( - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/common/config" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" - "github.com/smartcontractkit/chainlink/v2/core/config" ) // chainSpecificIsUsable allows for additional logic specific to a particular diff --git a/core/chains/evm/gas/cmd/arbgas/main.go b/core/chains/evm/gas/cmd/arbgas/main.go index 4ceeb0009e7..6b79ff2f130 100644 --- a/core/chains/evm/gas/cmd/arbgas/main.go +++ b/core/chains/evm/gas/cmd/arbgas/main.go @@ -12,7 +12,7 @@ import ( "go.uber.org/zap/zapcore" feetypes "github.com/smartcontractkit/chainlink/v2/common/fee/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" "github.com/smartcontractkit/chainlink/v2/core/logger" ) diff --git a/core/chains/evm/gas/fixed_price_estimator.go b/core/chains/evm/gas/fixed_price_estimator.go index a45df741a27..7eb7454dad9 100644 --- a/core/chains/evm/gas/fixed_price_estimator.go +++ b/core/chains/evm/gas/fixed_price_estimator.go @@ -7,7 +7,7 @@ import ( commonfee "github.com/smartcontractkit/chainlink/v2/common/fee" feetypes "github.com/smartcontractkit/chainlink/v2/common/fee/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/logger" ) diff --git a/core/chains/evm/gas/fixed_price_estimator_test.go b/core/chains/evm/gas/fixed_price_estimator_test.go index a6cb313e5e2..9fa0997c103 100644 --- a/core/chains/evm/gas/fixed_price_estimator_test.go +++ b/core/chains/evm/gas/fixed_price_estimator_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/logger" diff --git a/core/chains/evm/gas/gas_test.go b/core/chains/evm/gas/gas_test.go index 4c6be2cf504..a3f7224a094 100644 --- a/core/chains/evm/gas/gas_test.go +++ b/core/chains/evm/gas/gas_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" "github.com/smartcontractkit/chainlink/v2/core/logger" ) diff --git a/core/chains/evm/gas/helpers_test.go b/core/chains/evm/gas/helpers_test.go index ac1f5129e09..9a5076be6d6 100644 --- a/core/chains/evm/gas/helpers_test.go +++ b/core/chains/evm/gas/helpers_test.go @@ -6,9 +6,9 @@ import ( "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/common/config" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" - "github.com/smartcontractkit/chainlink/v2/core/config" ) func init() { diff --git a/core/chains/evm/gas/mocks/config.go b/core/chains/evm/gas/mocks/config.go index eabbd0f03e4..c09005b5e3d 100644 --- a/core/chains/evm/gas/mocks/config.go +++ b/core/chains/evm/gas/mocks/config.go @@ -3,7 +3,7 @@ package mocks import ( - config "github.com/smartcontractkit/chainlink/v2/core/config" + config "github.com/smartcontractkit/chainlink/v2/common/config" mock "github.com/stretchr/testify/mock" ) diff --git a/core/chains/evm/gas/mocks/evm_estimator.go b/core/chains/evm/gas/mocks/evm_estimator.go index 80ab3c68cc0..f2cb51f8560 100644 --- a/core/chains/evm/gas/mocks/evm_estimator.go +++ b/core/chains/evm/gas/mocks/evm_estimator.go @@ -5,7 +5,7 @@ package mocks import ( context "context" - assets "github.com/smartcontractkit/chainlink/v2/core/assets" + assets "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" diff --git a/core/chains/evm/gas/mocks/evm_fee_estimator.go b/core/chains/evm/gas/mocks/evm_fee_estimator.go index 42ea96cd50b..b9b16367796 100644 --- a/core/chains/evm/gas/mocks/evm_fee_estimator.go +++ b/core/chains/evm/gas/mocks/evm_fee_estimator.go @@ -5,7 +5,7 @@ package mocks import ( big "math/big" - assets "github.com/smartcontractkit/chainlink/v2/core/assets" + assets "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" context "context" diff --git a/core/chains/evm/gas/models.go b/core/chains/evm/gas/models.go index 299d7d54734..50cbddcd9bc 100644 --- a/core/chains/evm/gas/models.go +++ b/core/chains/evm/gas/models.go @@ -11,16 +11,16 @@ import ( "github.com/smartcontractkit/chainlink-relay/pkg/services" + "github.com/smartcontractkit/chainlink/v2/common/config" commonfee "github.com/smartcontractkit/chainlink/v2/common/fee" feetypes "github.com/smartcontractkit/chainlink/v2/common/fee/types" commontypes "github.com/smartcontractkit/chainlink/v2/common/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" evmconfig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas/rollups" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/label" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" - "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/logger" bigmath "github.com/smartcontractkit/chainlink/v2/core/utils/big_math" ) diff --git a/core/chains/evm/gas/models_test.go b/core/chains/evm/gas/models_test.go index c1dd9e44ffc..8ac94a2269c 100644 --- a/core/chains/evm/gas/models_test.go +++ b/core/chains/evm/gas/models_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas/mocks" rollupMocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas/rollups/mocks" diff --git a/core/chains/evm/gas/rollups/l1_gas_price_oracle.go b/core/chains/evm/gas/rollups/l1_gas_price_oracle.go index d990017bd0f..09244e9d319 100644 --- a/core/chains/evm/gas/rollups/l1_gas_price_oracle.go +++ b/core/chains/evm/gas/rollups/l1_gas_price_oracle.go @@ -13,9 +13,9 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/smartcontractkit/chainlink-relay/pkg/services" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/common/config" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" - "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/utils" ) diff --git a/core/chains/evm/gas/rollups/l1_gas_price_oracle_test.go b/core/chains/evm/gas/rollups/l1_gas_price_oracle_test.go index 320c9cb71da..801d72919e7 100644 --- a/core/chains/evm/gas/rollups/l1_gas_price_oracle_test.go +++ b/core/chains/evm/gas/rollups/l1_gas_price_oracle_test.go @@ -13,8 +13,8 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas/rollups/mocks" - "github.com/smartcontractkit/chainlink/v2/core/assets" - "github.com/smartcontractkit/chainlink/v2/core/config" + "github.com/smartcontractkit/chainlink/v2/common/config" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/logger" ) diff --git a/core/chains/evm/gas/rollups/mocks/l1_oracle.go b/core/chains/evm/gas/rollups/mocks/l1_oracle.go index 31407300b64..f6f8cc736af 100644 --- a/core/chains/evm/gas/rollups/mocks/l1_oracle.go +++ b/core/chains/evm/gas/rollups/mocks/l1_oracle.go @@ -5,7 +5,7 @@ package mocks import ( context "context" - assets "github.com/smartcontractkit/chainlink/v2/core/assets" + assets "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" mock "github.com/stretchr/testify/mock" ) diff --git a/core/chains/evm/gas/rollups/models.go b/core/chains/evm/gas/rollups/models.go index 83ae29f4ea9..1659436071b 100644 --- a/core/chains/evm/gas/rollups/models.go +++ b/core/chains/evm/gas/rollups/models.go @@ -3,7 +3,7 @@ package rollups import ( "context" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/services" ) diff --git a/core/chains/evm/gas/suggested_price_estimator.go b/core/chains/evm/gas/suggested_price_estimator.go index a4ffb80997e..24cf20f172e 100644 --- a/core/chains/evm/gas/suggested_price_estimator.go +++ b/core/chains/evm/gas/suggested_price_estimator.go @@ -11,7 +11,7 @@ import ( "github.com/smartcontractkit/chainlink-relay/pkg/services" feetypes "github.com/smartcontractkit/chainlink/v2/common/fee/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/logger" diff --git a/core/chains/evm/gas/suggested_price_estimator_test.go b/core/chains/evm/gas/suggested_price_estimator_test.go index 808b28a3a6b..3b6b8184e3e 100644 --- a/core/chains/evm/gas/suggested_price_estimator_test.go +++ b/core/chains/evm/gas/suggested_price_estimator_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas/mocks" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" diff --git a/core/chains/evm/mocks/balance_monitor.go b/core/chains/evm/mocks/balance_monitor.go index 2a5e66bbc02..cdda18b7f03 100644 --- a/core/chains/evm/mocks/balance_monitor.go +++ b/core/chains/evm/mocks/balance_monitor.go @@ -4,7 +4,7 @@ package mocks import ( common "github.com/ethereum/go-ethereum/common" - assets "github.com/smartcontractkit/chainlink/v2/core/assets" + assets "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" context "context" diff --git a/core/chains/evm/monitor/balance.go b/core/chains/evm/monitor/balance.go index 5f5b8a243b0..476d3c7019d 100644 --- a/core/chains/evm/monitor/balance.go +++ b/core/chains/evm/monitor/balance.go @@ -15,7 +15,7 @@ import ( "github.com/smartcontractkit/chainlink-relay/pkg/services" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" httypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/headtracker/types" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" diff --git a/core/chains/evm/monitor/balance_test.go b/core/chains/evm/monitor/balance_test.go index c80d64e7ef7..6a62549e493 100644 --- a/core/chains/evm/monitor/balance_test.go +++ b/core/chains/evm/monitor/balance_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmclimocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client/mocks" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/monitor" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" diff --git a/core/chains/evm/txmgr/attempts.go b/core/chains/evm/txmgr/attempts.go index 7b2a05a34c4..06c1126b869 100644 --- a/core/chains/evm/txmgr/attempts.go +++ b/core/chains/evm/txmgr/attempts.go @@ -12,7 +12,7 @@ import ( feetypes "github.com/smartcontractkit/chainlink/v2/common/fee/types" txmgrtypes "github.com/smartcontractkit/chainlink/v2/common/txmgr/types" commontypes "github.com/smartcontractkit/chainlink/v2/common/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/logger" diff --git a/core/chains/evm/txmgr/attempts_test.go b/core/chains/evm/txmgr/attempts_test.go index 863eae47236..11304384ab8 100644 --- a/core/chains/evm/txmgr/attempts_test.go +++ b/core/chains/evm/txmgr/attempts_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" gasmocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas/mocks" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" diff --git a/core/chains/evm/txmgr/broadcaster_test.go b/core/chains/evm/txmgr/broadcaster_test.go index 460f9629fb8..48b68f9b55c 100644 --- a/core/chains/evm/txmgr/broadcaster_test.go +++ b/core/chains/evm/txmgr/broadcaster_test.go @@ -25,7 +25,7 @@ import ( commonclient "github.com/smartcontractkit/chainlink/v2/common/client" txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr" txmgrtypes "github.com/smartcontractkit/chainlink/v2/common/txmgr/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" evmconfig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" diff --git a/core/chains/evm/txmgr/config.go b/core/chains/evm/txmgr/config.go index 0e6b46574ae..8346a0d0551 100644 --- a/core/chains/evm/txmgr/config.go +++ b/core/chains/evm/txmgr/config.go @@ -5,9 +5,9 @@ import ( gethcommon "github.com/ethereum/go-ethereum/common" + "github.com/smartcontractkit/chainlink/v2/common/config" txmgrtypes "github.com/smartcontractkit/chainlink/v2/common/txmgr/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" - coreconfig "github.com/smartcontractkit/chainlink/v2/core/config" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" ) // ChainConfig encompasses config used by txmgr package @@ -15,7 +15,7 @@ import ( // //go:generate mockery --quiet --recursive --name ChainConfig --output ./mocks/ --case=underscore --structname Config --filename config.go type ChainConfig interface { - ChainType() coreconfig.ChainType + ChainType() config.ChainType FinalityDepth() uint32 FinalityTagEnabled() bool NonceAutoSync() bool diff --git a/core/chains/evm/txmgr/confirmer_test.go b/core/chains/evm/txmgr/confirmer_test.go index 3a0d33f7ba0..31464f8f521 100644 --- a/core/chains/evm/txmgr/confirmer_test.go +++ b/core/chains/evm/txmgr/confirmer_test.go @@ -24,7 +24,7 @@ import ( commonfee "github.com/smartcontractkit/chainlink/v2/common/fee" txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr" txmgrtypes "github.com/smartcontractkit/chainlink/v2/common/txmgr/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" evmconfig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" diff --git a/core/chains/evm/txmgr/evm_tx_store.go b/core/chains/evm/txmgr/evm_tx_store.go index c3371fee80b..9262c85a833 100644 --- a/core/chains/evm/txmgr/evm_tx_store.go +++ b/core/chains/evm/txmgr/evm_tx_store.go @@ -20,7 +20,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/common/txmgr" txmgrtypes "github.com/smartcontractkit/chainlink/v2/common/txmgr/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/label" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" diff --git a/core/chains/evm/txmgr/evm_tx_store_test.go b/core/chains/evm/txmgr/evm_tx_store_test.go index f8798f9f836..73bfc6fc85a 100644 --- a/core/chains/evm/txmgr/evm_tx_store_test.go +++ b/core/chains/evm/txmgr/evm_tx_store_test.go @@ -9,7 +9,7 @@ import ( txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr" txmgrtypes "github.com/smartcontractkit/chainlink/v2/common/txmgr/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" diff --git a/core/chains/evm/txmgr/mocks/config.go b/core/chains/evm/txmgr/mocks/config.go index d6f961ccb50..ab98d686c85 100644 --- a/core/chains/evm/txmgr/mocks/config.go +++ b/core/chains/evm/txmgr/mocks/config.go @@ -3,7 +3,7 @@ package mocks import ( - config "github.com/smartcontractkit/chainlink/v2/core/config" + config "github.com/smartcontractkit/chainlink/v2/common/config" mock "github.com/stretchr/testify/mock" ) diff --git a/core/chains/evm/txmgr/test_helpers.go b/core/chains/evm/txmgr/test_helpers.go index f9c0423a620..e279dddf5fa 100644 --- a/core/chains/evm/txmgr/test_helpers.go +++ b/core/chains/evm/txmgr/test_helpers.go @@ -6,7 +6,8 @@ import ( "github.com/ethereum/go-ethereum/common" - "github.com/smartcontractkit/chainlink/v2/core/assets" + commonconfig "github.com/smartcontractkit/chainlink/v2/common/config" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/services/pg" @@ -136,12 +137,12 @@ func (c *MockConfig) EVM() evmconfig.EVM { return c.EvmConfig } -func (c *MockConfig) NonceAutoSync() bool { return true } -func (c *MockConfig) ChainType() config.ChainType { return "" } -func (c *MockConfig) FinalityDepth() uint32 { return c.finalityDepth } -func (c *MockConfig) SetFinalityDepth(fd uint32) { c.finalityDepth = fd } -func (c *MockConfig) FinalityTagEnabled() bool { return c.finalityTagEnabled } -func (c *MockConfig) RPCDefaultBatchSize() uint32 { return c.RpcDefaultBatchSize } +func (c *MockConfig) NonceAutoSync() bool { return true } +func (c *MockConfig) ChainType() commonconfig.ChainType { return "" } +func (c *MockConfig) FinalityDepth() uint32 { return c.finalityDepth } +func (c *MockConfig) SetFinalityDepth(fd uint32) { c.finalityDepth = fd } +func (c *MockConfig) FinalityTagEnabled() bool { return c.finalityTagEnabled } +func (c *MockConfig) RPCDefaultBatchSize() uint32 { return c.RpcDefaultBatchSize } func MakeTestConfigs(t *testing.T) (*MockConfig, *TestDatabaseConfig, *TestEvmConfig) { db := &TestDatabaseConfig{defaultQueryTimeout: pg.DefaultQueryTimeout} diff --git a/core/chains/evm/txmgr/transmitchecker_test.go b/core/chains/evm/txmgr/transmitchecker_test.go index 79868e6a641..b43fcb4f459 100644 --- a/core/chains/evm/txmgr/transmitchecker_test.go +++ b/core/chains/evm/txmgr/transmitchecker_test.go @@ -21,7 +21,7 @@ import ( "github.com/stretchr/testify/require" txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" v1 "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/solidity_vrf_coordinator_interface" diff --git a/core/chains/evm/txmgr/txmgr_test.go b/core/chains/evm/txmgr/txmgr_test.go index 4e201b9c6fe..e27cea137b5 100644 --- a/core/chains/evm/txmgr/txmgr_test.go +++ b/core/chains/evm/txmgr/txmgr_test.go @@ -19,7 +19,7 @@ import ( txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr" commontxmmocks "github.com/smartcontractkit/chainlink/v2/common/txmgr/types/mocks" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" evmconfig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/forwarders" diff --git a/core/chains/evm/types/block_json_benchmark_test.go b/core/chains/evm/types/block_json_benchmark_test.go index 8c5f766d632..21c58bd1987 100644 --- a/core/chains/evm/types/block_json_benchmark_test.go +++ b/core/chains/evm/types/block_json_benchmark_test.go @@ -9,7 +9,7 @@ import ( "github.com/ethereum/go-ethereum/common" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" ) diff --git a/core/chains/evm/types/models.go b/core/chains/evm/types/models.go index c2d61e00703..83b90b4d539 100644 --- a/core/chains/evm/types/models.go +++ b/core/chains/evm/types/models.go @@ -18,7 +18,7 @@ import ( htrktypes "github.com/smartcontractkit/chainlink/v2/common/headtracker/types" commontypes "github.com/smartcontractkit/chainlink/v2/common/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types/internal/blocks" "github.com/smartcontractkit/chainlink/v2/core/null" "github.com/smartcontractkit/chainlink/v2/core/utils" diff --git a/core/chains/evm/types/models_test.go b/core/chains/evm/types/models_test.go index 2911e426e86..3507b6a1318 100644 --- a/core/chains/evm/types/models_test.go +++ b/core/chains/evm/types/models_test.go @@ -17,7 +17,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" diff --git a/core/cmd/cosmos_node_commands_test.go b/core/cmd/cosmos_node_commands_test.go index 9ac7dfb2ba0..591160629ec 100644 --- a/core/cmd/cosmos_node_commands_test.go +++ b/core/cmd/cosmos_node_commands_test.go @@ -11,7 +11,7 @@ import ( "github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos/config" coscfg "github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos/config" - "github.com/smartcontractkit/chainlink-relay/pkg/utils" + relaycfg "github.com/smartcontractkit/chainlink-relay/pkg/config" "github.com/smartcontractkit/chainlink/v2/core/cmd" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" @@ -35,7 +35,7 @@ func TestShell_IndexCosmosNodes(t *testing.T) { chainID := cosmostest.RandomChainID() node := config.Node{ Name: ptr("second"), - TendermintURL: utils.MustParseURL("http://tender.mint.test/bombay-12"), + TendermintURL: relaycfg.MustParseURL("http://tender.mint.test/bombay-12"), } chain := config.TOMLConfig{ ChainID: ptr(chainID), diff --git a/core/cmd/eth_keys_commands_test.go b/core/cmd/eth_keys_commands_test.go index 630e76783a2..d74ae231d72 100644 --- a/core/cmd/eth_keys_commands_test.go +++ b/core/cmd/eth_keys_commands_test.go @@ -12,7 +12,8 @@ import ( "github.com/pkg/errors" - "github.com/smartcontractkit/chainlink/v2/core/assets" + relayassets "github.com/smartcontractkit/chainlink-relay/pkg/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/cmd" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" @@ -34,7 +35,7 @@ func TestEthKeysPresenter_RenderTable(t *testing.T) { var ( address = "0x5431F5F973781809D18643b87B44921b11355d81" ethBalance = assets.NewEth(1) - linkBalance = assets.NewLinkFromJuels(2) + linkBalance = relayassets.NewLinkFromJuels(2) isDisabled = true createdAt = time.Now() updatedAt = time.Now().Add(time.Second) @@ -89,7 +90,7 @@ func TestShell_ListETHKeys(t *testing.T) { ethClient := newEthMock(t) ethClient.On("BalanceAt", mock.Anything, mock.Anything, mock.Anything).Return(big.NewInt(42), nil) - ethClient.On("LINKBalance", mock.Anything, mock.Anything, mock.Anything).Return(assets.NewLinkFromJuels(13), nil) + ethClient.On("LINKBalance", mock.Anything, mock.Anything, mock.Anything).Return(relayassets.NewLinkFromJuels(13), nil) ethClient.On("PendingNonceAt", mock.Anything, mock.Anything).Return(uint64(0), nil) app := startNewApplicationV2(t, func(c *chainlink.Config, s *chainlink.Secrets) { c.EVM[0].Enabled = ptr(true) @@ -168,7 +169,7 @@ func TestShell_CreateETHKey(t *testing.T) { ethClient := newEthMock(t) ethClient.On("BalanceAt", mock.Anything, mock.Anything, mock.Anything).Return(big.NewInt(42), nil) - ethClient.On("LINKBalance", mock.Anything, mock.Anything, mock.Anything).Return(assets.NewLinkFromJuels(42), nil) + ethClient.On("LINKBalance", mock.Anything, mock.Anything, mock.Anything).Return(relayassets.NewLinkFromJuels(42), nil) ethClient.On("PendingNonceAt", mock.Anything, mock.Anything).Return(uint64(0), nil) app := startNewApplicationV2(t, func(c *chainlink.Config, s *chainlink.Secrets) { @@ -243,7 +244,7 @@ func TestShell_ImportExportETHKey_NoChains(t *testing.T) { ethClient := newEthMock(t) ethClient.On("BalanceAt", mock.Anything, mock.Anything, mock.Anything).Return(big.NewInt(42), nil) - ethClient.On("LINKBalance", mock.Anything, mock.Anything, mock.Anything).Return(assets.NewLinkFromJuels(42), nil) + ethClient.On("LINKBalance", mock.Anything, mock.Anything, mock.Anything).Return(relayassets.NewLinkFromJuels(42), nil) ethClient.On("PendingNonceAt", mock.Anything, mock.Anything).Return(uint64(0), nil) app := startNewApplicationV2(t, func(c *chainlink.Config, s *chainlink.Secrets) { c.EVM[0].Enabled = ptr(true) @@ -361,7 +362,7 @@ func TestShell_ImportExportETHKey_WithChains(t *testing.T) { ethClient.On("Dial", mock.Anything).Maybe() ethClient.On("BalanceAt", mock.Anything, mock.Anything, mock.Anything).Return(big.NewInt(42), nil) - ethClient.On("LINKBalance", mock.Anything, mock.Anything, mock.Anything).Return(assets.NewLinkFromJuels(42), nil) + ethClient.On("LINKBalance", mock.Anything, mock.Anything, mock.Anything).Return(relayassets.NewLinkFromJuels(42), nil) set := flag.NewFlagSet("test", 0) cltest.FlagSetApplyFromAction(client.RemoteLogin, set, "") diff --git a/core/cmd/evm_transaction_commands.go b/core/cmd/evm_transaction_commands.go index 68fffde303e..d702bc3b799 100644 --- a/core/cmd/evm_transaction_commands.go +++ b/core/cmd/evm_transaction_commands.go @@ -10,7 +10,7 @@ import ( "github.com/urfave/cli" "go.uber.org/multierr" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/store/models" "github.com/smartcontractkit/chainlink/v2/core/utils" "github.com/smartcontractkit/chainlink/v2/core/utils/stringutils" diff --git a/core/cmd/evm_transaction_commands_test.go b/core/cmd/evm_transaction_commands_test.go index 484b1ccd3da..e071d875f03 100644 --- a/core/cmd/evm_transaction_commands_test.go +++ b/core/cmd/evm_transaction_commands_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/require" "github.com/urfave/cli" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/cmd" diff --git a/core/cmd/shell_local.go b/core/cmd/shell_local.go index 70d75f761b5..f7e17ef7fc2 100644 --- a/core/cmd/shell_local.go +++ b/core/cmd/shell_local.go @@ -31,8 +31,8 @@ import ( "github.com/jmoiron/sqlx" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/build" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" diff --git a/core/cmd/solana_node_commands_test.go b/core/cmd/solana_node_commands_test.go index 3f95ebc0d84..7c88557c6de 100644 --- a/core/cmd/solana_node_commands_test.go +++ b/core/cmd/solana_node_commands_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-relay/pkg/utils" + "github.com/smartcontractkit/chainlink-relay/pkg/config" solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config" "github.com/smartcontractkit/chainlink-solana/pkg/solana" @@ -35,11 +35,11 @@ func TestShell_IndexSolanaNodes(t *testing.T) { id := solanatest.RandomChainID() node1 := solcfg.Node{ Name: ptr("first"), - URL: utils.MustParseURL("https://solana1.example"), + URL: config.MustParseURL("https://solana1.example"), } node2 := solcfg.Node{ Name: ptr("second"), - URL: utils.MustParseURL("https://solana2.example"), + URL: config.MustParseURL("https://solana2.example"), } chain := solana.TOMLConfig{ ChainID: &id, diff --git a/core/cmd/starknet_node_commands_test.go b/core/cmd/starknet_node_commands_test.go index e799e5aac07..9d7c6fcaf4c 100644 --- a/core/cmd/starknet_node_commands_test.go +++ b/core/cmd/starknet_node_commands_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-relay/pkg/utils" + relaycfg "github.com/smartcontractkit/chainlink-relay/pkg/config" "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" "github.com/smartcontractkit/chainlink/v2/core/cmd" @@ -34,11 +34,11 @@ func TestShell_IndexStarkNetNodes(t *testing.T) { id := "starknet chain ID" node1 := config.Node{ Name: ptr("first"), - URL: utils.MustParseURL("https://starknet1.example"), + URL: relaycfg.MustParseURL("https://starknet1.example"), } node2 := config.Node{ Name: ptr("second"), - URL: utils.MustParseURL("https://starknet2.example"), + URL: relaycfg.MustParseURL("https://starknet2.example"), } chain := config.TOMLConfig{ ChainID: &id, diff --git a/core/config/docs/docs_test.go b/core/config/docs/docs_test.go index 927592e448d..74fa6682c96 100644 --- a/core/config/docs/docs_test.go +++ b/core/config/docs/docs_test.go @@ -14,7 +14,7 @@ import ( "github.com/smartcontractkit/chainlink-solana/pkg/solana" stkcfg "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/config/docs" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" diff --git a/core/config/parse/parsers.go b/core/config/parse/parsers.go index 93e519064bf..e2f6978187c 100644 --- a/core/config/parse/parsers.go +++ b/core/config/parse/parsers.go @@ -13,7 +13,8 @@ import ( "github.com/pkg/errors" "go.uber.org/zap/zapcore" - "github.com/smartcontractkit/chainlink/v2/core/assets" + relayassets "github.com/smartcontractkit/chainlink-relay/pkg/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/static" "github.com/smartcontractkit/chainlink/v2/core/utils" ) @@ -22,10 +23,10 @@ func String(str string) (string, error) { return str, nil } -func Link(str string) (*assets.Link, error) { - i, ok := new(assets.Link).SetString(str, 10) +func Link(str string) (*relayassets.Link, error) { + i, ok := new(relayassets.Link).SetString(str, 10) if !ok { - return i, fmt.Errorf("unable to parse '%v' into *assets.Link(base 10)", str) + return i, fmt.Errorf("unable to parse '%v' into *relayassets.Link(base 10)", str) } return i, nil } diff --git a/core/internal/cltest/cltest.go b/core/internal/cltest/cltest.go index 778ccbdb154..644c516c21b 100644 --- a/core/internal/cltest/cltest.go +++ b/core/internal/cltest/cltest.go @@ -47,10 +47,10 @@ import ( "github.com/smartcontractkit/chainlink/v2/common/client" txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr" commonmocks "github.com/smartcontractkit/chainlink/v2/common/types/mocks" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/auth" "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" evmclimocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client/mocks" evmconfig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" diff --git a/core/internal/cltest/factories.go b/core/internal/cltest/factories.go index a52b9a5d06b..741afe828f9 100644 --- a/core/internal/cltest/factories.go +++ b/core/internal/cltest/factories.go @@ -25,9 +25,9 @@ import ( txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr" txmgrtypes "github.com/smartcontractkit/chainlink/v2/common/txmgr/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/auth" "github.com/smartcontractkit/chainlink/v2/core/bridges" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/headtracker" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" diff --git a/core/internal/features/features_test.go b/core/internal/features/features_test.go index b5f42d8bf3e..7749b173c55 100644 --- a/core/internal/features/features_test.go +++ b/core/internal/features/features_test.go @@ -41,9 +41,9 @@ import ( "github.com/smartcontractkit/libocr/offchainreporting/confighelper" ocrtypes "github.com/smartcontractkit/libocr/offchainreporting/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/auth" "github.com/smartcontractkit/chainlink/v2/core/bridges" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/forwarders" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" diff --git a/core/internal/features/ocr2/features_ocr2_test.go b/core/internal/features/ocr2/features_ocr2_test.go index 3e220935685..387b15f76c8 100644 --- a/core/internal/features/ocr2/features_ocr2_test.go +++ b/core/internal/features/ocr2/features_ocr2_test.go @@ -34,8 +34,8 @@ import ( confighelper2 "github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper" ocrtypes2 "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/bridges" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/forwarders" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/authorized_forwarder" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/link_token_interface" diff --git a/core/scripts/go.mod b/core/scripts/go.mod index eb41312a6ab..7bf60aff8b4 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -304,7 +304,7 @@ require ( github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231109141932-cb1ea9020255 // indirect - github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231113174149-046d4ddaca1a // indirect + github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231115124244-8303409abccd // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231023133638-72f4e799ab05 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231024133459-1ef3a11319eb // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 35e85fe2c97..7139f0efa4e 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1464,8 +1464,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231109141932-cb1ea9020255 h1:Pt6c7bJU9wIN6PQQnmN8UmYYH6lpfiQ6U/B8yEC2s5s= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231109141932-cb1ea9020255/go.mod h1:EHppaccd/LTlTMI2o4dmBHe4BknEgEFFDjDGMNuGb3k= -github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231113174149-046d4ddaca1a h1:G/pD8uI1PULRJU8Y3eLLzjqQBp9ruG9hj+wWxtyrgTo= -github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231113174149-046d4ddaca1a/go.mod h1:M9U1JV7IQi8Sfj4JR1qSi1tIh6omgW78W/8SHN/8BUQ= +github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231115124244-8303409abccd h1:PRVJxNK67pQWufXuB1cxckH/xZkcQFDy8KjN9ZYqong= +github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231115124244-8303409abccd/go.mod h1:rOayi690YxLlkQy959PD8INhOAIAUi9LoN0G+J/CEf4= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231023133638-72f4e799ab05 h1:DaPSVnxe7oz1QJ+AVIhQWs1W3ubQvwvGo9NbHpMs1OQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231023133638-72f4e799ab05/go.mod h1:o0Pn1pbaUluboaK6/yhf8xf7TiFCkyFl6WUOdwqamuU= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231024133459-1ef3a11319eb h1:HiluOfEVGOQTM6BTDImOqYdMZZ7qq7fkZ3TJdmItNr8= diff --git a/core/scripts/ocr2vrf/main.go b/core/scripts/ocr2vrf/main.go index 60260c54d9d..c698fcd730d 100644 --- a/core/scripts/ocr2vrf/main.go +++ b/core/scripts/ocr2vrf/main.go @@ -15,7 +15,7 @@ import ( ocr2vrftypes "github.com/smartcontractkit/ocr2vrf/types" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/link_token_interface" ) diff --git a/core/scripts/vrfv2/testnet/main.go b/core/scripts/vrfv2/testnet/main.go index 677c0b105ea..5856256504b 100644 --- a/core/scripts/vrfv2/testnet/main.go +++ b/core/scripts/vrfv2/testnet/main.go @@ -24,7 +24,7 @@ import ( "github.com/jmoiron/sqlx" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/batch_blockhash_store" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/batch_vrf_coordinator_v2" diff --git a/core/scripts/vrfv2plus/testnet/main.go b/core/scripts/vrfv2plus/testnet/main.go index b7940d6fda0..6b1ef585a5a 100644 --- a/core/scripts/vrfv2plus/testnet/main.go +++ b/core/scripts/vrfv2plus/testnet/main.go @@ -29,7 +29,7 @@ import ( "github.com/jmoiron/sqlx" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/batch_blockhash_store" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/batch_vrf_coordinator_v2plus" diff --git a/core/services/chainlink/config_test.go b/core/services/chainlink/config_test.go index 34fcc4bbe91..0caae3607f7 100644 --- a/core/services/chainlink/config_test.go +++ b/core/services/chainlink/config_test.go @@ -17,12 +17,13 @@ import ( ocrcommontypes "github.com/smartcontractkit/libocr/commontypes" coscfg "github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos/config" - relayutils "github.com/smartcontractkit/chainlink-relay/pkg/utils" + relayassets "github.com/smartcontractkit/chainlink-relay/pkg/assets" + relaycfg "github.com/smartcontractkit/chainlink-relay/pkg/config" "github.com/smartcontractkit/chainlink-solana/pkg/solana" solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config" stkcfg "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" legacy "github.com/smartcontractkit/chainlink/v2/core/config" @@ -144,7 +145,7 @@ var ( MaxMsgsPerBatch: ptr[int64](13), }, Nodes: []*coscfg.Node{ - {Name: ptr("primary"), TendermintURL: relayutils.MustParseURL("http://columbus.cosmos.com")}, + {Name: ptr("primary"), TendermintURL: relaycfg.MustParseURL("http://columbus.cosmos.com")}, }}, { ChainID: ptr("Malaga-420"), @@ -152,7 +153,7 @@ var ( BlocksUntilTxTimeout: ptr[int64](20), }, Nodes: []*coscfg.Node{ - {Name: ptr("secondary"), TendermintURL: relayutils.MustParseURL("http://bombay.cosmos.com")}, + {Name: ptr("secondary"), TendermintURL: relaycfg.MustParseURL("http://bombay.cosmos.com")}, }}, }, Solana: []*solana.TOMLConfig{ @@ -162,16 +163,16 @@ var ( MaxRetries: ptr[int64](12), }, Nodes: []*solcfg.Node{ - {Name: ptr("primary"), URL: relayutils.MustParseURL("http://mainnet.solana.com")}, + {Name: ptr("primary"), URL: relaycfg.MustParseURL("http://mainnet.solana.com")}, }, }, { ChainID: ptr("testnet"), Chain: solcfg.Chain{ - OCR2CachePollPeriod: relayutils.MustNewDuration(time.Minute), + OCR2CachePollPeriod: relaycfg.MustNewDuration(time.Minute), }, Nodes: []*solcfg.Node{ - {Name: ptr("secondary"), URL: relayutils.MustParseURL("http://testnet.solana.com")}, + {Name: ptr("secondary"), URL: relaycfg.MustParseURL("http://testnet.solana.com")}, }, }, }, @@ -179,10 +180,10 @@ var ( { ChainID: ptr("foobar"), Chain: stkcfg.Chain{ - ConfirmationPoll: relayutils.MustNewDuration(time.Hour), + ConfirmationPoll: relaycfg.MustNewDuration(time.Hour), }, Nodes: []*stkcfg.Node{ - {Name: ptr("primary"), URL: relayutils.MustParseURL("http://stark.node")}, + {Name: ptr("primary"), URL: relaycfg.MustParseURL("http://stark.node")}, }, }, }, @@ -537,7 +538,7 @@ func TestConfig_Marshal(t *testing.T) { LogBackfillBatchSize: ptr[uint32](17), LogPollInterval: &minute, LogKeepBlocksDepth: ptr[uint32](100000), - MinContractPayment: assets.NewLinkFromJuels(math.MaxInt64), + MinContractPayment: relayassets.NewLinkFromJuels(math.MaxInt64), MinIncomingConfirmations: ptr[uint32](13), NonceAutoSync: ptr(true), NoNewHeadsThreshold: &minute, @@ -602,13 +603,13 @@ func TestConfig_Marshal(t *testing.T) { ChainID: ptr("mainnet"), Enabled: ptr(false), Chain: solcfg.Chain{ - BalancePollPeriod: relayutils.MustNewDuration(time.Minute), - ConfirmPollPeriod: relayutils.MustNewDuration(time.Second), - OCR2CachePollPeriod: relayutils.MustNewDuration(time.Minute), - OCR2CacheTTL: relayutils.MustNewDuration(time.Hour), - TxTimeout: relayutils.MustNewDuration(time.Hour), - TxRetryTimeout: relayutils.MustNewDuration(time.Minute), - TxConfirmTimeout: relayutils.MustNewDuration(time.Second), + BalancePollPeriod: relaycfg.MustNewDuration(time.Minute), + ConfirmPollPeriod: relaycfg.MustNewDuration(time.Second), + OCR2CachePollPeriod: relaycfg.MustNewDuration(time.Minute), + OCR2CacheTTL: relaycfg.MustNewDuration(time.Hour), + TxTimeout: relaycfg.MustNewDuration(time.Hour), + TxRetryTimeout: relaycfg.MustNewDuration(time.Minute), + TxConfirmTimeout: relaycfg.MustNewDuration(time.Second), SkipPreflight: ptr(true), Commitment: ptr("banana"), MaxRetries: ptr[int64](7), @@ -616,12 +617,12 @@ func TestConfig_Marshal(t *testing.T) { ComputeUnitPriceMax: ptr[uint64](1000), ComputeUnitPriceMin: ptr[uint64](10), ComputeUnitPriceDefault: ptr[uint64](100), - FeeBumpPeriod: relayutils.MustNewDuration(time.Minute), + FeeBumpPeriod: relaycfg.MustNewDuration(time.Minute), }, Nodes: []*solcfg.Node{ - {Name: ptr("primary"), URL: relayutils.MustParseURL("http://solana.web")}, - {Name: ptr("foo"), URL: relayutils.MustParseURL("http://solana.foo")}, - {Name: ptr("bar"), URL: relayutils.MustParseURL("http://solana.bar")}, + {Name: ptr("primary"), URL: relaycfg.MustParseURL("http://solana.web")}, + {Name: ptr("foo"), URL: relaycfg.MustParseURL("http://solana.foo")}, + {Name: ptr("bar"), URL: relaycfg.MustParseURL("http://solana.bar")}, }, }, } @@ -630,14 +631,14 @@ func TestConfig_Marshal(t *testing.T) { ChainID: ptr("foobar"), Enabled: ptr(true), Chain: stkcfg.Chain{ - OCR2CachePollPeriod: relayutils.MustNewDuration(6 * time.Hour), - OCR2CacheTTL: relayutils.MustNewDuration(3 * time.Minute), - RequestTimeout: relayutils.MustNewDuration(time.Minute + 3*time.Second), - TxTimeout: relayutils.MustNewDuration(13 * time.Second), - ConfirmationPoll: relayutils.MustNewDuration(42 * time.Second), + OCR2CachePollPeriod: relaycfg.MustNewDuration(6 * time.Hour), + OCR2CacheTTL: relaycfg.MustNewDuration(3 * time.Minute), + RequestTimeout: relaycfg.MustNewDuration(time.Minute + 3*time.Second), + TxTimeout: relaycfg.MustNewDuration(13 * time.Second), + ConfirmationPoll: relaycfg.MustNewDuration(42 * time.Second), }, Nodes: []*stkcfg.Node{ - {Name: ptr("primary"), URL: relayutils.MustParseURL("http://stark.node")}, + {Name: ptr("primary"), URL: relaycfg.MustParseURL("http://stark.node")}, }, }, } @@ -647,21 +648,21 @@ func TestConfig_Marshal(t *testing.T) { Enabled: ptr(true), Chain: coscfg.Chain{ Bech32Prefix: ptr("wasm"), - BlockRate: relayutils.MustNewDuration(time.Minute), + BlockRate: relaycfg.MustNewDuration(time.Minute), BlocksUntilTxTimeout: ptr[int64](12), - ConfirmPollPeriod: relayutils.MustNewDuration(time.Second), + ConfirmPollPeriod: relaycfg.MustNewDuration(time.Second), FallbackGasPrice: mustDecimal("0.001"), GasToken: ptr("ucosm"), GasLimitMultiplier: mustDecimal("1.2"), MaxMsgsPerBatch: ptr[int64](17), - OCR2CachePollPeriod: relayutils.MustNewDuration(time.Minute), - OCR2CacheTTL: relayutils.MustNewDuration(time.Hour), - TxMsgTimeout: relayutils.MustNewDuration(time.Second), + OCR2CachePollPeriod: relaycfg.MustNewDuration(time.Minute), + OCR2CacheTTL: relaycfg.MustNewDuration(time.Hour), + TxMsgTimeout: relaycfg.MustNewDuration(time.Second), }, Nodes: []*coscfg.Node{ - {Name: ptr("primary"), TendermintURL: relayutils.MustParseURL("http://tender.mint")}, - {Name: ptr("foo"), TendermintURL: relayutils.MustParseURL("http://foo.url")}, - {Name: ptr("bar"), TendermintURL: relayutils.MustParseURL("http://bar.web")}, + {Name: ptr("primary"), TendermintURL: relaycfg.MustParseURL("http://tender.mint")}, + {Name: ptr("foo"), TendermintURL: relaycfg.MustParseURL("http://foo.url")}, + {Name: ptr("bar"), TendermintURL: relaycfg.MustParseURL("http://bar.web")}, }, }, } diff --git a/core/services/chainlink/relayer_chain_interoperators_test.go b/core/services/chainlink/relayer_chain_interoperators_test.go index 87293069646..293cc298c8d 100644 --- a/core/services/chainlink/relayer_chain_interoperators_test.go +++ b/core/services/chainlink/relayer_chain_interoperators_test.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/require" coscfg "github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos/config" + relaycfg "github.com/smartcontractkit/chainlink-relay/pkg/config" "github.com/smartcontractkit/chainlink-relay/pkg/loop" - relayutils "github.com/smartcontractkit/chainlink-relay/pkg/utils" solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config" stkcfg "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" @@ -84,7 +84,7 @@ func TestCoreRelayerChainInteroperators(t *testing.T) { Chain: solcfg.Chain{}, Nodes: []*solcfg.Node{{ Name: ptr("solana chain 1 node 1"), - URL: ((*relayutils.URL)(models.MustParseURL("http://localhost:8547").URL())), + URL: ((*relaycfg.URL)(models.MustParseURL("http://localhost:8547").URL())), }}, }, &solana.TOMLConfig{ @@ -93,7 +93,7 @@ func TestCoreRelayerChainInteroperators(t *testing.T) { Chain: solcfg.Chain{}, Nodes: []*solcfg.Node{{ Name: ptr("solana chain 2 node 1"), - URL: ((*relayutils.URL)(models.MustParseURL("http://localhost:8527").URL())), + URL: ((*relaycfg.URL)(models.MustParseURL("http://localhost:8527").URL())), }}, }, } @@ -106,15 +106,15 @@ func TestCoreRelayerChainInteroperators(t *testing.T) { Nodes: []*stkcfg.Node{ { Name: ptr("starknet chain 1 node 1"), - URL: ((*relayutils.URL)(models.MustParseURL("http://localhost:8547").URL())), + URL: ((*relaycfg.URL)(models.MustParseURL("http://localhost:8547").URL())), }, { Name: ptr("starknet chain 1 node 2"), - URL: ((*relayutils.URL)(models.MustParseURL("http://localhost:8548").URL())), + URL: ((*relaycfg.URL)(models.MustParseURL("http://localhost:8548").URL())), }, { Name: ptr("starknet chain 1 node 3"), - URL: ((*relayutils.URL)(models.MustParseURL("http://localhost:8549").URL())), + URL: ((*relaycfg.URL)(models.MustParseURL("http://localhost:8549").URL())), }, }, }, @@ -125,7 +125,7 @@ func TestCoreRelayerChainInteroperators(t *testing.T) { Nodes: []*stkcfg.Node{ { Name: ptr("starknet chain 2 node 1"), - URL: ((*relayutils.URL)(models.MustParseURL("http://localhost:3547").URL())), + URL: ((*relaycfg.URL)(models.MustParseURL("http://localhost:3547").URL())), }, }, }, @@ -143,7 +143,7 @@ func TestCoreRelayerChainInteroperators(t *testing.T) { Nodes: coscfg.Nodes{ &coscfg.Node{ Name: ptr("cosmos chain 1 node 1"), - TendermintURL: (*relayutils.URL)(models.MustParseURL("http://localhost:9548").URL()), + TendermintURL: (*relaycfg.URL)(models.MustParseURL("http://localhost:9548").URL()), }, }, }, @@ -158,7 +158,7 @@ func TestCoreRelayerChainInteroperators(t *testing.T) { Nodes: coscfg.Nodes{ &coscfg.Node{ Name: ptr("cosmos chain 2 node 1"), - TendermintURL: (*relayutils.URL)(models.MustParseURL("http://localhost:9598").URL()), + TendermintURL: (*relaycfg.URL)(models.MustParseURL("http://localhost:9598").URL()), }, }, }, diff --git a/core/services/directrequest/delegate.go b/core/services/directrequest/delegate.go index 920f94b4d60..10943308b39 100644 --- a/core/services/directrequest/delegate.go +++ b/core/services/directrequest/delegate.go @@ -9,9 +9,9 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/pkg/errors" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink-relay/pkg/services" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/log" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" diff --git a/core/services/directrequest/delegate_test.go b/core/services/directrequest/delegate_test.go index 34c79a0afbb..1c7929d94d3 100644 --- a/core/services/directrequest/delegate_test.go +++ b/core/services/directrequest/delegate_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/log" log_mocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/log/mocks" diff --git a/core/services/directrequest/validate.go b/core/services/directrequest/validate.go index 95ea9b60232..cdb478e8aae 100644 --- a/core/services/directrequest/validate.go +++ b/core/services/directrequest/validate.go @@ -4,7 +4,7 @@ import ( "github.com/pelletier/go-toml" "github.com/pkg/errors" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/null" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" diff --git a/core/services/fluxmonitorv2/config.go b/core/services/fluxmonitorv2/config.go index 5e5e56e768b..0360e9ce03a 100644 --- a/core/services/fluxmonitorv2/config.go +++ b/core/services/fluxmonitorv2/config.go @@ -3,7 +3,7 @@ package fluxmonitorv2 import ( "time" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" "github.com/smartcontractkit/chainlink/v2/core/store/models" ) diff --git a/core/services/fluxmonitorv2/flux_monitor_test.go b/core/services/fluxmonitorv2/flux_monitor_test.go index e81e1ba9e63..e8bbf739bbb 100644 --- a/core/services/fluxmonitorv2/flux_monitor_test.go +++ b/core/services/fluxmonitorv2/flux_monitor_test.go @@ -20,8 +20,8 @@ import ( "github.com/jmoiron/sqlx" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/log" logmocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/log/mocks" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" diff --git a/core/services/fluxmonitorv2/integrations_test.go b/core/services/fluxmonitorv2/integrations_test.go index 38c73d3ad74..729bcd76eba 100644 --- a/core/services/fluxmonitorv2/integrations_test.go +++ b/core/services/fluxmonitorv2/integrations_test.go @@ -26,8 +26,8 @@ import ( "github.com/jmoiron/sqlx" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/bridges" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/log" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/flags_wrapper" faw "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/flux_aggregator_wrapper" diff --git a/core/services/fluxmonitorv2/payment_checker.go b/core/services/fluxmonitorv2/payment_checker.go index 6b11ec13433..b5dbd73c064 100644 --- a/core/services/fluxmonitorv2/payment_checker.go +++ b/core/services/fluxmonitorv2/payment_checker.go @@ -3,7 +3,7 @@ package fluxmonitorv2 import ( "math/big" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" ) // MinFundedRounds defines the minimum number of rounds that needs to be paid diff --git a/core/services/fluxmonitorv2/payment_checker_test.go b/core/services/fluxmonitorv2/payment_checker_test.go index c987fdf3604..48a06553cb9 100644 --- a/core/services/fluxmonitorv2/payment_checker_test.go +++ b/core/services/fluxmonitorv2/payment_checker_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/services/fluxmonitorv2" ) diff --git a/core/services/fluxmonitorv2/validate_test.go b/core/services/fluxmonitorv2/validate_test.go index 78dda2e3d31..b397e6d3749 100644 --- a/core/services/fluxmonitorv2/validate_test.go +++ b/core/services/fluxmonitorv2/validate_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/store/models" "github.com/smartcontractkit/chainlink/v2/core/utils/tomlutils" diff --git a/core/services/functions/connector_handler.go b/core/services/functions/connector_handler.go index c5dbff6f10f..5b67e333d2b 100644 --- a/core/services/functions/connector_handler.go +++ b/core/services/functions/connector_handler.go @@ -10,9 +10,9 @@ import ( ethCommon "github.com/ethereum/go-ethereum/common" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink-relay/pkg/services" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/gateway/api" "github.com/smartcontractkit/chainlink/v2/core/services/gateway/common" diff --git a/core/services/functions/connector_handler_test.go b/core/services/functions/connector_handler_test.go index fa9f74712be..1bf9f8e5938 100644 --- a/core/services/functions/connector_handler_test.go +++ b/core/services/functions/connector_handler_test.go @@ -7,7 +7,7 @@ import ( "math/big" "testing" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/functions" diff --git a/core/services/gateway/handlers/functions/handler.functions.go b/core/services/gateway/handlers/functions/handler.functions.go index bb6812c1f9b..a4301ef7e9c 100644 --- a/core/services/gateway/handlers/functions/handler.functions.go +++ b/core/services/gateway/handlers/functions/handler.functions.go @@ -13,8 +13,8 @@ import ( "github.com/prometheus/client_golang/prometheus/promauto" "go.uber.org/multierr" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink-relay/pkg/services" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/gateway/api" diff --git a/core/services/gateway/handlers/functions/handler.functions_test.go b/core/services/gateway/handlers/functions/handler.functions_test.go index 49fdae2bb24..4c8ba5bec3c 100644 --- a/core/services/gateway/handlers/functions/handler.functions_test.go +++ b/core/services/gateway/handlers/functions/handler.functions_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/gateway/api" diff --git a/core/services/job/job_orm_test.go b/core/services/job/job_orm_test.go index f4471e75c68..c2fc425918a 100644 --- a/core/services/job/job_orm_test.go +++ b/core/services/job/job_orm_test.go @@ -16,8 +16,8 @@ import ( "github.com/smartcontractkit/chainlink-relay/pkg/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/bridges" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" diff --git a/core/services/job/models.go b/core/services/job/models.go index a474040dd41..0b3e622f59b 100644 --- a/core/services/job/models.go +++ b/core/services/job/models.go @@ -14,10 +14,11 @@ import ( "github.com/pkg/errors" "gopkg.in/guregu/null.v4" + relayassets "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink-relay/pkg/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/bridges" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" clnull "github.com/smartcontractkit/chainlink/v2/core/null" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" @@ -433,7 +434,7 @@ type DirectRequestSpec struct { ContractAddress ethkey.EIP55Address `toml:"contractAddress"` MinIncomingConfirmations clnull.Uint32 `toml:"minIncomingConfirmations"` Requesters models.AddressCollection `toml:"requesters"` - MinContractPayment *assets.Link `toml:"minContractPaymentLinkJuels"` + MinContractPayment *relayassets.Link `toml:"minContractPaymentLinkJuels"` EVMChainID *utils.Big `toml:"evmChainID"` CreatedAt time.Time `toml:"-"` UpdatedAt time.Time `toml:"-"` @@ -474,7 +475,7 @@ type FluxMonitorSpec struct { DrumbeatSchedule string DrumbeatRandomDelay time.Duration DrumbeatEnabled bool - MinPayment *assets.Link + MinPayment *relayassets.Link EVMChainID *utils.Big `toml:"evmChainID"` CreatedAt time.Time `toml:"-"` UpdatedAt time.Time `toml:"-"` diff --git a/core/services/keeper/integration_test.go b/core/services/keeper/integration_test.go index f76ef935741..29a0b68702d 100644 --- a/core/services/keeper/integration_test.go +++ b/core/services/keeper/integration_test.go @@ -16,7 +16,7 @@ import ( "github.com/smartcontractkit/libocr/gethwrappers/link_token_interface" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/forwarders" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/authorized_forwarder" diff --git a/core/services/keeper/upkeep_executer.go b/core/services/keeper/upkeep_executer.go index 33ad8b7d773..30e9f363579 100644 --- a/core/services/keeper/upkeep_executer.go +++ b/core/services/keeper/upkeep_executer.go @@ -13,7 +13,7 @@ import ( "github.com/prometheus/client_golang/prometheus/promauto" "github.com/smartcontractkit/chainlink-relay/pkg/services" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" httypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/headtracker/types" diff --git a/core/services/keeper/upkeep_executer_test.go b/core/services/keeper/upkeep_executer_test.go index 32b1d2c191d..a064c3ed4b6 100644 --- a/core/services/keeper/upkeep_executer_test.go +++ b/core/services/keeper/upkeep_executer_test.go @@ -15,8 +15,8 @@ import ( "github.com/jmoiron/sqlx" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmclimocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client/mocks" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" gasmocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas/mocks" diff --git a/core/services/keeper/upkeep_executer_unit_test.go b/core/services/keeper/upkeep_executer_unit_test.go index f4e99341ca0..a8fc46319cd 100644 --- a/core/services/keeper/upkeep_executer_unit_test.go +++ b/core/services/keeper/upkeep_executer_unit_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" diff --git a/core/services/keystore/keys/ethkey/address.go b/core/services/keystore/keys/ethkey/address.go index 4a161045ea0..c14b602c597 100644 --- a/core/services/keystore/keys/ethkey/address.go +++ b/core/services/keystore/keys/ethkey/address.go @@ -9,7 +9,7 @@ import ( "github.com/ethereum/go-ethereum/common" - "github.com/smartcontractkit/chainlink/v2/core/utils" + "github.com/smartcontractkit/chainlink-relay/pkg/utils/bytes" ) // EIP55Address is a new type for string which persists an ethereum address in @@ -85,7 +85,7 @@ func (a *EIP55Address) UnmarshalText(input []byte) error { // UnmarshalJSON parses a hash from a JSON string func (a *EIP55Address) UnmarshalJSON(input []byte) error { - input = utils.RemoveQuotes(input) + input = bytes.TrimQuotes(input) return a.UnmarshalText(input) } diff --git a/core/services/ocr/contract_tracker.go b/core/services/ocr/contract_tracker.go index db19bdd4f0a..3e614fef4ae 100644 --- a/core/services/ocr/contract_tracker.go +++ b/core/services/ocr/contract_tracker.go @@ -22,11 +22,11 @@ import ( "github.com/smartcontractkit/chainlink-relay/pkg/services" + "github.com/smartcontractkit/chainlink/v2/common/config" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" httypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/headtracker/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/log" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" - "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/offchain_aggregator_wrapper" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/ocrcommon" diff --git a/core/services/ocr/validate.go b/core/services/ocr/validate.go index 07fdc15912e..145bb7597ec 100644 --- a/core/services/ocr/validate.go +++ b/core/services/ocr/validate.go @@ -10,9 +10,9 @@ import ( "github.com/pkg/errors" "github.com/smartcontractkit/libocr/offchainreporting" + "github.com/smartcontractkit/chainlink/v2/common/config" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" evmconfig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" - "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/ocrcommon" diff --git a/core/services/ocr2/plugins/functions/config/config.go b/core/services/ocr2/plugins/functions/config/config.go index 0978500deb5..a179a22ce44 100644 --- a/core/services/ocr2/plugins/functions/config/config.go +++ b/core/services/ocr2/plugins/functions/config/config.go @@ -10,7 +10,7 @@ import ( "github.com/smartcontractkit/libocr/offchainreporting2/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/services/gateway/connector" "github.com/smartcontractkit/chainlink/v2/core/services/gateway/handlers/common" "github.com/smartcontractkit/chainlink/v2/core/services/gateway/handlers/functions" diff --git a/core/services/ocr2/plugins/functions/integration_tests/v1/internal/testutils.go b/core/services/ocr2/plugins/functions/integration_tests/v1/internal/testutils.go index 9f63d60eef6..e576e829677 100644 --- a/core/services/ocr2/plugins/functions/integration_tests/v1/internal/testutils.go +++ b/core/services/ocr2/plugins/functions/integration_tests/v1/internal/testutils.go @@ -29,8 +29,8 @@ import ( confighelper2 "github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper" ocrtypes2 "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/bridges" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/functions/generated/functions_allow_list" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/functions/generated/functions_client_example" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/functions/generated/functions_coordinator" diff --git a/core/services/ocr2/plugins/functions/plugin.go b/core/services/ocr2/plugins/functions/plugin.go index 8597b8ad4cc..14d7415cab5 100644 --- a/core/services/ocr2/plugins/functions/plugin.go +++ b/core/services/ocr2/plugins/functions/plugin.go @@ -13,7 +13,7 @@ import ( "github.com/smartcontractkit/libocr/commontypes" libocr2 "github.com/smartcontractkit/libocr/offchainreporting2plus" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" "github.com/smartcontractkit/chainlink/v2/core/logger" diff --git a/core/services/ocr2/plugins/functions/plugin_test.go b/core/services/ocr2/plugins/functions/plugin_test.go index 2e35672e920..eea751789a0 100644 --- a/core/services/ocr2/plugins/functions/plugin_test.go +++ b/core/services/ocr2/plugins/functions/plugin_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/gateway/connector" hc "github.com/smartcontractkit/chainlink/v2/core/services/gateway/handlers/common" diff --git a/core/services/ocr2/plugins/mercury/integration_test.go b/core/services/ocr2/plugins/mercury/integration_test.go index e7e059289a2..ae2b4ca9742 100644 --- a/core/services/ocr2/plugins/mercury/integration_test.go +++ b/core/services/ocr2/plugins/mercury/integration_test.go @@ -39,8 +39,8 @@ import ( relaycodecv2 "github.com/smartcontractkit/chainlink-relay/pkg/reportingplugins/mercury/v2" relaycodecv3 "github.com/smartcontractkit/chainlink-relay/pkg/reportingplugins/mercury/v3" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/bridges" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" token "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/link_token_interface" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/fee_manager" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/reward_manager" diff --git a/core/services/ocr2/plugins/ocr2keeper/evm21/logprovider/integration_test.go b/core/services/ocr2/plugins/ocr2keeper/evm21/logprovider/integration_test.go index 9a1e99610c1..0df774d5dfd 100644 --- a/core/services/ocr2/plugins/ocr2keeper/evm21/logprovider/integration_test.go +++ b/core/services/ocr2/plugins/ocr2keeper/evm21/logprovider/integration_test.go @@ -21,7 +21,7 @@ import ( ocr2keepers "github.com/smartcontractkit/ocr2keepers/pkg/v3/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" diff --git a/core/services/ocr2/plugins/ocr2keeper/integration_21_test.go b/core/services/ocr2/plugins/ocr2keeper/integration_21_test.go index 562f972bc42..ee8b7cd6e9a 100644 --- a/core/services/ocr2/plugins/ocr2keeper/integration_21_test.go +++ b/core/services/ocr2/plugins/ocr2keeper/integration_21_test.go @@ -33,7 +33,7 @@ import ( "github.com/smartcontractkit/ocr2keepers/pkg/v3/config" relaytypes "github.com/smartcontractkit/chainlink-relay/pkg/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" automationForwarderLogic "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/automation_forwarder_logic" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/basic_upkeep_contract" diff --git a/core/services/ocr2/plugins/ocr2keeper/integration_test.go b/core/services/ocr2/plugins/ocr2keeper/integration_test.go index f50321631ce..569dc20753b 100644 --- a/core/services/ocr2/plugins/ocr2keeper/integration_test.go +++ b/core/services/ocr2/plugins/ocr2keeper/integration_test.go @@ -34,7 +34,7 @@ import ( "github.com/stretchr/testify/require" "github.com/umbracle/ethgo/abi" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/forwarders" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" "github.com/smartcontractkit/chainlink/v2/core/config/toml" diff --git a/core/services/ocr2/plugins/ocr2vrf/internal/ocr2vrf_integration_test.go b/core/services/ocr2/plugins/ocr2vrf/internal/ocr2vrf_integration_test.go index 0dbb6a5915e..57d13a69ec5 100644 --- a/core/services/ocr2/plugins/ocr2vrf/internal/ocr2vrf_integration_test.go +++ b/core/services/ocr2/plugins/ocr2vrf/internal/ocr2vrf_integration_test.go @@ -31,7 +31,7 @@ import ( "github.com/smartcontractkit/ocr2vrf/ocr2vrf" ocr2vrftypes "github.com/smartcontractkit/ocr2vrf/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/forwarders" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/authorized_forwarder" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/link_token_interface" diff --git a/core/services/ocr2/plugins/ocr2vrf/reasonablegasprice/reasonable_gas_price_provider.go b/core/services/ocr2/plugins/ocr2vrf/reasonablegasprice/reasonable_gas_price_provider.go index 43262d6ad50..c0e969a2879 100644 --- a/core/services/ocr2/plugins/ocr2vrf/reasonablegasprice/reasonable_gas_price_provider.go +++ b/core/services/ocr2/plugins/ocr2vrf/reasonablegasprice/reasonable_gas_price_provider.go @@ -6,7 +6,7 @@ import ( "github.com/smartcontractkit/ocr2vrf/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" ) diff --git a/core/services/ocr2/plugins/ocr2vrf/reasonablegasprice/reasonable_gas_price_test.go b/core/services/ocr2/plugins/ocr2vrf/reasonablegasprice/reasonable_gas_price_test.go index a33c146564b..ec8b085dea8 100644 --- a/core/services/ocr2/plugins/ocr2vrf/reasonablegasprice/reasonable_gas_price_test.go +++ b/core/services/ocr2/plugins/ocr2vrf/reasonablegasprice/reasonable_gas_price_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" ) func Test_ReasonableGasPrice(t *testing.T) { diff --git a/core/services/ocrcommon/block_translator.go b/core/services/ocrcommon/block_translator.go index 48b96416998..dcac83fd2bd 100644 --- a/core/services/ocrcommon/block_translator.go +++ b/core/services/ocrcommon/block_translator.go @@ -4,9 +4,9 @@ import ( "context" "math/big" + "github.com/smartcontractkit/chainlink/v2/common/config" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" - "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/logger" ) diff --git a/core/services/ocrcommon/config.go b/core/services/ocrcommon/config.go index a61a47519cc..2fcc877610c 100644 --- a/core/services/ocrcommon/config.go +++ b/core/services/ocrcommon/config.go @@ -5,7 +5,7 @@ import ( "github.com/smartcontractkit/libocr/commontypes" - "github.com/smartcontractkit/chainlink/v2/core/config" + "github.com/smartcontractkit/chainlink/v2/common/config" ) type Config interface { diff --git a/core/services/relay/evm/mercury/v1/data_source_test.go b/core/services/relay/evm/mercury/v1/data_source_test.go index 40542c2631a..3aea503ae6a 100644 --- a/core/services/relay/evm/mercury/v1/data_source_test.go +++ b/core/services/relay/evm/mercury/v1/data_source_test.go @@ -18,7 +18,7 @@ import ( relaymercury "github.com/smartcontractkit/chainlink-relay/pkg/reportingplugins/mercury" relaymercuryv1 "github.com/smartcontractkit/chainlink-relay/pkg/reportingplugins/mercury/v1" commonmocks "github.com/smartcontractkit/chainlink/v2/common/mocks" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/logger" diff --git a/core/services/transmission/integration_test.go b/core/services/transmission/integration_test.go index 0484b1d8cd6..58521dcdf84 100644 --- a/core/services/transmission/integration_test.go +++ b/core/services/transmission/integration_test.go @@ -12,7 +12,7 @@ import ( "github.com/ethereum/go-ethereum/core" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/link_token_interface" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/mock_v3_aggregator_contract" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/solidity_vrf_consumer_interface_v08" diff --git a/core/services/vrf/delegate.go b/core/services/vrf/delegate.go index e976d01b995..3b91f783b4a 100644 --- a/core/services/vrf/delegate.go +++ b/core/services/vrf/delegate.go @@ -12,8 +12,8 @@ import ( "github.com/jmoiron/sqlx" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/log" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/aggregator_v3_interface" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/batch_vrf_coordinator_v2" diff --git a/core/services/vrf/delegate_test.go b/core/services/vrf/delegate_test.go index 389e1159be1..3d544027d40 100644 --- a/core/services/vrf/delegate_test.go +++ b/core/services/vrf/delegate_test.go @@ -8,9 +8,9 @@ import ( "github.com/jmoiron/sqlx" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmclimocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client/mocks" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/headtracker" httypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/headtracker/types" diff --git a/core/services/vrf/mocks/fee_config.go b/core/services/vrf/mocks/fee_config.go index 55a6360c339..067ce7e4455 100644 --- a/core/services/vrf/mocks/fee_config.go +++ b/core/services/vrf/mocks/fee_config.go @@ -4,7 +4,7 @@ package mocks import ( common "github.com/ethereum/go-ethereum/common" - assets "github.com/smartcontractkit/chainlink/v2/core/assets" + assets "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" config "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" diff --git a/core/services/vrf/proof/proof_response_test.go b/core/services/vrf/proof/proof_response_test.go index 24df77d4b32..c547be2be2c 100644 --- a/core/services/vrf/proof/proof_response_test.go +++ b/core/services/vrf/proof/proof_response_test.go @@ -16,7 +16,7 @@ import ( "github.com/pkg/errors" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/pgtest" ) diff --git a/core/services/vrf/solidity_cross_tests/vrf_coordinator_interface.go b/core/services/vrf/solidity_cross_tests/vrf_coordinator_interface.go index f0c398f8cf0..a8e662c9318 100644 --- a/core/services/vrf/solidity_cross_tests/vrf_coordinator_interface.go +++ b/core/services/vrf/solidity_cross_tests/vrf_coordinator_interface.go @@ -7,7 +7,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/pkg/errors" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/solidity_vrf_coordinator_interface" "github.com/smartcontractkit/chainlink/v2/core/utils" ) diff --git a/core/services/vrf/solidity_cross_tests/vrf_coordinator_interface_test.go b/core/services/vrf/solidity_cross_tests/vrf_coordinator_interface_test.go index 9fab3737ae2..2601f800e9e 100644 --- a/core/services/vrf/solidity_cross_tests/vrf_coordinator_interface_test.go +++ b/core/services/vrf/solidity_cross_tests/vrf_coordinator_interface_test.go @@ -9,7 +9,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/services/vrf/solidity_cross_tests" ) @@ -18,14 +17,14 @@ var ( jobID = common.BytesToHash([]byte("1234567890abcdef1234567890abcdef")) seed = big.NewInt(1) sender = common.HexToAddress("0xecfcab0a285d3380e488a39b4bb21e777f8a4eac") - fee = assets.NewLinkFromJuels(100) + fee = big.NewInt(100) requestID = common.HexToHash("0xcafe") raw = solidity_cross_tests.RawRandomnessRequestLog{ KeyHash: keyHash, Seed: seed, JobID: jobID, Sender: sender, - Fee: (*big.Int)(fee), + Fee: fee, RequestID: requestID, Raw: types.Log{ // A raw, on-the-wire RandomnessRequestLog is the concat of fields as uint256's @@ -33,7 +32,7 @@ var ( keyHash.Bytes(), common.BigToHash(seed).Bytes()...), sender.Hash().Bytes()...), - fee.ToHash().Bytes()...), + common.BigToHash(fee).Bytes()...), requestID.Bytes()...), Topics: []common.Hash{{}, jobID}, }, diff --git a/core/services/vrf/solidity_cross_tests/vrf_hash_to_curve_cost_test.go b/core/services/vrf/solidity_cross_tests/vrf_hash_to_curve_cost_test.go index 38675e2651d..29d1db437d1 100644 --- a/core/services/vrf/solidity_cross_tests/vrf_hash_to_curve_cost_test.go +++ b/core/services/vrf/solidity_cross_tests/vrf_hash_to_curve_cost_test.go @@ -11,7 +11,7 @@ import ( "github.com/ethereum/go-ethereum/eth/ethconfig" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/vrfkey" "github.com/smartcontractkit/chainlink/v2/core/services/signatures/secp256k1" diff --git a/core/services/vrf/solidity_cross_tests/vrf_solidity_crosscheck_test.go b/core/services/vrf/solidity_cross_tests/vrf_solidity_crosscheck_test.go index c2896d42314..06875edd74e 100644 --- a/core/services/vrf/solidity_cross_tests/vrf_solidity_crosscheck_test.go +++ b/core/services/vrf/solidity_cross_tests/vrf_solidity_crosscheck_test.go @@ -19,7 +19,7 @@ import ( "github.com/stretchr/testify/require" "go.dedis.ch/kyber/v3" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/vrfkey" "github.com/smartcontractkit/chainlink/v2/core/services/signatures/secp256k1" diff --git a/core/services/vrf/solidity_cross_tests/vrf_v08_solidity_crosscheck_test.go b/core/services/vrf/solidity_cross_tests/vrf_v08_solidity_crosscheck_test.go index 695a9dfd2f1..d1b21b58647 100644 --- a/core/services/vrf/solidity_cross_tests/vrf_v08_solidity_crosscheck_test.go +++ b/core/services/vrf/solidity_cross_tests/vrf_v08_solidity_crosscheck_test.go @@ -15,7 +15,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/vrfkey" "github.com/smartcontractkit/chainlink/v2/core/services/signatures/secp256k1" diff --git a/core/services/vrf/v2/bhs_feeder_test.go b/core/services/vrf/v2/bhs_feeder_test.go index 219fe1c8fd2..f388f80f561 100644 --- a/core/services/vrf/v2/bhs_feeder_test.go +++ b/core/services/vrf/v2/bhs_feeder_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest/heavyweight" diff --git a/core/services/vrf/v2/integration_helpers_test.go b/core/services/vrf/v2/integration_helpers_test.go index a086cbbb09f..a5737371919 100644 --- a/core/services/vrf/v2/integration_helpers_test.go +++ b/core/services/vrf/v2/integration_helpers_test.go @@ -17,7 +17,7 @@ import ( "github.com/stretchr/testify/require" txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" diff --git a/core/services/vrf/v2/integration_v2_plus_test.go b/core/services/vrf/v2/integration_v2_plus_test.go index 75026423f4b..e45e650dc8d 100644 --- a/core/services/vrf/v2/integration_v2_plus_test.go +++ b/core/services/vrf/v2/integration_v2_plus_test.go @@ -16,7 +16,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/batch_blockhash_store" diff --git a/core/services/vrf/v2/integration_v2_test.go b/core/services/vrf/v2/integration_v2_test.go index 1f607da2f26..df886924aa1 100644 --- a/core/services/vrf/v2/integration_v2_test.go +++ b/core/services/vrf/v2/integration_v2_test.go @@ -30,10 +30,11 @@ import ( "github.com/jmoiron/sqlx" + relayassets "github.com/smartcontractkit/chainlink-relay/pkg/assets" txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr" txmgrtypes "github.com/smartcontractkit/chainlink/v2/common/txmgr/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmclimocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client/mocks" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" @@ -1461,7 +1462,7 @@ func simulatedOverrides(t *testing.T, defaultGasPrice *assets.Wei, ks ...toml.Ke c.EVM[0].FinalityDepth = ptr[uint32](15) c.EVM[0].MinIncomingConfirmations = ptr[uint32](1) - c.EVM[0].MinContractPayment = assets.NewLinkFromJuels(100) + c.EVM[0].MinContractPayment = relayassets.NewLinkFromJuels(100) c.EVM[0].KeySpecific = ks } } diff --git a/core/services/vrf/v2/listener_v2.go b/core/services/vrf/v2/listener_v2.go index 17cb9ec96e4..3480f63f092 100644 --- a/core/services/vrf/v2/listener_v2.go +++ b/core/services/vrf/v2/listener_v2.go @@ -28,8 +28,8 @@ import ( "github.com/smartcontractkit/chainlink-relay/pkg/services" txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr" txmgrtypes "github.com/smartcontractkit/chainlink/v2/common/txmgr/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/log" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" diff --git a/core/services/vrf/v2/listener_v2_helpers_test.go b/core/services/vrf/v2/listener_v2_helpers_test.go index fc34a115b1c..401a5bcc577 100644 --- a/core/services/vrf/v2/listener_v2_helpers_test.go +++ b/core/services/vrf/v2/listener_v2_helpers_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" v2 "github.com/smartcontractkit/chainlink/v2/core/services/vrf/v2" "github.com/smartcontractkit/chainlink/v2/core/services/vrf/vrfcommon" diff --git a/core/services/vrf/vrfcommon/types.go b/core/services/vrf/vrfcommon/types.go index 03de4eb562f..175b362b5aa 100644 --- a/core/services/vrf/vrfcommon/types.go +++ b/core/services/vrf/vrfcommon/types.go @@ -5,7 +5,7 @@ import ( "github.com/ethereum/go-ethereum/common" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" ) diff --git a/core/services/vrf/vrfcommon/validate.go b/core/services/vrf/vrfcommon/validate.go index d417336562c..07e8676ddb7 100644 --- a/core/services/vrf/vrfcommon/validate.go +++ b/core/services/vrf/vrfcommon/validate.go @@ -9,7 +9,7 @@ import ( "github.com/pelletier/go-toml" "github.com/pkg/errors" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" "github.com/smartcontractkit/chainlink/v2/core/services/signatures/secp256k1" diff --git a/core/services/vrf/vrfcommon/validate_test.go b/core/services/vrf/vrfcommon/validate_test.go index 03d544f8189..efb1f22216f 100644 --- a/core/services/vrf/vrfcommon/validate_test.go +++ b/core/services/vrf/vrfcommon/validate_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/services/job" ) diff --git a/core/services/vrf/vrftesthelpers/helpers.go b/core/services/vrf/vrftesthelpers/helpers.go index f36fb1ea027..2f269fbff03 100644 --- a/core/services/vrf/vrftesthelpers/helpers.go +++ b/core/services/vrf/vrftesthelpers/helpers.go @@ -17,7 +17,7 @@ import ( "github.com/shopspring/decimal" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/blockhash_store" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/link_token_interface" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/solidity_vrf_consumer_interface" diff --git a/core/store/models/common.go b/core/store/models/common.go index fc7f7762046..10f391861e1 100644 --- a/core/store/models/common.go +++ b/core/store/models/common.go @@ -17,7 +17,7 @@ import ( "github.com/tidwall/gjson" "go.uber.org/multierr" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/utils" ) diff --git a/core/testdata/testspecs/v2_specs.go b/core/testdata/testspecs/v2_specs.go index beda7354566..0155dc0a53a 100644 --- a/core/testdata/testspecs/v2_specs.go +++ b/core/testdata/testspecs/v2_specs.go @@ -8,7 +8,7 @@ import ( "github.com/google/uuid" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/services/vrf/vrfcommon" "github.com/smartcontractkit/chainlink/v2/core/services/webhook" "github.com/smartcontractkit/chainlink/v2/core/utils" diff --git a/core/utils/big.go b/core/utils/big.go index 6bdb95c1217..f0f9a2d96df 100644 --- a/core/utils/big.go +++ b/core/utils/big.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/smartcontractkit/chainlink-relay/pkg/utils/bytes" bigmath "github.com/smartcontractkit/chainlink/v2/core/utils/big_math" ) @@ -80,7 +81,7 @@ func (b Big) MarshalJSON() ([]byte, error) { // UnmarshalText implements encoding.TextUnmarshaler. func (b *Big) UnmarshalText(input []byte) error { - input = RemoveQuotes(input) + input = bytes.TrimQuotes(input) str := string(input) if HasHexPrefix(str) { decoded, err := hexutil.DecodeBig(str) diff --git a/core/utils/utils.go b/core/utils/utils.go index e5541ecf558..6ea7164df1e 100644 --- a/core/utils/utils.go +++ b/core/utils/utils.go @@ -305,22 +305,6 @@ func Sha256(in string) (string, error) { return hex.EncodeToString(hasher.Sum(nil)), nil } -// IsQuoted checks if the first and last characters are either " or '. -func IsQuoted(input []byte) bool { - return len(input) >= 2 && - ((input[0] == '"' && input[len(input)-1] == '"') || - (input[0] == '\'' && input[len(input)-1] == '\'')) -} - -// RemoveQuotes removes the first and last character if they are both either -// " or ', otherwise it is a noop. -func RemoveQuotes(input []byte) []byte { - if IsQuoted(input) { - return input[1 : len(input)-1] - } - return input -} - // EIP55CapitalizedAddress returns true iff possibleAddressString has the correct // capitalization for an Ethereum address, per EIP 55 func EIP55CapitalizedAddress(possibleAddressString string) bool { diff --git a/core/web/bridge_types_controller.go b/core/web/bridge_types_controller.go index eca99f1a20a..57a79e2b611 100644 --- a/core/web/bridge_types_controller.go +++ b/core/web/bridge_types_controller.go @@ -8,7 +8,7 @@ import ( "github.com/jackc/pgconn" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/logger/audit" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" diff --git a/core/web/bridge_types_controller_test.go b/core/web/bridge_types_controller_test.go index 6459cad0545..a65362ba9aa 100644 --- a/core/web/bridge_types_controller_test.go +++ b/core/web/bridge_types_controller_test.go @@ -6,7 +6,7 @@ import ( "net/http" "testing" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" diff --git a/core/web/eth_keys_controller.go b/core/web/eth_keys_controller.go index 28afe8c43bf..6e2a3b2efc4 100644 --- a/core/web/eth_keys_controller.go +++ b/core/web/eth_keys_controller.go @@ -9,8 +9,9 @@ import ( "strconv" "strings" - "github.com/smartcontractkit/chainlink/v2/core/assets" + relayassets "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/config/toml" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/logger/audit" @@ -364,13 +365,13 @@ func (ekc *ETHKeysController) getEthBalance(ctx context.Context, state ethkey.St } -func (ekc *ETHKeysController) setLinkBalance(bal *assets.Link) presenters.NewETHKeyOption { +func (ekc *ETHKeysController) setLinkBalance(bal *relayassets.Link) presenters.NewETHKeyOption { return presenters.SetETHKeyLinkBalance(bal) } // queries the EthClient for the LINK balance at the address associated with state -func (ekc *ETHKeysController) getLinkBalance(ctx context.Context, state ethkey.State) *assets.Link { - var bal *assets.Link +func (ekc *ETHKeysController) getLinkBalance(ctx context.Context, state ethkey.State) *relayassets.Link { + var bal *relayassets.Link chainID := state.EVMChainID.ToInt() chain, err := ekc.app.GetRelayers().LegacyEVMChains().Get(chainID.String()) if err != nil { diff --git a/core/web/eth_keys_controller_test.go b/core/web/eth_keys_controller_test.go index e3a39d541a4..8941c2d2fdc 100644 --- a/core/web/eth_keys_controller_test.go +++ b/core/web/eth_keys_controller_test.go @@ -8,9 +8,9 @@ import ( "github.com/pkg/errors" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" commontxmmocks "github.com/smartcontractkit/chainlink/v2/common/txmgr/types/mocks" commonmocks "github.com/smartcontractkit/chainlink/v2/common/types/mocks" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" diff --git a/core/web/evm_transactions_controller_test.go b/core/web/evm_transactions_controller_test.go index 9d8336325e2..9135be432de 100644 --- a/core/web/evm_transactions_controller_test.go +++ b/core/web/evm_transactions_controller_test.go @@ -6,7 +6,7 @@ import ( "testing" txmgrtypes "github.com/smartcontractkit/chainlink/v2/common/txmgr/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" diff --git a/core/web/evm_transfer_controller.go b/core/web/evm_transfer_controller.go index f5973a20f2f..7f09bc9fdc6 100644 --- a/core/web/evm_transfer_controller.go +++ b/core/web/evm_transfer_controller.go @@ -11,8 +11,8 @@ import ( "github.com/pkg/errors" commontxmgr "github.com/smartcontractkit/chainlink/v2/common/txmgr" - "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" "github.com/smartcontractkit/chainlink/v2/core/logger/audit" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" diff --git a/core/web/evm_transfer_controller_test.go b/core/web/evm_transfer_controller_test.go index 14259637b4f..c41219e1894 100644 --- a/core/web/evm_transfer_controller_test.go +++ b/core/web/evm_transfer_controller_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" diff --git a/core/web/presenters/bridges.go b/core/web/presenters/bridges.go index 3317895e166..440e444c613 100644 --- a/core/web/presenters/bridges.go +++ b/core/web/presenters/bridges.go @@ -3,7 +3,7 @@ package presenters import ( "time" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/bridges" ) diff --git a/core/web/presenters/bridges_test.go b/core/web/presenters/bridges_test.go index b9fefd022d2..f6ce3af7561 100644 --- a/core/web/presenters/bridges_test.go +++ b/core/web/presenters/bridges_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/store/models" ) diff --git a/core/web/presenters/eth_key.go b/core/web/presenters/eth_key.go index 167679513ef..92654427619 100644 --- a/core/web/presenters/eth_key.go +++ b/core/web/presenters/eth_key.go @@ -3,7 +3,8 @@ package presenters import ( "time" - "github.com/smartcontractkit/chainlink/v2/core/assets" + relayassets "github.com/smartcontractkit/chainlink-relay/pkg/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/utils" ) @@ -12,14 +13,14 @@ import ( // representation of the address plus its ETH & LINK balances type ETHKeyResource struct { JAID - EVMChainID utils.Big `json:"evmChainID"` - Address string `json:"address"` - EthBalance *assets.Eth `json:"ethBalance"` - LinkBalance *assets.Link `json:"linkBalance"` - Disabled bool `json:"disabled"` - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` - MaxGasPriceWei *utils.Big `json:"maxGasPriceWei"` + EVMChainID utils.Big `json:"evmChainID"` + Address string `json:"address"` + EthBalance *assets.Eth `json:"ethBalance"` + LinkBalance *relayassets.Link `json:"linkBalance"` + Disabled bool `json:"disabled"` + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` + MaxGasPriceWei *utils.Big `json:"maxGasPriceWei"` } // GetName implements the api2go EntityNamer interface @@ -62,7 +63,7 @@ func SetETHKeyEthBalance(ethBalance *assets.Eth) NewETHKeyOption { } } -func SetETHKeyLinkBalance(linkBalance *assets.Link) NewETHKeyOption { +func SetETHKeyLinkBalance(linkBalance *relayassets.Link) NewETHKeyOption { return func(r *ETHKeyResource) { r.LinkBalance = linkBalance } diff --git a/core/web/presenters/eth_key_test.go b/core/web/presenters/eth_key_test.go index 7afb55068fb..0e68fbc90c9 100644 --- a/core/web/presenters/eth_key_test.go +++ b/core/web/presenters/eth_key_test.go @@ -5,7 +5,8 @@ import ( "testing" "time" - "github.com/smartcontractkit/chainlink/v2/core/assets" + relayassets "github.com/smartcontractkit/chainlink-relay/pkg/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/utils" @@ -39,12 +40,12 @@ func TestETHKeyResource(t *testing.T) { r := NewETHKeyResource(key, state, SetETHKeyEthBalance(assets.NewEth(1)), - SetETHKeyLinkBalance(assets.NewLinkFromJuels(1)), + SetETHKeyLinkBalance(relayassets.NewLinkFromJuels(1)), SetETHKeyMaxGasPriceWei(utils.NewBigI(12345)), ) assert.Equal(t, assets.NewEth(1), r.EthBalance) - assert.Equal(t, assets.NewLinkFromJuels(1), r.LinkBalance) + assert.Equal(t, relayassets.NewLinkFromJuels(1), r.LinkBalance) assert.Equal(t, utils.NewBigI(12345), r.MaxGasPriceWei) b, err := jsonapi.Marshal(r) diff --git a/core/web/presenters/eth_tx.go b/core/web/presenters/eth_tx.go index 8878733d708..2c2b5b90ff2 100644 --- a/core/web/presenters/eth_tx.go +++ b/core/web/presenters/eth_tx.go @@ -6,7 +6,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" "github.com/smartcontractkit/chainlink/v2/core/utils" ) diff --git a/core/web/presenters/eth_tx_test.go b/core/web/presenters/eth_tx_test.go index 10f4ceab006..2ed8e23c76a 100644 --- a/core/web/presenters/eth_tx_test.go +++ b/core/web/presenters/eth_tx_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/require" txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" diff --git a/core/web/presenters/job.go b/core/web/presenters/job.go index 06b9950755f..d9ec1844aea 100644 --- a/core/web/presenters/job.go +++ b/core/web/presenters/job.go @@ -7,7 +7,8 @@ import ( "github.com/lib/pq" "gopkg.in/guregu/null.v4" - "github.com/smartcontractkit/chainlink/v2/core/assets" + relayassets "github.com/smartcontractkit/chainlink-relay/pkg/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" clnull "github.com/smartcontractkit/chainlink/v2/core/null" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" @@ -43,7 +44,7 @@ const ( type DirectRequestSpec struct { ContractAddress ethkey.EIP55Address `json:"contractAddress"` MinIncomingConfirmations clnull.Uint32 `json:"minIncomingConfirmations"` - MinContractPayment *assets.Link `json:"minContractPaymentLinkJuels"` + MinContractPayment *relayassets.Link `json:"minContractPaymentLinkJuels"` Requesters models.AddressCollection `json:"requesters"` Initiator string `json:"initiator"` CreatedAt time.Time `json:"createdAt"` @@ -80,7 +81,7 @@ type FluxMonitorSpec struct { DrumbeatEnabled bool `json:"drumbeatEnabled"` DrumbeatSchedule *string `json:"drumbeatSchedule"` DrumbeatRandomDelay *string `json:"drumbeatRandomDelay"` - MinPayment *assets.Link `json:"minPayment"` + MinPayment *relayassets.Link `json:"minPayment"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` EVMChainID *utils.Big `json:"evmChainID"` diff --git a/core/web/presenters/job_test.go b/core/web/presenters/job_test.go index bb79c8e953c..46c765a38b2 100644 --- a/core/web/presenters/job_test.go +++ b/core/web/presenters/job_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" "gopkg.in/guregu/null.v4" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" clnull "github.com/smartcontractkit/chainlink/v2/core/null" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" diff --git a/core/web/resolver/bridge_test.go b/core/web/resolver/bridge_test.go index b12186e1121..e708ac92a42 100644 --- a/core/web/resolver/bridge_test.go +++ b/core/web/resolver/bridge_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/store/models" ) diff --git a/core/web/resolver/eth_key_test.go b/core/web/resolver/eth_key_test.go index a7f8ce56d9f..f8f417ca44b 100644 --- a/core/web/resolver/eth_key_test.go +++ b/core/web/resolver/eth_key_test.go @@ -9,8 +9,9 @@ import ( "github.com/pkg/errors" "github.com/stretchr/testify/mock" - "github.com/smartcontractkit/chainlink/v2/core/assets" + relayassets "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" mocks2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/mocks" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" @@ -95,7 +96,7 @@ func TestResolver_ETHKeys(t *testing.T) { f.Mocks.ethKs.On("GetStatesForKeys", keys).Return(states, nil) f.Mocks.ethKs.On("Get", keys[0].Address.Hex()).Return(keys[0], nil) f.Mocks.ethKs.On("GetAll").Return(keys, nil) - f.Mocks.ethClient.On("LINKBalance", mock.Anything, address, linkAddr).Return(assets.NewLinkFromJuels(12), nil) + f.Mocks.ethClient.On("LINKBalance", mock.Anything, address, linkAddr).Return(relayassets.NewLinkFromJuels(12), nil) f.Mocks.chain.On("Client").Return(f.Mocks.ethClient) f.Mocks.balM.On("GetEthBalance", address).Return(assets.NewEth(1)) f.Mocks.chain.On("BalanceMonitor").Return(f.Mocks.balM) @@ -300,7 +301,7 @@ func TestResolver_ETHKeys(t *testing.T) { f.Mocks.ethKs.On("Get", keys[0].Address.Hex()).Return(keys[0], nil) f.Mocks.ethKs.On("GetAll").Return(keys, nil) f.Mocks.keystore.On("Eth").Return(f.Mocks.ethKs) - f.Mocks.ethClient.On("LINKBalance", mock.Anything, address, linkAddr).Return(assets.NewLinkFromJuels(12), gError) + f.Mocks.ethClient.On("LINKBalance", mock.Anything, address, linkAddr).Return(relayassets.NewLinkFromJuels(12), gError) f.Mocks.legacyEVMChains.On("Get", states[0].EVMChainID.String()).Return(f.Mocks.chain, nil) f.Mocks.relayerChainInterops.EVMChains = f.Mocks.legacyEVMChains f.Mocks.chain.On("Client").Return(f.Mocks.ethClient) @@ -353,7 +354,7 @@ func TestResolver_ETHKeys(t *testing.T) { f.Mocks.ethKs.On("GetStatesForKeys", keys).Return(states, nil) f.Mocks.ethKs.On("Get", keys[0].Address.Hex()).Return(keys[0], nil) f.Mocks.ethKs.On("GetAll").Return(keys, nil) - f.Mocks.ethClient.On("LINKBalance", mock.Anything, address, linkAddr).Return(assets.NewLinkFromJuels(12), nil) + f.Mocks.ethClient.On("LINKBalance", mock.Anything, address, linkAddr).Return(relayassets.NewLinkFromJuels(12), nil) f.Mocks.chain.On("Client").Return(f.Mocks.ethClient) f.Mocks.chain.On("BalanceMonitor").Return(nil) f.Mocks.chain.On("Config").Return(f.Mocks.scfg) diff --git a/core/web/resolver/eth_transaction.go b/core/web/resolver/eth_transaction.go index 31a96727a9c..1292b6bc104 100644 --- a/core/web/resolver/eth_transaction.go +++ b/core/web/resolver/eth_transaction.go @@ -6,7 +6,7 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/graph-gophers/graphql-go" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" "github.com/smartcontractkit/chainlink/v2/core/utils/stringutils" "github.com/smartcontractkit/chainlink/v2/core/web/loader" diff --git a/core/web/resolver/eth_transaction_test.go b/core/web/resolver/eth_transaction_test.go index 8a1685e4f72..a719c838e81 100644 --- a/core/web/resolver/eth_transaction_test.go +++ b/core/web/resolver/eth_transaction_test.go @@ -10,7 +10,7 @@ import ( gqlerrors "github.com/graph-gophers/graphql-go/errors" txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" diff --git a/core/web/resolver/helpers.go b/core/web/resolver/helpers.go index 5c855a1c165..2dc865674e2 100644 --- a/core/web/resolver/helpers.go +++ b/core/web/resolver/helpers.go @@ -8,7 +8,7 @@ import ( "github.com/graph-gophers/graphql-go" "github.com/pkg/errors" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/utils/stringutils" ) diff --git a/core/web/resolver/mutation.go b/core/web/resolver/mutation.go index f9eee0734a3..52f914e0a84 100644 --- a/core/web/resolver/mutation.go +++ b/core/web/resolver/mutation.go @@ -13,7 +13,7 @@ import ( "go.uber.org/zap/zapcore" "gopkg.in/guregu/null.v4" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/auth" "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/logger/audit" diff --git a/core/web/resolver/spec_test.go b/core/web/resolver/spec_test.go index 8e4095e171e..fd369088bb8 100644 --- a/core/web/resolver/spec_test.go +++ b/core/web/resolver/spec_test.go @@ -9,9 +9,10 @@ import ( "github.com/stretchr/testify/require" "gopkg.in/guregu/null.v4" + relayassets "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink-relay/pkg/types" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" clnull "github.com/smartcontractkit/chainlink/v2/core/null" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" @@ -96,7 +97,7 @@ func TestResolver_DirectRequestSpec(t *testing.T) { CreatedAt: f.Timestamp(), EVMChainID: utils.NewBigI(42), MinIncomingConfirmations: clnull.NewUint32(1, true), - MinContractPayment: assets.NewLinkFromJuels(1000), + MinContractPayment: relayassets.NewLinkFromJuels(1000), Requesters: models.AddressCollection{requesterAddress}, }, }, nil) @@ -163,7 +164,7 @@ func TestResolver_FluxMonitorSpec(t *testing.T) { DrumbeatEnabled: false, IdleTimerDisabled: false, IdleTimerPeriod: time.Duration(1 * time.Hour), - MinPayment: assets.NewLinkFromJuels(1000), + MinPayment: relayassets.NewLinkFromJuels(1000), PollTimerDisabled: false, PollTimerPeriod: time.Duration(1 * time.Minute), }, @@ -232,7 +233,7 @@ func TestResolver_FluxMonitorSpec(t *testing.T) { DrumbeatSchedule: "CRON_TZ=UTC 0 0 1 1 *", IdleTimerDisabled: true, IdleTimerPeriod: time.Duration(1 * time.Hour), - MinPayment: assets.NewLinkFromJuels(1000), + MinPayment: relayassets.NewLinkFromJuels(1000), PollTimerDisabled: true, PollTimerPeriod: time.Duration(1 * time.Minute), }, diff --git a/core/web/solana_chains_controller_test.go b/core/web/solana_chains_controller_test.go index 724d5cd2c3d..c4023f166bb 100644 --- a/core/web/solana_chains_controller_test.go +++ b/core/web/solana_chains_controller_test.go @@ -11,8 +11,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + relaycfg "github.com/smartcontractkit/chainlink-relay/pkg/config" "github.com/smartcontractkit/chainlink-relay/pkg/types" - "github.com/smartcontractkit/chainlink-relay/pkg/utils" "github.com/smartcontractkit/chainlink-solana/pkg/solana/config" "github.com/smartcontractkit/chainlink-solana/pkg/solana" @@ -84,7 +84,7 @@ Nodes = [] ChainID: ptr(validId), Chain: config.Chain{ SkipPreflight: ptr(false), - TxTimeout: utils.MustNewDuration(time.Hour), + TxTimeout: relaycfg.MustNewDuration(time.Hour), }, }) @@ -114,7 +114,7 @@ func Test_SolanaChainsController_Index(t *testing.T) { chainA := &solana.TOMLConfig{ ChainID: ptr(fmt.Sprintf("ChainlinktestA-%d", rand.Int31n(999999))), Chain: config.Chain{ - TxTimeout: utils.MustNewDuration(time.Hour), + TxTimeout: relaycfg.MustNewDuration(time.Hour), }, } chainB := &solana.TOMLConfig{ diff --git a/go.mod b/go.mod index 0a85fe7f488..40803d504ce 100644 --- a/go.mod +++ b/go.mod @@ -66,7 +66,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231109141932-cb1ea9020255 - github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231113174149-046d4ddaca1a + github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231115124244-8303409abccd github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231023133638-72f4e799ab05 github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231024133459-1ef3a11319eb github.com/smartcontractkit/libocr v0.0.0-20231107151413-13e0202ae8d7 diff --git a/go.sum b/go.sum index 7fe91a6b123..52975e722a4 100644 --- a/go.sum +++ b/go.sum @@ -1465,8 +1465,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231109141932-cb1ea9020255 h1:Pt6c7bJU9wIN6PQQnmN8UmYYH6lpfiQ6U/B8yEC2s5s= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231109141932-cb1ea9020255/go.mod h1:EHppaccd/LTlTMI2o4dmBHe4BknEgEFFDjDGMNuGb3k= -github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231113174149-046d4ddaca1a h1:G/pD8uI1PULRJU8Y3eLLzjqQBp9ruG9hj+wWxtyrgTo= -github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231113174149-046d4ddaca1a/go.mod h1:M9U1JV7IQi8Sfj4JR1qSi1tIh6omgW78W/8SHN/8BUQ= +github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231115124244-8303409abccd h1:PRVJxNK67pQWufXuB1cxckH/xZkcQFDy8KjN9ZYqong= +github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231115124244-8303409abccd/go.mod h1:rOayi690YxLlkQy959PD8INhOAIAUi9LoN0G+J/CEf4= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231023133638-72f4e799ab05 h1:DaPSVnxe7oz1QJ+AVIhQWs1W3ubQvwvGo9NbHpMs1OQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231023133638-72f4e799ab05/go.mod h1:o0Pn1pbaUluboaK6/yhf8xf7TiFCkyFl6WUOdwqamuU= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231024133459-1ef3a11319eb h1:HiluOfEVGOQTM6BTDImOqYdMZZ7qq7fkZ3TJdmItNr8= diff --git a/integration-tests/actions/vrfv2plus/vrfv2plus_steps.go b/integration-tests/actions/vrfv2plus/vrfv2plus_steps.go index 28fb2635ff3..254f2ca6ce6 100644 --- a/integration-tests/actions/vrfv2plus/vrfv2plus_steps.go +++ b/integration-tests/actions/vrfv2plus/vrfv2plus_steps.go @@ -9,7 +9,8 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/utils" - "github.com/smartcontractkit/chainlink/v2/core/assets" + relayassets "github.com/smartcontractkit/chainlink-relay/pkg/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrfv2plus_wrapper_load_test_consumer" "github.com/ethereum/go-ethereum/common" @@ -868,7 +869,7 @@ func retreiveLoadTestMetrics( func LogSubDetails(l zerolog.Logger, subscription vrf_coordinator_v2_5.GetSubscription, subID *big.Int, coordinator contracts.VRFCoordinatorV2_5) { l.Debug(). Str("Coordinator", coordinator.Address()). - Str("Link Balance", (*assets.Link)(subscription.Balance).Link()). + Str("Link Balance", (*relayassets.Link)(subscription.Balance).Link()). Str("Native Token Balance", assets.FormatWei(subscription.NativeBalance)). Str("Subscription ID", subID.String()). Str("Subscription Owner", subscription.Owner.String()). @@ -971,11 +972,11 @@ func LogFulfillmentDetailsLinkBilling( randomWordsFulfilledEvent *vrf_coordinator_v2_5.VRFCoordinatorV25RandomWordsFulfilled, ) { l.Debug(). - Str("Consumer Balance Before Request (Link)", (*assets.Link)(wrapperConsumerJuelsBalanceBeforeRequest).Link()). - Str("Consumer Balance After Request (Link)", (*assets.Link)(wrapperConsumerJuelsBalanceAfterRequest).Link()). + Str("Consumer Balance Before Request (Link)", (*relayassets.Link)(wrapperConsumerJuelsBalanceBeforeRequest).Link()). + Str("Consumer Balance After Request (Link)", (*relayassets.Link)(wrapperConsumerJuelsBalanceAfterRequest).Link()). Bool("Fulfilment Status", consumerStatus.Fulfilled). - Str("Paid by Consumer Contract (Link)", (*assets.Link)(consumerStatus.Paid).Link()). - Str("Paid by Coordinator Sub (Link)", (*assets.Link)(randomWordsFulfilledEvent.Payment).Link()). + Str("Paid by Consumer Contract (Link)", (*relayassets.Link)(consumerStatus.Paid).Link()). + Str("Paid by Coordinator Sub (Link)", (*relayassets.Link)(randomWordsFulfilledEvent.Payment).Link()). Str("RequestTimestamp", consumerStatus.RequestTimestamp.String()). Str("FulfilmentTimestamp", consumerStatus.FulfilmentTimestamp.String()). Str("RequestBlockNumber", consumerStatus.RequestBlockNumber.String()). diff --git a/integration-tests/go.mod b/integration-tests/go.mod index a943e1c41a9..a450dd235ad 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -22,6 +22,7 @@ require ( github.com/scylladb/go-reflectx v1.0.1 github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 + github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231115124244-8303409abccd github.com/smartcontractkit/chainlink-testing-framework v1.18.6 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20231107151413-13e0202ae8d7 @@ -387,7 +388,6 @@ require ( github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231109141932-cb1ea9020255 // indirect - github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231113174149-046d4ddaca1a // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231023133638-72f4e799ab05 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231024133459-1ef3a11319eb // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 5719c36b5a8..f882a7bb570 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -2369,8 +2369,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231109141932-cb1ea9020255 h1:Pt6c7bJU9wIN6PQQnmN8UmYYH6lpfiQ6U/B8yEC2s5s= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231109141932-cb1ea9020255/go.mod h1:EHppaccd/LTlTMI2o4dmBHe4BknEgEFFDjDGMNuGb3k= -github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231113174149-046d4ddaca1a h1:G/pD8uI1PULRJU8Y3eLLzjqQBp9ruG9hj+wWxtyrgTo= -github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231113174149-046d4ddaca1a/go.mod h1:M9U1JV7IQi8Sfj4JR1qSi1tIh6omgW78W/8SHN/8BUQ= +github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231115124244-8303409abccd h1:PRVJxNK67pQWufXuB1cxckH/xZkcQFDy8KjN9ZYqong= +github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231115124244-8303409abccd/go.mod h1:rOayi690YxLlkQy959PD8INhOAIAUi9LoN0G+J/CEf4= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231023133638-72f4e799ab05 h1:DaPSVnxe7oz1QJ+AVIhQWs1W3ubQvwvGo9NbHpMs1OQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231023133638-72f4e799ab05/go.mod h1:o0Pn1pbaUluboaK6/yhf8xf7TiFCkyFl6WUOdwqamuU= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231024133459-1ef3a11319eb h1:HiluOfEVGOQTM6BTDImOqYdMZZ7qq7fkZ3TJdmItNr8= diff --git a/integration-tests/types/config/node/core.go b/integration-tests/types/config/node/core.go index 37047cdb667..7ddddafdd5f 100644 --- a/integration-tests/types/config/node/core.go +++ b/integration-tests/types/config/node/core.go @@ -11,8 +11,9 @@ import ( "github.com/segmentio/ksuid" + relayassets "github.com/smartcontractkit/chainlink-relay/pkg/assets" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/config/toml" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" @@ -167,7 +168,7 @@ func SetChainConfig( chainConfig = evmcfg.Chain{ AutoCreateKey: utils2.Ptr(true), FinalityDepth: utils2.Ptr[uint32](1), - MinContractPayment: assets.NewLinkFromJuels(0), + MinContractPayment: relayassets.NewLinkFromJuels(0), } } cfg.EVM = evmcfg.EVMConfigs{ @@ -193,7 +194,7 @@ func WithPrivateEVMs(networks []blockchain.EVMNetwork) NodeConfigOpt { Chain: evmcfg.Chain{ AutoCreateKey: utils2.Ptr(true), FinalityDepth: utils2.Ptr[uint32](50), - MinContractPayment: assets.NewLinkFromJuels(0), + MinContractPayment: relayassets.NewLinkFromJuels(0), LogPollInterval: models.MustNewDuration(1 * time.Second), HeadTracker: evmcfg.HeadTracker{ HistoryDepth: utils2.Ptr(uint32(100)), diff --git a/tools/flakeytests/runner_test.go b/tools/flakeytests/runner_test.go index c4509ff2cc9..31f300dcbee 100644 --- a/tools/flakeytests/runner_test.go +++ b/tools/flakeytests/runner_test.go @@ -25,7 +25,7 @@ func newMockReporter() *mockReporter { } func TestParser(t *testing.T) { - output := `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestLink","Elapsed":0} + output := `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0} ` r := strings.NewReader(output) @@ -33,14 +33,14 @@ func TestParser(t *testing.T) { require.NoError(t, err) assert.Len(t, ts, 1) - assert.Len(t, ts["github.com/smartcontractkit/chainlink/v2/core/assets"], 1) - assert.Equal(t, ts["github.com/smartcontractkit/chainlink/v2/core/assets"]["TestLink"], 1) + assert.Len(t, ts["github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"], 1) + assert.Equal(t, ts["github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"]["TestLink"], 1) } func TestParser_SkipsNonJSON(t *testing.T) { output := `Failed tests and panics: ------- -{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestLink","Elapsed":0} +{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0} ` r := strings.NewReader(output) @@ -48,13 +48,13 @@ func TestParser_SkipsNonJSON(t *testing.T) { require.NoError(t, err) assert.Len(t, ts, 1) - assert.Len(t, ts["github.com/smartcontractkit/chainlink/v2/core/assets"], 1) - assert.Equal(t, ts["github.com/smartcontractkit/chainlink/v2/core/assets"]["TestLink"], 1) + assert.Len(t, ts["github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"], 1) + assert.Equal(t, ts["github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"]["TestLink"], 1) } func TestParser_PanicDueToLogging(t *testing.T) { output := ` -{"Time":"2023-09-07T16:01:40.649849+01:00","Action":"output","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestAssets_LinkScanValue","Output":"panic: foo\n"} +{"Time":"2023-09-07T16:01:40.649849+01:00","Action":"output","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestAssets_LinkScanValue","Output":"panic: foo\n"} ` r := strings.NewReader(output) @@ -62,24 +62,24 @@ func TestParser_PanicDueToLogging(t *testing.T) { require.NoError(t, err) assert.Len(t, ts, 1) - assert.Len(t, ts["github.com/smartcontractkit/chainlink/v2/core/assets"], 1) - assert.Equal(t, ts["github.com/smartcontractkit/chainlink/v2/core/assets"]["TestAssets_LinkScanValue"], 1) + assert.Len(t, ts["github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"], 1) + assert.Equal(t, ts["github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"]["TestAssets_LinkScanValue"], 1) } func TestParser_SuccessfulOutput(t *testing.T) { output := ` -{"Time":"2023-09-07T16:22:52.556853+01:00","Action":"start","Package":"github.com/smartcontractkit/chainlink/v2/core/assets"} -{"Time":"2023-09-07T16:22:52.762353+01:00","Action":"run","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestAssets_NewLinkAndString"} -{"Time":"2023-09-07T16:22:52.762456+01:00","Action":"output","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestAssets_NewLinkAndString","Output":"=== RUN TestAssets_NewLinkAndString\n"} -{"Time":"2023-09-07T16:22:52.76249+01:00","Action":"output","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestAssets_NewLinkAndString","Output":"=== PAUSE TestAssets_NewLinkAndString\n"} -{"Time":"2023-09-07T16:22:52.7625+01:00","Action":"pause","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestAssets_NewLinkAndString"} -{"Time":"2023-09-07T16:22:52.762511+01:00","Action":"cont","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestAssets_NewLinkAndString"} -{"Time":"2023-09-07T16:22:52.762528+01:00","Action":"output","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestAssets_NewLinkAndString","Output":"=== CONT TestAssets_NewLinkAndString\n"} -{"Time":"2023-09-07T16:22:52.762546+01:00","Action":"output","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestAssets_NewLinkAndString","Output":"--- PASS: TestAssets_NewLinkAndString (0.00s)\n"} -{"Time":"2023-09-07T16:22:52.762557+01:00","Action":"pass","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestAssets_NewLinkAndString","Elapsed":0} -{"Time":"2023-09-07T16:22:52.762566+01:00","Action":"output","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Output":"PASS\n"} -{"Time":"2023-09-07T16:22:52.762955+01:00","Action":"output","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Output":"ok \tgithub.com/smartcontractkit/chainlink/v2/core/assets\t0.206s\n"} -{"Time":"2023-09-07T16:22:52.765598+01:00","Action":"pass","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Elapsed":0.209} +{"Time":"2023-09-07T16:22:52.556853+01:00","Action":"start","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"} +{"Time":"2023-09-07T16:22:52.762353+01:00","Action":"run","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestAssets_NewLinkAndString"} +{"Time":"2023-09-07T16:22:52.762456+01:00","Action":"output","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestAssets_NewLinkAndString","Output":"=== RUN TestAssets_NewLinkAndString\n"} +{"Time":"2023-09-07T16:22:52.76249+01:00","Action":"output","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestAssets_NewLinkAndString","Output":"=== PAUSE TestAssets_NewLinkAndString\n"} +{"Time":"2023-09-07T16:22:52.7625+01:00","Action":"pause","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestAssets_NewLinkAndString"} +{"Time":"2023-09-07T16:22:52.762511+01:00","Action":"cont","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestAssets_NewLinkAndString"} +{"Time":"2023-09-07T16:22:52.762528+01:00","Action":"output","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestAssets_NewLinkAndString","Output":"=== CONT TestAssets_NewLinkAndString\n"} +{"Time":"2023-09-07T16:22:52.762546+01:00","Action":"output","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestAssets_NewLinkAndString","Output":"--- PASS: TestAssets_NewLinkAndString (0.00s)\n"} +{"Time":"2023-09-07T16:22:52.762557+01:00","Action":"pass","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestAssets_NewLinkAndString","Elapsed":0} +{"Time":"2023-09-07T16:22:52.762566+01:00","Action":"output","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Output":"PASS\n"} +{"Time":"2023-09-07T16:22:52.762955+01:00","Action":"output","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Output":"ok \tgithub.com/smartcontractkit/chainlink/v2/core/assets\t0.206s\n"} +{"Time":"2023-09-07T16:22:52.765598+01:00","Action":"pass","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Elapsed":0.209} ` r := strings.NewReader(output) @@ -95,9 +95,9 @@ func (t testAdapter) test(pkg string, tests []string, out io.Writer) error { } func TestRunner_WithFlake(t *testing.T) { - initialOutput := `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestLink","Elapsed":0}` + initialOutput := `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0}` outputs := []string{ - `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestLink","Elapsed":0}`, + `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0}`, ``, } m := newMockReporter() @@ -120,18 +120,18 @@ func TestRunner_WithFlake(t *testing.T) { err := r.Run() require.NoError(t, err) assert.Len(t, m.entries, 1) - _, ok := m.entries["github.com/smartcontractkit/chainlink/v2/core/assets"]["TestLink"] + _, ok := m.entries["github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"]["TestLink"] assert.True(t, ok) } func TestRunner_WithFailedPackage(t *testing.T) { initialOutput := ` -{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestLink","Elapsed":0} -{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Elapsed":0} +{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0} +{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Elapsed":0} ` outputs := []string{` -{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestLink","Elapsed":0} -{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Elapsed":0} +{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0} +{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Elapsed":0} `, ``, } @@ -155,16 +155,16 @@ func TestRunner_WithFailedPackage(t *testing.T) { err := r.Run() require.NoError(t, err) assert.Len(t, m.entries, 1) - _, ok := m.entries["github.com/smartcontractkit/chainlink/v2/core/assets"]["TestLink"] + _, ok := m.entries["github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"]["TestLink"] assert.True(t, ok) } func TestRunner_AllFailures(t *testing.T) { - output := `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestLink","Elapsed":0}` + output := `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0}` rerunOutput := ` -{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestLink","Elapsed":0} -{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestLink","Elapsed":0} +{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0} +{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0} ` m := newMockReporter() r := &Runner{ @@ -184,11 +184,11 @@ func TestRunner_AllFailures(t *testing.T) { } func TestRunner_RerunSuccessful(t *testing.T) { - output := `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestLink","Elapsed":0}` + output := `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0}` rerunOutputs := []string{ - `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestLink","Elapsed":0}`, - `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"pass","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestLink","Elapsed":0}`, + `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0}`, + `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"pass","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0}`, } m := newMockReporter() i := 0 @@ -206,7 +206,7 @@ func TestRunner_RerunSuccessful(t *testing.T) { err := r.Run() require.NoError(t, err) - _, ok := m.entries["github.com/smartcontractkit/chainlink/v2/core/assets"]["TestLink"] + _, ok := m.entries["github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"]["TestLink"] assert.True(t, ok) } @@ -233,11 +233,11 @@ func TestRunner_RootLevelTest(t *testing.T) { } func TestRunner_RerunFailsWithNonzeroExitCode(t *testing.T) { - output := `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestLink","Elapsed":0}` + output := `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0}` rerunOutputs := []string{ - `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestLink","Elapsed":0}`, - `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"pass","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestLink","Elapsed":0}`, + `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0}`, + `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"pass","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0}`, } m := newMockReporter() i := 0 @@ -255,14 +255,14 @@ func TestRunner_RerunFailsWithNonzeroExitCode(t *testing.T) { err := r.Run() require.NoError(t, err) - _, ok := m.entries["github.com/smartcontractkit/chainlink/v2/core/assets"]["TestLink"] + _, ok := m.entries["github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"]["TestLink"] assert.True(t, ok) } func TestRunner_RerunWithNonZeroExitCodeDoesntStopCommand(t *testing.T) { outputs := []io.Reader{ strings.NewReader(` -{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestLink","Elapsed":0} +{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0} `), strings.NewReader(` {"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/services/vrf/v2","Test":"TestMaybeReservedLinkV2","Elapsed":0} @@ -270,8 +270,8 @@ func TestRunner_RerunWithNonZeroExitCodeDoesntStopCommand(t *testing.T) { } rerunOutputs := []string{ - `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestLink","Elapsed":0}`, - `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"pass","Package":"github.com/smartcontractkit/chainlink/v2/core/assets","Test":"TestLink","Elapsed":0}`, + `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0}`, + `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"pass","Package":"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets","Test":"TestLink","Elapsed":0}`, `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/services/vrf/v2","Test":"TestMaybeReservedLinkV2","Elapsed":0}`, `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/core/services/vrf/v2","Test":"TestMaybeReservedLinkV2","Elapsed":0}`, } @@ -295,7 +295,7 @@ func TestRunner_RerunWithNonZeroExitCodeDoesntStopCommand(t *testing.T) { calls := index assert.Equal(t, 4, calls) - _, ok := m.entries["github.com/smartcontractkit/chainlink/v2/core/assets"]["TestLink"] + _, ok := m.entries["github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"]["TestLink"] assert.True(t, ok) }