Welcome to the Ton-Dex-Jetton-Swap repository, a comprehensive solution for leveraging the Ton blockchain's advanced capabilities. This project focuses on facilitating decentralized exchanges (DEX) through the implementation of Jetton swaps. Harness the power of the Ton blockchain and engage in efficient, secure token trading.
- Ton DEX: Seamlessly integrate with the Ton blockchain to create a decentralized exchange for trading tokens.
- Jetton Swap: Enables the swapping of Jettons, making use of Ton's native token functionalities for enhanced liquidity and trading options.
- Ton Tact & Template: Utilize Ton's Tact language and templates for building scalable and customizable smart contracts that fit various decentralized financing needs.
- Ton Pumpfun: Explore advanced economic strategies like Pumpfun, boosting your project's reach and engagement within the Ton ecosystem.
- Smart Contracts: Secure and efficient smart contracts powered by the Ton blockchain, ensuring all trades are trustless and transparent.
- Ton Application & Economics: Create impactful decentralized applications with robust support for Ton's economic models, maximizing user value and network efficiency.
- Smart Contracts: Written in Tact, these contracts manage token swaps and liquidity pools within the Ton ecosystem, focusing on security and scalability.
- Application Design: Offers a template for development teams to create dynamic and robust decentralized applications on the Ton network.
Follow the provided documentation and resources to understand the architecture and start building your own DEX on Ton. This project is ideal for developers interested in decentralized finance and the economic applications of blockchain technology.
import { JettonSwapContract } from './contracts/JettonSwap';
// Initialize the contract
const swapContract = new JettonSwapContract();
// Function to perform a token swap
async function executeSwap(userAddress: string, amount: number): Promise<void> {
try {
console.log(`Initiating swap for ${amount} tokens from ${userAddress}`);
await swapContract.swap(userAddress, amount);
console.log('Swap completed successfully!');
} catch (error) {
console.error('Error executing swap:', error);
}
}
// Example usage
executeSwap('0xUserWalletAddress', 100);
```shell
yarn test # To test contract
yarn build # To build contract
yarn deploy # To deploy contract
To deploy a contract, follow these steps:
- Define the
contract.tact
file that will be used as entry point of your contract. - Customize the
contract.deploy.ts
file based on yourcontract.tact
to generate a deployment link. It is crucial to ensure the proper invocation of theinit()
function within the contract.
If you rename contract.tact
, make sure to update tact.config.json
correspondingly. Refer to the Tact Documentation for detailed information.
You can find some examples of contract tests in contract.spec.ts
. For more information about testing, see the Tact Documentation.
To add new test files to your contracts, you should create *.spec.ts
files similar to the template's one and they would be automatically included in testing.
MIT