@@ -3,7 +3,6 @@ package sequences
33import (
44 "fmt"
55
6- "github.com/Masterminds/semver/v3"
76 "github.com/ethereum/go-ethereum/common"
87 "github.com/smartcontractkit/chainlink-deployments-framework/chain/evm"
98 "github.com/smartcontractkit/chainlink-deployments-framework/datastore"
@@ -26,7 +25,7 @@ type ConfigureRMNCurseAdminsInput struct {
2625// ConfigureRMNCurseAdmins applies authorized caller (curse admin) updates to an already-deployed RMN contract.
2726var ConfigureRMNCurseAdmins = cldf_ops .NewSequence (
2827 "configure-rmn-curse-admins" ,
29- semver . MustParse ( "1.0.0" ) ,
28+ rmnops . Version ,
3029 "Applies authorized caller (curse admin) updates to the RMN contract" ,
3130 func (b cldf_ops.Bundle , chain evm.Chain , input ConfigureRMNCurseAdminsInput ) (output sequences.OnChainOutput , err error ) {
3231 if input .ChainSelector != chain .Selector {
@@ -66,7 +65,7 @@ type DeployRMNInput struct {
6665// DeployRMN deploys a new RMN contract or returns the existing address from the datastore.
6766var DeployRMN = cldf_ops .NewSequence (
6867 "deploy-rmn" ,
69- semver . MustParse ( "1.0.0" ) ,
68+ rmnops . Version ,
7069 "Deploys the RMN (curse / IRMN) contract" ,
7170 func (b cldf_ops.Bundle , chain evm.Chain , input DeployRMNInput ) (output sequences.OnChainOutput , err error ) {
7271 if input .ChainSelector != chain .Selector {
@@ -89,3 +88,57 @@ var DeployRMN = cldf_ops.NewSequence(
8988 return output , nil
9089 },
9190)
91+
92+ // SeqCurseInput holds the parameters for cursing one or more subjects on an RMN v2.1.0 contract.
93+ type SeqCurseInput struct {
94+ RMNAddress common.Address
95+ Subjects [][16 ]byte
96+ }
97+
98+ // SeqUncurseInput holds the parameters for uncursing one or more subjects on an RMN v2.1.0 contract.
99+ type SeqUncurseInput struct {
100+ RMNAddress common.Address
101+ Subjects [][16 ]byte
102+ }
103+
104+ // RmnCurse curses one or more subjects on an RMN v2.1.0 contract.
105+ var RmnCurse = cldf_ops .NewSequence (
106+ "rmn-curse" ,
107+ rmnops .Version ,
108+ "Cursing subjects with RMN" ,
109+ func (b cldf_ops.Bundle , chain evm.Chain , in SeqCurseInput ) (output sequences.OnChainOutput , err error ) {
110+ opOutput , err := cldf_ops .ExecuteOperation (b , rmnops .Curse0 , chain , contract.FunctionInput [[][16 ]byte ]{
111+ Address : in .RMNAddress ,
112+ ChainSelector : chain .Selector ,
113+ Args : in .Subjects ,
114+ })
115+ if err != nil {
116+ return sequences.OnChainOutput {}, fmt .Errorf ("failed to curse with RMN at %s on chain %d: %w" , in .RMNAddress .String (), chain .Selector , err )
117+ }
118+ batchOp , err := contract .NewBatchOperationFromWrites ([]contract.WriteOutput {opOutput .Output })
119+ if err != nil {
120+ return sequences.OnChainOutput {}, fmt .Errorf ("failed to create batch operation from writes: %w" , err )
121+ }
122+ return sequences.OnChainOutput {BatchOps : []mcms_types.BatchOperation {batchOp }}, nil
123+ })
124+
125+ // RmnUncurse uncurses one or more subjects on an RMN v2.1.0 contract.
126+ var RmnUncurse = cldf_ops .NewSequence (
127+ "rmn-uncurse" ,
128+ rmnops .Version ,
129+ "Uncursing subjects with RMN" ,
130+ func (b cldf_ops.Bundle , chain evm.Chain , in SeqUncurseInput ) (output sequences.OnChainOutput , err error ) {
131+ opOutput , err := cldf_ops .ExecuteOperation (b , rmnops .Uncurse0 , chain , contract.FunctionInput [[][16 ]byte ]{
132+ Address : in .RMNAddress ,
133+ ChainSelector : chain .Selector ,
134+ Args : in .Subjects ,
135+ })
136+ if err != nil {
137+ return sequences.OnChainOutput {}, fmt .Errorf ("failed to uncurse with RMN at %s on chain %d: %w" , in .RMNAddress .String (), chain .Selector , err )
138+ }
139+ batchOp , err := contract .NewBatchOperationFromWrites ([]contract.WriteOutput {opOutput .Output })
140+ if err != nil {
141+ return sequences.OnChainOutput {}, fmt .Errorf ("failed to create batch operation from writes: %w" , err )
142+ }
143+ return sequences.OnChainOutput {BatchOps : []mcms_types.BatchOperation {batchOp }}, nil
144+ })
0 commit comments