-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: enhance jetton page #403
base: main
Are you sure you want to change the base?
Conversation
|
||
### Jetton Master Contract | ||
|
||
The Jetton Master Contract serves as the central entity for a specific token. It maintains critical information about the jetton itself and facilitates the creation of individual wallets for token holders. Key responsibilities and data stored in the Jetton Master Contract include: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jetton master doesn't actually take part in the process of creation of jetton wallets, and transfers happen without any actions from jetton master side. wallets deploy each other.
The Jetton Master Contract serves as the central entity for a specific token. It maintains critical information about the jetton itself and facilitates the creation of individual wallets for token holders. Key responsibilities and data stored in the Jetton Master Contract include: | ||
|
||
* Jetton Metadata: Information such as the token's name, symbol, total supply, and decimals. | ||
* Jetton Wallet Creation: The Jetton Master can generate individual Jetton Wallet contracts for token holders. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jetton master doesn't deploy jetton wallets, unless it's mint
process, which isn't even a part of the standard
* Minting and Burning: When new jettons are minted (created), the Jetton Master handles the creation process and distributes them to the relevant wallets. Similarly, it manages burning (destruction) of tokens when required. | ||
* Supply Management: The Jetton Master keeps track of the total supply of the token, ensuring proper accounting for all issued jettons. | ||
|
||
### Jetton Wallet Contract |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good to explain here that wallets usually communicate between each other without any activity from master, so master contract doesn't create a bottleneck
|
||
Since notifications originate from your contract's jetton wallet, as illustrated in the diagram, the function [`myAddress(){:tact}`](/ref/core-common#myaddress) should be used in `ownerAddress{:tact}` field. | ||
|
||
Calculation of contract's jetton wallet is done via function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
via function
- unfinished sentence
Since notifications originate from your contract's jetton wallet, as illustrated in the diagram, the function [`myAddress(){:tact}`](/ref/core-common#myaddress) should be used in `ownerAddress{:tact}` field. | ||
|
||
Calculation of contract's jetton wallet is done via function. | ||
To obtain jetton wallet state init we need jetton wallets data and code. Common initial data layout is shown below but in may differ in some case, like in . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like in .
- unfinished sentence
|
||
Calculation of contract's jetton wallet is done via function. | ||
To obtain jetton wallet state init we need jetton wallets data and code. Common initial data layout is shown below but in may differ in some case, like in . | ||
Since notifications come from your contract's jetton wallet as shown in diagram, the function should be used in state init the owner address field. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function should
- extra space
|
||
init(jettonWalletCode: Cell, jettonMasterAddress: Address) { | ||
self.jettonWalletCode = jettonWalletCode; | ||
self.jettonMasterAddress = jettonMasterAddress; | ||
self.myJettonWalletAddress = calculateJettonWalletAddress(myAddress(), jettonMasterAddress, jettonWalletCode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as I already said before in previous reviews, in most cases the solution for verification is to calculate that address offchain and then just add it into the stateinit of the contract itself.
calculating the address on-chain will only work if you're 100% sure in the jetton code and data structure, or if you take them as variable parameters in the stateinit
require(sender() == myJettonWalletAddress, "Notification not from your jetton wallet!"); | ||
require(sender() == self.myJettonWalletAddress, "Notification not from your jetton wallet!"); | ||
|
||
self.myJettonAmount += msg.amount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also highlight that these notifications are not guaranteed to be sent. The default implementation doesn't send notification if forwardAmount
is zero, so in such cases you can't really rely on them.
Closes #399