-
Notifications
You must be signed in to change notification settings - Fork 239
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
TEP: discoverable jetton wallets #89
Merged
hacker-volodya
merged 8 commits into
ton-blockchain:master
from
EmelyanenkoK:jetton-wallet-discovery
Oct 4, 2022
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e13b3a7
Add discoverable jetton wallets standard
EmelyanenkoK fcc94a0
Add minimal get_wallet_address request amount
EmelyanenkoK 0aa3840
Rename handler messages
EmelyanenkoK 9af0d6c
Add Sasha as co-author
EmelyanenkoK 60ce0aa
Add link to discoverable jetton minter example
EmelyanenkoK 813dde3
Fix typo
hacker-volodya 21a9bd9
Fix typo
hacker-volodya 66675fc
TEP-89: Move state to 'Active'
hacker-volodya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
- **TEP**: [89](https://github.com/ton-blockchain/TEPs/pull/89) | ||
- **title**: Discoverable Jettons Wallets | ||
- **status**: Draft | ||
- **type**: Contract Interface | ||
- **authors**: [EmelyanenkoK](https://github.com/EmelyanenkoK) | ||
- **created**: 08.09.2022 | ||
- **replaces**: - | ||
- **replaced by**: - | ||
|
||
# Summary | ||
|
||
This proposal suggest to extend standard Jetton master by adding mandatory onchain `get_wallet_address` handler. | ||
|
||
# Motivation | ||
|
||
Some application may want to be able to discover their or other contract wallets for some specific Jetton Master. For instance some contract may want to obtain and store it's jetton wallet for some Jetton to handle transfer notifications from it in specific way. | ||
|
||
# Guide | ||
|
||
Upon receiving `get_wallet_address` message with address in question, Jetton Master should response with message containing address. | ||
|
||
# Specification | ||
|
||
## New Jetton Master contracts | ||
Jettom Master should handle message | ||
|
||
`get_wallet_address#418cbb4e query_id:uint64 owner_address:MsgAddress include_address:Bool = InternalMsgBody;` | ||
|
||
with TON amount higher than `5000 gas-units + msg_forward_prices.lump_price + msg_forward_prices.cell_price` = 0.0061 TON for current basechain settings (if amount is less than that it is not possible to send response) attached | ||
|
||
and either throw an exception if amount of incoming value is not enough to calculate wallet address or | ||
response with message (sent with mode 64) | ||
|
||
`report_wallet_address#ad30f94a query_id:uint64 wallet_address:MsgAddress owner_address:(Maybe ^MsgAddress) = InternalMsgBody;` | ||
|
||
Note: if it is not possible to generate wallet address for address in question (for instance wrong workchain) `wallet_address` in `report_wallet_address` should be equal to `addr_none`. If `include_address` is set to `True`, `report_wallet_address` should include `owner_address` equal to `owner_address` in request (in other words response contains both owner address and associated jetton wallet address). | ||
|
||
## Already existing Jetton Master contracts | ||
|
||
Jettons with non-upgradable Jetton Master may spawn separate smart-contract (Jetton discovery) which implements this functionality. In this case pair of contracts (Jetton Master + Jetton Discovery) will behave the same way as new Jetton Master. For non-upgradable Jetton Master with updatable metadata it is recommended to add "wallet-discovery" key with value equal to text representaion of Jetton Discovery contract address. | ||
|
||
## Scheme: | ||
``` | ||
get_wallet_address query_id:uint64 owner_address:MsgAddress include_address:Bool = InternalMsgBody; | ||
report_wallet_address query_id:uint64 wallet_address:MsgAddress owner_address:(Maybe ^MsgAddress) = InternalMsgBody; | ||
``` | ||
|
||
``` | ||
crc32('get_wallet_address query_id:uint64 owner_address:MsgAddress include_address:Bool = InternalMsgBody') = 418cbb4e | ||
crc32('report_wallet_address query_id:uint64 wallet_address:MsgAddress owner_address:Maybe ^MsgAddress = InternalMsgBody') = ad30f94a | ||
``` | ||
|
||
# Drawbacks | ||
|
||
If new applications start to heavily rely on these proposal without supporting separate Jetton Master/Jetton Discovery they may not be able to process already existing jettons. | ||
|
||
# Rationale and alternatives | ||
|
||
Currently it is expected that decentralised applications will work with specific wallets not with Jetton Masters. However sometimes it makes logic more complicated (especially if it is desired to create predictable contract addresses) or less straightforward for user-side checks. | ||
|
||
# Prior art | ||
|
||
- | ||
|
||
# Unresolved questions | ||
|
||
It is not possible to distinguish Jetton Discovery which consume higher than expected fee from non-Jetton Discovery contract. | ||
|
||
# Future possibilities | ||
|
||
- |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Please consider naming report_wallet_address return_wallet_address, because report has the context of marking an entity as malicious etc.
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.
other potential terms instead of "report" are "return" / "query" / "get"
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.
Currently we mimic names used in NFT for
get_static_data
.I don't like return/query naming because I think it will looks a little bit counterintuitive to implement "return_wallet_address" method on recipient side to actually handle the response.
What about a
take_static_data
? Alternatively we can just useget_static_data
op-code with high-bit set to true (to emphasize it is response), however we doesn't have TL-B notation for that.Anyway, I don't think that this issue is important and any decision will work ok.
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 realised that op should represent the operation that a receiver should execute.
With that in mind the best way to name our ops is: provide_wallet_address and take_wallet_address.