Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions deployment/ops/ccip_router/op_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,18 +177,40 @@ var setOnRampsHandler = func(b cld_ops.Bundle, deps sui_ops.OpTxDeps, input SetO
return sui_ops.OpTxResult[SetOnRampsObjects]{}, err
}

opts := deps.GetCallOpts()
opts.Signer = deps.Signer
tx, err := routerPackage.SetOnRamps(
b.GetContext(),
opts,
encodedCall, err := routerPackage.Encoder().SetOnRamps(
bind.Object{Id: input.OwnerCapObjectId},
bind.Object{Id: input.RouterStateObjectId},
input.DestChainSelectors,
input.OnRampAddresses,
)
if err != nil {
return sui_ops.OpTxResult[SetOnRampsObjects]{}, fmt.Errorf("failed to execute set_on_ramps: %w", err)
return sui_ops.OpTxResult[SetOnRampsObjects]{}, fmt.Errorf("failed to encode SetOnRamps call: %w", err)
}
call, err := sui_ops.ToTransactionCall(encodedCall, input.RouterStateObjectId)
if err != nil {
return sui_ops.OpTxResult[SetOnRampsObjects]{}, fmt.Errorf("failed to convert encoded call to TransactionCall: %w", err)
}
if deps.Signer == nil {
b.Logger.Infow("Skipping execution of SetOnRamps on Router as per no Signer provided",
"destChainSelectors", input.DestChainSelectors,
"onRampAddresses", input.OnRampAddresses)
return sui_ops.OpTxResult[SetOnRampsObjects]{
Digest: "",
PackageId: input.RouterPackageId,
Objects: SetOnRampsObjects{},
Call: call,
}, nil
}

opts := deps.GetCallOpts()
opts.Signer = deps.Signer
tx, err := routerPackage.Bound().ExecuteTransaction(
b.GetContext(),
opts,
encodedCall,
)
if err != nil {
return sui_ops.OpTxResult[SetOnRampsObjects]{}, fmt.Errorf("failed to execute SetOnRamps on Router: %w", err)
}

b.Logger.Infow("On-ramps set successfully",
Expand All @@ -199,6 +221,7 @@ var setOnRampsHandler = func(b cld_ops.Bundle, deps sui_ops.OpTxDeps, input SetO
Digest: tx.Digest,
PackageId: input.RouterPackageId,
Objects: SetOnRampsObjects{},
Call: call,
}, nil
}

Expand Down
Loading