i have develop a token that distributes eth to its holders. now i want to distributes 4% doge to my holders with every transaction or after 7 days of holding. eth distribution is working well but doge coin distribution is not working. here is the token… https://github.com/coderbang1/eth-distri-token/blob/main/code
Hi @iammoud2,
Still not working?
Can you give some more details where it is not working (function, details / example)… then help/support is better possible.
If you have an (part of the) app available too it makes debugging easier or even possible.
function swapTokensForEth(uint256 tokenAmount) private {
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function swapAndSendDividends(uint256 tokens) private {
swapTokensForEth(tokens);
uint256 dividends = address(this).balance;
(bool success,) = address(dividendTracker).call{value: dividends}("");
if (success) {
emit SentDividends(tokens, dividends);
}
}
}
please take a look at the code…i think here we can change, but i cant.