👨🏫WEbdEXPassV3
The WEbdEXPassV3
contract is a fundamental component of the Botmoney platform, focused on managing passes and facilitating access to the services offered. This contract is developed in Solidity, following robust security standards on the Ethereum blockchain.
Contract Code: Imports and 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)
Contract Structure and Key Components
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)
Functions for Pass Management and User Handling
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)
Internal Functions and Information Queries
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)
Conclusion
The WEbdEXPassV3
contract is a key piece in the Botmoney platform, providing a flexible and secure mechanism for managing passes and free trials. It allows users of the platform to easily access the services offered, maintaining a high level of security and transparency.
Last updated