π₯οΈFor Developers
Contrato
Contrato WEbdEXFactoryV3
solidityCopy code// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import "@openzeppelin/contracts/access/Ownable.sol";SPDX-License-Identifier: Este Γ© um comentΓ‘rio SPDX-License-Identifier indicando que o contrato estΓ‘ licenciado sob o MIT.
pragma solidity ^0.8.18: Indica a versΓ£o mΓnima do compilador Solidity necessΓ‘ria para compilar o contrato.
ImportaΓ§Γ£o de bibliotecas:
O contrato importa a biblioteca
Ownabledo OpenZeppelin, que fornece funcionalidades bΓ‘sicas de controle de propriedade.
solidityCopy codecontract WEbdEXFactoryV3 is Ownable {DeclaraΓ§Γ£o de VariΓ‘veis:
bots: Uma matriz interna de estruturasBot.faucets, wusd, usdt, dai, usdc, switchWUSD, swapBook, payments: EndereΓ§os de contratos relacionados Γ plataforma WEbdEX.
solidityCopy code Bot[] internal bots;
address public faucets;
address public wusd;
address public usdt;
address public dai;
address public usdc;
address public switchWUSD;
address public swapBook;
address public payments;Struct Bot:
Define uma estrutura chamada
Botque armazena informaΓ§Γ΅es sobre um bot, incluindo seu nome, endereΓ§o da carteira, endereΓ§os de contratos relevantes, e outros.
Constructor:
O construtor recebe os endereΓ§os iniciais dos contratos relevantes e os atribui Γ s variΓ‘veis correspondentes.
FunΓ§Γ£o addBot:
Permite ao proprietΓ‘rio adicionar um novo bot Γ plataforma, fornecendo informaΓ§Γ΅es como nome, carteira, e endereΓ§os dos contratos relevantes.
FunΓ§Γ£o getBots:
Permite ao proprietΓ‘rio obter a lista de bots adicionados Γ plataforma.
Essas sΓ£o as principais caracterΓsticas e funcionalidades do contrato. Ele serve como uma fΓ‘brica para criar bots, mantendo uma lista de bots existentes e seus detalhes.
WEbdEXManagerV3 Contract
License and Pragma Directives:
SPDX-License-Identifier specifies the license under which the contract is released.
Pragma solidity ^0.8.18 sets the minimum version of the Solidity compiler.
Import Statements:
The contract imports the Ownable contract from the OpenZeppelin library and a custom NFT contract.
Contract Declaration:
The contract inherits from the Ownable contract, indicating it has owner-based access control.
State Variables:
bot: Stores information about a bot, including its name, associated token contract, wallet, and seller address.webDexPassV3: Represents an interface to the WEbdEXPassV3 contract, allowing access to user information.registers: An array to store registration details, including user wallet and associated manager.webDexStrategiesV3: Address of the WebDexStrategies contract.
Mapping and Structs:
users: A mapping to store user information based on their address.User: A struct representing user details, including the associated manager and registration status.Bot: A struct representing bot details, including its name, associated token, wallet, and seller address.
Additional Structs:
Register: A struct to store registration details, including user wallet and associated manager.Display: A struct representing user details for display purposes, including wallet, manager, status, pass expiration, free trial status, and expiration time.
Event and Constructor:
Transactionevent: Logs transactions with details such as the sender, method, timestamp, recipient, and value.Constructor: Initializes the contract with the bot details, including its name, token, wallet, and seller, as well as the WEbdEXPassV3 contract interface.
Modifier:
onlyWebDexStrategiesOrOwner: A modifier restricting access to certain functions to the owner or the WebDexStrategies contract.
Function:
changeWEbdEXStrategiesV3: Allows the owner to change the address of the WebDexStrategies contract.
Function:
registerInBot: Allows users to register in the bot, associating themselves with a manager and minting an NFT.
Function:
getUserInfo: Retrieves user information for the caller.
Function:
getUserInfoByWallet: Retrieves user information based on the provided wallet address, restricted to the owner or the WebDexStrategies contract.
Function:
getBot: Retrieves information about the bot.
Function:
getRegisters: Retrieves an array of registration details.
Internal Function:
_getUser: Internal function to retrieve user information based on the provided address.
This breakdown provides a detailed overview of the WEbdEXManagerV3 contract, including its state variables, functions, and modifiers.
WEbdEXPassV3 Contract
License and Pragma Directives:
SPDX-License-Identifier specifies the license under which the contract is released.
Pragma solidity ^0.8.18 sets the minimum version of the Solidity compiler.
Import Statements:
The contract imports the ERC20 contract from the OpenZeppelin library and the Ownable contract for access control.
Events:
PayFee: Emitted when a fee is paid. Includes details such as the wallet, coin, and amount.ExtractLogs: Emitted for various transaction logs. Includes details like the sender, method, timestamp, recipient, and value.PayPass: Emitted when a pass is paid. Includes details such as the sender, coin, and value.
Structs:
NetworkData: Represents data about a network, including wallet and amount.PayFeesAmount: Represents amounts for various fees, including network fees, seller fee, bot fee, manager fee, token, user, and transaction type.PayComissions: Represents the commission structure with a list of fees and addresses for seller, bot, manager, webDexStrategiesV3, and webDexNetworkPoolV3.
Mappings and Constructor:
listPayments: A mapping to keep track of whether a payment has been made.privilegedWallets: A mapping to manage privileged wallets.Constructor: Initializes the contract with ERC20 token details, pass values, and free trial expiration time.
Modifiers:
onlyWalletPrivileged: A modifier to restrict access to only the owner or privileged wallets.onlyHaveFreeTrial: A modifier to check if the user has a free trial.
Function:
comissionPass: Allows the owner to pay various commissions. Utilizes a complex structure with different fees and destinations.
Internal Function:
_payFee: Internal function to facilitate the payment of fees, involving LP minting and adding balances to the network pool.
Function:
changeFreeTrialExpirationTime: Allows the owner or privileged wallets to change the free trial expiration time.
Function:
changePassValue: Allows the owner or privileged wallets to change the pass values based on the pass type.
Function:
payPass: Allows users to pay for a pass based on the pass type.
Function:
getFreeTrial: Allows users to obtain a free trial.
Function:
sendPass: Allows the owner or privileged wallets to send a pass to a specified address.
Functions:
addWalletPrivilege: Allows the owner to add wallet privilege.revokeWalletPrivilege: Allows the owner to revoke wallet privilege.
Functions:
getUserInfo: Retrieves user information for the caller.getUserInfoByWallet: Retrieves user information based on the provided wallet address.
Internal Functions:
_getUserInfo: Internal function to retrieve user information based on the provided address._passExpired: Internal function to check if the pass for the given address has expired._haveFreeTrial: Internal function to check if the user at the given address has a free trial.
This breakdown provides a detailed overview of the WEbdEXPassV3 contract, including its state variables, events, modifiers, functions, and internal functions.
Last updated