👨‍🏫WEbdEXNetworkPoolV3

The WEbdEXNetworkPoolV3 is a key smart contract within the Botmoney platform, developed in Solidity for managing liquidity pools and related financial functions.

Overview

The WEbdEXNetworkPoolV3 is a key smart contract within the WEbdEX platform, developed in Solidity for managing liquidity pools and related financial functions.

Imports and Interfaces

The contract employs the OpenZeppelin library for Ownable functionality, ensuring secure management of ownership. It also interacts with the IWEbdEXStrategiesV3 interface for specific LP token-related operations.

solidityCopy code// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

interface IWEbdEXStrategiesV3 {
    function lpBurnFrom(address to, address coin, uint256 amount) external;
}

contract WEbdEXNetworkPoolV3 is Ownable {
    // ... (continuation of the code)

Contract Structure and Key Components

Public Variables and LPToken Structure

solidityCopy code    address public webDexPaymentsV3;
    address public webDexPass;
    uint16 public fee_withdraw;
    mapping(address => mapping(address => LPToken)) internal balances;

    struct LPToken {
        address coin;
        uint256 balance;
    }
    // ... (continuation of the code)

Events for Activity Logging

solidityCopy code    event ExtractLogs(
        address indexed from,
        address indexed to,
        string method,
        uint256 timeStamp,
        uint256 value,
        uint256 fee,
        address user
    );
    // ... (continuation of the code)

Constructor and Modifiers

solidityCopy code    constructor(address webDexPaymentsV3_, address webDexPass_) {
        webDexPaymentsV3 = webDexPaymentsV3_;
        webDexPass = webDexPass_;
        fee_withdraw = 5;
    }

    modifier onlyWebDexPaymentsOrWebDexPass() {
        require(msg.sender == webDexPaymentsV3 || msg.sender == webDexPass, "You must be the WebDexPayments or the webDexPass");
        _;
    }
    // ... (continuation of the code)

Main Contract Functions

Fee Management and Balance Operations

solidityCopy code    function changeFeeWithdraw(uint16 amount) public onlyOwner {
        // Adjusts the withdrawal fee
    }

    function addBalance(
        address to,
        address coin,
        uint256 amount,
        address lpToken,
        address user,
        string memory method
    ) external onlyWebDexPaymentsOrWebDexPass {
        // Adds balance to the pool
    }

    function withdraw(
        address lpToken,
        uint256 amount,
        IWEbdEXStrategiesV3 webDexStrategiesV3
    ) public {
        // Allows withdrawals from the pool
    }
    // ... (continuation of the code)

Balance Queries

solidityCopy code    function getBalance(address lpToken) public view returns (uint256) {
        return _getBalance(msg.sender, lpToken);
    }

    function getBalanceByWallet(
        address to,
        address lpToken
    ) public view onlyOwner returns (uint256) {
        return _getBalance(to, lpToken);
    }

    function _getBalance(
        address to,
        address lpToken
    ) internal view returns (uint256) {
        // Returns the balance of a specific address
    }
    // ... (continuation of the code)

Conclusion

The WEbdEXNetworkPoolV3 contract plays a vital role in managing liquidity pools and financial operations on the Botmoney platform.

Last updated