Documentation
¶
Index ¶
Constants ¶
const ( PkgLib = "link.chain.ton.lib" PkgCCIP = "link.chain.ton.ccip" PkgMCMS = "link.chain.ton.mcms" // Third-party contract types PkgJetton = "com.github.ton-blockchain.jetton-contract" // Libs and traits TypeOwnable = PkgLib + ".access.Ownable" TypeRBAC = PkgLib + ".access.RBAC" TypeWithdrawable = PkgLib + ".funding.Withdrawable" TypeUpgradeable = PkgLib + ".versioning.Upgradeable" // MCMS TypeMCMS = PkgMCMS + ".MCMS" TypeTimelock = PkgMCMS + ".Timelock" // CCIP TypeRouter = PkgCCIP + ".Router" TypeOnRamp = PkgCCIP + ".OnRamp" TypeOffRamp = PkgCCIP + ".OffRamp" TypeFeeQuoter = PkgCCIP + ".FeeQuoter" TypeSendExecutor = PkgCCIP + ".CCIPSendExecutor" TypeDeployable = PkgCCIP + ".Deployable" TypeMerkleRoot = PkgCCIP + ".MerkleRoot" TypeReceiveExecutor = PkgCCIP + ".ReceiveExecutor" TypeTestReceiver = PkgCCIP + ".test.Receiver" // Jetton TypeJettonWallet = PkgJetton + ".contracts.jetton-wallet" TypeJettonMinter = PkgJetton + ".contracts.jetton-minter" )
TODO we should use a type alias for these, sometihng like ContractTypeLong
Variables ¶
var AllContractTypes = []struct { SimpleName string ContractType string }{ {"Router", TypeRouter}, {"FeeQuoter", TypeFeeQuoter}, {"OnRamp", TypeOnRamp}, {"OffRamp", TypeOffRamp}, {"SendExecutor", TypeSendExecutor}, {"Deployable", TypeDeployable}, {"MerkleRoot", TypeMerkleRoot}, {"ReceiveExecutor", TypeReceiveExecutor}, {"TestReceiver", TypeTestReceiver}, {"Timelock", TypeTimelock}, {"MCMS", TypeMCMS}, }
AllContractTypes lists every fully qualified name for contracts present in the bindings
var DefaultTraceStopCondition tracetracking.StopCondition = func(parent, current *tracetracking.ReceivedMessage) (bool, error) { if current.InternalMsg == nil { return false, nil } ec, err := current.ExitCode() if err != nil { return false, fmt.Errorf("failed to get exit code: %w", err) } opcodeCurrent, err := tvm.ExtractOpcode(current.InternalMsg.Body) if err != nil { return false, fmt.Errorf("failed to extract opcode from current message: %w", err) } if ec == tvm.ExitCodeComputeSkipReasonNoState { fmt.Printf("Stopping trace tracking due to NoState exit code on opcode %d\n", opcodeCurrent) switch uint64(opcodeCurrent) { case 0: return true, nil case rbac.OpcodeRoleGranted: return true, nil case rbac.OpcodeRoleRevoked: return true, nil } } if parent.InternalMsg == nil { return false, nil } opcodeParent, err := tvm.ExtractOpcode(parent.InternalMsg.Body) if err != nil { return false, fmt.Errorf("failed to extract opcode from parent message: %w", err) } switch uint64(opcodeParent) { case offramp.OpcodeCCIPReceive: return uint64(opcodeCurrent) != router.OpcodeCCIPReceiveConfirm, nil } return false, nil }
DefaultTraceStopCondition is the default policy for bounded trace tracking - stopping message (DAG) trace tracking in the context of MCMS/CCIP.
Notice: we expect account contracts (e.g., Wallet contracts, MCMS/Timelock, multisigs, etc) to accept all incoming messages (replies) and not reject with 0xffff (wrong opcode) but accept/ignore.
var Registry = tvm.ContractTLBRegistry{ TypeOwnable: ownable2step.TLBs, TypeRBAC: rbac.TLBs, TypeWithdrawable: withdrawable.TLBs, TypeUpgradeable: upgradeable.TLBs, TypeMCMS: mcms.TLBs, TypeTimelock: timelock.TLBs, TypeRouter: router.TLBs, TypeOnRamp: onramp.TLBs, TypeOffRamp: offramp.TLBs, TypeFeeQuoter: feequoter.TLBs, TypeSendExecutor: ccipsendexecutor.TLBs, TypeJettonWallet: wallet.TLBs, TypeJettonMinter: minter.TLBs, }
Map of TLBs keyed by contract type
var TypeToGetterMap = map[string]GetterMap{ TypeRouter: { "owner": router.GetOwner, "pendingOwner": router.GetPendingOwner, "rmn_owner": router.GetRMNOwner, "rmn_pendingOwner": router.GetRMNPendingOwner, "onRamp": router.GetOnRamp, "destChainSelectors": router.GetDestChainSelectors, }, TypeOnRamp: { "owner": onramp.GetOwner, "pendingOwner": onramp.GetPendingOwner, "destChainConfig": onramp.GetDestChainConfig, "dynamicConfig": onramp.GetDynamicConfig, "staticConfig": onramp.GetStaticConfig, "destChainSelectors": onramp.GetDestChainSelectors, }, TypeOffRamp: { "owner": offramp.GetOwner, "pendingOwner": offramp.GetPendingOwner, "ocr3Config": offramp.GetOCR3Config, "config": offramp.GetConfig, "sourceChainConfig": offramp.GetSourceChainConfig, "sourceChainSelectors": offramp.GetSourceChainSelectors, }, TypeFeeQuoter: { "owner": feequoter.GetOwner, "pendingOwner": feequoter.GetPendingOwner, "destChainConfig": feequoter.GetDestChainConfig, "destinationChainGasPrice": feequoter.GetDestinationChainGasPrice, "tokenPrice": feequoter.GetTokenPrice, "staticConfig": feequoter.GetStaticConfig, "destChainSelectors": feequoter.GetDestChainSelectors, }, "link.chain.ton.ccip.Common": { "typeAndVersion": common.GetTypeAndVersion, }, TypeOwnable: { "owner": ownable2step.GetOwner, "pendingOwner": ownable2step.GetPendingOwner, }, TypeMCMS: { "getConfig": mcms.GetConfig, "getOpCount": mcms.GetOpCount, "getRoot": mcms.GetRoot, "getRootMetadata": mcms.GetRootMetadata, "getOracle": mcms.GetOracle, "getOpPendingInfo": mcms.GetOpPendingInfo, }, TypeTimelock: { "getMinDelay": timelock.GetMinDelay, "getRoleMemberCount": timelock.GetRoleMemberCount, "getRoleMember": timelock.GetRoleMember, "isOperation": timelock.IsOperation, "isOperationPending": timelock.IsOperationPending, "isOperationReady": timelock.IsOperationReady, "isOperationDone": timelock.IsOperationDone, "isOperationError": timelock.IsOperationError, }, }
TypeToGetterMap is a registry mapping contract types to their available getters. The outer map keys are contract type identifiers (e.g., "link.chain.ton.ccip.Router"). The inner map keys are getter method names (e.g., "owner", "onRamp"). The values are Getter[A, R] instances representing typed getter methods.
Functions ¶
func GetBuildDir ¶
func GetBuildsDir ¶
func GetBuildsDir() string
func GetRepoRootDir ¶
func GetRepoRootDir() string