From 7a1bc1603de5907492c70fd62496f9bc82f834da Mon Sep 17 00:00:00 2001 From: Aliaksandr Bahdanau Date: Tue, 24 Sep 2024 15:04:39 +0300 Subject: [PATCH 1/4] feat: add part of stonfi cookbook --- pages/cookbook/dexes/stonfi.mdx | 161 +++++++++++++++++++++++++++++++- 1 file changed, 158 insertions(+), 3 deletions(-) diff --git a/pages/cookbook/dexes/stonfi.mdx b/pages/cookbook/dexes/stonfi.mdx index 6a887a35..d0e1a681 100644 --- a/pages/cookbook/dexes/stonfi.mdx +++ b/pages/cookbook/dexes/stonfi.mdx @@ -6,8 +6,163 @@ import { Callout, Steps, Tabs } from 'nextra/components' [STON.fi](https://ston.fi) is a decentralized automated market maker (AMM) built on [TON blockchain](https://ton.org) providing virtually zero fees, low slippage, an extremely easy interface, and direct integration with TON wallets. - + + This api is about v2 of STON.fi. Make sure not to use it with v1 contracts + - This page is a stub until it gets new content in [#149](https://github.com/tact-lang/tact-docs/issues/149). +## Swap jetton to jetton - +```tact +message(0x6664de2a) StonfiSwap { + otherTokenWallet: Address; // Address of the other Router token wallet + 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; +} + +struct SwapAdditionalData { + minOut: Int as coins; // Minimum required amount of tokens to receive + receiver: Address; // Address where tokens will be sent after swap + fwdGas: Int as coins = 0; // Gas used to forward a message in transfer_notification after swap if custom_payload is present + customPayload: Cell? = null; // Payload sent in transfer_notification after swap + refundFwdGas: Int as coins = 0; // Gas used to forward a message in transfer_notification if swap fails if refund_payload is present + refundPayload: Cell? = null; // Payload sent in transfer_notification if swap fails + refFee: Int as uint16 = 10; // Referral fee. Max amount is 100 (1%) + referralAddress: Address? = null; // Referral address +} + +message(0xf8a7ea5) JettonTransfer { + queryId: Int as uint64; + amount: Int as coins; + destination: Address; + responseDestination: Address?; + customPayload: Cell? = null; + forwardTonAmount: Int as coins; + forwardPayload: Cell?; // hack for now, equivalent to Slice as remaining with first bit set to 1 +} + +// precalculated gas amounts to swap +const GasSwapJettonToJetton: Int = ton("0.3"); +const GasSwapJettonToJettonFwd: Int = ton("0.24"); + +const RouterAddress: Address = address("kQALh-JBBIKK7gr0o4AVf9JZnEsFndqO0qTCyT-D-yBsWk0v"); // CPI Router v2.1.0 +const RouterJettonWallet: Address = address("kQAtX3x2s-wMtYTz8CfmAyloHAB73vONzJM5S2idqXl-_5xK"); // Router Lupa Address. Should be calculated onchain in real scenarios + +message SwapJetton { + myJettonWalletAddress: Address; // calculated offchain for ease of example, in real case scenarios should be calculated onchain +} + +contract JettonToJetton { + receive() {} + receive(msg: SwapJetton) { + let myJettonWalletAddress: Address = msg.myJettonWalletAddress; + + let receiver = address("0QD-SuoCHsCL2pIZfE8IAKsjc0aDpDUQAoo-ALHl2mje04A-"); // replace with your reciver address + let offerAmount: Int = 100000; // replace with your offer amount + + let forwardPayload = StonfiSwap{ + otherTokenWallet: RouterJettonWallet, + refundAddress: myAddress(), // replace with your refund address + excessesAddress: myAddress(), // replace with your exceesses address + deadline: now() + 10000, + additionalData: SwapAdditionalData{ + minOut: 1, // swap will fail if a receiver should receive less than minOut of tokens as a result + receiver, + } + }; + + send(SendParameters{ + to: myJettonWalletAddress, + value: GasSwapJettonToJetton, + body: JettonTransfer{ + queryId: 42, + amount: offerAmount, + destination: RouterAddress, + responseDestination: myAddress(), + forwardTonAmount: GasSwapJettonToJettonFwd, + forwardPayload: forwardPayload.toCell(), + }.toCell() + }); + } +} +``` + +## Swap jetton to TON + +Swapping jetton to TON is similar to jetton/jetton swap. The only one difference is that `RouterJettonWallet` address should be replaced with `RouterProxyTonWallet`. + +```tact +message(0x6664de2a) StonfiSwap { + otherTokenWallet: Address; // Address of the other Router token wallet + 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; +} + +struct SwapAdditionalData { + minOut: Int as coins; // Minimum required amount of tokens to receive + receiver: Address; // Address where tokens will be sent after swap + fwdGas: Int as coins = 0; // Gas used to forward a message in transfer_notification after swap if custom_payload is present + customPayload: Cell? = null; // Payload sent in transfer_notification after swap + refundFwdGas: Int as coins = 0; // Gas used to forward a message in transfer_notification if swap fails if refund_payload is present + refundPayload: Cell? = null; // Payload sent in transfer_notification if swap fails + refFee: Int as uint16 = 10; // Referral fee. Max amount is 100 (1%) + referralAddress: Address? = null; // Referral address +} + +message(0xf8a7ea5) JettonTransfer { + queryId: Int as uint64; + amount: Int as coins; + destination: Address; + responseDestination: Address?; + customPayload: Cell? = null; + forwardTonAmount: Int as coins; + forwardPayload: Cell?; // hack for now, equivalent to Slice as remaining with first bit set to 1 +} + +const GasSwapJettonToTon: Int = ton("0.3"); +const GasSwapJettonToTonFwd: Int = ton("0.24"); + +const RouterAddress: Address = address("kQALh-JBBIKK7gr0o4AVf9JZnEsFndqO0qTCyT-D-yBsWk0v"); // CPI Router v2.1.0 +const RouterProxyTonWallet: Address = address("kQBbJjnahBMGbMUJwhAXLn8BiigcGXMJhSC0l7DBhdYABhG7"); // Router pTON Address + +message SwapJetton { + myJettonWalletAddress: Address; // calculated offchain for ease of example, in real case scenarios should be calculated onchain +} + +contract Sample { + receive() {} + receive(msg: SwapJetton) { + let myJettonWalletAddress: Address = msg.myJettonWalletAddress; + + let receiver = address("0QD-SuoCHsCL2pIZfE8IAKsjc0aDpDUQAoo-ALHl2mje04A-"); // replace with your reciever address + let offerAmount: Int = 100000; + + let forwardPayload = StonfiSwap{ + otherTokenWallet: RouterProxyTonWallet, + refundAddress: myAddress(), // replace with your refund address + excessesAddress: myAddress(), // replace with your excesses address + deadline: now() + 10000, + additionalData: SwapAdditionalData{ + minOut: 1, // swap will fail if a receiver should receive less than minOut of tokens as a result + receiver, + } + }; + + send(SendParameters{ + to: myJettonWalletAddress, + value: GasSwapJettonToTon, + body: JettonTransfer{ + queryId: 42, + amount: offerAmount, + destination: RouterAddress, + responseDestination: myAddress(), + forwardTonAmount: GasSwapJettonToTonFwd, + forwardPayload: forwardPayload.toCell(), + }.toCell() + }); + } +} +``` From 7293248b47ac69655562259eb9fa212d6042bcb8 Mon Sep 17 00:00:00 2001 From: Aliaksandr Bahdanau Date: Tue, 24 Sep 2024 22:34:18 +0300 Subject: [PATCH 2/4] feat: add swaps examples --- pages/cookbook/dexes/stonfi.mdx | 134 +++++++++++++++++++------------- 1 file changed, 82 insertions(+), 52 deletions(-) diff --git a/pages/cookbook/dexes/stonfi.mdx b/pages/cookbook/dexes/stonfi.mdx index d0e1a681..3a711303 100644 --- a/pages/cookbook/dexes/stonfi.mdx +++ b/pages/cookbook/dexes/stonfi.mdx @@ -7,10 +7,16 @@ import { Callout, Steps, Tabs } from 'nextra/components' [STON.fi](https://ston.fi) is a decentralized automated market maker (AMM) built on [TON blockchain](https://ton.org) providing virtually zero fees, low slippage, an extremely easy interface, and direct integration with TON wallets. - This api is about v2 of STON.fi. Make sure not to use it with v1 contracts + This api is about STON.fi version 2, which is under development. Use it at your own risk. -## Swap jetton to jetton +## Swaps + +More about swaps [here](https://docs.ston.fi/docs/developer-section/api-reference-v2/example_swap). + +Some variables like `offerAmount` are hardcoded for demonstration purposes. Don't forget to change them in real case scenarios. + +Swaps have several common structures and messages. Don't forget to use them with the code examples below! ```tact message(0x6664de2a) StonfiSwap { @@ -41,34 +47,46 @@ message(0xf8a7ea5) JettonTransfer { forwardTonAmount: Int as coins; forwardPayload: Cell?; // hack for now, equivalent to Slice as remaining with first bit set to 1 } +``` + +Below are shown gas constants. All of them are taken from the sdk [STON.fi sdk](https://github.com/ston-fi/sdk). They are slightly differ from reality, but it is ok for now. -// precalculated gas amounts to swap +```tact const GasSwapJettonToJetton: Int = ton("0.3"); const GasSwapJettonToJettonFwd: Int = ton("0.24"); +const GasSwapJettonToTon: Int = ton("0.3"); +const GasSwapJettonToTonFwd: Int = ton("0.24"); + +const GasSwapTonToJettonFwd: Int = ton("0.3"); +const GasSwapTonToJetton: Int = ton("0.01"); +``` + +### Jetton to jetton + +```tact const RouterAddress: Address = address("kQALh-JBBIKK7gr0o4AVf9JZnEsFndqO0qTCyT-D-yBsWk0v"); // CPI Router v2.1.0 -const RouterJettonWallet: Address = address("kQAtX3x2s-wMtYTz8CfmAyloHAB73vONzJM5S2idqXl-_5xK"); // Router Lupa Address. Should be calculated onchain in real scenarios +const RouterJettonWallet: Address = address("kQAtX3x2s-wMtYTz8CfmAyloHAB73vONzJM5S2idqXl-_5xK"); // Router Jetton Wallet Address -message SwapJetton { +message SwapJettonJetton { myJettonWalletAddress: Address; // calculated offchain for ease of example, in real case scenarios should be calculated onchain } contract JettonToJetton { receive() {} - receive(msg: SwapJetton) { + receive(msg: SwapJettonJetton) { let myJettonWalletAddress: Address = msg.myJettonWalletAddress; - let receiver = address("0QD-SuoCHsCL2pIZfE8IAKsjc0aDpDUQAoo-ALHl2mje04A-"); // replace with your reciver address - let offerAmount: Int = 100000; // replace with your offer amount + let offerAmount: Int = 100000; let forwardPayload = StonfiSwap{ otherTokenWallet: RouterJettonWallet, - refundAddress: myAddress(), // replace with your refund address - excessesAddress: myAddress(), // replace with your exceesses address + refundAddress: myAddress(), + excessesAddress: myAddress(), deadline: now() + 10000, additionalData: SwapAdditionalData{ minOut: 1, // swap will fail if a receiver should receive less than minOut of tokens as a result - receiver, + receiver: myAddress(), } }; @@ -88,66 +106,33 @@ contract JettonToJetton { } ``` -## Swap jetton to TON +### Jetton to TON Swapping jetton to TON is similar to jetton/jetton swap. The only one difference is that `RouterJettonWallet` address should be replaced with `RouterProxyTonWallet`. ```tact -message(0x6664de2a) StonfiSwap { - otherTokenWallet: Address; // Address of the other Router token wallet - 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; -} - -struct SwapAdditionalData { - minOut: Int as coins; // Minimum required amount of tokens to receive - receiver: Address; // Address where tokens will be sent after swap - fwdGas: Int as coins = 0; // Gas used to forward a message in transfer_notification after swap if custom_payload is present - customPayload: Cell? = null; // Payload sent in transfer_notification after swap - refundFwdGas: Int as coins = 0; // Gas used to forward a message in transfer_notification if swap fails if refund_payload is present - refundPayload: Cell? = null; // Payload sent in transfer_notification if swap fails - refFee: Int as uint16 = 10; // Referral fee. Max amount is 100 (1%) - referralAddress: Address? = null; // Referral address -} - -message(0xf8a7ea5) JettonTransfer { - queryId: Int as uint64; - amount: Int as coins; - destination: Address; - responseDestination: Address?; - customPayload: Cell? = null; - forwardTonAmount: Int as coins; - forwardPayload: Cell?; // hack for now, equivalent to Slice as remaining with first bit set to 1 -} - -const GasSwapJettonToTon: Int = ton("0.3"); -const GasSwapJettonToTonFwd: Int = ton("0.24"); - const RouterAddress: Address = address("kQALh-JBBIKK7gr0o4AVf9JZnEsFndqO0qTCyT-D-yBsWk0v"); // CPI Router v2.1.0 -const RouterProxyTonWallet: Address = address("kQBbJjnahBMGbMUJwhAXLn8BiigcGXMJhSC0l7DBhdYABhG7"); // Router pTON Address +const RouterProxyTonWallet: Address = address("kQBbJjnahBMGbMUJwhAXLn8BiigcGXMJhSC0l7DBhdYABhG7"); // Router's pTON Address -message SwapJetton { +message SwapJettonTon { myJettonWalletAddress: Address; // calculated offchain for ease of example, in real case scenarios should be calculated onchain } -contract Sample { +contract JettonToTon { receive() {} - receive(msg: SwapJetton) { + receive(msg: SwapJettonTon) { let myJettonWalletAddress: Address = msg.myJettonWalletAddress; - let receiver = address("0QD-SuoCHsCL2pIZfE8IAKsjc0aDpDUQAoo-ALHl2mje04A-"); // replace with your reciever address let offerAmount: Int = 100000; let forwardPayload = StonfiSwap{ otherTokenWallet: RouterProxyTonWallet, - refundAddress: myAddress(), // replace with your refund address - excessesAddress: myAddress(), // replace with your excesses address + refundAddress: myAddress(), + excessesAddress: myAddress(), deadline: now() + 10000, additionalData: SwapAdditionalData{ minOut: 1, // swap will fail if a receiver should receive less than minOut of tokens as a result - receiver, + receiver: myAddress(), } }; @@ -166,3 +151,48 @@ contract Sample { } } ``` + +### TON to jetton + +TON to jetton swap introduces `ProxyTonTransfer` cause all interaction is done with pTON contract. + +```tact +message(0x01f3835d) ProxyTonTransfer { + queryId: Int as uint64 = 0; + tonAmount: Int as coins; + refundAddress: Address; + forwardPayload: Cell?; +} + +const RouterProxyTonWallet: Address = address("kQBbJjnahBMGbMUJwhAXLn8BiigcGXMJhSC0l7DBhdYABhG7"); // Router's pTON wallet Address +const RouterJettonWallet: Address = address("kQAtX3x2s-wMtYTz8CfmAyloHAB73vONzJM5S2idqXl-_5xK"); // Router's Jetton Wallet Address + +contract TonToJetton { + receive() {} + receive("ton-jetton") { + let offerAmount: Int = 100000; + + let forwardPayload = StonfiSwap{ + otherTokenWallet: RouterJettonWallet, + refundAddress: myAddress(), + excessesAddress: myAddress(), + deadline: now() + 10000, + additionalData: SwapAdditionalData{ + minOut: 1, // swap will fail if a receiver should receive less than minOut of tokens as a result + receiver: myAddress(), + } + }; + + send(SendParameters{ + to: RouterProxyTonWallet, + value: GasSwapTonToJetton + GasSwapTonToJettonFwd + offerAmount, + body: ProxyTonTransfer{ + queryId: 42, + tonAmount: offerAmount, + refundAddress: myAddress(), + forwardPayload: forwardPayload.toCell(), + }.toCell() + }); + } +} +``` From 1f42c61d831f57268edc0671f768384b453a9200 Mon Sep 17 00:00:00 2001 From: Aliaksandr Bahdanau Date: Wed, 25 Sep 2024 11:06:01 +0300 Subject: [PATCH 3/4] feat: add liquidity provision examples --- pages/cookbook/dexes/stonfi.mdx | 143 ++++++++++++++++++++++++++++++-- 1 file changed, 138 insertions(+), 5 deletions(-) diff --git a/pages/cookbook/dexes/stonfi.mdx b/pages/cookbook/dexes/stonfi.mdx index 3a711303..25b3949e 100644 --- a/pages/cookbook/dexes/stonfi.mdx +++ b/pages/cookbook/dexes/stonfi.mdx @@ -1,8 +1,6 @@ # STON.fi -import { Callout, Steps, Tabs } from 'nextra/components' - -{/* See: https://nextra.site/docs/guide/built-ins */} +import { Callout } from 'nextra/components' [STON.fi](https://ston.fi) is a decentralized automated market maker (AMM) built on [TON blockchain](https://ton.org) providing virtually zero fees, low slippage, an extremely easy interface, and direct integration with TON wallets. @@ -69,7 +67,7 @@ const RouterAddress: Address = address("kQALh-JBBIKK7gr0o4AVf9JZnEsFndqO0qTCyT-D const RouterJettonWallet: Address = address("kQAtX3x2s-wMtYTz8CfmAyloHAB73vONzJM5S2idqXl-_5xK"); // Router Jetton Wallet Address message SwapJettonJetton { - myJettonWalletAddress: Address; // calculated offchain for ease of example, in real case scenarios should be calculated onchain + myJettonWalletAddress: Address; // calculated offchain for ease of example, in real world scenarios should be calculated onchain } contract JettonToJetton { @@ -115,7 +113,7 @@ const RouterAddress: Address = address("kQALh-JBBIKK7gr0o4AVf9JZnEsFndqO0qTCyT-D const RouterProxyTonWallet: Address = address("kQBbJjnahBMGbMUJwhAXLn8BiigcGXMJhSC0l7DBhdYABhG7"); // Router's pTON Address message SwapJettonTon { - myJettonWalletAddress: Address; // calculated offchain for ease of example, in real case scenarios should be calculated onchain + myJettonWalletAddress: Address; // calculated offchain for ease of example, in real world scenarios should be calculated onchain } contract JettonToTon { @@ -196,3 +194,138 @@ contract TonToJetton { } } ``` + +## Liquidity provision + +More about liquidity provision [here](https://docs.ston.fi/docs/developer-section/api-reference-v2/example_lp_provide). + +It is possible to deposit liquidity by sending just 1 type of token, the pool will automatically perform a swap and use the resulting amount to mint lp tokens. Non-single side provision is done just with `bothPositive` flag equals `true`. + +Liquidity provisions have several common structures and messages. Don't forget to use them with the code examples below! + +```tact +message(0x37c096df) ProvideLP { + otherTokenWallet: Address; // Address of the other Router token wallet + 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: ProvideLPAdditionalData; +} + +struct ProvideLPAdditionalData { + minLpOut: Int as coins; // Minimum required amount of lp tokens to receive + receiverAddress: Address; // Address where lp tokens will be sent + bothPositive: Bool = true; // Trigger liquidity deposit only if both token amounts are non-zero + fwdGas: Int as coins = 0; // Gas used to forward a message in transfer notification after mint if customPayload is present + customPayload: Cell? = null; +} +``` + +Below are shown gas constants. All of them are taken from the sdk [STON.fi sdk](https://github.com/ston-fi/sdk). They are slightly differ from reality, but it is ok for now. + +```tact +const SignleSideProvideLpJettonGas: Int = ton("1"); +const SignleSideProvideLpJettonGasFwd: Int = ton("0.8"); +const SignleSideProvideLpTonGas: Int = ton("0.8"); +const TonTansferGas: Int = ton("0.01"); +``` + +### Jetton deposit + +```tact +message(0xf8a7ea5) JettonTransfer { + queryId: Int as uint64; + amount: Int as coins; + destination: Address; + responseDestination: Address?; + customPayload: Cell? = null; + forwardTonAmount: Int as coins; + forwardPayload: Cell?; // hack for now, equivalent to Slice as remaining with first bit set to 1 +} + +message SampleProvideLP { + myJettonWalletAddress: Address; // calculated offchain for ease of example, in real world scenarios should be calculated onchain +} + +const RouterAddress: Address = address("kQALh-JBBIKK7gr0o4AVf9JZnEsFndqO0qTCyT-D-yBsWk0v"); // CPI Router v2.1.0 +const RouterProxyTonWallet: Address = address("kQBbJjnahBMGbMUJwhAXLn8BiigcGXMJhSC0l7DBhdYABhG7"); // Router's pTON wallet Address +const RouterJettonWallet: Address = address("kQAtX3x2s-wMtYTz8CfmAyloHAB73vONzJM5S2idqXl-_5xK"); // Router's Jetton Wallet Address + +contract Sample { + receive() {} + receive(msg: SampleProvideLP) { + let myJettonWalletAddress = msg.myJettonWalletAddress; + + let offerAmount = 1000000; + + let forwardPayload = ProvideLP{ + otherTokenWallet: RouterProxyTonWallet, + refundAddress: myAddress(), + excessesAddress: myAddress(), + deadline: now() + 1000, + additionalData: ProvideLPAdditionalData{ + minLpOut: 1, + receiverAddress: myAddress(), + bothPositive: false, // false means single side + } + }; + + send(SendParameters{ + to: myJettonWalletAddress, + value: SignleSideProvideLpJettonGas, + body: JettonTransfer{ + queryId: 42, + amount: offerAmount, + destination: RouterAddress, + responseDestination: myAddress(), + forwardTonAmount: SignleSideProvideLpJettonGasFwd, + forwardPayload: forwardPayload.toCell(), + }.toCell(), + }); + } +} +``` + +### TON Deposit + +```tact +message(0x01f3835d) ProxyTonTransfer { + queryId: Int as uint64 = 0; + tonAmount: Int as coins; + refundAddress: Address; + forwardPayload: Cell?; +} + +const RouterProxyTonWallet: Address = address("kQBbJjnahBMGbMUJwhAXLn8BiigcGXMJhSC0l7DBhdYABhG7"); // Router's pTON wallet Address +const RouterJettonWallet: Address = address("kQAtX3x2s-wMtYTz8CfmAyloHAB73vONzJM5S2idqXl-_5xK"); // Router's Jetton Wallet Address + +contract Sample { + receive() {} + receive("provide-lp-ton") { + let offerAmount = 1000000; + + let forwardPayload = ProvideLP{ + otherTokenWallet: RouterJettonWallet, + refundAddress: myAddress(), + excessesAddress: myAddress(), + deadline: now() + 1000, + additionalData: ProvideLPAdditionalData{ + minLpOut: 1, + receiverAddress: myAddress(), + bothPositive: false, // false means single side + } + }; + + send(SendParameters{ + to: RouterProxyTonWallet, + value: SignleSideProvideLpTonGas + TonTansferGas + offerAmount, + body: ProxyTonTransfer{ + queryId: 42, + tonAmount: offerAmount, + refundAddress: myAddress(), + forwardPayload: forwardPayload.toCell(), + }.toCell(), + }); + } +} +``` From ca1ce273a7b8145907adf918adbbb71486ca0531 Mon Sep 17 00:00:00 2001 From: Aliaksandr Bahdanau Date: Wed, 25 Sep 2024 13:42:10 +0300 Subject: [PATCH 4/4] fix: fix spelling --- cspell.json | 1 + pages/cookbook/dexes/stonfi.mdx | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cspell.json b/cspell.json index ed68bce4..f0acd2e8 100644 --- a/cspell.json +++ b/cspell.json @@ -43,6 +43,7 @@ "shardchains", "stdlibs", "STON.fi", + "Stonfi", "TIMELOCK", "timeouted", "Timeouted", diff --git a/pages/cookbook/dexes/stonfi.mdx b/pages/cookbook/dexes/stonfi.mdx index 25b3949e..740211c8 100644 --- a/pages/cookbook/dexes/stonfi.mdx +++ b/pages/cookbook/dexes/stonfi.mdx @@ -224,10 +224,10 @@ struct ProvideLPAdditionalData { Below are shown gas constants. All of them are taken from the sdk [STON.fi sdk](https://github.com/ston-fi/sdk). They are slightly differ from reality, but it is ok for now. ```tact -const SignleSideProvideLpJettonGas: Int = ton("1"); -const SignleSideProvideLpJettonGasFwd: Int = ton("0.8"); -const SignleSideProvideLpTonGas: Int = ton("0.8"); -const TonTansferGas: Int = ton("0.01"); +const SingleSideProvideLpJettonGas: Int = ton("1"); +const SingleSideProvideLpJettonGasFwd: Int = ton("0.8"); +const SingleSideProvideLpTonGas: Int = ton("0.8"); +const TonTransferGas: Int = ton("0.01"); ``` ### Jetton deposit @@ -272,13 +272,13 @@ contract Sample { send(SendParameters{ to: myJettonWalletAddress, - value: SignleSideProvideLpJettonGas, + value: SingleSideProvideLpJettonGas, body: JettonTransfer{ queryId: 42, amount: offerAmount, destination: RouterAddress, responseDestination: myAddress(), - forwardTonAmount: SignleSideProvideLpJettonGasFwd, + forwardTonAmount: SingleSideProvideLpJettonGasFwd, forwardPayload: forwardPayload.toCell(), }.toCell(), }); @@ -318,7 +318,7 @@ contract Sample { send(SendParameters{ to: RouterProxyTonWallet, - value: SignleSideProvideLpTonGas + TonTansferGas + offerAmount, + value: SingleSideProvideLpTonGas + TonTransferGas + offerAmount, body: ProxyTonTransfer{ queryId: 42, tonAmount: offerAmount,