offramp

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 14 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetConfig = tvm.NewNoArgsGetter(tvm.NoArgsOpts[Config]{
	Name: configGetter,
	Decoder: tvm.NewResultDecoder(func(r *ton.ExecutionResult) (Config, error) {
		var c Config
		cs, err := r.Int(0)
		if err != nil {
			return c, fmt.Errorf("failed to get ChainSelector: %w", err)
		}

		chainSelector := cs.Uint64()

		feeQuoterAddressSlice, err := r.Slice(1)
		if err != nil {
			return c, fmt.Errorf("failed to get feeQuoter address slice: %w", err)
		}

		feeQuoterAddress, err := feeQuoterAddressSlice.LoadAddr()
		if err != nil {
			return c, fmt.Errorf("failed to load feeQuoter address: %w", err)
		}

		thresholdInt, err := r.Int(2)
		if err != nil {
			return c, fmt.Errorf("failed to get permissionlessExecutionThresholdSeconds: %w", err)
		}

		return Config{
			ChainSelector:                           chainSelector,
			FeeQuoterAddress:                        feeQuoterAddress,
			PermissionlessExecutionThresholdSeconds: uint32(thresholdInt.Uint64()),
		}, nil
	}),
})

GetConfig gets the configuration of the OffRamp contract

View Source
var GetCursedSubjects = tvm.NewNoArgsGetter(tvm.NoArgsOpts[[]*big.Int]{
	Name: cursedSubjectsGetter,
	Decoder: tvm.NewResultDecoder(func(r *ton.ExecutionResult) ([]*big.Int, error) {
		return parser.ParseLispTuple[*big.Int](r.AsTuple())
	}),
})

GetCursedSubjects gets all cursed subjects from the OffRamp contract

View Source
var GetOCR3Config = tvm.NewNoArgsGetter(tvm.NoArgsOpts[OCR3Base]{
	Name: ocr3BaseGetter,
	Decoder: tvm.NewResultDecoder(func(r *ton.ExecutionResult) (OCR3Base, error) {
		var c OCR3Base

		chainIDInt, err := r.Int(0)
		if err != nil {
			return c, fmt.Errorf("failed to get ChainID: %w", err)
		}
		c.ChainID = uint8(chainIDInt.Uint64())

		isNil, err := r.IsNil(1)
		if err != nil {
			return c, err
		}
		if !isNil {
			configCell, err1 := r.Cell(1)
			if err1 != nil {
				return c, err1
			}

			var config OCR3Config
			if err = tlb.LoadFromCell(&config, configCell.BeginParse()); err != nil {
				return c, fmt.Errorf("load OCR3Config from cell: %w", err)
			}
			c.Commit = &config
		}

		isNil, err = r.IsNil(2)
		if err != nil {
			return c, err
		}
		if !isNil {
			configCell, err2 := r.Cell(2)
			if err2 != nil {
				return c, err2
			}

			var config OCR3Config
			if err = tlb.LoadFromCell(&config, configCell.BeginParse()); err != nil {
				return c, fmt.Errorf("load OCR3Config from cell: %w", err)
			}
			c.Execute = &config
		}

		return c, nil
	}),
})

GetOCR3Config gets the OCR3 configuration of the OffRamp contract

GetOwner gets the owner of the OffRamp contract

View Source
var GetPendingOwner = ownable2step.GetPendingOwner

GetPendingOwner gets the pending owner of the OffRamp contract

