Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

feat: add stonfi cookbook #400

Closed
wants to merge 4 commits into from
Closed

Conversation

pixelplex
Copy link
Contributor

@pixelplex pixelplex commented Sep 25, 2024

Closes #149

P.S.: Why do you do the issue reference in a separate message? :)

@a-bahdanau
Copy link
Contributor

#149

@pixelplex pixelplex changed the title Stonfi feat: add stonfi cookbook Sep 25, 2024

### TON to jetton

TON to jetton swap introduces `ProxyTonTransfer` cause all interaction is done with pTON contract.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's explain a little bit more about pTON and provide a link to the related page in stonfi docs for further reading

refundAddress: Address; // Address where refund will be sent if swap fails
excessesAddress: Address; // Address where TON excesses will be sent
deadline: Int as uint64; // Timestamp of execution deadline for this tx
additionalData: SwapAdditionalData;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add a comment like defined below for this line


</Callout>
Some variables like `offerAmount` are hardcoded for demonstration purposes. Don't forget to change them in real case scenarios.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add a few links for common TON stuff in the beginning of the article, like what are messages in general, how to work with jettons etc

const RouterJettonWallet: Address = address("kQAtX3x2s-wMtYTz8CfmAyloHAB73vONzJM5S2idqXl-_5xK"); // Router Jetton Wallet Address

message SwapJettonJetton {
myJettonWalletAddress: Address; // calculated offchain for ease of example, in real world scenarios should be calculated onchain
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the should be part seems wrong to me, especially in the context of this specific line. let's move this warning comment to the line below (see next comment)

contract JettonToJetton {
receive() {}
receive(msg: SwapJettonJetton) {
let myJettonWalletAddress: Address = msg.myJettonWalletAddress;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's move that comment here, and rephrase it so that it's clear that this specific example just takes whatever address it receives in message instead of some reliable way (either on-chain calculation or saving on initialization)


</Callout>
Some variables like `offerAmount` are hardcoded for demonstration purposes. Don't forget to change them in real case scenarios.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should explain what offerAmount is and how it should be changed in real case scenarios. none of the below examples explain that. you can probably just add a link to the related stonfi doca page and tell readers to look there for other variables explanations too

}

message SampleProvideLP {
myJettonWalletAddress: Address; // calculated offchain for ease of example, in real world scenarios should be calculated onchain
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as for the swaps

}
```

## Liquidity provision
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also add a section on withdrawing provided liquidity

@a-bahdanau
Copy link
Contributor

@Gusarich should i do this in this version of docs or move to the newest one?

@novusnota
Copy link
Member

@a-bahdanau newest one is preferred, since there is a better test suite available

@a-bahdanau
Copy link
Contributor

Closed all comments through tact-lang/tact#956

@novusnota
Copy link
Member

This PR was adjusted for the new docs and moved to tact-lang/tact#956

@novusnota novusnota closed this Nov 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

An example of sending a Ston.fi swap transaction in Cookbook
4 participants