Options
All
  • Public
  • Public/Protected
  • All
Menu

It represents a deployed contract throughout its life (e.g. maintains merkle tree state) Functionality relevant to anchors in general (proving, verifying) is implemented in static methods Functionality relevant to a particular anchor deployment (deposit, withdraw) is implemented in instance methods

Hierarchy

  • Anchor

Implements

Index

Constructors

Properties

denomination?: string
depositHistory: Record<number, string>
latestSyncedBlock: number
signer: Signer
token?: string
zkComponents: ZkComponents

Methods

  • bridgedTransact(inputs: Utxo[], outputs: Utxo[], fee: BigNumberish, recipient: string, relayer: string, merkleProofsForInputs: any[]): Promise<ContractReceipt>
  • bridgedTransactWrap(tokenAddress: string, inputs: Utxo[], outputs: Utxo[], fee: BigNumberish, recipient: string, relayer: string, merkleProofsForInputs: any[]): Promise<ContractReceipt>
  • bridgedWithdraw(deposit: IAnchorDeposit, merkleProof: any, recipient: string, relayer: string, fee: string, refund: string, refreshCommitment: string): Promise<WithdrawalEvent>
  • bridgedWithdrawAndUnwrap(deposit: IAnchorDeposit, merkleProof: any, recipient: string, relayer: string, fee: string, refund: string, refreshCommitment: string, tokenAddress: string): Promise<WithdrawalEvent>
  • checkKnownRoot(): Promise<void>
  • createResourceId(): Promise<string>
  • createWitness(data: any): Promise<any>
  • Makes a deposit of the anchor's fixed sized denomination into the smart contracts. Assumes the sender possesses the anchor's fixed sized denomination. Assumes the anchor has the correct, full deposit history.

    Parameters

    • Optional destinationChainId: number

    Returns Promise<IAnchorDeposit>

  • generateWitnessInput(deposit: IAnchorDepositInfo, originChain: number, refreshCommitment: string | number, recipient: string, relayer: string, fee: BigInt, refund: BigInt, roots: string[], pathElements: any[], pathIndices: any[]): Promise<{ extData: IFixedAnchorExtData; input: any }>
  • getAddress(): string
  • getAmountToWrap(wrappingFee: number): BigNumber
  • getHandler(): Promise<string>
  • getHandlerProposalData(newHandler: string): Promise<string>
  • getMaxDepositLimitProposalData(_maximumDepositAmount: string): Promise<string>
  • getMinWithdrawalLimitProposalData(_minimalWithdrawalAmount: string): Promise<string>
  • getProposalData(resourceID: string, leafIndex?: number): Promise<string>
  • populateRootsForProof(): Promise<string[]>
  • proveAndVerify(wtns: any): Promise<string>
  • setHandler(handlerAddress: string): Promise<void>
  • setSigner(newSigner: Signer): Promise<boolean>
  • setWithLeaves(leaves: string[], syncedBlock?: number): Promise<Boolean>
  • Given a list of leaves and a latest synced block, update internal tree state The function will create a new tree, and check on chain root before updating its member variable If the passed leaves match on chain data, update this instance and return true else return false

    Parameters

    • leaves: string[]
    • Optional syncedBlock: number

    Returns Promise<Boolean>

  • update(blockNumber?: number): Promise<void>
  • Sync the local tree with the tree on chain. Start syncing from the given block number, otherwise latest synced block.

    Parameters

    • Optional blockNumber: number

    Returns Promise<void>

  • withdraw(deposit: IAnchorDepositInfo, index: number, recipient: string, relayer: string, fee: bigint, refreshCommitment: string | number): Promise<RefreshEvent | WithdrawalEvent>
  • withdrawAndUnwrap(deposit: IAnchorDepositInfo, originChainId: number, index: number, recipient: string, relayer: string, fee: bigint, refreshCommitment: string, tokenAddress: string): Promise<WithdrawalEvent>
  • wrapAndDeposit(tokenAddress: string, wrappingFee?: number, destinationChainId?: number): Promise<IAnchorDeposit>
  • createAnchor(verifier: string, hasher: string, denomination: BigNumberish, merkleTreeHeight: number, token: string, handler: string, maxEdges: number, zkComponents: ZkComponents, signer: Signer): Promise<Anchor>
  • Deploys an Anchor contract and sets the signer for deposit and withdraws on this contract.

    Parameters

    • verifier: string
    • hasher: string
    • denomination: BigNumberish
    • merkleTreeHeight: number
    • token: string
    • handler: string
    • maxEdges: number
    • zkComponents: ZkComponents
    • signer: Signer

    Returns Promise<Anchor>

  • createRootsBytes(rootArray: string[] | BigNumberish[]): string
  • generateDeposit(destinationChainId: number, secretBytesLen?: number, nullifierBytesLen?: number): IAnchorDepositInfo
  • generateWithdrawProofCallData(proof: any, publicSignals: any): Promise<string>
  • groth16ExportSolidityCallData(proof: any, pub: any): Promise<any>

Generated using TypeDoc