PreSale Contract Docs.
VNTPreSale User Guide
General Information
VNT Token Address: The address of the VNT token being sold.
VNT Bank Address: The address where VNT tokens are stored and from which they will be released.
USDC Token Address: The address of the USDC token used for purchasing VNT.
Token Price: The price of one VNT token in USDC (e.g., 0.22 USDC for 1 VNT).
Total Sale Amount: The total amount of VNT tokens available for sale.
Start Timestamp: The start date of the sale.
End Timestamp: The end date of the sale.
Lock Period: The lock period (e.g., 4 months) after which the purchased tokens can be claimed.
Total Sold: The total amount of VNT tokens sold.
Official Address: The official address where the USDC funds are sent.
Actions and Permissions
setStartTimestamp:
Description: Sets the start date and time for the token sale.
Permission: Can only be called by the contract owner.
Function:
function setStartTimestamp(uint256 _startTimestamp) external onlyOwner
setEndTimestamp:
Description: Sets the end date and time for the token sale.
Permission: Can only be called by the contract owner.
Function:
function setEndTimestamp(uint256 _endTimestamp) external onlyOwner
setTokenPrice:
Description: Sets the price of the VNT token in USDC.
Permission: Can only be called by the contract owner.
Function:
function setTokenPrice(uint256 _tokenPrice) external onlyOwner
setLockPeriod:
Description: Sets the lock period after which the purchased tokens can be claimed.
Permission: Can only be called by the contract owner.
Function:
function setLockPeriod(uint256 _lockPeriod) external onlyOwner
setVntTokenAddress:
Description: Sets the address of the VNT token contract.
Permission: Can only be called by the contract owner.
Function:
function setVntTokenAddress(address _vntAddress) external onlyOwner
Requirement:
require(_vntAddress != address(0), "Invalid address")
Event:
event VntTokenUpdated(address indexed previousAddress, address indexed newAddress)
setUSDCAddress:
Description: Sets the address of the USDC token contract.
Permission: Can only be called by the contract owner.
Function:
function setUSDCAddress(address _usdcAddress) external onlyOwner
Requirement:
require(_usdcAddress != address(0), "Invalid address")
Event:
event UsdcTokenUpdated(address indexed previousAddress, address indexed newAddress)
setVntBank:
Description: Sets the address of the VNT bank.
Permission: Can only be called by the contract owner.
Function:
function setVntBank(address _vntBank) external onlyOwner
Requirement:
require(_vntBank != address(0), "Invalid address")
Event:
event VntBankUpdated(address indexed previousBank, address indexed newBank)
buyTokens:
Description: Allows users to purchase VNT tokens using USDC.
Permission: Can be called by anyone during the active sale period.
Function:
function buyTokens(uint256 vntAmount) external saleActive nonReentrant
Requirements:
require(totalSold <= totalSaleAmount, "Sale cap reached")
require(totalSold + vntAmount <= totalSaleAmount, "Not enough tokens left")
require(vntAmount > 0, "VNT amount must be greater than 0")
require(temp > 0 , "temp = 0")
require(temp >= usdcAmount, "USDC allowance too low")
require(IERC20(usdcToken).transferFrom(msg.sender, officialAddress, usdcAmount), "USDC transfer failed")
Event:
event TokensPurchased(address indexed buyer, uint256 usdcSpent, uint256 tokensBought)
releaseTokens:
Description: Allows users to claim their purchased VNT tokens after the lock period has ended.
Permission: Can be called by anyone who has purchased tokens.
Function:
function releaseTokens() external nonReentrant
Requirement:
require(unreleased > 0, "No tokens are due")
Event:
event TokensReleased(address indexed beneficiary, uint256 amount)
releasableAmount:
Description: Returns the amount of VNT tokens that a user can claim.
Permission: Can be called by anyone.
Function:
function releasableAmount(address beneficiary) public view returns (uint256)
getPurchaseAndPeriods:
Description: Returns the purchase details and release periods for a specified buyer.
Permission: Can be called by anyone.
Function:
function getPurchaseAndPeriods(address buyer) external view returns (uint256 usdcSpent, uint256 totalVntBought, uint256 purchaseTime, Period[10] memory releasePeriods)
Additional Information
Purchases:
mapping(address => Purchase)
keeps track of each user's purchase details.Purchase Struct:
usdcSpent
: Amount of USDC spent by the user.totalVntBought
: Total amount of VNT tokens bought by the user.purchaseTime
: Timestamp of the purchase.releasePeriods
: Array of 10 periods, each containing VNT tokens per period, claimable time, and claimed status.
Period Struct:
vntPerPeriod
: Amount of VNT tokens allocated per period.claimableTime
: Time when the tokens can be claimed.claimed
: Boolean indicating if the tokens for the period have been claimed.
Last updated