Skip to content

Commit f7177f2

Browse files
Merge pull request #89 from EmelyanenkoK/jetton-wallet-discovery
TEP-89: Discoverable Jetton Wallets
2 parents 1eaccb3 + 66675fc commit f7177f2

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
- **TEP**: [89](https://github.com/ton-blockchain/TEPs/pull/89)
2+
- **title**: Discoverable Jettons Wallets
3+
- **status**: Active
4+
- **type**: Contract Interface
5+
- **authors**: [sasha1618](https://github.com/sasha1618), [EmelyanenkoK](https://github.com/EmelyanenkoK)
6+
- **created**: 08.09.2022
7+
- **replaces**: -
8+
- **replaced by**: -
9+
10+
# Summary
11+
12+
This proposal suggest to extend standard Jetton master by adding mandatory onchain `provide_wallet_address` handler.
13+
14+
# Motivation
15+
16+
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.
17+
18+
# Guide
19+
20+
Upon receiving `provide_wallet_address` message with address in question, Jetton Master should response with message containing address.
21+
22+
# Specification
23+
24+
## New Jetton Master contracts
25+
Example of discoverable jetton minter code can be found [here](https://github.com/ton-blockchain/token-contract/blob/main/ft/jetton-minter-discoverable.fc)
26+
27+
28+
Jetton Master should handle message
29+
30+
`provide_wallet_address#2c76b973 query_id:uint64 owner_address:MsgAddress include_address:Bool = InternalMsgBody;`
31+
32+
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
33+
34+
and either throw an exception if amount of incoming value is not enough to calculate wallet address or
35+
response with message (sent with mode 64)
36+
37+
`take_wallet_address#d1735400 query_id:uint64 wallet_address:MsgAddress owner_address:(Maybe ^MsgAddress) = InternalMsgBody;`
38+
39+
Note: if it is not possible to generate wallet address for address in question (for instance wrong workchain) `wallet_address` in `take_wallet_address` should be equal to `addr_none`. If `include_address` is set to `True`, `take_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).
40+
41+
## Already existing Jetton Master contracts
42+
43+
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.
44+
45+
## Scheme:
46+
```
47+
provide_wallet_address#2c76b973 query_id:uint64 owner_address:MsgAddress include_address:Bool = InternalMsgBody;
48+
take_wallet_address#d1735400 query_id:uint64 wallet_address:MsgAddress owner_address:(Maybe ^MsgAddress) = InternalMsgBody;
49+
```
50+
51+
```
52+
crc32('provide_wallet_address query_id:uint64 owner_address:MsgAddress include_address:Bool = InternalMsgBody') = 2c76b973
53+
crc32('take_wallet_address query_id:uint64 wallet_address:MsgAddress owner_address:Maybe ^MsgAddress = InternalMsgBody') = d1735400
54+
```
55+
56+
# Drawbacks
57+
58+
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.
59+
60+
# Rationale and alternatives
61+
62+
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.
63+
64+
# Prior art
65+
66+
-
67+
68+
# Unresolved questions
69+
70+
It is not possible to distinguish Jetton Discovery which consume higher than expected fee from non-Jetton Discovery contract.
71+
72+
# Future possibilities
73+
74+
-

0 commit comments

Comments
 (0)