adapters

package
v0.0.0-...-67263d3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigureLaneLegAsDest = cldf_ops.NewSequence(
	"aptos/sequences/ccip/tooling-api/configure-lane-leg-as-dest",
	semver.MustParse("1.6.0"),
	"Configures lane leg as dest on CCIP 1.6.0",
	func(b cldf_ops.Bundle, chains cldf_chain.BlockChains, input lanes.UpdateLanesInput) (sequences.OnChainOutput, error) {
		chainSelector := input.Dest.Selector
		chain := chains.AptosChains()[chainSelector]
		deps := buildAptosDeps(chain, chainSelector, input.Dest.OffRamp)

		var result sequences.OnChainOutput
		isEnabled := !input.IsDisabled

		offRampReport, err := cldf_ops.ExecuteOperation(b, operation.UpdateOffRampSourcesOp, deps, operation.UpdateOffRampSourcesInput{
			Updates: map[uint64]v1_6.OffRampSourceUpdate{
				input.Source.Selector: {
					IsEnabled:                 isEnabled,
					TestRouter:                input.TestRouter,
					IsRMNVerificationDisabled: !input.Source.RMNVerificationEnabled,
				},
			},
		})
		if err != nil {
			return sequences.OnChainOutput{}, fmt.Errorf("update offramp sources: %w", err)
		}
		appendBatchOp(&result, chainSelector, offRampReport.Output)

		return result, nil
	},
)
View Source
var ConfigureLaneLegAsSource = cldf_ops.NewSequence(
	"aptos/sequences/ccip/tooling-api/configure-lane-leg-as-source",
	semver.MustParse("1.6.0"),
	"Configures lane leg as source on CCIP 1.6.0",
	func(b cldf_ops.Bundle, chains cldf_chain.BlockChains, input lanes.UpdateLanesInput) (sequences.OnChainOutput, error) {
		chainSelector := input.Source.Selector
		chain := chains.AptosChains()[chainSelector]
		deps := buildAptosDeps(chain, chainSelector, input.Source.OnRamp)

		var result sequences.OnChainOutput
		isEnabled := !input.IsDisabled

		fqReport, err := cldf_ops.ExecuteOperation(b, operation.UpdateFeeQuoterDestsOp, deps, operation.UpdateFeeQuoterDestsInput{
			Updates: map[uint64]aptos_fee_quoter.DestChainConfig{
				input.Dest.Selector: v1_6.ToAptosFeeQuoterDestChainConfig(input.Dest.FeeQuoterDestChainConfig),
			},
		})
		if err != nil {
			return sequences.OnChainOutput{}, fmt.Errorf("update fee quoter dests: %w", err)
		}
		appendBatchOp(&result, chainSelector, fqReport.Output)

		onRampReport, err := cldf_ops.ExecuteOperation(b, operation.UpdateOnRampDestsOp, deps, operation.UpdateOnRampDestsInput{
			Updates: map[uint64]v1_6.OnRampDestinationUpdate{
				input.Dest.Selector: {
					IsEnabled:        isEnabled,
					TestRouter:       input.TestRouter,
					AllowListEnabled: input.Dest.AllowListEnabled,
				},
			},
		})
		if err != nil {
			return sequences.OnChainOutput{}, fmt.Errorf("update onramp dests: %w", err)
		}
		appendBatchOp(&result, chainSelector, onRampReport.Output)

		if err := appendApplyAllowedOfframpUpdates(b, &result, chainSelector, deps); err != nil {
			return sequences.OnChainOutput{}, err
		}

		priceReport, err := cldf_ops.ExecuteOperation(b, operation.UpdateFeeQuoterPricesOp, deps, operation.UpdateFeeQuoterPricesInput{
			TokenPrices: input.Source.TokenPrices,
			GasPrices: map[uint64]*big.Int{
				input.Dest.Selector: input.Dest.GasPrice,
			},
		})
		if err != nil {
			return sequences.OnChainOutput{}, fmt.Errorf("update fee quoter prices: %w", err)
		}
		appendBatchOp(&result, chainSelector, priceReport.Output)

		onRampVersion := input.ExtraConfigs.OnRampVersion
		if onRampVersion == nil {
			onRampVersion = []byte{1, 6, 0}
		}
		routerReport, err := cldf_ops.ExecuteOperation(b, operation.UpdateRouterOp, deps, operation.UpdateRouterDestInput{
			Updates: []aptos_router.OnRampSet{{
				DestChainSelector: input.Dest.Selector,
				OnRampVersion:     onRampVersion,
			}},
		})
		if err != nil {
			return sequences.OnChainOutput{}, fmt.Errorf("update router: %w", err)
		}
		appendBatchOp(&result, chainSelector, []mcmstypes.Transaction{routerReport.Output})

		return result, nil
	},
)
View Source
var SetOCR3Config = cldf_ops.NewSequence(
	"aptos/sequences/ccip/tooling-api/set-ocr3-config",
	semver.MustParse("1.6.0"),
	"Set OCR3 Config on Aptos chains",
	func(b cldf_ops.Bundle, chains cldf_chain.BlockChains, input deployops.SetOCR3ConfigInput) (sequences.OnChainOutput, error) {
		chainSelector := input.ChainSelector
		chain := chains.AptosChains()[chainSelector]

		ccipBytes, err := getCCIPAccountBytes(input.Datastore, chainSelector)
		if err != nil {
			return sequences.OnChainOutput{}, fmt.Errorf("get ccip address: %w", err)
		}
		deps := buildAptosDeps(chain, chainSelector, ccipBytes)

		var result sequences.OnChainOutput
		for pluginType, cfg := range input.Configs {
			report, err := cldf_ops.ExecuteOperation(b, operation.SetOcr3ConfigOp, deps, operation.SetOcr3ConfigInput{
				OcrPluginType: uint8(pluginType),
				OCRConfigArgs: intoOCRArgs(cfg),
			})
			if err != nil {
				return sequences.OnChainOutput{}, fmt.Errorf("set ocr3 config for plugin %d: %w", pluginType, err)
			}
			appendBatchOp(&result, chainSelector, []mcmstypes.Transaction{report.Output})
		}

		return result, nil
	},
)

