diff --git a/README.md b/README.md index dea1ec3..00ad608 100644 --- a/README.md +++ b/README.md @@ -86,10 +86,28 @@ Also, additional utils from `sources/utils/` are used in tests and deployment sc Main smart contract is `jetton_minter.tact`. It imports `messages.tact` and `jetton_wallet.tact`, so they will be compiled automatically, when setting `jetton_minter.tact` as target in `tact.config.json`. ### Traits -Jetton minter is using *OwnableTransferable* and *Deployable* trait. Actually, you can remove *Deployable* trait. It is used only for more convenient deployment in tests. +Jetton minter is using only *OwnableTransferable* which is inherited from *Ownable* trait. Jetton wallet is using only *Ownable* trait. +**Note: These traits are implemented in stdlib.** + +Scheme of inheritance and imports: +```mermaid +graph LR + B[jetton_minter.tact] -->|import| A[messages.tact] + C[jetton_wallet.tact] -->|import| A[messages.tact] + B[jetton_minter.tact] -->|import| C[jetton_wallet.tact] + + C[jetton_wallet.tact] -->|uses| E[ownable] + B[jetton_minter.tact] -->|uses| F[ownableTransferable] + F[ownableTransferable] -->|inherits| E[ownable] + + class E,F ownableStyle; + + classDef ownableStyle stroke-width:2,rx:25,ry:25; + +``` You can learn more about traits in the [Tact standard library](https://docs.tact-lang.org/ref/standard-libraries/). ## Best Practices diff --git a/sources/contract.spec.ts b/sources/contract.spec.ts index 3af2c15..c5dd0e6 100644 --- a/sources/contract.spec.ts +++ b/sources/contract.spec.ts @@ -146,13 +146,16 @@ describe("JettonMinter", () => { notDeployer = await blockchain.treasury('notDeployer'); defaultContent = beginCell().endCell(); - let msg: Deploy = { - $$type: "Deploy", - queryId: 0n, + let msg: TokenUpdateContent = { + $$type: "TokenUpdateContent", + content: defaultContent, } jettonMinter = blockchain.openContract(await JettonMinter.fromInit(deployer.address, defaultContent)); + + //We send Update content to deploy the contract, because it is not automatically deployed after blockchain.openContract + //And to deploy it we should send any message. But update content message with same content does not affect anything. That is why I chose it. const deployResult = await jettonMinter.send(deployer.getSender(), {value: toNano("0.1")}, msg); expect(deployResult.transactions).toHaveTransaction({ diff --git a/sources/jetton_minter.tact b/sources/jetton_minter.tact index 562c1b7..36a9af8 100644 --- a/sources/jetton_minter.tact +++ b/sources/jetton_minter.tact @@ -13,7 +13,7 @@ struct JettonMasterState { jettonWalletCode: Cell; } -contract JettonMinter with OwnableTransferable, Deployable { +contract JettonMinter with OwnableTransferable { totalSupply: Int as coins; mintable: Bool; owner: Address;