View Source
var GetSourceChainConfig = tvm.Getter[uint64, SourceChainConfig]{
	Name: srcChainConfigGetter,
	Decoder: tvm.NewResultDecoder(func(r *ton.ExecutionResult) (SourceChainConfig, error) {
		var c SourceChainConfig
		routerAddressSlice, err := r.Slice(0)
		if err != nil {
			return c, fmt.Errorf("failed to get router address slice: %w", err)
		}
		routerAddress, err := routerAddressSlice.LoadAddr()
		if err != nil {
			return c, fmt.Errorf("failed to load router address: %w", err)
		}

		isEnabledInt, err := r.Int(1)
		if err != nil {
			return c, fmt.Errorf("failed to get isEnabled: %w", err)
		}
		isEnabled := isEnabledInt.Cmp(big.NewInt(0)) != 0

		minSeqNrInt, err := r.Int(2)
		if err != nil {
			return c, fmt.Errorf("failed to get minSeqNr: %w", err)
		}
		minSeqNr := minSeqNrInt.Uint64()

		isRMNDisabledInt, err := r.Int(3)
		if err != nil {
			return c, fmt.Errorf("failed to get isRMNVerificationDisabled: %w", err)
		}
		isRMNVerificationDisabled := isRMNDisabledInt.Cmp(big.NewInt(0)) != 0

		onRampSlice, err := r.Slice(4)
		if err != nil {
			return c, fmt.Errorf("failed to get onRamp slice: %w", err)
		}
		onRamp, err := ccipcommon.LoadCrossChainAddressWithoutPrefix(onRampSlice)
		if err != nil {
			return c, fmt.Errorf("failed to parse onRamp: %w", err)
		}

		return SourceChainConfig{
			Router:                    routerAddress,
			IsEnabled:                 isEnabled,
			MinSeqNr:                  minSeqNr,
			IsRMNVerificationDisabled: isRMNVerificationDisabled,
			OnRamp:                    onRamp,
		}, nil
	}),
}

GetSourceChainConfig gets the source chain configuration for a given chain selector

View Source
var GetSourceChainSelectors = tvm.NewNoArgsGetter(tvm.NoArgsOpts[[]uint64]{
	Name: sourceChainSelectorsGetter,
	Decoder: tvm.NewResultDecoder(func(r *ton.ExecutionResult) ([]uint64, error) {
		selectors, err := parser.ParseLispTuple[*big.Int](r.AsTuple())
		if err != nil {
			return nil, err
		}
		return lo.Map(selectors, func(x *big.Int, _ int) uint64 { return x.Uint64() }), nil
	}),
})

GetSourceChainSelectors gets all source chain selectors

View Source
var (
	OpcodeCCIPReceive = tvm.MustExtractMagic(reflect.TypeOf(CCIPReceive{}))
)

Functions

This section is empty.

Types

type Any2TVMMessage

type Any2TVMMessage struct {
	MessageID           []byte                       `tlb:"bits 256"`
	SourceChainSelector uint64                       `tlb:"## 64"`
	Sender              ccipcommon.CrossChainAddress `tlb:"."` // CrossChainAddress (inline: length prefix + bytes)
	Data                *cell.Cell                   `tlb:"^"`
	TokenAmounts        *cell.Cell                   `tlb:"maybe ^"`
}

Any2TVMMessage represents a cross-chain message to TON

type CCIPReceive

type CCIPReceive struct {
	RootID  []byte         `tlb:"bits 192"`
	Message Any2TVMMessage `tlb:"."`
	// contains filtered or unexported fields
}

CCIPReceive represents the CCIP message received on TON

type Commit

type Commit struct {
	QueryID          uint64                                      `tlb:"## 64"`
	ConfigDigest     []byte                                      `tlb:"bits 512"`
	CommitReport     ocr.CommitReport                            `tlb:"."`
	SignatureEd25519 ccipcommon.SnakedCell[ocr.SignatureEd25519] `tlb:"^"`
	// contains filtered or unexported fields
}

Commit represents the commit method call on the offRamp contract

type CommitReportAccepted

type CommitReportAccepted struct {
	MerkleRoot   *ocr.MerkleRoot   `tlb:"maybe ."`
	PriceUpdates *ocr.PriceUpdates `tlb:"maybe ^"`
}

CommitReportAccepted represents the CommitReportAccepted event data

type Config

type Config struct {
	ChainSelector                           uint64           `tlb:"## 64"`
	FeeQuoterAddress                        *address.Address `tlb:"addr"`
	PermissionlessExecutionThresholdSeconds uint32           `tlb:"## 32"`
}

Config represents the offRamp contract configuration

func (*Config) GetterMethodName deprecated

func (c *Config) GetterMethodName() string

Deprecated: Use GetConfig getter instead.

func (*Config) UnmarshalResult deprecated

func (c *Config) UnmarshalResult(result *ton.ExecutionResult) error

Deprecated: Use GetConfig getter instead.

type ConfigInfo

type ConfigInfo struct {
	ConfigDigest                   []byte `tlb:"bits 256"`
	F                              uint8  `tlb:"## 8"`
	N                              uint8  `tlb:"## 8"`
	IsSignatureVerificationEnabled bool   `tlb:"bool"`
}

