The PEPE getReward Function: A Key Mechanism
Last updated
Last updated
Central to this ecosystem is the getReward function, a critical mechanism for rewarding user participation.
Updating Staking Rewards: Initially, the function updates the staking rewards for the user (msg.sender), ensuring that each participant’s contribution is accurately reflected.
RewardValidation: It checks the user’s staked balance to confirm if there are sufficient rewards to claim the requested amount, maintaining the integrity of the reward system.
Oracle Consultation: The Oracle is then consulted to ascertain the current value of PEPE tokens in ETH. This step is vital for calculating the rewards in ETH equivalent.
TaxCalculation and Verification: The function calculates the ETH tax based on the Oracle’s valuation and verifies that the user has provided enough ETH to cover this tax.
Token Minting and Tax Transfer: Following successful verification, PEPE tokens are minted for the user, and the ETH tax is transferred to the Chad contract.
Refunding Overpayment: If the user sends more ETH than required, the function refunds the excess amount