nacho-common-o1js
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

nacho-common-o1js

The common o1js utilities for Nacho.

nacho-common-o1js package is intended to be used for Nacho only as it contains naive implementations of the things Nacho needs.

📦 Installation

If you are using npm:

npm install nacho-common-o1js

If you are using yarn:

yarn add nacho-common-o1js

If you are using pnpm:

pnpm add nacho-common-o1js

🔍 Details

Nacho's common o1js utilities are some provable data structures, functions and constant values.

🧱 Provable Data Structures

  • Balance:

    Represents a token balance of a user in the layer 2.

  • Burn:

    Represents a token burn of a user in the layer 2.

  • Deposit:

    Represents a token deposit of a user in the layer 1.

  • DoubleBalanceWitness:

    Represents the witness of two leaves in the Merkle tree that storesbalances.

  • Liquidity:

    Represents an AMM pool liquidity of a user in the layer 2.

  • Pool:

    Represents an AMM pool in the layer 2.

  • SingleBalanceWitness:

    Represents the witness of a leaf in the Merkle tree that stores balances.

  • SingleBurnWitness:

    Represents the witness of a leaf in the Merkle tree that stores burns.

  • SingleLiquidityWitness:

    Represents the witness of a leaf in the Merkle tree that stores AMM liquidities.

  • SinglePoolWitness:

    Represents the witness of a leaf in the Merkle tree that stores AMM pools.

  • SingleWithdrawalWitness:

    Represents the witness of a leaf in the Merkle tree that stores withdrawals.

  • StateRoots:

    Represents the Merkle roots of the layer 2's state in the layer 1.

  • Withdrawal:

    Represents a token withdrawal of a user in the layer 1.

🛠️ Provable Functions

  • addOnePerMilFee:

    Multiplies the given number by 1.001.

  • choose:

    Equivalent of conditional operator.

  • normalDiv:

    Normal division operation on field elements.

  • putInOrder:

    Swaps the order of given elements based on given the condition.

🏷️ Constant Values

📝 License

This project is licensed under the MIT License.

You may use the source code of this project accordingly.

👤 About Me

I am Berzan and I am developing Nacho to express my skills in the real world.

I built this library to use inside Nacho.

Package Sidebar

Install

npm i nacho-common-o1js

Weekly Downloads

13

Version

1.0.0

License

MIT

Unpacked Size

62.3 kB

Total Files

5

Last publish

Collaborators

  • berzan