ConfigInfo represents the configuration information for OCR3

type DeployableInitializeBounced

type DeployableInitializeBounced struct {
	DeployableAddress *address.Address `tlb:"addr"`
}

DeployableInitializeBounced represents the DeployableInitializeBounced event data

type Deployables

type Deployables struct {
	RMNRouter           *address.Address `tlb:"addr"`
	Deployer            *cell.Cell       `tlb:"^"`
	MerkleRootCode      *cell.Cell       `tlb:"^"`
	ReceiveExecutorCode *cell.Cell       `tlb:"^"`
}

Deployables holds the deployable code cells for the offRamp contract

type DynamicConfigSet

type DynamicConfigSet struct {
	FeeQuoter                               *address.Address `tlb:"addr"`
	PermissionlessExecutionThresholdSeconds uint32           `tlb:"## 32"`
}

DynamicConfigSet represents the DynamicConfigSet event data

type Execute

type Execute struct {
	QueryID       uint64            `tlb:"## 64"`
	ConfigDigest  []byte            `tlb:"bits 512"`
	ExecuteReport ocr.ExecuteReport `tlb:"."`
	// contains filtered or unexported fields
}

Execute represents the execute method call on the offRamp contract

type ExecutionStateChanged

type ExecutionStateChanged struct {
	SourceChainSelector uint64 `tlb:"## 64"`
	SequenceNumber      uint64 `tlb:"## 64"`
	MessageID           []byte `tlb:"bits 256"`
	State               uint8  `tlb:"## 8"`
}

ExecutionStateChanged represents the ExecutionStateChanged event data

type ExitCode

type ExitCode tvm.ExitCode
const (
	ErrorMessageNotFromOwnedContract ExitCode = iota + 22100 // Facility ID * 100
	ErrorSourceChainNotEnabled
	ErrorEmptyExecutionReport
	ErrorInvalidMessageDestChainSelector
	ErrorSourceChainSelectorMismatch
	ErrorInvalidOnRampUpdate
	ErrorInsufficientFee
	ErrorSubjectCursed
	ErrorUnauthorized
	ErrorZeroAddressNotAllowed
	ErrorTooManyMessagesInReport
	ErrorSignatureVerificationRequiredInCommitPlugin
	ErrorSignatureVerificationNotAllowedInExecutionPlugin
	ErrorInvalidInterval
	ErrorBatchingNotSupported
	ErrorOnRampAddressMismatch
	ErrorEmptyCommitReport
	ErrorMerkleRootCannotBeZero
)

func (ExitCode) NewFrom

func (ExitCode) NewFrom(ec tvm.ExitCode) (ExitCode, error)

func (ExitCode) String

func (i ExitCode) String() string

type OCR3Base

type OCR3Base struct {
	ChainID uint8       `tlb:"## 8"`
	Commit  *OCR3Config `tlb:"maybe ^"`
	Execute *OCR3Config `tlb:"maybe ^"`
}

OCR3Base represents the OCR3 base configuration stored on-chain

func (*OCR3Base) GetterMethodName deprecated

func (c *OCR3Base) GetterMethodName() string

Deprecated: Use GetOCR3Config getter instead.

func (*OCR3Base) UnmarshalResult deprecated

func (c *OCR3Base) UnmarshalResult(result *ton.ExecutionResult) error

Deprecated: Use GetOCR3Config getter instead.

type OCR3Config

type OCR3Config struct {
	ConfigInfo   ConfigInfo       `tlb:"."`
	Signers      *cell.Dictionary `tlb:"dict 256"`
	Transmitters *cell.Dictionary `tlb:"dict 267"`
}

OCR3Config represents the OCR3 configuration stored on-chain

type ReceiveExecutorInitExecuteBounced

type ReceiveExecutorInitExecuteBounced struct {
	ReceiveExecutor *address.Address `tlb:"addr"`
	Root            *address.Address `tlb:"addr"`
	SequenceNumber  uint64           `tlb:"## 64"`
}

ReceiveExecutorInitExecuteBounced represents the ReceiveExecutorInitExecuteBounced event data

type RouteMessageBounced

type RouteMessageBounced struct {
	Router *address.Address `tlb:"addr"`
	ExecID []byte           `tlb:"bits 192"`
}

RouteMessageBounced represents the RouteMessageBounced event data

