Code Monkey home page Code Monkey logo

starknet-token's Introduction

StarkNet Token

This repository contains the solidity files implementing the StarkNet token and related contracts. This repository and this README file do not relate to any other aspect of StarkNet or StarkNet Token.

Introduction

The StarkNet Token is an ERC20 Solidity contract.

Basic info

Name: StarkNet Token

Symbol: STRK

Decimals: 18

The StarkNet Token is a straightforward implementation of the OpenZeppelin reference code.

The access control is following OpenZeppelin AccessControl: Privileged Roles :

  1. DEFAULT_ADMIN_ROLE is an admin role for MINTER_ROLE
  2. MINTER_ROLE: is allowed to mint.

Locked tokens considerations

The grants are locked for regulatory reasons. The lock is enforced by the {LockedTokenGrant} contract.

Global unlock time is shared between all the grants. It's maintained by a centralized contract {LockedTokenCommon}.

The {LockedTokenCommon} contract is also used to deploy the {LockedTokenGrant} and provide them with funds in an atomic manner.

1. Locked Token Grants

  • A Locked Token grant is a grant of locked tokens, granted to a recipient address.
  • They are deployed from LockedTokenCommon
  • The balance transferred to them is from an approved pool, not from the balance of the LockedTokenCommon itself.
  • LockedTokenGrant allows gradual release of tokens to the recipient address. A locked grant has the following properties: -- Start time - the start time when the release of the locked grant starts -- Grant amount - the amount of tokens in the grant. Once the grant start time passes, the locked tokens gradually release at a fixed rate, over a duration of 4 years.
  • A recipient address can receive up to 1 locked token grant. See Global time-lock and Exemption from lock for "modification" of this behavior.

LOCKED_GRANT_ADMIN_ROLE is a role defined on the LockedTokenCommon contract. Account holding LOCKED_GRANT_ADMIN_ROLE permission can grant locked tokens.

2. Gradual Release

The locked token grant releases gradually and evenly across 4 years starting from the grant start time. Before the grant start time, it's 100% locked.

3. Global time-lock

The LockedTokenCommon maintains a global time-lock i.e. a common time-lock for all the grants that were allocated by this contract. Before the global time-lock expires - ALL the locked token grants are 100% locked, regardless of their start time.

  • The global time-lock can be changed by an admin. To perform that, the admin must hold the GLOBAL_TIMELOCK_ADMIN_ROLE rights on the LockedTokenCommon contract.
  • The global time-lock can be reset to a new timestamp as long as the following conditions are met: i. The new timestamp is in the future with at least a minimal margin. ii. The new timestamp does not exceed the global time-lock upper bound. iii. The global time-lock has not expired yet.

4. Exemption from lock

Staking is exempted from locking. Exact mechanism for StarkNet Token staking is TBD.

Repository structure:

src/starkware/isd/third_party : OpenZeppelin reference code (v4.7.3).

src/starkware/isd/solidity : StarkNet Token and related contracts solidity source files.

Build instructions:

solc-0.8.16 --base-path src/ src/starkware/isd/solidity/StarkNetToken.sol --optimize-runs=1000000

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.