Dripper
Inherits: IDripper, Ownable
Author: Sperax Foundation
This contract releases tokens at a steady rate to the Vault contract, for rebasing the USDs stablecoin.
The Dripper contract ensures that tokens are released gradually over time, allowing for consistent and controlled distribution.
State Variables
vault
address public vault;
dripRate
uint256 public dripRate;
dripDuration
uint256 public dripDuration;
lastCollectTS
uint256 public lastCollectTS;
Functions
constructor
Constructor to initialize the Dripper.
constructor(address _vault, uint256 _dripDuration);
Parameters
_vault
address
Address of the contract that receives the dripped tokens.
_dripDuration
uint256
The duration over which tokens are dripped.
recoverTokens
Emergency fund recovery function.
Transfers the asset to the owner of the contract.
function recoverTokens(address _asset) external onlyOwner;
Parameters
_asset
address
Address of the asset to recover.
addUSDs
Function to be used to send USDs to dripper and update dripRate
.
function addUSDs(uint256 _amount) external;
Parameters
_amount
uint256
Amount of USDs to be sent form caller to this contract.
collect
Transfers the dripped tokens to the vault.
This function also updates the dripRate based on the fund state.
function collect() public returns (uint256);
Returns
uint256
The amount of tokens collected and transferred to the vault.
updateVault
Update the vault address.
function updateVault(address _vault) public onlyOwner;
Parameters
_vault
address
Address of the new vault contract.
updateDripDuration
Updates the dripDuration.
function updateDripDuration(uint256 _dripDuration) public onlyOwner;
Parameters
_dripDuration
uint256
The desired drip duration to be set.
getCollectableAmt
Gets the collectible amount of tokens at the current time.
function getCollectableAmt() public view returns (uint256);
Returns
uint256
The amount of tokens that can be collected.
Events
Collected
event Collected(uint256 amount);
Recovered
event Recovered(address owner, uint256 amount);
VaultUpdated
event VaultUpdated(address vault);
DripDurationUpdated
event DripDurationUpdated(uint256 dripDuration);
USDsAdded
event USDsAdded(uint256 _amount);
Errors
NothingToRecover
error NothingToRecover();
Last updated
Was this helpful?