type SetDynamicConfig

type SetDynamicConfig struct {
	QueryID                                 uint64           `tlb:"## 64"`
	FeeQuoter                               *address.Address `tlb:"addr"`
	PermissionlessExecutionThresholdSeconds uint32           `tlb:"## 32"`
	// contains filtered or unexported fields
}

type SetOCR3Config

type SetOCR3Config struct {
	QueryID                        uint64                                        `tlb:"## 64"`
	ConfigDigest                   []byte                                        `tlb:"bits 256"`
	PluginType                     uint16                                        `tlb:"## 16"`
	F                              uint8                                         `tlb:"## 8"`
	IsSignatureVerificationEnabled bool                                          `tlb:"bool"`
	Signers                        ccipcommon.SnakedCell[Signer]                 `tlb:"^"`
	Transmitters                   ccipcommon.SnakedCell[ccipcommon.AddressWrap] `tlb:"^"`
	// contains filtered or unexported fields
}

SetOCR3Config represents the setOCR3Config method call on the offRamp contract

type Signer

type Signer struct {
	Pubkey []byte `tlb:"bits 256"`
}

Signer represents a signer entry in the OCR3 config

type SourceChainConfig

type SourceChainConfig struct {
	Router                    *address.Address             `tlb:"addr"`
	IsEnabled                 bool                         `tlb:"bool"`
	MinSeqNr                  uint64                       `tlb:"## 64"`
	IsRMNVerificationDisabled bool                         `tlb:"bool"`
	OnRamp                    ccipcommon.CrossChainAddress `tlb:"."`
}

SourceChainConfig represents the configuration for a specific source chain

func (*SourceChainConfig) GetterMethodName deprecated

func (c *SourceChainConfig) GetterMethodName() string

Deprecated: Use GetSourceChainConfig getter instead.

func (*SourceChainConfig) UnmarshalResult deprecated

func (c *SourceChainConfig) UnmarshalResult(result *ton.ExecutionResult) error

Deprecated: Use GetSourceChainConfig getter instead.

type SourceChainConfigUpdated

type SourceChainConfigUpdated struct {
	SourceChainSelector uint64            `tlb:"## 64"`
	SourceChainConfig   SourceChainConfig `tlb:"."`
}

SourceChainConfigUpdated represents the SourceChainConfigUpdated event data

type SourceChainSelectorAdded

type SourceChainSelectorAdded struct {
	SourceChainSelector uint64 `tlb:"## 64"`
}

SourceChainSelectorAdded represents the SourceChainSelectorAdded event data

type Storage

type Storage struct {
	ID                                      uint32               `tlb:"## 32"`
	Ownable                                 ownable2step.Storage `tlb:"."`
	Deployables                             Deployables          `tlb:"^"`
	FeeQuoter                               *address.Address     `tlb:"addr"`
	OCR3Base                                OCR3Base             `tlb:"^"`
	CursedSubjects                          *cell.Dictionary     `tlb:"dict 128"`
	ChainSelector                           uint64               `tlb:"## 64"`
	PermissionlessExecutionThresholdSeconds uint32               `tlb:"## 32"`
	SourceChainConfigs                      *cell.Dictionary     `tlb:"dict 64"`
	LatestPriceSequenceNumber               uint64               `tlb:"## 64"`
}

Storage represents the offRamp contract storage state

type UpdateDeployables

type UpdateDeployables struct {
	QueryID             uint64     `tlb:"## 64"`
	ReceiveExecutorCode *cell.Cell `tlb:"maybe ^"`
	MerkleRootCode      *cell.Cell `tlb:"maybe ^"`
	// contains filtered or unexported fields
}

type UpdateSourceChainConfig

type UpdateSourceChainConfig struct {
	SourceChainSelector uint64            `tlb:"## 64"`
	Config              SourceChainConfig `tlb:"."`
}

UpdateSourceChainConfig represents the updateSourceChainConfig structure

type UpdateSourceChainConfigs

type UpdateSourceChainConfigs struct {
	QueryID uint64                                         `tlb:"## 64"`
	Configs ccipcommon.SnakedCell[UpdateSourceChainConfig] `tlb:"^"`
	// contains filtered or unexported fields
}

UpdateSourceChainConfigs represents the updateSourceChainConfigs method call on the offRamp contract

Jump to

Keyboard shortcuts

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