TonIon Contracts is a reusable smart contract library and toolkit for the Tact language on the TON blockchain
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 thetraits (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 calculatejettonwalletinit(owneraddress: 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.jettonmaster = jettonmaster; }
override inline fun calculatejettonwalletinit(owneraddress: Address): StateInit { return initOf MyJettonWallet(owneraddress, self.jettonmaster); } }
implementation
actually you can find implementation for the traits or TEPs in mock contracts/mock directoryTonion-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:
- Fork the repository.
- Add a feature or fix a bug
- Open a pull request.
Contributors
| Zig Blathazar | Kay | olumo-oke | satya sai | seniorGarin |
License
This project is licensed under the MIT License - see the MIT License file for details.