compiler

package
v0.0.0-...-581a61f Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package compiler wraps the simc binary to compile SimplicityHL contracts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compile

func Compile(shlPath string) (binary []byte, cmr [32]byte, err error)

Compile compiles a .shl file with simc and returns the program binary and CMR. If a companion <file>.args exists it is passed via --args. The CMR (Commitment Merkle Root) is the 32-byte Simplicity commitment hash used as the taproot leaf script content for address derivation.

func CompileAll

func CompileAll(buildDir string, net *network.Network) (*pool.Config, error)

CompileAll compiles all pool contracts from buildDir and returns a Config with addresses, CMRs, binaries, and control blocks populated. pool_creation uses a single-leaf taproot; pool_a/b and lp_reserve use dual-leaf taproot (swap+remove variants share one address).

func PatchLPAssetID

func PatchLPAssetID(shlPath string, outPath string, assetID [32]byte) error

PatchLPAssetID updates LP_ASSET_ID in the .args file that corresponds to shlPath. outPath is used only to derive the destination .args path (usually equal to shlPath).

func PatchParams

func PatchParams(buildDir string, params map[string]ArgsParam) error

PatchParams updates the specified parameter values in all .args files found in buildDir. Only keys that already exist in a given .args file are updated; extra keys in params are silently ignored for files that don't have them.

Types

type ArgsParam

type ArgsParam = argsEntry

ArgsParam is one entry in a .args JSON file (value + type pair).

type SimcOutput

type SimcOutput struct {
	Program string `json:"program"`
	CMR     string `json:"cmr"`
}

SimcOutput is the JSON structure from simc --json

Jump to

Keyboard shortcuts

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