Chart
This revision is from 2025/06/24 20:32. You can Restore it.
<iframe id="dextools-widget"
title="DEXTools Trading Chart"
width="100%" height="700"
src="https://www.dextools.io/widget-chart/en/bnb/pe-light/0xfa56e9abcaa45207be5e43cf475ee061768ca915?theme=light&chartType=2&chartResolution=30&drawingToolbars=false"></iframe>
<b>As a rough guide, 100 million IMT entered as 100000000 is about $2.30 USD or about 0.004 BNB.</b>
<div style="font-family: Arial, sans-serif; background: #fff; display: flex; flex-direction: column; align-items: center; padding: 2rem;">
<div style="background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); width: 100%;">
<h3 style="color: #000">Swap IMT ↔ BNB</h3><br>
<label for="amount">Amount:</label>
<input type="number" id="amount" placeholder="0.004" min="0" step="0.01" value="0.004" style="width: 100%; padding: 0.75rem; margin: 0.5rem 0; border-radius: 4px; border: 1px solid #ccc;" />
<button id="max" style="width: 100%; padding: 0.75rem; margin: 0.5rem 0; border-radius: 4px; border: none; background: #007bff; color: #fff; cursor: pointer;">Max</button>
<label for="slippage">Slippage Tolerance (%):</label>
<input type="number" id="slippage" placeholder="e.g. 15" min="0" max="100" value="15" style="width: 100%; padding: 0.75rem; margin: 0.5rem 0; border-radius: 4px; border: 1px solid #ccc;" />
<button id="connect" style="width: 100%; padding: 0.75rem; margin: 0.5rem 0; border-radius: 4px; border: none; background: #007bff; color: #fff; cursor: pointer;">Connect Wallet</button>
<button id="reverse" disabled style="width: 100%; padding: 0.75rem; margin: 0.5rem 0; border-radius: 4px; border: none; background: #aaa; color: #fff;">Swap BNB → IMT</button>
<button id="swap" disabled style="width: 100%; padding: 0.75rem; margin: 0.5rem 0; border-radius: 4px; border: none; background: #aaa; color: #fff;">Swap IMT → BNB</button>
<p id="status" style="min-height: 1.5em; white-space: pre-line;"></p>
<p id="summary" style="min-height: 1.5em; white-space: pre-line;"></p>
</div>
</div>
<style>
button#swap[disabled], button#reverse[disabled] {
background: #aaa;
}
button#swap:not([disabled]), button#reverse:not([disabled]) {
background: #007bff !important;
}
</style>
<script>
(function(){
if (typeof ethers === 'undefined') {
document.getElementById('status').innerText = 'Error: ethers.js not loaded. Check script source.';
throw new Error('ethers is not defined');
}
const IMT_ADDRESS = ethers.utils.getAddress("0x2bf2141ed175f3236903cf07de33d7324871802d");
const WBNB_ADDRESS = ethers.utils.getAddress("0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c");
const ROUTER_ADDRESS = ethers.utils.getAddress("0x10ed43c718714eb63d5aa57b78b54704e256024e");
const ERC20_ABI = [
"function approve(address spender, uint256 amount) external returns (bool)",
"function allowance(address owner, address spender) external view returns (uint256)",
"function balanceOf(address account) external view returns (uint256)",
"function decimals() view returns (uint8)"
];
const ROUTER_ABI = [
"function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory)",
"function swapExactTokensForETHSupportingFeeOnTransferTokens(uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint deadline) external",
"function swapExactETHForTokensSupportingFeeOnTransferTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) payable external"
];
let provider, signer, imt, router;
const connectBtn = document.getElementById('connect');
const swapBtn = document.getElementById('swap');
const reverseBtn = document.getElementById('reverse');
const maxBtn = document.getElementById('max');
const statusEl = document.getElementById('status');
const summaryEl = document.getElementById('summary');
async function connectEthersWallet() {
statusEl.innerText = 'Connecting...';
try {
if (!window.ethereum) throw new Error('MetaMask not found. Please install MetaMask.');
provider = new ethers.providers.Web3Provider(window.ethereum);
await provider.send('eth_requestAccounts', []);
signer = provider.getSigner();
imt = new ethers.Contract(IMT_ADDRESS, ERC20_ABI, signer);
router = new ethers.Contract(ROUTER_ADDRESS, ROUTER_ABI, signer);
const address = await signer.getAddress();
connectBtn.innerText = 'Wallet Connected';
connectBtn.disabled = true;
connectBtn.style.background = '#aaa';
statusEl.innerText = 'Connected: ' + address;
await checkLiquidity();
} catch (err) {
console.error('Connection error:', err);
statusEl.innerText = 'Connection failed: ' + (err.message || err);
swapBtn.disabled = true;
reverseBtn.disabled = true;
}
}
async function checkLiquidity() {
swapBtn.disabled = true;
reverseBtn.disabled = true;
try {
const oneUnit = ethers.utils.parseUnits('1', await imt.decimals());
const amounts = await router.getAmountsOut(oneUnit, [IMT_ADDRESS, WBNB_ADDRESS]);
if (amounts[1].gt(0)) {
const price = ethers.utils.formatEther(amounts[1]);
statusEl.innerText += '\nLiquidity: 1 IMT ≈ ' + price + ' BNB';
swapBtn.disabled = false;
reverseBtn.disabled = false;
} else {
statusEl.innerText += '\nNo liquidity found for IMT/WBNB';
}
} catch (e) {
statusEl.innerText += '\nLiquidity check failed: ' + e.message;
console.error('Liquidity check error:', e);
}
}
maxBtn.addEventListener('click', async () => {
if (imt && signer) {
const bal = await imt.balanceOf(await signer.getAddress());
document.getElementById('amount').value = ethers.utils.formatUnits(bal, await imt.decimals());
document.getElementById('amount').dispatchEvent(new Event('input'));
}
});
document.getElementById('amount').addEventListener('input', async () => {
try {
summaryEl.innerText = '';
const amt = document.getElementById('amount').value;
if (!amt || amt <= 0) return;
const decimals = await imt.decimals();
const amountIn = ethers.utils.parseUnits(amt.toString(), decimals);
const amounts = await router.getAmountsOut(amountIn, [IMT_ADDRESS, WBNB_ADDRESS]);
summaryEl.innerText = 'Estimate: ' + ethers.utils.formatEther(amounts[1]) + ' BNB';
} catch {}
});
connectBtn.addEventListener('click', connectEthersWallet);
swapBtn.addEventListener('click', async () => {
try {
swapBtn.disabled = true;
const inputAmt = document.getElementById('amount').value;
const slippage = parseFloat(document.getElementById('slippage').value);
const decimals = await imt.decimals();
const amountIn = ethers.utils.parseUnits(inputAmt.toString(), decimals);
const user = await signer.getAddress();
let allowance = await imt.allowance(user, ROUTER_ADDRESS);
if (allowance.lt(amountIn)) {
const txA = await imt.approve(ROUTER_ADDRESS, amountIn);
await txA.wait();
}
const amounts = await router.getAmountsOut(amountIn, [IMT_ADDRESS, WBNB_ADDRESS]);
const rawOut = amounts[1];
const amountOutMin = rawOut.mul(100 - slippage).div(100);
summaryEl.innerText = 'Swapping ' + inputAmt + ' IMT for at least ' + ethers.utils.formatEther(amountOutMin) + ' BNB';
const deadline = Math.floor(Date.now() / 1000) + 600;
const tx = await router.swapExactTokensForETHSupportingFeeOnTransferTokens(
amountIn, amountOutMin, [IMT_ADDRESS, WBNB_ADDRESS], user, deadline, { gasLimit: 500000 }
);
await tx.wait();
statusEl.innerText = 'Swap successful!';
} catch (err) {
console.error(err);
statusEl.innerText = 'Swap failed: ' + (err.reason || err.message);
} finally {
swapBtn.disabled = false;
}
});
reverseBtn.addEventListener('click', async () => {
try {
reverseBtn.disabled = true;
const inputAmt = document.getElementById('amount').value;
const slippage = parseFloat(document.getElementById('slippage').value);
const valueIn = ethers.utils.parseEther(inputAmt);
const user = await signer.getAddress();
const amounts = await router.getAmountsOut(valueIn, [WBNB_ADDRESS, IMT_ADDRESS]);
const minOut = amounts[1].mul(100 - slippage).div(100);
const decimals = await imt.decimals();
const formattedMinOut = ethers.utils.formatUnits(minOut, decimals);
summaryEl.innerText = 'Swapping ' + inputAmt + ' BNB for at least ' + formattedMinOut + ' IMT';
const deadline = Math.floor(Date.now() / 1000) + 600;
const tx = await router.swapExactETHForTokensSupportingFeeOnTransferTokens(
minOut, [WBNB_ADDRESS, IMT_ADDRESS], user, deadline, { value: valueIn, gasLimit: 500000 }
);
await tx.wait();
statusEl.innerText = 'Swap successful!';
} catch (err) {
console.error(err);
statusEl.innerText = 'Reverse swap failed: ' + (err.reason || err.message);
} finally {
reverseBtn.disabled = false;
}
});
})();
</script>
<p>➡️ <a href="https://imtcoin.com/guide.html">Guide to setting up for crypto</a></p>
<p>➡️ <a href="https://metamask.io/" target="_blank">Install Metamask through the official homepage</a></p>
<p>➡️ <a href="https://imtcoin.com/paypal.html">Click here to buy Immortality through PayPal or using credit card or debit card</a></p>
<button id="connect2" style="padding: 10px">➡️ Connect to Wallet</button>
<button id="addToken" style="padding: 10px">➡️ Add Immortality</button>
<p>Chart is provided by a non-affiliated, independent party. You are trading using your own wallet. Swap backend is PancakeSwap, which is the main swap of Binance Smart Chain</p>
<script>
(function(){
const ui_connectButton = document.getElementById('connect2');
const ui_addTokenButton = document.getElementById('addToken');
const ui_bscParams = {
chainId: '0x38',
chainName: 'Binance Smart Chain',
nativeCurrency: {
name: 'BNB',
symbol: 'BNB',
decimals: 18
},
rpcUrls: ['https://bsc-dataseed.binance.org/'],
blockExplorerUrls: ['https://bscscan.com']
};
const ui_tokenDetails = {
address: '0x2bf2141ed175f3236903cf07de33d7324871802d',
symbol: 'IMT',
decimals: 8,
image: 'https://imt.cx/imtmm.png'
};
function ui_isMobile() {
return /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
}
function ui_isMetaMaskBrowser() {
return typeof window.ethereum !== 'undefined' && window.ethereum.isMetaMask;
}
function ui_redirectToMetaMaskApp() {
const ui_dappUrl = window.location.hostname + window.location.pathname;
window.location.href = 'https://metamask.app.link/dapp/' + ui_dappUrl;
}
async function ui_connectDeepLink() {
if (ui_isMobile() && !ui_isMetaMaskBrowser()) {
ui_redirectToMetaMaskApp();
return;
}
if (!window.ethereum) {
alert('MetaMask not detected!');
return;
}
try {
await window.ethereum.request({ method: 'eth_requestAccounts' });
const ui_currentChain = await window.ethereum.request({ method: 'eth_chainId' });
if (ui_currentChain !== ui_bscParams.chainId) {
await window.ethereum.request({
method: 'wallet_addEthereumChain',
params: [ui_bscParams]
});
}
alert('Wallet connected and switched to BSC!');
} catch (err) {
console.error(err);
alert('Error connecting wallet.');
}
}
async function ui_addTokenToWallet() {
if (ui_isMobile() && !ui_isMetaMaskBrowser()) {
ui_redirectToMetaMaskApp();
return;
}
if (!window.ethereum) {
alert('MetaMask not detected!');
return;
}
try {
const ui_wasAdded = await window.ethereum.request({
method: 'wallet_watchAsset',
params: {
type: 'ERC20',
options: ui_tokenDetails
}
});
alert(ui_wasAdded ? 'IMT added to wallet!' : 'Token not added.');
} catch (err) {
console.error(err);
alert('Error adding token.');
}
}
ui_connectButton.onclick = ui_connectDeepLink;
ui_addTokenButton.onclick = ui_addTokenToWallet;
})();
</script>
<table width="100%">
<tr><td valign="top" width="50%">
<p>Official channels.</p>
<a href="https://www.youtube.com/channel/UCyRzjFMdYx8PPXBThO1SYoA" target="_blank"><img src="kb/images/yt.png"></a>
<a href="https://twitter.com/Immortality_IMT" target="_blank"><img src="kb/images/x.png"></a>
</td></tr></table>