55 "testing"
66 "time"
77
8- "github.com/ethereum/go-ethereum/common"
98 chainselectors "github.com/smartcontractkit/chain-selectors"
109 cldf_chain "github.com/smartcontractkit/chainlink-deployments-framework/chain"
1110 "github.com/smartcontractkit/chainlink-deployments-framework/datastore"
@@ -15,6 +14,8 @@ import (
1514 mcmstypes "github.com/smartcontractkit/mcms/types"
1615 "github.com/stretchr/testify/require"
1716
17+ "github.com/smartcontractkit/cld-changesets/datastore/refkey"
18+ "github.com/smartcontractkit/cld-changesets/internal/semvers"
1819 transfertotimelock "github.com/smartcontractkit/cld-changesets/mcms/changesets/transfer-to-timelock"
1920)
2021
@@ -43,15 +44,19 @@ func testMCMSInput() *cldf.MCMSTimelockProposalInput {
4344 }
4445}
4546
47+ func testContractRef (selector uint64 ) refkey.RefKey {
48+ return refkey .New (selector , "LinkToken" , & semvers .V1_0_0 , "" )
49+ }
50+
4651func TestChangeset_VerifyPreconditions_NoDatastore (t * testing.T ) {
4752 t .Parallel ()
4853
4954 env := testEnvironment (t , nil )
5055 input := transfertotimelock.Input {
5156 MCMS : testMCMSInput (),
5257 Cfg : transfertotimelock.Config {
53- ContractsByChain : map [uint64 ][]common. Address {
54- chainselectors .TEST_90000001 .Selector : {common . HexToAddress ( "0x1" )},
58+ ContractsByChain : map [uint64 ][]refkey. RefKey {
59+ chainselectors .TEST_90000001 .Selector : {testContractRef ( chainselectors . TEST_90000001 . Selector )},
5560 },
5661 },
5762 }
@@ -66,8 +71,8 @@ func TestChangeset_VerifyPreconditions_NoMCMSInput(t *testing.T) {
6671 env := testEnvironment (t , datastore .NewMemoryDataStore ().Seal ())
6772 input := transfertotimelock.Input {
6873 Cfg : transfertotimelock.Config {
69- ContractsByChain : map [uint64 ][]common. Address {
70- chainselectors .TEST_90000001 .Selector : {common . HexToAddress ( "0x1" )},
74+ ContractsByChain : map [uint64 ][]refkey. RefKey {
75+ chainselectors .TEST_90000001 .Selector : {testContractRef ( chainselectors . TEST_90000001 . Selector )},
7176 },
7277 },
7378 }
@@ -96,7 +101,7 @@ func TestChangeset_VerifyPreconditions_EmptyContractsForChain(t *testing.T) {
96101 input := transfertotimelock.Input {
97102 MCMS : testMCMSInput (),
98103 Cfg : transfertotimelock.Config {
99- ContractsByChain : map [uint64 ][]common. Address {
104+ ContractsByChain : map [uint64 ][]refkey. RefKey {
100105 selector : {},
101106 },
102107 },
@@ -114,8 +119,8 @@ func TestChangeset_VerifyPreconditions_UnsupportedChainFamily(t *testing.T) {
114119 input := transfertotimelock.Input {
115120 MCMS : testMCMSInput (),
116121 Cfg : transfertotimelock.Config {
117- ContractsByChain : map [uint64 ][]common. Address {
118- selector : {common . HexToAddress ( "0x1" )},
122+ ContractsByChain : map [uint64 ][]refkey. RefKey {
123+ selector : {testContractRef ( selector )},
119124 },
120125 },
121126 }
@@ -130,8 +135,8 @@ func TestChangeset_Apply_NoMCMSInput(t *testing.T) {
130135 env := testEnvironment (t , datastore .NewMemoryDataStore ().Seal ())
131136 input := transfertotimelock.Input {
132137 Cfg : transfertotimelock.Config {
133- ContractsByChain : map [uint64 ][]common. Address {
134- chainselectors .TEST_90000001 .Selector : {common . HexToAddress ( "0x1" )},
138+ ContractsByChain : map [uint64 ][]refkey. RefKey {
139+ chainselectors .TEST_90000001 .Selector : {testContractRef ( chainselectors . TEST_90000001 . Selector )},
135140 },
136141 },
137142 }
0 commit comments