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.
You can find Tonion documents on Tonion docs
add the traits (contracts/traits)
to your project contracts/imports
, then
Import the required contracts and traits in your Tact code.
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());
}
}
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);
}
}
actually you can find implementation for the traits or TEPs in mock contracts/mock directory
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.
┌ 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 ⏳
-
Build All Contracts: Compiles all the contracts in the library.
npm run build:all
-
Run Tests: Executes the test suite using Jest.
npm test
┌── 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
We welcome contributions from the community! If you'd like to contribute, please follow these steps:
- Fork the repository.
- Add a feature or fix a bug
- Open a pull request.
Zig Blathazar |
Kay |
olumo-oke |
This project is licensed under the MIT License - see the MIT License file for details.