Skip to content

Commit fa44a6e

Browse files
committed
add deployment
1 parent a92e775 commit fa44a6e

File tree

7 files changed

+266
-3
lines changed

7 files changed

+266
-3
lines changed

ccv/chains/evm/deployment/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/ethereum/go-ethereum v1.16.8
1111
github.com/smartcontractkit/chain-selectors v1.0.89
1212
github.com/smartcontractkit/chainlink-ccip v0.1.1-solana.0.20260206181544-f1613c67d071
13-
github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm v0.0.0-20260206181544-f1613c67d071
13+
github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm v0.0.0-20260207103925-a92e7750e174
1414
github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment v0.0.0-20260206181544-f1613c67d071
1515
github.com/smartcontractkit/chainlink-ccip/deployment v0.0.0-20260206181544-f1613c67d071
1616
github.com/smartcontractkit/chainlink-common v0.9.6-0.20260114142648-bd9e1b483e96

ccv/chains/evm/deployment/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,8 +680,8 @@ github.com/smartcontractkit/chainlink-aptos v0.0.0-20251024142440-51f2ad2652a2 h
680680
github.com/smartcontractkit/chainlink-aptos v0.0.0-20251024142440-51f2ad2652a2/go.mod h1:iteU0WORHkArACVh/HoY/1bipV4TcNcJdTmom9uIT0E=
681681
github.com/smartcontractkit/chainlink-ccip v0.1.1-solana.0.20260206181544-f1613c67d071 h1:2VnRpQ48kh67blhCjgkx1xJ5dLiY5gj0XN73s2UeZbM=
682682
github.com/smartcontractkit/chainlink-ccip v0.1.1-solana.0.20260206181544-f1613c67d071/go.mod h1:ZtZ+wtqU9JsJEmbiCsavVVEbhywpgMF7q/IpD9Eaq48=
683-
github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm v0.0.0-20260206181544-f1613c67d071 h1:64bvvq3x6F8sJD57B8fLFvaVTOSieEiTMqod2Nwo/ZU=
684-
github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm v0.0.0-20260206181544-f1613c67d071/go.mod h1:Gl35ExaFLinqVhp50+Yq1GnMuHb3fnDtZUFPCtcfV3M=
683+
github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm v0.0.0-20260207103925-a92e7750e174 h1:FtXuw9ruR0nTEQcEelKFh7U6MLOKBvwaVrrU2pbQhDg=
684+
github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm v0.0.0-20260207103925-a92e7750e174/go.mod h1:Gl35ExaFLinqVhp50+Yq1GnMuHb3fnDtZUFPCtcfV3M=
685685
github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment v0.0.0-20260206181544-f1613c67d071 h1:HbJ2HN7lL/eeYJXVYNpfE9uXW3BJ5r9dwA9Tbdv2AtU=
686686
github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment v0.0.0-20260206181544-f1613c67d071/go.mod h1:35R2jCvDmWdLe38d/23mdJ3D9lb1jzsvkb4g0JsFPCM=
687687
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20260121163256-85accaf3d28d h1:xdFpzbApEMz4Rojg2Y2OjFlrh0wu7eB10V2tSZGW5y8=
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package changesets
2+
3+
import (
4+
"github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm/deployment/v1_7_0/sequences"
5+
evm_sequences "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/utils/sequences"
6+
"github.com/smartcontractkit/chainlink-ccip/deployment/utils/changesets"
7+
"github.com/smartcontractkit/chainlink-deployments-framework/chain/evm"
8+
"github.com/smartcontractkit/chainlink-deployments-framework/datastore"
9+
cldf_deployment "github.com/smartcontractkit/chainlink-deployments-framework/deployment"
10+
)
11+
12+
type DeployAdvancedPoolHooksExtractorCfg struct {
13+
ChainSel uint64
14+
}
15+
16+
func (c DeployAdvancedPoolHooksExtractorCfg) ChainSelector() uint64 {
17+
return c.ChainSel
18+
}
19+
20+
var DeployAdvancedPoolHooksExtractor = changesets.NewFromOnChainSequence(changesets.NewFromOnChainSequenceParams[
21+
sequences.DeployAdvancedPoolHooksExtractorInput,
22+
evm.Chain,
23+
DeployAdvancedPoolHooksExtractorCfg,
24+
]{
25+
Sequence: sequences.DeployAdvancedPoolHooksExtractor,
26+
ResolveInput: func(e cldf_deployment.Environment, cfg DeployAdvancedPoolHooksExtractorCfg) (sequences.DeployAdvancedPoolHooksExtractorInput, error) {
27+
addresses := e.DataStore.Addresses().Filter(datastore.AddressRefByChainSelector(cfg.ChainSel))
28+
return sequences.DeployAdvancedPoolHooksExtractorInput{
29+
ChainSelector: cfg.ChainSel,
30+
ExistingAddresses: addresses,
31+
}, nil
32+
},
33+
ResolveDep: evm_sequences.ResolveEVMChainDep[DeployAdvancedPoolHooksExtractorCfg],
34+
})
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package changesets_test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm/deployment/v1_7_0/changesets"
7+
"github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm/deployment/v1_7_0/operations/advanced_pool_hooks_extractor"
8+
cs_core "github.com/smartcontractkit/chainlink-ccip/deployment/utils/changesets"
9+
"github.com/smartcontractkit/chainlink-ccip/deployment/utils/mcms"
10+
"github.com/smartcontractkit/chainlink-deployments-framework/datastore"
11+
"github.com/smartcontractkit/chainlink-deployments-framework/engine/test/environment"
12+
"github.com/stretchr/testify/require"
13+
)
14+
15+
func TestDeployAdvancedPoolHooksExtractor_VerifyPreconditions(t *testing.T) {
16+
chainSelector := uint64(5009297550715157269)
17+
e, err := environment.New(t.Context(),
18+
environment.WithEVMSimulated(t, []uint64{chainSelector}),
19+
)
20+
require.NoError(t, err)
21+
require.NotNil(t, e)
22+
e.DataStore = datastore.NewMemoryDataStore().Seal()
23+
24+
mcmsRegistry := cs_core.GetRegistry()
25+
err = changesets.DeployAdvancedPoolHooksExtractor(mcmsRegistry).VerifyPreconditions(*e, cs_core.WithMCMS[changesets.DeployAdvancedPoolHooksExtractorCfg]{
26+
MCMS: mcms.Input{},
27+
Cfg: changesets.DeployAdvancedPoolHooksExtractorCfg{
28+
ChainSel: chainSelector,
29+
},
30+
})
31+
require.NoError(t, err)
32+
}
33+
34+
func TestDeployAdvancedPoolHooksExtractor_Apply(t *testing.T) {
35+
chainSelector := uint64(5009297550715157269)
36+
e, err := environment.New(t.Context(),
37+
environment.WithEVMSimulated(t, []uint64{chainSelector}),
38+
)
39+
require.NoError(t, err)
40+
require.NotNil(t, e)
41+
e.DataStore = datastore.NewMemoryDataStore().Seal()
42+
43+
mcmsRegistry := cs_core.GetRegistry()
44+
out, err := changesets.DeployAdvancedPoolHooksExtractor(mcmsRegistry).Apply(*e, cs_core.WithMCMS[changesets.DeployAdvancedPoolHooksExtractorCfg]{
45+
MCMS: mcms.Input{},
46+
Cfg: changesets.DeployAdvancedPoolHooksExtractorCfg{
47+
ChainSel: chainSelector,
48+
},
49+
})
50+
require.NoError(t, err)
51+
52+
addrs, err := out.DataStore.Addresses().Fetch()
53+
require.NoError(t, err)
54+
require.Len(t, addrs, 1)
55+
require.Equal(t, datastore.ContractType(advanced_pool_hooks_extractor.ContractType), addrs[0].Type)
56+
require.Equal(t, advanced_pool_hooks_extractor.Version.String(), addrs[0].Version.String())
57+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package advanced_pool_hooks_extractor
2+
3+
import (
4+
"github.com/Masterminds/semver/v3"
5+
"github.com/ethereum/go-ethereum/common"
6+
"github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm/gobindings/generated/latest/advanced_pool_hooks_extractor"
7+
"github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/utils/operations/contract"
8+
cldf_deployment "github.com/smartcontractkit/chainlink-deployments-framework/deployment"
9+
)
10+
11+
var ContractType cldf_deployment.ContractType = "AdvancedPoolHooksExtractor"
12+
13+
var Version = semver.MustParse("2.0.0")
14+
15+
type ConstructorArgs struct{}
16+
17+
var Deploy = contract.NewDeploy(contract.DeployParams[ConstructorArgs]{
18+
Name: "advanced-pool-hooks-extractor:deploy",
19+
Version: Version,
20+
Description: "Deploys the AdvancedPoolHooksExtractor contract",
21+
ContractMetadata: advanced_pool_hooks_extractor.AdvancedPoolHooksExtractorMetaData,
22+
BytecodeByTypeAndVersion: map[string]contract.Bytecode{
23+
cldf_deployment.NewTypeAndVersion(ContractType, *Version).String(): {
24+
EVM: common.FromHex(advanced_pool_hooks_extractor.AdvancedPoolHooksExtractorBin),
25+
},
26+
},
27+
Validate: func(ConstructorArgs) error { return nil },
28+
})
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package sequences
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/Masterminds/semver/v3"
7+
"github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm/deployment/v1_7_0/operations/advanced_pool_hooks_extractor"
8+
contract_utils "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/utils/operations/contract"
9+
"github.com/smartcontractkit/chainlink-ccip/deployment/utils/sequences"
10+
"github.com/smartcontractkit/chainlink-deployments-framework/chain/evm"
11+
"github.com/smartcontractkit/chainlink-deployments-framework/datastore"
12+
"github.com/smartcontractkit/chainlink-deployments-framework/deployment"
13+
cldf_ops "github.com/smartcontractkit/chainlink-deployments-framework/operations"
14+
)
15+
16+
type DeployAdvancedPoolHooksExtractorInput struct {
17+
ChainSelector uint64
18+
ExistingAddresses []datastore.AddressRef
19+
}
20+
21+
var DeployAdvancedPoolHooksExtractor = cldf_ops.NewSequence(
22+
"deploy-advanced-pool-hooks-extractor",
23+
semver.MustParse("1.7.0"),
24+
"Deploys the AdvancedPoolHooksExtractor contract",
25+
func(b cldf_ops.Bundle, chain evm.Chain, input DeployAdvancedPoolHooksExtractorInput) (sequences.OnChainOutput, error) {
26+
ref, err := contract_utils.MaybeDeployContract(b, advanced_pool_hooks_extractor.Deploy, chain, contract_utils.DeployInput[advanced_pool_hooks_extractor.ConstructorArgs]{
27+
TypeAndVersion: deployment.NewTypeAndVersion(advanced_pool_hooks_extractor.ContractType, *advanced_pool_hooks_extractor.Version),
28+
ChainSelector: chain.Selector,
29+
Args: advanced_pool_hooks_extractor.ConstructorArgs{},
30+
}, input.ExistingAddresses)
31+
if err != nil {
32+
return sequences.OnChainOutput{}, fmt.Errorf("failed to deploy AdvancedPoolHooksExtractor: %w", err)
33+
}
34+
35+
return sequences.OnChainOutput{
36+
Addresses: []datastore.AddressRef{ref},
37+
}, nil
38+
},
39+
)
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
package sequences_test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm/deployment/v1_7_0/operations/advanced_pool_hooks_extractor"
7+
"github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm/deployment/v1_7_0/sequences"
8+
"github.com/smartcontractkit/chainlink-deployments-framework/datastore"
9+
"github.com/smartcontractkit/chainlink-deployments-framework/engine/test/environment"
10+
"github.com/smartcontractkit/chainlink-deployments-framework/operations"
11+
"github.com/stretchr/testify/require"
12+
)
13+
14+
func TestDeployAdvancedPoolHooksExtractor(t *testing.T) {
15+
chainSelector := uint64(5009297550715157269)
16+
e, err := environment.New(t.Context(),
17+
environment.WithEVMSimulated(t, []uint64{chainSelector}),
18+
)
19+
require.NoError(t, err)
20+
require.NotNil(t, e)
21+
22+
report, err := operations.ExecuteSequence(
23+
e.OperationsBundle,
24+
sequences.DeployAdvancedPoolHooksExtractor,
25+
e.BlockChains.EVMChains()[chainSelector],
26+
sequences.DeployAdvancedPoolHooksExtractorInput{
27+
ChainSelector: chainSelector,
28+
},
29+
)
30+
require.NoError(t, err)
31+
require.Len(t, report.Output.Addresses, 1)
32+
33+
ref := report.Output.Addresses[0]
34+
require.Equal(t, datastore.ContractType(advanced_pool_hooks_extractor.ContractType), ref.Type)
35+
require.Equal(t, advanced_pool_hooks_extractor.Version.String(), ref.Version.String())
36+
require.Equal(t, chainSelector, ref.ChainSelector)
37+
require.NotEmpty(t, ref.Address)
38+
}
39+
40+
func TestDeployAdvancedPoolHooksExtractor_Idempotency(t *testing.T) {
41+
chainSelector := uint64(5009297550715157269)
42+
e, err := environment.New(t.Context(),
43+
environment.WithEVMSimulated(t, []uint64{chainSelector}),
44+
)
45+
require.NoError(t, err)
46+
require.NotNil(t, e)
47+
48+
report1, err := operations.ExecuteSequence(
49+
e.OperationsBundle,
50+
sequences.DeployAdvancedPoolHooksExtractor,
51+
e.BlockChains.EVMChains()[chainSelector],
52+
sequences.DeployAdvancedPoolHooksExtractorInput{
53+
ChainSelector: chainSelector,
54+
},
55+
)
56+
require.NoError(t, err)
57+
require.Len(t, report1.Output.Addresses, 1)
58+
59+
// Run again with the deployed address as existing
60+
report2, err := operations.ExecuteSequence(
61+
e.OperationsBundle,
62+
sequences.DeployAdvancedPoolHooksExtractor,
63+
e.BlockChains.EVMChains()[chainSelector],
64+
sequences.DeployAdvancedPoolHooksExtractorInput{
65+
ChainSelector: chainSelector,
66+
ExistingAddresses: report1.Output.Addresses,
67+
},
68+
)
69+
require.NoError(t, err)
70+
require.Len(t, report2.Output.Addresses, 1)
71+
72+
require.Equal(t, report1.Output.Addresses[0].Address, report2.Output.Addresses[0].Address)
73+
require.Equal(t, report1.Output.Addresses[0].Type, report2.Output.Addresses[0].Type)
74+
require.Equal(t, report1.Output.Addresses[0].Version.String(), report2.Output.Addresses[0].Version.String())
75+
}
76+
77+
func TestDeployAdvancedPoolHooksExtractor_MultipleChains(t *testing.T) {
78+
chainSelectors := []uint64{5009297550715157269, 4949039107694359620}
79+
e, err := environment.New(t.Context(),
80+
environment.WithEVMSimulated(t, chainSelectors),
81+
)
82+
require.NoError(t, err)
83+
require.NotNil(t, e)
84+
85+
addresses := make(map[uint64]string)
86+
for _, sel := range chainSelectors {
87+
report, err := operations.ExecuteSequence(
88+
e.OperationsBundle,
89+
sequences.DeployAdvancedPoolHooksExtractor,
90+
e.BlockChains.EVMChains()[sel],
91+
sequences.DeployAdvancedPoolHooksExtractorInput{
92+
ChainSelector: sel,
93+
},
94+
)
95+
require.NoError(t, err)
96+
require.Len(t, report.Output.Addresses, 1)
97+
98+
ref := report.Output.Addresses[0]
99+
require.Equal(t, datastore.ContractType(advanced_pool_hooks_extractor.ContractType), ref.Type)
100+
addresses[sel] = ref.Address
101+
}
102+
103+
require.Len(t, addresses, len(chainSelectors))
104+
require.NotEqual(t, addresses[chainSelectors[0]], addresses[chainSelectors[1]])
105+
}

0 commit comments

Comments
 (0)