Functions

This section is empty.

Types

type AptosAdapter

type AptosAdapter struct{}

AptosAdapter implements deploy.Deployer for Aptos chains. Aptos initial deploy stays on DeployAptosChain changeset; tooling deploy adapter methods other than SetOCR3Config are stubs until a later migration.

type AptosCurseMCMSReader

type AptosCurseMCMSReader struct{}

AptosCurseMCMSReader implements changesets.MCMSReader for the Aptos CurseMCMS contract. It is not registered as the family reader; DeployCurseMCMS builds proposals directly. Kept for callers that need curse-MCMS metadata explicitly.

func (*AptosCurseMCMSReader) GetChainMetadata

func (r *AptosCurseMCMSReader) GetChainMetadata(e deployment.Environment, chainSelector uint64, input mcms_utils.Input) (mcmstypes.ChainMetadata, error)

func (*AptosCurseMCMSReader) GetMCMSRef

func (r *AptosCurseMCMSReader) GetMCMSRef(e deployment.Environment, chainSelector uint64, input mcms_utils.Input) (datastore.AddressRef, error)

func (*AptosCurseMCMSReader) GetTimelockRef

func (r *AptosCurseMCMSReader) GetTimelockRef(e deployment.Environment, chainSelector uint64, input mcms_utils.Input) (datastore.AddressRef, error)

type AptosLaneAdapter

type AptosLaneAdapter struct{}

AptosLaneAdapter implements lanes.LaneAdapter for Aptos chains.

func (*AptosLaneAdapter) GetChainFamilySelector

func (a *AptosLaneAdapter) GetChainFamilySelector() [4]byte

func (*AptosLaneAdapter) GetDefaultGasPrice

func (a *AptosLaneAdapter) GetDefaultGasPrice() *big.Int

func (*AptosLaneAdapter) GetFQAddress

