circuit

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//  is poseidon hash(empty account info)
	EmptyAccountLeafNodeHash, _ = new(big.Int).SetString("0f870d7404597dad9eca7c50a6f0af812ab7cd6a11d5c464d4031a3272377b95", 16)
)

Functions

func IntegerDivision added in v1.1.0

func IntegerDivision(_ *big.Int, in []*big.Int, out []*big.Int) error

Types

type API

type API = frontend.API

type BatchCreateUserCircuit

type BatchCreateUserCircuit struct {
	BatchCommitment           Variable `gnark:",public"`
	BeforeAccountTreeRoot     Variable
	AfterAccountTreeRoot      Variable
	BeforeCEXAssetsCommitment Variable
	AfterCEXAssetsCommitment  Variable
	BeforeCexAssets           []CexAssetInfo
	CreateUserOps             []CreateUserOperation
}

func NewBatchCreateUserCircuit

func NewBatchCreateUserCircuit(userAssetCounts uint32, allAssetCounts uint32, batchCounts uint32) *BatchCreateUserCircuit

func NewVerifyBatchCreateUserCircuit

func NewVerifyBatchCreateUserCircuit(commitment []byte) *BatchCreateUserCircuit

func SetBatchCreateUserCircuitWitness

func SetBatchCreateUserCircuitWitness(batchWitness *utils.BatchCreateUserWitness) (witness *BatchCreateUserCircuit, err error)

func (BatchCreateUserCircuit) Define

func (b BatchCreateUserCircuit) Define(api API) error

type CexAssetInfo

type CexAssetInfo struct {
	TotalEquity Variable
	TotalDebt   Variable
	BasePrice   Variable

	LoanCollateral            Variable
	MarginCollateral          Variable
	PortfolioMarginCollateral Variable

	LoanRatios            []TierRatio
	MarginRatios          []TierRatio
	PortfolioMarginRatios []TierRatio
}

type CreateUserOperation

type CreateUserOperation struct {
	BeforeAccountTreeRoot Variable
	AfterAccountTreeRoot  Variable
	Assets                []UserAssetInfo
	AssetsForUpdateCex    []UserAssetMeta
	AccountIndex          Variable
	AccountIdHash         Variable
	AccountProof          [utils.AccountTreeDepth]Variable
}

type TierRatio added in v1.1.0

type TierRatio struct {
	BoundaryValue    Variable
	Ratio            Variable
	PrecomputedValue Variable
}

Consider using variable or constant

type UserAssetInfo

type UserAssetInfo struct {
	AssetIndex Variable
	// The index means the position of tier ratios where the boundary value is larger than the collateral.
	LoanCollateralIndex Variable
	// If the flag is 1, the boundary value of last tier ratio is less than the collateral.
	LoanCollateralFlag Variable

	MarginCollateralIndex Variable
	MarginCollateralFlag  Variable

	PortfolioMarginCollateralIndex Variable
	PortfolioMarginCollateralFlag  Variable
}

type UserAssetMeta added in v1.1.0

type UserAssetMeta struct {
	Equity                    Variable
	Debt                      Variable
	LoanCollateral            Variable
	MarginCollateral          Variable
	PortfolioMarginCollateral Variable
}

type Variable

type Variable = frontend.Variable

Jump to

Keyboard shortcuts

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