npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jwalab/tokenization-service-contracts

v0.2.0

Published

Tokenization Service's Smart Contracts

Downloads

22

Readme

Tokenization Service Contracts

The Tokenization Service's Smart Contract.

How to use the smart contracts:

  1. Install the tokenization service contracts:
npm install @jwalab/tokenization-service-contracts
  1. Deploy with Taquito:

Example deploying the warehouse contract:

const { TezosToolkit, MichelsonMap } = require('@taquito/taquito');
const { InMemorySigner } = require('@taquito/signer');

const tokenizationServiceContracts = require('@jwalab/tokenization-service-contracts');

// using truffle's default accounts
// An account looks like this:
// alice: {
//      pkh: "tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb",
//      sk: "edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq",
//      pk: "edpkvGfYw3LyB1UcCahKQk4rF2tvbMUk8GFiTuMjL75uGXrpvKXhjn"
// }
const accounts = require('./path/to/accounts');

const Tezos = new TezosToolkit();

Tezos.setProvider({
    rpc: 'http://localhost:20000',
    signer: new InMemorySigner(accounts.alice.sk)
})

Tezos.contract
  .originate({
    code: tokenizationServiceContracts.warehouse.michelson,
    storage: {
        owners: ["tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb"],
        version: "1",
        items: MichelsonMap.fromLiteral({}),
        instances: MichelsonMap.fromLiteral({})
    },
  })
  .then((originationOp) => {
    console.log(`Waiting for confirmation of origination for ${originationOp.contractAddress}`);
    return originationOp.contract(1, 1);
  })
  .then(() => {
    console.log(`Origination completed.`);
  })
  .catch((error) => console.log(error));

Smart Contract APIs

Our Smart Contracts are fully tested, please look at the ./test folder to see how they work and how to configure their storage.

Development

Requirements

  1. Items created in the Warehouse are truly immutable, their characteristics may never be altered. Just like a manufactured product once manufactured can't be altered. If a faulty item is minted, it must be discarded or sold as-is, or minted again.
  2. Items in the Warehouse don't belong to anyone and can't be transferred. Items in the Warehouse are not owned, only linked to an originator.
  3. Items in the Warehouse are semi-fungible. If an item is created with a quantity of 1000, all 1000 items have the same value and can be exchanged without destruction of value.
  4. When an item in the Warehouse is purchased, and item instance is created and assigned to a user. The Warehouse item remains unaltered, its total quantity remains unaltered, but there's one fewer item left to be purchased (available_quantity). The instance is now mutable and can evolve independently from other instances of the same item.
  5. An item's instance can be transferred to another user.
  6. One more thing, an item in the Warehouse can actually be modified until the it's marked as frozen.

Project Structure

The Tezos contracts are written in the ./contracts folder.

Getting Started

  1. Start by cloning this repository
  2. run npm install in this folder

Test the contracts using the built-in sandbox

Start a tezos node first, use minilab or

docker run -d -p 20000:20000 -e block_time=2 tqtezos/flextesa:20210602 granabox start

Then run the tests:

npm run test

Cost estimation:

0.2.0 with multiple owners

| action | cost | | ---------------------------------- | ----------- | | warehouse origination | 0.626894ꜩ | | create warehouse item | 0.031207ꜩ | | Update same size warehouse item | 0.000733ꜩ | | Update smaller size warehouse item | 0.000708ꜩ | | Update bigger size warehouse item | 0.017005ꜩ | | Freeze item | 0.000680ꜩ | | Assign item to user | 0.021997ꜩ | | Update instance | 0.009729ꜩ | | transfer instance to new user | 0.000703ꜩ |

0.1.1 with security

| action | cost | | ---------------------------------- | ----------- | | warehouse origination | 0.566903ꜩ | | create warehouse item | 0.031202ꜩ | | Update same size warehouse item | 0.000729ꜩ | | Update smaller size warehouse item | 0.000703ꜩ | | Update bigger size warehouse item | 0.017045ꜩ | | Freeze item | 0.000675ꜩ | | Assign item to user | 0.021992ꜩ | | Update instance | 0.009724ꜩ | | transfer instance to new user | 0.000698ꜩ |

0.1.0 integrated contract and Granada:

| action | cost | | ---------------------------------- | ----------- | | warehouse origination | 0.57152ꜩ | | create warehouse item | 0.032072ꜩ | | Update same size warehouse item | 0.001618ꜩ | | Update smaller size warehouse item | 0.001588ꜩ | | Update bigger size warehouse item | 0.017936ꜩ | | Freeze item | 0.001552ꜩ | | Assign item to user | 0.022876ꜩ | | Update instance | 0.010594ꜩ | | transfer instance to new user | 0.001568ꜩ |

Granada:

| action | cost | | ---------------------------------- | ----------- | | warehouse origination | 0.451211ꜩ | | inventory origination | 0.386428ꜩ | | create warehouse item | 0.031179ꜩ | | Update same size warehouse item | 0.000706ꜩ | | Update smaller size warehouse item | 0.00068ꜩ | | Update bigger size warehouse item | 0.017023ꜩ | | Transfer item to inventory | 0.020832ꜩ |

Florence:

| action | cost | | ---------------------------------- | ----------- | | warehouse origination | 0.451804ꜩ | | inventory origination | 0.386914ꜩ | | create warehouse item | 0.03179ꜩ | | Update same size warehouse item | 0.001335ꜩ | | Update smaller size warehouse item | 0.001305ꜩ | | Update bigger size warehouse item | 0.017653ꜩ | | Transfer item to inventory | 0.022413ꜩ |