ERC-20 VKINHA contract with buying, staking, and administration functionalities.
The VKINHA contract is an ERC-20 token deployed on the BNB Chain Mainnet, designed to provide buying, transferring, staking, and administrative functionalities, with anti-bot mechanisms and fees to encourage legitimate use and deter abuse. The token, symbolized as VKINHA, has a maximum total supply of 15 million and integrates with decentralized exchanges (DEXs) such as PancakeSwap, Biswap, ApeSwap, and SushiSwap, supporting purchases with BNB, BUSD, and USDT via Chainlink oracles.
The constants defined in the contract determine its behavior and operational limits. The table below lists the main constants:
Name | Value | Description |
---|---|---|
MAX_SUPPLY | 15_000_000 * 10^18 | Maximum supply of VKINHA (15M). |
LOCKED_SUPPLY | 2_000_000 * 10^18 | Initial locked amount, unlockable after 365 days. |
ADMIN_SUPPLY | 1_500_000 * 10^18 | Initial amount minted for admin1. |
INITIAL_TOKEN_WALLET_SUPPLY | 11_500_000 * 10^18 | Initial amount minted for tokenWallet. |
BURN_AMOUNT | 100_000 * 10^18 | Amount of tokens burned per interval. |
BURN_SUPPLY_TARGET | 10_000_000 * 10^18 | Target supply after burns. |
BURN_INTERVAL | 30 days | Interval between burns. |
UNLOCK_DELAY | 365 days | Lock period for LOCKED_SUPPLY. |
STAKING_THRESHOLD | 10^16 (0.01 VKINHA) | Minimum staking threshold. |
MAX_STAKED_TOKENS | 1_000_000 * 10^18 | Maximum staked tokens allowed. |
BASE_BUY_FEE_PERCENTAGE | 25 (0.25%) | Base fee for purchases in buyTokens. |
EXTRA_FEE_INCREMENT | 100 (1%) | Fee increment per extra purchase within 30 minutes. |
MAX_EXTRA_FEE_PERCENTAGE | 2000 (20%) | Maximum additional fee for repetitive purchases. |
TRANSFER_FEE_PERCENTAGE | 300 (3%) | Fixed fee for normal transfers. |
SELL_FEE_PERCENTAGE | 50 (0.5%) | Additional fee for sales on DEX. |
BASE_REWARD_RATE | 2 (0.002% per day) | Base reward rate for staking. |
EXTRA_REWARD_RATE | 1 (0.001% per 1000 tokens) | Extra reward rate for tokens above 0.01 VKINHA. |
MAX_REWARD_RATE | 100 (0.1% per day) | Maximum reward rate for staking. |
FEE_POOL_REWARD_RATE | 2 (0.002% per day) | Reward rate on the fee pool. |
MIN_TRANSACTION_AMOUNT | 1e11 (0.0000001 VKINHA) | Minimum amount for purchases and transfers. |
COOLDOWN_WINDOW | 30 minutes | Window for applying progressive fees. |
RESET_WINDOW | 1 hour | Period to reset extra fee after inactivity. |
Configurable addresses used in the contract for administrators, wallets, and DEX integration:
Name | Mainnet Address | Description |
---|---|---|
admin1 | 0x5B419e1A55e24e91D7016D4313BC5b284382Faf6 | Primary administrator. |
admin2 | 0xe93bc1259C7F53aBf2073b0528e6007275D0E507 | Secondary administrator. |
tokenWallet | 0xB9A2eF80914Cb1bDBE93F04C86CBC9a54Eb0d7D2 | Token storage wallet. |
dexRouter | 0x10ED43C718714eb63d5aA57B78B54704E256024E | PancakeSwap V2 Router (configurable). |
WBNB | 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c | Wrapped BNB on Mainnet. |
BUSD | 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56 | BUSD on Mainnet. |
USDT | 0x55d398326f99059fF775485246999027B3197955 | USDT on Mainnet. |
Oracles used to fetch real-time prices for BNB, BUSD, and USDT:
Name | Mainnet Address | Description |
---|---|---|
bnbPriceFeed | 0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE | BNB/USD price. |
busdPriceFeed | 0xcBb98864Ef56E9042e7d2efef76141f15731B82f | BUSD/USD price. |
usdtPriceFeed | 0xB97Ad0E74fa7d920791E90258A6E2085088b4320 | USDT/USD price. |
Base Fee: 0.25% (BASE_BUY_FEE_PERCENTAGE).
Progressive Fee:
Note: The progressive fee is designed to discourage automated trading bots and high-frequency trades, which can manipulate the price. This ensures a more stable and fair trading environment.
Calculation:
uint256 extraFee = purchaseCountInWindow[msg.sender] > 1 ? (purchaseCountInWindow[msg.sender] - 1) * EXTRA_FEE_INCREMENT : 0;
uint256 totalFeePercentage = BASE_BUY_FEE_PERCENTAGE + (extraFee > MAX_EXTRA_FEE_PERCENTAGE ? MAX_EXTRA_FEE_PERCENTAGE : extraFee);
uint256 buyFee = (amount * totalFeePercentage) / 10000;
uint256 amountAfterFee = amount - buyFee;
Destination: buyFee is transferred to tokenWallet and added to accumulatedFeePool.
Transfer Fee: 3% (TRANSFER_FEE_PERCENTAGE) on all transfers.
Sale Fee: 0.5% (SELL_FEE_PERCENTAGE) additional only when the recipient is dexRouter (sale on DEX).
Calculation:
uint256 transferFee = (amount * TRANSFER_FEE_PERCENTAGE) / 10000;
uint256 sellFee = (to == dexRouter) ? (amount * SELL_FEE_PERCENTAGE) / 10000 : 0;
uint256 totalFee = transferFee + sellFee;
uint256 amountAfterFee = amount - totalFee;
Destination: totalFee is transferred to tokenWallet and added to accumulatedFeePool.
Operation: Users stake VKINHA to earn rewards based on accumulated fees.
Rewards: Calculated in calculateRewards based on:
Calculation:
uint256 baseReward = (staker.amount * BASE_REWARD_RATE * timeElapsed) / (10000 * 1 days);
uint256 extraReward = (extraTokens / (1000 * 1e18)) * EXTRA_REWARD_RATE * timeElapsed / (10000 * 1 days);
uint256 fixedReward = baseReward + extraReward > maxReward ? maxReward : baseReward + extraReward;
uint256 feePoolReward = (feePoolDelta * FEE_POOL_REWARD_RATE * timeElapsed) / (10000 * 1 days);
uint256 proportionalReward = totalStaked > 0 ? (staker.amount * feePoolReward) / totalStaked : 0;
return staker.accumulatedRewards + fixedReward + proportionalReward;
Payment: Rewards are transferred from tokenWallet when calling claimRewardsFunction to claim your staking rewards. Example: After staking 100 VKINHA, you claim 0.5 VKINHA in rewards..
The VKINHA contract implements a fee structure where a portion of the fees collected from purchases and transfers is allocated to a dedicated fee pool. This pool serves as the foundation for distributing rewards to token holders who participate in staking. Specifically, a segment of the accumulated fees is systematically redistributed to stakers, proportional to their staked amount, thereby providing a direct financial benefit to committed holders. This mechanism not only incentivizes long-term holding and active participation in the ecosystem but also contributes to the token's overall health and stability by aligning the interests of holders with the sustainability of the network. By rewarding those who stake their VKINHA tokens, the system fosters a robust and resilient token economy.
admin1: Initial owner with permission for all administrative functions.
admin2: Secondary administrator with permission for specific functions (e.g., replaceTokenWallet).
Buying VKINHA with BNB:
buyTokens(uint256 amount, address paymentToken)
Transferring VKINHA:
transfer(address to, uint256 amount)
const Web3 = require('web3');
const web3 = new Web3('https://bsc-dataseed.binance.org/');
const contractABI = [/* Contract ABI */];
const contractAddress = '0xContract';
const contract = new web3.eth.Contract(contractABI, contractAddress);
async function buyTokens(account, amount) {
const tx = await contract.methods.buyTokens(amount, "0x0000000000000000000000000000000000000000")
.send({ from: account, value: web3.utils.toWei('0.001', 'ether') });
console.log('Purchase completed:', tx.transactionHash);
}
buyTokens('0xYourAddress', '1000000000000000');
Hardhat:
Setup:
const { ethers } = require("hardhat");
async function main() {
const VKINHA = await ethers.getContractFactory("VKINHA");
const vkinha = await VKINHA.deploy();
await vkinha.deployed();
console.log("Contract deployed to:", vkinha.address);
}
Tests:
it("should apply progressive buy fee", async function () {
const [owner] = await ethers.getSigners();
await vkinha.buyTokens(ethers.utils.parseEther("0.001"), "0x0", { value: ethers.utils.parseEther("0.001") });
await vkinha.buyTokens(ethers.utils.parseEther("0.001"), "0x0", { value: ethers.utils.parseEther("0.001") });
// Verify fee > 0.25%
});
Foundry:
Setup: Use forge init
and add the contract.
Test: Write in Solidity to simulate interactions.
struct PurchaseInfo {
uint256 lastBlock;
uint256 lastTime;
uint256 countInWindow;
}
mapping(address => PurchaseInfo) public purchaseData;
Estimated reduction: 5-10% in gas cost per transaction.