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

@tokenize.it/contracts

v5.0.1

Published

Tokenize.it smart contracts for company tokenization, crowdinvesting, private offers and employee participation

Downloads

456

Readme

tokenize.it

These smart contracts implement tokenize.it's tokenized cap table management. Using tokenize.it, it is possible to:

  • generate tokens that grant economical rights to the token holder
  • sell these tokens to investors either publicly or privately
  • distribute tokens to employees or partners, either directly or through a vesting contract

Getting Started

... for usage

yarn add @tokenizeit/contracts

or

npm install @tokenizeit/contracts

... for development

  1. clone repository: git clone --recurse-submodules [email protected]:corpus-ventures/tokenize.it-smart-contracts.git
  2. enter project root folder: cd tokenize.it-smart-contracts
  3. if repository was cloned without submodules, init submodules now (not necessary if cloning command above was used): git submodule update --init --recursive
  4. init project: yarn install
  5. run tests: yarn test

If you are missing dependencies:

  • node/npm:
    • install nvm
    • nvm install 18
    • nvm use 18
  • yarn: npm install yarn
  • foundry: install guide

More dev information can be found here:

Main Concept

  1. Using tokenize.it's legal approach, a company can create tokens that grant economical rights to the token holders. The best smart contract to create these tokens is Token.sol
  2. Funds are raised through selling of these tokens:
    • a customized deal to a specific investor can be realized through the PrivateOffer.sol contract.
    • crowdinvesting, which is open to everyone meeting the requirements, is done through the Crowdinvesting.sol contract
  3. Employee participation is easy:
    • direct distribution of tokens (does not need another smart contract)
    • vesting can be realized using the Vesting.sol contract

The requirements for an address to send or receive tokens are checked against the AllowList.sol contract. Fees are collected according to the settings in FeeSettings.sol. Tokenize.it will deploy and manage at least one AllowList and one FeeSettings contract.

Contracts

The smart contracts can be found in the contracts/ folder.

All contracts are based on the well documented and tested OpenZeppelin smart contract suite.

EIP-2771

It is possible to directly use all smart contracts in this project, without going through the platform's frontend at all. In order to improve UX, though, a frontend will be offered. In order to improve UX even more, the user will not have to pay gas when using this frontend. This is achieved through three approaches:

  1. the platform executes transactions like contract deployments that do not require the user's signature
  2. actions concerning our own contracts that require the user's approval are executed as meta-transactions, using EIP-2711
  3. granting allowances on external currencies is possible through EIP-2612 (ERC20Permit), which is widely adopted. This is not in the scope of this documentation though.

Several of the contracts implement EIP-2771, and therefore use a trusted forwarder. The forwarder will be set in the constructor and there is no way to change it after deployment. The forwarder used will be the openGSN v2 forwarder deployed on mainnet. Some information about this contract:

The platform will maintain a hot wallet (EOA) in order to send transactions to the forwarder contract. This results in the following flow:

  • contract A supports EIP-2771 and uses forwarder as its (one and only, immutable) trusted forwarder
  • user (investor or founder) wants to use function a(...) of contract A and uses the platform for this
  • platform (tokenize.it) prepares meta transaction payload and asks user for signature
  • user signs the payload with their own key (using metamask or similar)
  • platform now has payload and signature and uses its hot wallet to call forwarder.execute(payload, signature, ...)
  • forwarder verifies signature and payload on-chain
  • forwarder executes A.a(...) with parameters according to payload
  • contract A only verifies it is being called by the ONE forwarder it trusts. It does not verify any signatures. This is why the forwarder is called trusted forwarder: it is trusted to do the verification.
  • contract A executes function a(...) in the name of user

This is a trustless process, because:

  1. the forwarder contract can not be updated
  2. the trusted forwarder setting in contract A is immutable
  3. signature verification is executed on-chain

Open gas station network provides tools to execute meta transactions without involving a third party hot wallet. Tokenize.it does not plan on using these tools though. Exclusively using a hot wallet for transaction execution does not harm security at all.

The hot wallet approach might reduce availability, which is not a major concern for this use case (the hot wallet being available whenever the frontend is available is good enough). Keep in mind that EIP-2771 is purely offered for UX reasons. All smart contracts can be used directly, too, further reducing concerns about hot wallet availability.

An Openzeppelin Defender Relay may be used as hot wallet.

Supported Currencies

The currencies used for payments must conform to the ERC20 standard. This standard is not very strict though. It can be implemented in many ways, including incompatible and even malicious contracts. Therefore, tokenize.it will limit the currencies supported in the web frontend to this list:

These implementations have been checked and tested to work well with the tokenize.it smart contracts. The use of any other currencies is HIGHLY DISCOURAGED and might lead to:

  • loss of funds due to various attacks
  • partial payments due to the currency deducting a transfer fee
  • other issues

To enforce the use of trusted currencies only, they are added to the AllowList.sol contract with the special TRUSTED_CURRENCY bit. PrivateOffers and Crowdinvesting campaigns will only accept currencies that are on the AllowList and have the TRUSTED_CURRENCY bit set. This makes using a malicious currency by mistake impossible, but still allows either the platform or other operators of their own AllowLists to edit and extend the list of supported currencies.

Resources

The following resources are available regarding the contracts: