circuit

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2023 License: MIT Imports: 4 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("221970e0ba2d0b02a979e616cf186305372e73aab1e74f749772c9fef54dbf91", 16)
)

Functions

func CheckValueInRange

func CheckValueInRange(api API, value Variable)

check value is in [0, 2^64-1] range

func VerifyMerkleProof

func VerifyMerkleProof(api API, merkleRoot Variable, node Variable, proofSet, helper []Variable)

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(assetCounts 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
}

type CreateUserOperation

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

type UserAssetInfo

type UserAssetInfo struct {
	Equity Variable
	Debt   Variable
}

type Variable

type Variable = frontend.Variable

func AccountIdToMerkleHelper

func AccountIdToMerkleHelper(api API, accountId Variable) []Variable

func ComputeUserAssetsCommitment

func ComputeUserAssetsCommitment(api API, assets []UserAssetInfo) Variable

func UpdateMerkleProof

func UpdateMerkleProof(api API, node Variable, proofSet, helper []Variable) (root Variable)

Jump to

Keyboard shortcuts

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