Smart Contracts
Last updated
Last updated
The contracts are published in the Liquidswap GitHub repository at https://github.com/pontem-network/liquidswap_v1
Liquidswap V1 employs smart contracts written in the Move language, executed on the Move VM. This setup ensures the core contracts, which encompass the protocol's logic and safety guarantees, are distinctly separated from the peripheral contracts, such as routers or entry points (scripts). While the current implementation of the periphery is quite basic, it's designed to accommodate multiple peripherals in the future. Importantly, these enhancements will not impact the core codebase.
The current main
branch is the development branch and always contains the latest changes. Release branches contain the latest changes created for the specific release.
You can always find the latest release in the Releases section.
Aptos Mainnet
If you wish to experiment with Liquidswap V1 on the testnet, please utilize the testnet
branch of the Liquidswap V1 repository.
When interacting with the Pool module functions in Liquidswap V1, it's imperative to sort the coins passed as generics. Proper sorting is crucial because it establishes the rules for creating liquidity pools. It's important to note that all functions within the Liquidity Pool module and others require sorted generics to function correctly; failing to do so will result in the transaction being reverted.
The current sorting algorithm takes the types of provided coins, e.g., address::module::struct_name
, and compares the struct name of both coins. If it's equal, it continues with the module name and, in the end, with the address.
You always can just use the implementation in Move language.
Other languages:
Implementation in Javascript: Coin Sorting In JS.
Also, it's supported in Typescript SDK.
It is crucial to ensure that coins are sorted correctly in Liquidswap V1. Unlike versions V0/V0.5, automatic sorting is not functional in this version, and this applies even at the Router level.