Skip to content

Commit 1f6aa80

Browse files
authored
"docs(ton): update protocol contracts"
1 parent 0480f2f commit 1f6aa80

1 file changed

Lines changed: 107 additions & 0 deletions

File tree

  • src/pages/developers/protocol
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# TON Gateway Docs
2+
3+
## gateway.fc
4+
5+
### Constants
6+
7+
- **op::internal::donate** = 100
8+
- **op::internal::deposit** = 101
9+
- **op::internal::deposit_and_call** = 102
10+
- **op::internal::call** = 103
11+
- **op::external::withdraw** = 200
12+
- **op::external::increase_seqno** = 205
13+
- **op::authority::set_deposits_enabled** = 201
14+
- **op::authority::update_tss** = 202
15+
- **op::authority::update_code** = 203
16+
- **op::authority::update_authority** = 204
17+
- **op::authority::reset_seqno** = 206
18+
19+
### `handle_deposit`
20+
21+
```func
22+
() handle_deposit(int amount, slice in_msg_body) impure inline {
23+
```
24+
25+
Deposit TON to the gateway and specify the EVM recipient on ZetaChain
26+
27+
### `handle_call`
28+
29+
```func
30+
() handle_call(int amount, slice in_msg_body) impure inline {
31+
```
32+
33+
Handles zeta's onCall method by ensuring call_data size and gas costs are covered;
34+
35+
NOTE that this operation DOESN'T rebate sent amount if it's bigger than tx fee!
36+
We can consider sending surplus amount back in the future improvements.
37+
For now, send amount that is equal to calculate_gas_fee(op::call)
38+
39+
### `handle_set_deposits_enabled`
40+
41+
```func
42+
() handle_set_deposits_enabled(slice sender, slice message) impure inline {
43+
```
44+
45+
Enables or disables deposits.
46+
47+
### `handle_update_tss`
48+
49+
```func
50+
() handle_update_tss(slice sender, slice message) impure inline {
51+
```
52+
53+
Updates the TSS address. WARNING! Execute with extra caution.
54+
Wrong TSS address leads to loss of funds.
55+
56+
### `handle_update_code`
57+
58+
```func
59+
() handle_update_code(slice sender, slice message) impure inline {
60+
```
61+
62+
Updated the code of the contract
63+
Handle_code_update (cell new_code)
64+
65+
### `handle_reset_seqno`
66+
67+
```func
68+
() handle_reset_seqno(slice sender, slice message) impure inline {
69+
```
70+
71+
Resets the seqno to the specified value
72+
Handles reset_seqno (uint32 new_seqno)
73+
74+
### `recv_internal`
75+
76+
```func
77+
() recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure {
78+
```
79+
80+
Input for all internal messages
81+
82+
### `handle_withdrawal`
83+
84+
```func
85+
() handle_withdrawal(slice payload) impure inline {
86+
```
87+
88+
Withdraws assets to the recipient
89+
90+
Handle_withdrawal (MsgAddr recipient, Coins amount, uint32 seqno)
91+
92+
### `handle_increase_seqno`
93+
94+
```func
95+
() handle_increase_seqno(slice payload) impure inline {
96+
```
97+
98+
Increases seqno by 1 without doing any other operations.
99+
Handle_increase_seqno (uint32 failure_reason, uint32 seqno)
100+
101+
### `recv_external`
102+
103+
```func
104+
() recv_external(slice message) impure {
105+
```
106+
107+
Entry point for all external messages

0 commit comments

Comments
 (0)