Code Monkey home page Code Monkey logo

tonion-contracts's Introduction

TonIon


TonIon Contracts is a reusable smart contract library and toolkit for the Tact language on the TON blockchain. TonIon aims to provide reliable and efficient contract components to streamline the development of TON-based decentralized applications.

Document

You can find Tonion documents on Tonion docs

Traits

add the traits (contracts/traits) to your project contracts/imports, then Import the required contracts and traits in your Tact code.

Sample Jetton Master:

import "@stdlib/deploy";
import "../imports/tonion/JettonMaster.tact";
import "../imports/tonion/JettonWallet.tact";

contract MyJetton with JettonMaster, Deployable {
    total_supply: Int as coins;
    owner: Address;
    jetton_content: Cell;
    mintable: Bool;
    
    init(owner: Address, content: Cell){
        self.total_supply = 0;
        self.owner = owner;
        self.mintable = true;
        self.jetton_content = content;
    }

    override inline fun calculate_jetton_wallet_init(owner_address: Address): StateInit {
        return initOf MyJettonWallet(owner_address, myAddress());
    }

}

Sample Jetton Wallet:

import "@stdlib/deploy";
import "../imports/tonion/JettonMaster.tact";
import "../imports/tonion/JettonWallet.tact";

contract MyJettonWallet with JettonWallet, Deployable {
    balance: Int as coins = 0;
    owner: Address;
    jetton_master: Address;

    init(owner: Address, jetton_master: Address) {
        self.owner = owner;
        self.jetton_master = jetton_master;
    }

    override inline fun calculate_jetton_wallet_init(owner_address: Address): StateInit {
        return initOf MyJettonWallet(owner_address, self.jetton_master);
    }
}

implementation

actually you can find implementation for the traits or TEPs in mock contracts/mock directory


Tonion-CLI

We are working on a solution to use npm to install Tonion Contracts and import them directly into your contracts without copying the files manually. Additionally, we are exploring potential changes in Tact to support importing directly from GitHub or similar platforms.

Traits

┌ contracts/traits
│
├── access
│   │
│   ├── OwnableTransferable2Step.tact ✅
│   │
│   └── AccessControl.tact ✅
│
├── utils
│   │
│   └── Counter.tact ✅
│   
├── payments
│   │
│   └── PaymentSplitter.tact ✅
│   
└── tokens
    │
    ├── jetton
    │   │
    │   ├── JettonMaster.tact ✅
    │   ├── JettonWallet.tact ✅
    │   │
    │   └── extensions
    │       │
    │       ├── MaxSupply.tact ✅
    │       │
    │       └── Approveable.tact ❓
    │
    │
    └── NFT
        │
        ├── NFTCollection.tact ⏳
        ├── NFTItem.tact ⏳
        │
        └── extensions
            │
            ├── Editable.tact ⏳
            │
            ├── MaxSupply.tact ⏳
            │
            └── Royalty.tact ⏳

Scripts

  • Build All Contracts: Compiles all the contracts in the library.

    npm run build:all
  • Run Tests: Executes the test suite using Jest.

    npm test

Project Structure

┌── contracts
│   │
│   ├── traits
│   │   │
│   │   └── (trait categories)
│   │           │
│   │           └── (trait sub-categories)
│   │               │
│   │               └── (trait files)
│   ├── mocks
│   │   │
│   │   └── (mock categories)
│   │           │
│   │           └── (mock sub-categories)
│   │               │
│   │               └── (mock files)
├── tests
│   │
│   ├── (test categories)
│   │       │
│   │       └── (test files)
│   │
│   └── main.spec.ts
│
├── wrappers
│   │
│   └──(wrapper file)
│
├── package.json
│
└── README.md

Contributing

We welcome contributions from the community! If you'd like to contribute, please follow these steps:

  1. Fork the repository.
  2. Add a feature or fix a bug
  3. Open a pull request.

Contributors

ZigBalthazar
Zig Blathazar
kehiy
Kay
olumo-oke
olumo-oke

License

This project is licensed under the MIT License - see the MIT License file for details.

tonion-contracts's People

Contributors

zigbalthazar avatar github-actions[bot] avatar kehiy avatar olumo-oke avatar

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.