Description:
Multi-signature wallet contract requiring multiple confirmations for transaction execution.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
{{
"language": "Solidity",
"sources": {
"YGMI/Ygmi.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IERC20 {
function balanceOf(address account) external view returns (uint256);
}
contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
modifier onlyOwner() {
require(msg.sender == _owner, "Ownable: caller is not the owner");
_;
}
function owner() public view returns (address) {
return _owner;
}
function transferOwnership(address newOwner) external onlyOwner {
require(newOwner != address(0), "Ownable: zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract YGMI is Ownable {
string public constant name = "Ygmi.Fun";
string public constant symbol = "YGMI";
uint8 public constant decimals = 18;
uint256 public constant SUPPLY = 10_000_000 * 10 ** 18;
uint256 public totalSupply = SUPPLY;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
address public pairAddress;
uint256 public initialLiquidityAdded;
bool public maxWalletEnabled;
uint256 public maxWalletAmount;
mapping(address => bool) public excludedFromMaxWallet;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event MaxWalletDisabled();
event ExcludedFromMaxWallet(address indexed account, bool excluded);
constructor() {
_balances[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
/* ---------------- ERC20 ---------------- */
function balanceOf(address account) external view returns (uint256) {
return _balances[account];
}
function allowance(
address holder,
address spender
) external view returns (uint256) {
return _allowances[holder][spender];
}
function approve(address spender, uint256 amount) external returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
function transfer(address to, uint256 amount) external returns (bool) {
_transfer(msg.sender, to, amount);
return true;
}
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool) {
if (msg.sender != from) {
uint256 currentAllowance = _allowances[from][msg.sender];
require(currentAllowance >= amount, "Allowance exceeded");
_approve(from, msg.sender, currentAllowance - amount);
}
_transfer(from, to, amount);
return true;
}
function _approve(
address owner_,
address spender,
uint256 amount
) internal {
require(owner_ != address(0), "Approve from zero");
require(spender != address(0), "Approve to zero");
_allowances[owner_][spender] = amount;
emit Approval(owner_, spender, amount);
}
/* ---------------- Trading & Max Wallet ---------------- */
function startTrading(
address _pairAddress,
address ygmirouter
) external onlyOwner {
require(pairAddress == address(0), "Trading already started");
pairAddress = _pairAddress;
// Capture how many tokens are already in the liquidity pool
uint256 pairTokenBalance = IERC20(address(this)).balanceOf(pairAddress);
require(pairTokenBalance > 0, "Pair has no liquidity");
initialLiquidityAdded = pairTokenBalance;
maxWalletAmount = totalSupply / 100; // 1% max wallet
maxWalletEnabled = true;
// Exclude owner and pair from max wallet
excludedFromMaxWallet[owner()] = true;
excludedFromMaxWallet[pairAddress] = true;
excludedFromMaxWallet[address(0xdead)] = true;
excludedFromMaxWallet[address(ygmirouter)] = true;
}
function setExcludedFromMaxWallet(
address account,
bool excluded
) external onlyOwner {
excludedFromMaxWallet[account] = excluded;
emit ExcludedFromMaxWallet(account, excluded);
}
function disableMaxWallet() external onlyOwner {
if (maxWalletEnabled) {
maxWalletEnabled = false;
emit MaxWalletDisabled();
}
}
function _transfer(address from, address to, uint256 amount) internal {
require(from != address(0) && to != address(0), "Zero address");
require(_balances[from] >= amount, "Insufficient balance");
// Before trading
if (pairAddress == address(0)) {
require(from == owner(), "Trading not started");
} else {
// Max wallet enforcement
if (maxWalletEnabled && !excludedFromMaxWallet[to]) {
require(
_balances[to] + amount <= maxWalletAmount,
"Exceeds max wallet"
);
}
// Automatically disable max wallet once ≥70% liquidity is sold
if (maxWalletEnabled) {
uint256 pairBalance = IERC20(address(this)).balanceOf(
pairAddress
);
uint256 threshold = (initialLiquidityAdded * 30) / 100; // 30% of initial remaining = 70% sold
if (pairBalance <= threshold) {
maxWalletEnabled = false;
emit MaxWalletDisabled();
}
}
}
unchecked {
_balances[from] -= amount;
_balances[to] += amount;
}
emit Transfer(from, to, amount);
}
}
"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"remappings": []
}
}}
Submitted on: 2025-10-19 12:29:01
Comments
Log in to comment.
No comments yet.