Skip to content

Commit

Permalink
docs: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ZigBalthazar committed Jul 10, 2024
1 parent 0b65b35 commit 9abff40
Showing 1 changed file with 40 additions and 5 deletions.
45 changes: 40 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,48 @@ TonIon Contracts is a reusable smart contract library and toolkit for the Tact l

### Traits
add the `traits (contracts/traits)` to your project `contracts/imports`, then
Import the required contracts and traits in your Tact code:
Import the required contracts and traits in your Tact code(Sample Jetton Master):

```ts
import "@stdlib/deploy";
import "../../../traits/tokens/jetton/JettonMaster.tact";
import "../../../traits/tokens/jetton/JettonWallet.tact";

contract JettonMasterImp 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 JettonWalletImp(owner_address, myAddress());
}

```tact
import "./imports/traits/someCategory/SomeTrait.tact";
}
```

contract MyContract with someTrait {
//your logic :)
and Jetton Wallet:
```ts
contract JettonWalletImp 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 JettonWalletImp(owner_address, self.jetton_master);
}
}
```
### implementation
Expand Down

0 comments on commit 9abff40

Please sign in to comment.