Skip to content

XpandX-Labs/v1-core

Repository files navigation

XpandX V1

The XpandX smart contract v1 is utilized for the XpandX DEX. This contract serves as the underlying code governing the functionality and operations of the XpandX DEX platform. It may include various functions, data structures, and logic necessary for trading, liquidity provision, and other related activities within the exchange.

Visit us: https://xpandx.xyz/

Locklift is required to build, test, run and maintain the smart contract.

Contributing

If you are interested in contributing, we kindly request you to refer to our contribution guidelines for detailed information and instructions.

Deployed Contracts

Folder: deployments/venom_devnet

List of devnet Tokens

  • Folder: Deployment
  • Supported devnet tokens: XPX, USDT, USDC, DAI, WETH, WVENOM

Contracts:

Flow deposit liquidity:

  1. Create Dex account:
    • Call the getExpectedAccountAddress function of the DexRoot contract.
      • Input:
        • answerId: random
        • address_owner: user's address
      • Output: the expected account address of the user
    • If the account address is not active, call the deployAccount function:
      • Input:
        • account_owner: user's address
        • send_gas_to: user's address
  2. Deposit tokens into the Dex account:
    • Check if the user's address has a wallet account contract in the token root contract using the walletOf function.
    • Find the user's wallet account. If it doesn't exist, use the deployWallet function in the token contract to deploy a new one.
    • Once you have the wallet account for the token, access the wallet account contract and use the transfer function to transfer the tokens to the Dex account.
    • Repeat the process for both tokens that need to be transferred.
  3. Use the depositLiquidity function in the DexAccount contract to deposit liquidity.

Notes: To get pair address, please use function: getExpectedPairAddress on DexRoot

Flow exchange

  1. On the contract DexAccount and use function exchange to swap tokens in the pair