func (a *AptosLaneAdapter) GetFQAddress(ds datastore.DataStore, chainSelector uint64) ([]byte, error)

func (*AptosLaneAdapter) GetFeeQuoterDestChainConfig

func (a *AptosLaneAdapter) GetFeeQuoterDestChainConfig() lanes.FeeQuoterDestChainConfig

func (*AptosLaneAdapter) GetOffRampAddress

func (a *AptosLaneAdapter) GetOffRampAddress(ds datastore.DataStore, chainSelector uint64) ([]byte, error)

func (*AptosLaneAdapter) GetOnRampAddress

func (a *AptosLaneAdapter) GetOnRampAddress(ds datastore.DataStore, chainSelector uint64) ([]byte, error)

Aptos CCIP uses a single on-chain module account for OnRamp, OffRamp, Router, and FeeQuoter.

func (*AptosLaneAdapter) GetRouterAddress

func (a *AptosLaneAdapter) GetRouterAddress(ds datastore.DataStore, chainSelector uint64) ([]byte, error)

type AptosMCMSReader

type AptosMCMSReader struct{}

AptosMCMSReader implements changesets.MCMSReader for the Aptos family using the regular CCIP MCMS contract deployed by DeployAptosChain.

func (*AptosMCMSReader) GetChainMetadata

func (r *AptosMCMSReader) GetChainMetadata(e deployment.Environment, chainSelector uint64, input mcms_utils.Input) (mcmstypes.ChainMetadata, error)

func (*AptosMCMSReader) GetMCMSRef

func (r *AptosMCMSReader) GetMCMSRef(e deployment.Environment, chainSelector uint64, _ mcms_utils.Input) (datastore.AddressRef, error)

func (*AptosMCMSReader) GetTimelockRef

func (r *AptosMCMSReader) GetTimelockRef(e deployment.Environment, chainSelector uint64, _ mcms_utils.Input) (datastore.AddressRef, error)

type CurseAdapter

type CurseAdapter struct {
	CCIPAddress aptos.AccountAddress
}

func NewCurseAdapter

func NewCurseAdapter() *CurseAdapter

func (*CurseAdapter) Curse

Curse returns the sequence to curse multiple subjects on Aptos chain

func (*CurseAdapter) DeriveCurseAdapterVersion

func (c *CurseAdapter) DeriveCurseAdapterVersion(e cldf.Environment, selector uint64) (*semver.Version, error)

func (*CurseAdapter) Initialize

func (c *CurseAdapter) Initialize(e cldf.Environment, selector uint64) error

func (*CurseAdapter) IsChainConnectedToTargetChain

func (c *CurseAdapter) IsChainConnectedToTargetChain(e cldf.Environment, selector uint64, targetSelector uint64) (bool, error)

IsChainConnectedToTargetChain checks if the target chain is supported on Aptos chain

func (*CurseAdapter) IsCurseEnabledForChain

func (c *CurseAdapter) IsCurseEnabledForChain(cldf.Environment, uint64) (bool, error)

IsCurseEnabledForChain returns true because Aptos is live on CCIP 1.6

func (*CurseAdapter) IsSubjectCursedOnChain

func (c *CurseAdapter) IsSubjectCursedOnChain(e cldf.Environment, selector uint64, subject fastcurse.Subject) (bool, error)

IsSubjectCursedOnChain checks if the subject is cursed on Aptos chain

func (*CurseAdapter) ListConnectedChains

func (c *CurseAdapter) ListConnectedChains(e cldf.Environment, selector uint64) ([]uint64, error)

func (*CurseAdapter) SelectorToSubject

func (c *CurseAdapter) SelectorToSubject(selector uint64) fastcurse.Subject

SelectorToSubject converts selector to Subject.

func (*CurseAdapter) SubjectToSelector

func (c *CurseAdapter) SubjectToSelector(subject fastcurse.Subject) (uint64, error)

SubjectToSelector converts subject to chainselector

func (*CurseAdapter) Uncurse

Uncurse returns the sequence to uncurse multiple subjects on Aptos chain

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL