SPA Buyback
Inherits: Initializable, OwnableUpgradeable, ReentrancyGuardUpgradeable
Author: Sperax Foundation
This contract allows users to exchange SPA tokens for USDs tokens.
Users can provide SPA tokens and receive USDs tokens in return based on the current exchange rate.
A percentage of the provided SPA tokens are distributed as rewards, and the rest are burned.
State Variables
veSpaRewarder
rewardPercentage
oracle
Functions
constructor
initialize
Contract initializer
Parameters
withdraw
Emergency withdrawal function for unexpected situations
Can only be called by the owner
Parameters
updateRewardPercentage
Changes the reward percentage
Example value for _newRewardPercentage = 5000 for 50%
Parameters
updateVeSpaRewarder
Update veSpaRewarder address
Parameters
updateOracle
Update oracle address
Parameters
buyUSDs
Function to buy USDs for SPA for frontend
Parameters
getSPAReqdForUSDs
Calculates and returns SPA amount required for _usdsAmount
Parameters
Returns
buyUSDs
Buy USDs for SPA if you want a different receiver
Parameters
distributeAndBurnSPA
Sends available SPA in this contract to rewarder based on rewardPercentage and burns the rest
getUsdsOutForSpa
Returns the amount of USDS for SPA amount in
Parameters
Returns
_getUsdsOutForSpa
Returns the amount of USDS for SPA amount in
Parameters
Returns
_getOracleData
Retrieves price data from the oracle contract for SPA and USDS tokens.
Returns
_isValidRewardPercentage
Checks if the provided reward percentage is valid.
The reward percentage must be a non-zero value and should not exceed the maximum percentage value.
Parameters