👨‍🏫WEbdEXPassV3

Código do Contrato: Importações e Interfaces

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

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

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

interface IWEbdEXNetworkPoolV3 {
    function addBalance(address to, address coin, uint256 amount, address lpToken, address user, string memory method) external;
}

contract WEbdEXPassV3 is Ownable {
    ERC20 public erc20;
    // ... (continuation of the code)

Estrutura do Contrato e Componentes Principais

solidityCopy code    // Pass values
    uint256 public monthlyPassValue;
    uint256 public quarterlyPassValue;
    uint256 public semesterPassValue;
    uint256 public annualPassValue;

    // Pass expiration times
    uint256 internal constant monthlyExpirationTime = 30 days;
    uint256 internal constant quarterlyExpirationTime = 90 days;
    // ...

    // Mappings for expiration control and free trials
    mapping(address => uint256) internal expirationTimes;
    mapping(address => uint256) internal freeTrials;

    // Enumeration for pass types
    enum PassType { MONTHLY, QUARTERLY, SEMESTER, ANNUAL }

    // Structure to store user information
    struct User {
        bool passExpired;
        bool haveFreeTrial;
        uint256 expirationTime;
    }

    // Events for activity logging
    event PayFee(address indexed wallet, address indexed coin, uint256 amount);
    event ExtractLogs(address indexed from, string method, uint256 timeStamp, address to, uint256 value);
    event PayPass(address indexed from, address coin, uint256 value);

    // Constructor and modifier for wallet privileges
    constructor(ERC20 erc20_, uint256 monthlyPassValue_, /* ... */) {
        erc20 = erc20_;
        monthlyPassValue = monthlyPassValue_;
        // ...
    }

    modifier onlyWalletPrivileged() {
        require(msg.sender == owner() || privilegedWallets[msg.sender], "You must be the owner or the privilegedWallets");
        _;
    }
    // ... (continuation of the code)

Funções para Gerenciamento de Passes e Manipulação de Usuários

solidityCopy code    function comissionPass(PayComissions memory payments) public onlyOwner {
        // Logic for processing commissions
    }

    function changeFreeTrialExpirationTime(uint256 newExpirationTime) public onlyWalletPrivileged {
        // Change the expiration time of the free trial
    }

    function changePassValue(PassType passType, uint256 value) public onlyWalletPrivileged {
        // Adjust the value of passes
    }

    function payPass(PassType passType) public {
        // Logic for paying for passes
    }

    function getFreeTrial() public onlyHaveFreeTrial {
        // Obtain a free trial
    }
    // ... (continuation of the code)

Funções Internas e Consultas de Informações

solidityCopy code    function _getUserInfo(address to) internal view returns (User memory) {
        // Retrieve user information
    }

    function _passExpired(address to) internal view returns (bool) {
        // Check if the pass has expired
    }

    function _haveFreeTrial(address to) internal view returns (bool) {
        // Check if there is a free trial available
    }
    // ... (continuation of the code)

Conclusão

O contrato WEbdEXPassV3 é uma peça fundamental na plataforma Botmoney, fornecendo um mecanismo flexível e seguro para o gerenciamento de passes e testes gratuitos. Ele permite que os usuários da plataforma acessem facilmente os serviços oferecidos, mantendo um alto nível de segurança e transparência.

Last updated